Posts

Showing posts from May, 2013

gettext - How to selecting text outisude div with Jsoup -

here's problem, have html code this. <div class="article"> "some text on here" <div class="ads"> "ads text on here" </div> <div> what i'm trying is, want text div class="artikel". for now, try jsoup code. doc.select("div[class=article]").text(); but got code "some text on here ads text on here" what want "some text on here" is there can me text use jsoup's css selector ? i don't want use string library. thanks. you can use owntext() exclude containing tag elements of selected element : doc.select("div.article").first().owntext(); also , depending on requirement , may interested in textnodes() : for example, input html: <p>one <span>two</span> 3 <br> four</p> p element selected: p.text() = "one 2 3 four" p.owntext() = "one 3 four"

dns - Hosting SVN Server on my PC to access remotely -

i'm trying connect svn server (installed on local pc) remote machine. after going through questions , other guides, have done following steps: svn server installed on top of apache server using http protocol. can access typing http://localhost/svn in browser , in tortoisesvn. i have setup dns entry using free dns service providers against dynamic ip. i can type http://myfreednsname.freednsserver.com in remote machine , takes me machine. the problem address opens router's default page instead of svn page. same page can access on local machine typing 192.168.1.1. question is, how can configure machine pass incoming request svn page instead? you have set port forwarding on router point pc. forward port 80 local ip address of pc. how depend on router model. might give pc static ip address.

java - Are UUID's in Android specific to application within the device? -

looking in the web answers, sort of confused id uuid's unique service within device. want know if application on particular device can generate uuid during installation same in other devices app installed? so search can performed using uuid find how many devices using particular application using bluetooth. or there other way using uuid.( fetchuuidswithsdp ()) i new android programming. kind if being naive.. uuids generated random numbers or other algorithm intended guarantee no uuid ever generated twice. if want multiple instances of application use same uuid, you'll have generate in advance , include in application. there's no reason why can't this, , web search "uuid generator" turn several sites provide one.

javascript - Adding/deleting object properties and removing null -

i trying remember open accordions in custom plugin. first accordion open default, so: var active = [0]; i click on accordions , read localstorage values. inside click event: var active = json.parse(localstorage.getitem(outername)), tab = $(this).find('h3').index(ui.tab[0]); if (tab in active) { delete active[tab]; } else { active[tab] = tab; } (var = 0; < this.length; i++) { if (active[i] == null) { active.splice(i, 1); i--; } } localstorage.setitem(outername, json.stringify(active)); this works, except remove first accordion , click second , i'll duplicated values [1,1] . have removed null values each time cause don't know how values if toggle accordion removed object. [0,3] = accordion 1 , 4 open [0,1] = accordion 1 , 2 open ok patched plugin numbers active strings, modified object because broken: if (tab in active && active[tab] !== null) { delete active[tab]; } else { active[tab] =

c - Optimising and why openmp is much slower than sequential way? -

i newbie in programming openmp. wrote simple c program multiply matrix vector. unfortunately, comparing executing time found openmp slower sequential way. here code (here matrix n*n int, vector n int, result n long long): #pragma omp parallel private(i,j) shared(matrix,vector,result,m_size) for(i=0;i<m_size;i++) { for(j=0;j<m_size;j++) { result[i]+=matrix[i][j]*vector[j]; } } and code sequential way: for (i=0;i<m_size;i++) for(j=0;j<m_size;j++) result[i] += matrix[i][j] * vector[j]; when tried these 2 implementations 999x999 matrix , 999 vector, execution time is: sequential: 5439 ms parallel: 11120 ms i cannot understand why openmp slower sequential algo (over 2 times slower!) can solve problem? because when openmp distributes work among threads there lot of administration/synchronisation going on ensure values in shared matrix , vector not corrupted somehow. though read-only: humans see easily, compiler may n

php - Is it possible to change image filename in every page? -

i have website used ads listings backpage , craigslist. i have inserted banner ad on every sidebar on every city: example banner image filename is myimage.jpg now want happen is: whenever visit city (for example mysite.com/boston ), want filename this: src="myimage-boston.jpg" and when visit mysite.com/birmingham the image filename be src="myimage-birmingham.jpg" i'm doing seo purposes. hope i've explained well. thank in advance :) btw im using codeigniter. googlebot couldn't crawl url because points non-existent page. generally, 404s don't harm site's performance in search, can use them improve user experience.

C# Best way to compare fields of class -

i need have possibility of comparison of product, advancedproduct (and other classes inherit class product) how better realize hierarchical check of fields? example, want check 2 advancedproduct classes, first check fields basic class product check additional fields of advancedproduct , return in form (???) changes between them (maybe class pchanges???). whether there suitable template? how make this, make rather flexibly subsequent use? public class product { public string id; public string name; public product(string id, string name) { this.id = id; this.name = name; } } public class advancedproduct : product { public string currentversion; public advancedproduct(string id, string name, string version) : base(id, name) { } } public class pchanges { public bool namechanged = false; public bool versionchanged = false;

android bluetooth implementation basics -

can in simple words explain me need of uuid in android bluetooth example. have read articles still not getting clear exact need of uuid. , let me explain scenario of want develop: want develop android application transfer data example "file .xyz extension" phone other phone on bluetooth. not @ necessary receiving phone should have application using. want transfer data application other phone , thats it. don't care receiver data. want connect device within range , transfer file using application how should this? the role of uuid come here? have read uuid application , , both server , receiver should aware of uuid form connection . if receiver not have application? surely not know applications uuid ? how data transfer possible? want use bluetooth without concerning specific application. in here, application should doing? should creating server socket / client socket or what? , why. an explanation in simple words appreciated(some articles if possible). dont want regula

javascript - concat string IE8 SCRIPT438: Object doesn't support property or method -

i have simple javascript string concatenation: function stampalista(store) { lista = "<table ><tr>" + "<td class='titololista' style='width:80px'>data ins.</td>" + "<td class='titololista' style='width:130px'>data/ora attività</td>" + "<td class='titololista' style='width:100px'>tipologia</td>" + "<td class='titololista' style='width:30px'>stato</td>" + "<td class='titololista' style='width:150px'>utente ins.</td>" + "<td class='titololista' style='width:150px'>utente designato</td>" + "<td class='titololista' style='width:250px'>anagrafica</td>" + "<td class='titololista' style='width:30px'>vai<

c# - WPF binding ObservableCollection with converter -

i have observablecollection of strings , i'm tring bind converter listbox , show strings start prefix. wrote: public observablecollection<string> names { get; set; } public mainwindow() { initializecomponent(); names= new observablecollection<names>(); datacontext = this; } and converter: class nameslistconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { if (value == null) return null; return (value icollection<string>).where((x) => x.startswith("a")); } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { return null; } } and xaml: <listbox x:name="fileslist" itemssource="{binding path=names, converter={staticresource nameslistconverter}}" /> but listbox not update after beed upd

how i can set this src value using jQuery or javascript -

var fileref = document.createelement('script'); fileref.setattribute("type","text/javascript"); fileref.setattribute("src", "http://search.twitter.com/search.json? q="+buildstring+"&callback=tweettick&rpp=50"); document.getelementsbytagname("head")[0].appendchild(fileref); here buildstring value is from:@one+or+from:null+or+from:@two+or+from:null+or+from:@three+or+ from:null+or+from:null+or+from:@four+or+from:null+or+from:@five+or+ from:null+or+from:@six+or+from:null+or+from:@seven+or+from:null+or+ from:@eight here when used buildstring value( i.e specified ) set value src working me. but if set buildstring directly giving exception me. syntaxerror: illegal character tweettick(� if question not clear explain more detail. please me.thanks in advance.. seems api v1 search has stopped working, should upgrade api v1.1 require authentificated user. direct l

sorting - How to find the X lowest values in a list with bash/awk? -

ok problem is, have list n given lines, this: 4.96035894 2.94014535 9.71651378 on 8.37470259 9.08139103 10.23145322 off 5.73085411 4.21656546 9.98718707 on 6.40892867 9.44195654 8.83707549 on 4.26065784 3.74966832 7.89520829 on 8.89601431 9.84208918 9.63054539 on 9.10538764 8.58408119 10.87454882 on 6.21494725 4.61164407 9.08378204 off 7.62256424 9.59449339 10.84506558 off 6.49210768 4.03768151 10.75221925 off 5.04079861 4.99362253 10.34349177 off ... the objective find x (x < n) lines lowest value in third field (it extended given field, let's focus on third) , change fourth field (which string) on/off depending of argument called user, i.e. if argument on change on , if off change off. in above example if instance wanted change off 3 rows lowest third value, output be: 4.96035894 2.94014535 9.71651378 on 8.37470259 9.08139103 10.23145322 off 5.73085411 4.21656546 9.98718707 on 6.40892867 9.44195654 8.83707549 off // row changed 4.26065784

python - How to import a module of functions and pass variables between modules -

a file 'definitions.py' contains code: def testing(a,b): global result count in range(a,b): result.append(0) print result while file 'program.py' contains code: from definitions import * result = [] testing(0,10) print result the result of definitions.py expected list of zeros, while variable within program.py empty list despite results being defined global variable. how can made run function definitions.py pass resulting variable used within program.py? global namespaces relative module. not shared between modules. you return result : def testing(a,b): result = [] count in range(a,b): result.append(0) return result and use this: result = testing(0,10) print result but note above, new list, result = [] , being created in testing each time called.

python - Add Text on Image using PIL -

i have application loads image , when user clicks it, text area appears image (using jquery ), user can write text on image. should added on image. after doing research on it, figured pil (python imaging library ) can me this. tried couple of examples see how works , managed write text on image. think there difference when try using python shell , in web environment. mean text on textarea big in px. how can achieve same size of text when using pil 1 on textarea? the text multiline. how can make multiline in image also, using pil ? is there better way using pil? not entirely sure, if best implementation. html: <img src="images/test.jpg"/> its image being edited var count = 0; $('textarea').autogrow(); $('img').click(function(){ count = count + 1; if (count > 1){ $(this).after('<textarea />'); $('textarea').focus(); } }); the jquery add textarea. text area position:absolute , f

android - Why my ViewBinder shows the last element wrong? -

i have big problem , tried debug long time can not error. i have listview , load pictures, path saved in database. its works fine, have 1 problem: if have e.g. 4 items. first 2 have pictures , last 2 not. last item in list have picture last item had picture , can not figure out why. looked in database if maybe have path in last element empty. there code: simplecursoradapter adapter; adapter = new simplecursoradapter(this, r.layout.my_listlayout, maincontroller.getinstance().getmycursor(db), new string[] {"f1", "f2", "f3", "f4"}, new int[] {r.id.imageviewf1, r.id.textviewf2, r.id.textviewf3, r.id.textviewf4}, 0); adapter.setviewbinder(new viewbinder() { public boolean setviewvalue(view view, cursor cursor, int columnindex) { if (columnindex == 1) { imageview imageview = (imageview) view; string pic = cursor.getstring(1); if (pic != null) { /

c++ - Does inheritance imply a deep copy of memory? -

i have class foo , bar . foo has resource. when bar inherits foo have deep copy of memory? or have call constructor of foo bar s default-constructor? class foo { char *item; public: foo() : item(new char[5]) {} }; class bar : public foo {}; the derived class has: all members of base class + additional members in derived class the order of calling of constructors defined, base class constructor called before derived constructor. depending on how use member initialization list , either default base class constructor or parameterized version gets called. but it's base class constructor followed derived class constructor. not sure second q is. and precise, please remove char * member , use std::string . class foo { //char *item; ----------------> erroneous, difficult handle std::string item; ....

jquery - How to apply silde toggle effect from left to right -

hi iam using ajax post method if click on sidebar , ajax success result iam appending div this $.ajax({ type: "post", url: "{site_url}publish/my_select_section_form/"+item, success:function(data){ $('.sec-details').hide().html(data).slidedown(); } }); it giving me sliding down effect , thats fine if want apply toggle left right can do,can suggest me using jquery ui sould quite easy: http://jsbin.com/ipugec/2/edit $.ajax({ type: "post", url: "{site_url}publish/my_select_section_form/"+item, success:function(data){ // $('.sec-details').hide().html(data).slidedown(); $('.sec-details').hide().html(data).show("slide", { direction: "left" }, 1000); } });

python - Efficient way to convert a list to dictionary -

i need in efficient way convert following list dictionary: l = ['a:1','b:2','c:3','d:4'] at present, following: mydict = {} e in l: k,v = e.split(':') mydict[k] = v however, believe there should more efficient way achieve same. idea ? use dict() generator expression: >>> lis=['a:1','b:2','c:3','d:4'] >>> dict(x.split(":") x in lis) {'a': '1', 'c': '3', 'b': '2', 'd': '4'} using dict-comprehension ( suggested @paolomoretti): >>> {k:v k,v in (e.split(':') e in lis)} {'a': '1', 'c': '3', 'b': '2', 'd': '4'} timing results 10**6 items: >>> import * >>> %timeit case1() 1 loops, best of 3: 2.09 s per loop >>> %timeit case2() 1 loops, best of 3: 2.03 s per loop >>> %timeit c

c++ - Access violation error when getting input from a binary file -

okay, i'm trying read input binary file. i've changed code bit, version, i'm getting access violation error... it's trying access isn't there. here's source code problem area: void hashfile::filedump (ostream &log) { hashnode *temp = new hashnode; fstream bin_file; bin_file.open ("storage_file.bin", ios::in | ios::binary); for(int = 0; < table_size; i++) { bin_file.seekg( * sizeof(hashnode) ); bin_file.read( (char *)&temp, sizeof(hashnode) ); printdump(hashnode(temp->title, temp->artist, temp->type, temp->year, temp->price), log, i); } bin_file.close(); } void hashfile::printdump(hashnode a, ostream &log, int n) { log << "(" << n << ") " << a.title << ", " << a.artist << ", " << a.type << ", " << a.year << ", $"

substitution - substituting a string with cmd with wildchar -

i have text file me contains lines line1 line2 helloabcd line4 i want create batch file edit helloabcd line %this% dont know abcd know hello . how can it? i tried using fart.exe, never substituted when there wildcard fart.exe txt1.txt hello* %this% can done using pure cmd, or fart? thanks in advance reply edit: ok tried fart.exe txt1.txt hello %this% got %this%abcd instead of %this% try this: @echo off &setlocal set "this=wqreqwrq" /f "delims=" %%i in ('^<txt1.txt findstr /n "^"') ( set "line=%%i" setlocal enabledelayedexpansion set "line=!line:*:=!" if not "!line!"=="!line:hello=!" set "line=%this%" (echo(!line!)>>output.txt endlocal ) output in output.txt . edit: add. "!" removed.

c - Remove duplicate elements from a sorted linked list -

i attempting c program remove duplicates sorted linked list , using simple concept of traversing list start node. while traversing, compare each node next node. if data of next node same current node delete next node. my code is: struct node *remove_dup(struct node *start) { struct node *p,*tmp; p=start; while(p!=null) { if(p->info==p->link->info) { tmp=p->link; p->link=p->link->link; free(tmp); } p=p->link; } return start; } it not giving me correct answer! wrong execution? concept wrong? since code examines next element, need stop when @ element 1 before last, this: while (p != null && p->link != null) { ... } the reason have first part of condition trap empty lists. in addition, should not advance pointer when remove element. otherwise, not process runs of more 2 elements correctly.

mod rewrite - Redirect /about to /about.php in .htaccess -

first of all, know there plenty of similar questions around, but none of them seem work me none of them address want what want is, title suggests, redirect urls without .php extension actual .php file - changing url if possible (which presume handled [r=301]). latest thing tried this: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l rewriterule ^(.+)$ $1.php [r=301] that doesn't work. can still cant access /about.php /about . (.htaccess rules working fine though) i understand regex fine, htaccess rules mess head =[ so should do? now know you're thinking one of this: "why want this? rid of extensions , access pages via /about or /about/ trailing slash." i'd that, looks quite good. problem seo - assume page ranks annihilated because of sudden they're on different urls. before suggest that, suggest how i'd keep page ranks first. what i'm doing url shortening poste

c++ - mistake in vector showing -

this question has answer here: what object slicing? 15 answers i have 2 simple classes. want vector show result, number not showed. on other hand, when try result without vector, result show. can me? thank you. #include <iostream> #include <string> #include <vector> #include <iterator> using namespace std; template<typename t> class 1 { protected: t word; t word2; public: one() {word = "0"; word2 = "0";} one(t w, t w2) {word = w; word2 = w2;} virtual const void show() {cout << word << endl; cout << word2 << endl;} }; template<typename t> class 2 : public one<t> { private: int number; public: two() {number = 0;} two(t w, t w2, int n) : one(w,w2) {number = n;} virtual const void show () {cout << word << endl; cout << word2 &

c++ - Pack arbitrary number of bits -

what way of packing arbitrary number of bits? have sentences known contain characters , want encrypt. hence option use fewer bits represent these characters , encrypt characters in process. i looked @ std::bitset, requires me specify size of bitset constant, not do. i know how packed bits can converted characters obscure output. ie if pack 1000 , b 0100, resultant 8 bits of packing 1000 0100 character. btw, not supposed strong form of encryption @ all what looking dynamic_bitset . std::bitset can change size dynamically. also, can use std::vector<bool> need side effect of unfortunate historical decision implement bitset. hope helps. luck!

WPF Button behavior using Triggers -

i have button custom appearance defined controltemplate . it contains canvas contains path . add changes in path.opacity depending on mouse state: default - 0.5 mouse over, not pressed - 1.0 mouse over, pressed - 0.5 the first cases covered setting local value of path.opacity 0.5 , adding 1 trigger ismouseover : <button x:class="imagingshop.panosphere.controls.pathbutton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="100" d:designwidth="100" name="pathbutton"> <button.template> <controltemplate> <canvas back

python - Changing days and nights with pygame -

i try write simple 2d game using python 3.x , pygame 1.9.2. want simulate changing of days/nights. have got in-game time(like real, faster) , i'd make screen darker @ exact time have no ideas how it. advice me how reduce brightness of screen or other ways how show changing of days , nights? excuse language if make mistakes. english isn't native me) setting gamma or screen brightness not best way go. when game gets more complicated, it's easier if use technique ecline6 suggested: changing background image. since loaded image suppose, can use trick: let's have background surface. every 10s fire event change backround blitting low alpha-black surface on top of it. way background darker. you can same white, make more brighter too.

magento - Overriding account controller -

i try override function in controller /app/code/core/mage/customer/controllers/accountcontroller.php . i create module folders: /app/code/local/mandarin/skiplogoutsuccess/etc/config.xml <?xml version="1.0" encoding="utf-8"?> <config> <modules> <mandarin_skiplogoutsuccess> <version>0.1.0</version> </mandarin_skiplogoutsuccess> </modules> <frontend> <routers> <checkout> <args> <modules> <mandarin_skiplogoutsuccess before="mage_customer">mandarin_skiplogoutsuccess</mandarin_skiplogoutsuccess> </modules> </args> </checkout> </routers> </frontend> </config> /app/code/local/mandarin/skiplogoutsuccess/controllers/accountcontroller.php require_once

asp.net web api - WebAPI Model Binding from JSON -

Image
i creating application using durandal, webapi server. have kendoui grid displays data server correctly , functions until post or put methods called. here method: and can see that data binds ui (used data-bind extensibility in durandal change kendo bindings): then edit data in grid , passes changes inside request server can see in fiddler result: on server side cannot data passed client bind place parameter method on post or put. i realize couple different technologies troubleshoot (e.g. durandal, knockoutjs, kendo databinding, , webapi) think fundamentals working, data retrieved , bound ui , posted when changed, webapi endpoint cannot bind data. how can passed "models" array bind through modelbinding structure in webapi? update- here helpful jsfiddle gave me correct content-type add: http://jsfiddle.net/xhrrj/1/ new kendo.data.datasource({ transport: { read: { type: "post", url: "../cccs/servic

C# : Selenium firefox probleme -

i trying open firefox browser using selenium. this first time selenium, want c# application discover if facebook page on browser ( chrome , ie , firefox ) opened. but when try navigate firefox had following error message: (" an error occurred while connecting firefox ") i looking suggestions experts might have. this code: using openqa.selenium; using openqa.selenium.firefox; iwebdriver driver = new firefoxdriver(); ps : it's 100% worked ie , chrome can do? @bassem alrefaie: have references set in project? references in form of dll's. you must include dll's castle.core ; newtonsoft.json. try using these dll's , check.

ios - Wrong data returned from NSURLResponse when trying to invoke web service method -

Image
im rather new @ this.. got tomcat server running , have web service method there when invoked, returns string. when try use nsoperationqueue *backgroundqueue = [[nsoperationqueue alloc] init]; // url request nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl: [nsurl urlwithstring:@"http://localhost:8080/webservicetutorialclient/samplehelloproxy/input.jsp?method=18"]]; [request sethttpmethod:@"post"]; // send request [nsurlconnection sendasynchronousrequest:request queue:backgroundqueue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error){ nsstring *result = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nslog(@"%@", result); }]; i contents of page, rather string method supposed return. prolly looks silly have no idea how string. response (when nsl

c# - How do we programatically add data from datagrid to list? -

i have following code, list not fetching exact values datagrid. public list<double[]> extractgriddata(datagridview grid) { int numcols = grid.columns.count; list<double[]> list = new list<double[]>(); double[] cellsdata = new double[numcols]; foreach (datagridviewcell cell in grid.selectedcells) { if (cell.value != null) cellsdata[cell.rowindex] = convert.todouble(cell.value); list.add(cellsdata); } return list; } i think need move: double[] cellsdata = new double[numcols]; to within start of loop. @ moment, using same instance of array every iteration.

c++ - Eclipse Juno CDT opengl doesnt compile -

i want develop opengl app using cdt on eclipse . followed this guide. now every time build program , print's following : now know somehow related missing libriaries , tried add them via project -> properties -> paths , symbols -> libriaries . there i've tried add libglu32.a , libglut32.a , libopengl32.a path c:\cygwin\lib\w32api . didn't ... i run eclipse juno 64 bit version , windows 7 . what do wrong ?

.htaccess - Multiple RewriteRule -

i have multiple rewriterules in .htaccess file. # enable rewriting rewriteengine on # rewrite profile urls # input: /user<userid> # output: /profile.php?id=<userid> rewriterule ^user(\d+)/?$ profile.php?id=$1 [l] # rewrite default redirect.php rewriterule .* redirect.php every requests points redirect.php i thought, [l] flag in first rewriterule, stop processing rule set. if rewrite /user<userid> /profile.php?id=<userid> , rewrite other urls /redirect.php , try these 2 configuration directives: rewriteengine on rewriterule ^user([a-za-z0-9_-]+)/?$ /profile.php?id=$1 [l] rewriterule .* /redirect.php or: rewriteengine on rewriterule ^user([a-za-z0-9_-]+)/?$ /profile.php?id=$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* /redirect.php

java - What is the difference between OrderItemAddCmd vs. OrderItemUpdateCmd? -

for ibm's websphere commerce, distinguishing differences between these 2 commands? share orderitembasecmd , lot of same things. from documentation on orderitemupdate: "this command can orderitemadd command can do. in addition, can update products , items in existing order list.". http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=%2fcom.ibm.commerce.developer.doc%2frefs%2frosorderitemupdate.htm

python - Tweepy user id from mention -

i using tweepy set script finds latest mention of username. this, want retrieve text of tweet, , twitter user name. however, don't seem able retrieve actual @ username, id number. suggestions? below code. question marks need proper syntax: mymentions = tweepy.cursor (api.mentions).items(1) mention in mymentions: statustext = mention.text statususer = mention.???? thanks much! here's works me recent tweepy version: import tweepy auth = tweepy.oauthhandler(<consumer_key>, <consumer_secret>) auth.set_access_token(<key>, <secret>) api = tweepy.api(auth) mentions = api.mentions_timeline(count=1) mention in mentions: print mention.text print mention.user.screen_name hope helps.

css - DIV element not going all the way down to the bottom -

i have issue div on page. it's 1 have, , covers middle of page. few tweaks in css, made go way down. the problem though, video(which inside div element), sneaking out so: http://i.stack.imgur.com/xybem.jpg here's html: <html> <head> <link rel="shortcut icon" href="images/favicon.ico" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <title>arthur</title> <meta content="text/html" charset="windows-1251"> </head> <body background="images/background2.jpg"> <a href="main.html"><img class="imgborder" src="images/button.png" align="left" height="50"></a> <div id="wrapper" style="background-color:black; width:60%; margin-left: auto ; margin-right: auto ;"> <img class="cent

java - How to draw custom graphs in Android? -

Image
here example of graph: how can draw type of graph in android layout? jjoe64/graphview can used in case.samples given.

c++ - Can I call directly operator() without creating a temporary object? -

i've following utility function convert given string integer. class converttoint:public std::unary_function<const char*, int> { public: int operator()(const char* cnumber) { try { int result = boost::lexical_cast<int>(cnumber); return result; } catch ( boost::bad_lexical_cast& error) { std::cerr << "error in converting number "<< error.what() << std::endl; return -1; } } }; when want use utility function, i've following. converttoint cstrtoint; int inumbertocheck = cstrtoint(argv[1]); i'm wondering, there way, can directly call int inumbertocheck = converttoint(argv[1]); no, member function , requires ob

google maps - simple javascript for loop not behaving the way I think it should -

for (var i=0; i<gmaps.map.markers.length; i++) { google.maps.event.addlistener(gmaps.map.markers[i].serviceobject, 'click', function(object){ alert(gmaps.map.markers[i]); }); }; so, goes through loop. i'm using google maps api, obviously. each of markers on map has alert attached it. alert shows undefined though. if switch alert(gmaps.map.markers[0]); or other applicable number, shows me object object, should. if call alert(gmaps.map.markers[i].id); or like, value i'm looking for, obviously, every marker gives same alert. why i not being recognized in callback? you have privatize i: for (var i=0; i<gmaps.map.markers.length; i++) { (function(i){ google.maps.event.addlistener(gmaps.map.markers[i].serviceobject, 'click', function(object){ alert(gmaps.map.markers[i]); }); }(i)); };

math - partially reconstruct information of function convoluted with boxcar kernel -

Image
the function (f) want reconstruct partially this: the following properties known: it consists of alternating plateau (high/low). so first derivation 0 respectively undefined @ edges. the function convoluted kernel fulfilling following conditions: it boxcar function its center @ x=0 its integral 1. i want reconstruct positions of edges of original function (f) convolution result (c). these positions of interest me: if convolution kernel width (k) less minimum plateau width (b, 40 in example above) of f, c looks follows: (the width of box car convolution kernel here k=31.) in case easy reconstruct edge positions: (possibly broad) extrema, , in between neighbours [e1_x, e1_y] , [e2_x, e2_y] (one of them minimum , 1 maximum of course), search x0 fulfilling: c(x0) = (e1_y + e2_y) / 2. the reconstructed edge positions that: but if k > b approach fails: (k=57) is there possibility calculate original edge positions in f, if g (and k) , c known, k>b cases?

php - insert on duplicate key update - in mysqli loop -

i have database primary key 'id' , unique constraint made of price_date , fund_id , currency_id, , class_id $query = "insert `price_data` (`price_date`, `fund_id`, `currency_id`, `class_id`, `nav`, `nav_change`) values"; $format = " ('%s', '%s', '%s', '%s', %f, %f),"; // go on each array item , append sql query foreach($prices $price) { $query .= sprintf( $format, $mysqli->escape_string($price['pricedate']), $mysqli->escape_string($price['fund']), $mysqli->escape_string($price['currency']), $mysqli->escape_string($price['class']), $mysqli->escape_string($price['nav']), $mysqli->escape_string($price['navchange']) ); } // last values tuple has trailing comma cause // problems, let remove $query = rtrim($query, ','); // mysqli::query returns boolean insert $result = $mysqli->query(

Jquery append content to div -

i load content <div id="wrapper"></div> via jquery. $('#wrapper').html(data); when content inserted wrapper, there div id="video1" . how can append id="video1" $('#video1').append('<p>test</p>'); for demo, have appended p here.

ruby - Most succinct method that takes a single-level hash argument and returns a copy with nil values -

help me write succinct method takes 1 argument (a single-level hash) , returns copy values set nil. example input hash { email: 'hans@moleman.com', first_name: 'hans', last_name: 'moleman' } returned value { email: nil, first_name: nil, last_name: nil } what this? new_hash = hash[original_hash.keys.zip([])] take keys of hash, zip empty array pairs of keys nil, , use hash[] convert hash. or, @mu_is_too_short pointed out in comments, way might less tricky read is: new_hash = hash[original_hash.keys.map { |k| [k, nil] }] this alternative, credit @mu.

python - How to move db request (which uses yield) in an other function? -

i'm playing tornado , mongodb, asynchronous driver motor. when working callbacks everything's fine. discovered possibility use motor.op or tornado.gen.task perform request in 1 function only: so working: class contact_handler(main_handler): @web.asynchronous @gen.coroutine def get(self, other_id): event = events.event_send_contact_request(self.user_id) result = yield motor.op(db.users.update, {'_id': objectid(other_id)}, {'$push': {'evts': event.data}} ) self.finish("ok") but i'd move database request in own function in module. problem don't understand how yield working here (despite read lot of questions yield). tried, it's not working: #------ file views.py ------------- class contact_handler(main_handler): def get(self, other_id): event = events.event_send_contact_request(self.user_id) result = m

json - Autocomplete textbox using jQuery and ASP.NET Razor Syntax procedurally -

i trying create autocomplete function retrieves matching dvd titles database (dvd table). using asp.net razor syntax (not using mvc). have attempted this, no success. appreciate help. here have: html <input type="text" id="dvdtitles" class="custom-field"/> jquery $('#dvdtitles').autocomplete({ source: function (query, process) { $.ajax({ url: 'getdvdtitles.cshtml', type: 'post', data: 'term=' + term, datatype: 'json', async: true, success: function(data) { process(data) } }); } }); asp.net razor (getdvdtitles.cshtml) @{ var database = database.open("sqlserverconnectionstring"); var term = request.form["term"]; var sqlquery = "select * dvd dvd_t

Specific regex issue requiring assistance -

here provide example of line log file: [13/02/2013 16:53] [join] john_doe has joined server (40:12.34.56.78) to explain in english is: [date time] [join] firstname_lastname has joined server (userid:ip address) i wish extract list of names , ip's in csv format. do know regex expression run on each line achieve this? in case, reveal: john_doe,12.34.56.78 if want learn regular expressions: http://www.regular-expressions.info/tutorial.html this site contains general tutorial , tons of info on different regex implementations. if not want learn regular expressions: http://txt2re.com/ this site lets build regular expressions entering example pattern , clicking on parts need. the regex you've asked simple shouldn't posted here, not useful other users.

java - How to pass values from one JFrame to another JFrame? -

i've created 2 jframes. main jframe contains text area. sub jframe contains drop down list. task pass value i've selected in drop down list , display in text area in main jframe. code in sub jframe: private void btnokactionperformed(java.awt.event.actionevent evt) { close(); room=cmbroom.getselecteditem().tostring(); } code in main jframe: private void btndisplayactionperformed(java.awt.event.actionevent evt) { roomno r=new roomno(); txtarea2.append("\nroom number: " + r.getroom()); } import java.awt.*; import javax.swing.*; import java.awt.event.*; class passdata extends jframe { jtextfield text; passdata(){ jlabel l=new jlabel("name: "); text=new jtextfield(20); jbutton b=new jbutton("send"); setlayout(null); l.setbounds(10,10,100,20); text.setbounds(120,10,150,20); b.setbounds(120,40,80,20); add(l); add(text); ad

php - Apache Rewrite URL Creating Linking Issues -

problem: rewrite url causing links break. .htaccess has below rule: rewriterule ^blog/([0-9]+)/[-0-9a-za-z]+$ index.php?action=blog&postid=$1\%23disqus_thread [nc] style sheet reference in header template: <link rel="stylesheet" type="text/css" href="style.css" /> i can click on: domain.com/blog/1/title-of-article , file fine, style sheet link breaks if go directly to: domain.com/index.php?action=blog&postid=1#.uyv1mcqriso style sheet loads fine (ignore #.uyv1mcqriso, code disqus) . this breaking logo link, is: <a href="./"> instead of taking me domain.com, it's going domain.com/blog/1/ my basic file structure is: index.php , style.css in root, loads viewpost.php in/templates folder. what going , how correct this? easiest solution: set links relative domain root, fronting them slash (resp. removing dot referring current folder in link): <link rel="stylesheet" type=&q

Something like OpenCart for Java -

i've searched far many times question unfortunately without result. question: there open source shopping cart solution (e-commerce system) javaee (java based)? mean opencart . i appreciate comments. broadleaf commerce open source based on spring , hibernate.

exception - Why does using the Java Attach API fail on linux? (even though maven build completes) -

i've been using java attach api (part of tools.jar) attach running java process, , shut down within. it works on windows. when trying execute attach code when running on linux java.lang.noclassdeffounderror following stack trace cause... java.lang.classnotfoundexception:com.sun.tools.attach.virtualmachine... java.net.urlclassloader$1.run(urlclassloader.java:202) java.security.accesscontroller.doprivileged(native method) java.net.urlclassloader.findclass(urlclassloader.java:190) java.lang.classloader.loadclass(classloader.java:306) sun.misc.launcher$appclassloader.loadclass(launcher.java:301) java.lang.classloader.loadclass(classloader.java:247) i'm using maven , far have section, in order include tools.jar. <dependency> <groupid>com.sun</groupid> <artifactid>tools</artifactid> <version>1.4.2</version> <scope>system</scope> <systempath>${java.home}/../lib/tools.ja