Posts

Showing posts from April, 2015

ios - else condition is not executing? -

in following else if ,the last else condtion not executing ? please me if (flag==1) { ... } else if ([totalbooksid containsobject:currentbook]) { ... } else if (![totalbooksid containsobject:currentbook]) { ... } else { ... } all variable have values still else not executing. above else statement not executing @ all? please me this work if(flag==1){ if([ownlist containsobject:currentbook]){ if(fileexists) { [self renamereadbutton]; }else if(!fileexists){ [self renamedownloadbutton]; } [self renamelendbutton]; } } else if([totalbooksid containsobject:currentbook]){ //checking bought books if([ownlist containsobject:currentbook]){ if(fileexists){ [self renamereadbutton]; }else { [self renamedownlo

Facebook sdk 3.5.1 invite friends request makes double selecting in ios -

i didn't have problem fb sdk 3.2, after upgraded in sdk 3.5.1 friend inviter has strange problem, when select 1 friend choose selected 1 , 1 under it. when trying scroll downward restarts table , brings me on tables top. here method: -(ibaction)secondclick:(id)sender { nsdictionary *params = [[nsdictionary alloc] initwithobjectsandkeys:nil]; [fbwebdialogs presentrequestsdialogmodallywithsession:nil message:@"learn how make ios apps social." title:@"test" parameters:params handler:^(fbwebdialogresult result, nsurl *resulturl, nserror *error) { if (error) { // error launching dialog or sending request. nslog(@"error sending request."); } else { if (result == fbwebdialogresultdialognotcompleted) { // user clicked "x" icon nslog(@"user canceled request."); } else { // handle send request callback nsdictionary *urlparams = [self

java - graph representation with minimum cost (time and space) -

i have represent graph in java neither adjacency list nor adjacency matrix.. the basic idea if deg[i] is exit degree of vertex i, neigboors can store in edges[i][j] i <= j <= deg[i] , given edges[][] must initialized values dont know how make differ adjacency matrix.. any suggestions? in knowledge there 2 ways represent graph in language. either use adjacency matrix or use incidence matrix you can make incidence matrix like          e1  e2  e3  e4         v1     1   2   1   1           v2     2   1   2   1           v3     1   1   1   2           v4     1   1   2   1

iphone - Enabling mod_proxy65 on ejabberd server installed on ec2 ubuntu instance -

i working on ios chat application, media transfer work need enable mod_proxy65, , have enabled same in ejabberd.cfg file default setting: {mod_proxy65[]} . on client side using https://github.com/robbiehanson/xmppframework xmpp framework ios. in turnsocket.m have used proxy candidate dev.myserver.com in place of default jabber.org . when try open turn connection, series of iq received , sent follows: send: <iq type="get" to="dev.myserver.com" id="a9876dd0-b13c-4dc7-b812-2a6e653288bc"><query xmlns="http://jabber.org/protocol/disco#items"/></iq> recv: <iq xmlns="jabber:client" from="dev.gungroo.com" to="smita@dev.myserver.com/24983171131368877324197828" id="a9876dd0-b13c-4dc7-b812-2a6e653288bc" type="result"><query xmlns="http://jabber.org/protocol/disco#items"><item jid="conference.dev.myserver.com"/><item jid="irc.dev.myse

Android Studio - Android SDK out of date -

Image
i getting "sdk out of date" error. i've seen few other posts mention editing path variable i'm not sure means. if explain need past error i'd appreciate it! you need update default project settings. go file > other settings > default project structure. change project sdk setting android sdk. should clear error new projects.

Share GPU buffers across different CUDA contexts -

is possible share cudamalloc'ed gpu buffer between different contexts (cpu threads) use same gpu? each context allocates input buffer need filled pre-processing kernel use entire gpu , distribute output them. this scenario ideal avoid multiple data transfer , gpus. application beamformer, combine multiple antenna signals , generate multiple beams, each beam processed different gpu context. entire processing pipeline beams in place, need add beamforming part. having each thread generate it's own beam duplicate input data i'd avoid (also, it's more efficient generate multiple beams @ 1 go). each cuda context has it's own virtual memory space, therefore can not use pointer 1 context inside context. that being said, of cuda 4.0 default there 1 context created per process , not per thread. if have multiple threads running same cuda context, sharing device pointers between threads should work without problems.

django - 'NoneType' object has no attribute 'user' -

models.py class report(models.model): user = models.foreignkey(user, null=false) photo_files_attached = models.booleanfield('photos', default=false) views.py def media(request): user = request.user try: report = report.objects.get(user=user.id) except: report = none report_dir = str(report.user.id) + '/' + str(report.id) output_dir = settings.media_root + '/' + report_dir imagelist = [] if os.path.exists(output_dir): os.chdir(output_dir) files in os.listdir("."): extension in jpeg_allowed: if files.endswith(extension): image_with_path = report_dir + '/' + files imagelist.append(image_with_path) return render(request, 'incident/media.html', { 'newreport_menu': true, 'report':report, }) i tryin

Python errors. List in post -

i have couple of python errors dont understand how can fix them. thanks. list of errors: traceback (most recent call last): file "c:\users\----\desktop\wm3con-master\wm3con-master\wm3con.py", line 277, in <module> sys.exit(main()) file "c:\users\----\desktop\wm3con-master\wm3con-master\wm3con.py", line 274, in main return curses.wrapper(app.run_curses_app) file "c:\python32\lib\curses\wrapper.py", line 43, in wrapper return func(stdscr, *args, **kwds) file "c:\users\----\desktop\wm3con-master\wm3con-master\wm3con.py", line 230, in run_curses_app m.set_data(self.data) file "c:\users\----\desktop\wm3con-master\wm3con-master\wm3con.py", line 114, in set_data dets = data.get('detections', []) attributeerror: 'nonetype' object has no attribute 'get' edit: .py file's code below (converted 2 3) thing not work , dont know guys mean data none. this f-secures world

plone - How to customize dexterity-through-the-web-content view? -

i created content in plone 4.3 site (no grok here) nice dexterity through-the-web editor. i'd customize default view content. i've read martn aspelli's book problem through-the-web content does'nt have specific interface (so can't use create specific view). if want through-the-web, following: create template view in "custom" folder of portal_skins (through zmi). you'll want start copy of page template (portal_skins/plone_content/document_view). give name your_content_type_view. test appending /your_content_type_view url sample object. edit factory type information (portal_types/your_content_type/default view method) your_content_type_view. what have done create skin-level view type. different browser views martin discussing, indeed require class. dexterity development team working on way provide ttw maintenance of browser views, that's later version of plone. meanwhile, if later transfer dexterity content type python add on

JUnit NoClassDefFoundError -

i'm new @ junit , use inteliji idea. import org.junit.test; import org.junit.ignore; import org.junit.runner.runwith; import org.junit.runners.junit4; import java.util.date; import static org.junit.assert.*; public class testquote { @test public void testquote() { date date = new date(system.currenttimemillis()); quote quote=new quote("a",date,200.0,300.0,100.0,107.0,1.0); assertnull("object null",quote); assertequals("symbol ok",quote.getsymbol(),"a"); assertequals("date ok",quote.getdate(),system.currenttimemillis()); assertequals("open price ok",quote.getopenprice(),200.0); assertequals("high price ok",quote.gethighprice(),300.0); assertequals("low price ok",quote.getlowprice(),100.0); assertequals("close price ok",quote.getcloseprice(),107.0); } } here code of test class. junit.jar added classpath w

Trying to send xml file using Python Requests to OpenStreetMap Overpass API -

i have .xml request can succesfully retrieve data openstreetmap overpass api. <?xml version="1.0" encoding="utf-8"?> <osm-script> <query type="node"> <has-kv k="name" v="bethesda"/> <has-kv k="network" v="washington metro"/> </query> <query type="way"> <around radius="800"/> <has-kv k="building"/> </query> <union> <item/> <recurse type="down"/> </union> <print/> </osm-script> all i'm trying (and failing) send xml via python requests library (i'm open other python solutions). send request below: files = {'file': ('bethesda.xml', open('bethesda.xml', 'rb'))} r = requests.post('http://overpass-api.de/api/interpreter', data=files) print r.text but following error message: <?xml version="1.0"

html - onclick does not work reliably -

i have following html . pager triggers actions on server side using buttons icons. icons have onclick event attached supposed trigger server url (in jsfiddle triggering alert ), this: <button class="btn bootstrap-button-margin-style force-height" type="button"> <i class="icon-step-forward" onclick="alert('step-forward');"> </i> </button> if click around, notice alerts not shown (i shown 60% of times - using chrome). why that? is there way make onclick event reliable? is there better alternative onclick , icons triggering corresponding server action in reliable way? you have attached onclick event icon, not buttons. alert appears 100% of time when click on actual icon. alert not appear if click on button outside of icon element. move onclick event button element: <button class="btn bootstrap-button-margin-style force-height" type="button" onclick="alert(

timing - Who's calling my interrupt handler if I have both CIAs turned off? -

Image
i'm trying set simple raster interrupt handler change background color in given stripe. however, interrupt handler seems called time. (the code uses ca65's format) .include "c64.inc" row = 100 .segment "zpsave" .segment "startup" sei ;; turn off basic , kernal rom lda #$35 sta $01 ;; flush cia irqs bit cia1_icr bit cia2_icr ;; turn off cia interrupts lda #%011111111 sta cia1_icr sta cia2_icr ;; set target raster line lda #%01111111 , vic_ctrl1 sta vic_ctrl1 lda #row sta vic_hline ;; enable vic interrupt lda #%00000001 sta vic_imr ;; install interrupt handler lda #<isr sta $fffe lda #>isr sta $ffff cli rts .macro isr_pre pha txa pha tya pha .endmacro .macro isr_post

SQL Server works in CLI but not PDO -

i'm running this; sql that's outputted in die() works fine when copied , pasted console, it's throwing error sqlstate[42000]: [microsoft][sql server native client 11.0][sql server]incorrect syntax near 'go' when i'm running through pdo. i'm connecting sql azure table. any ideas? thanks. try { $conn = new pdo ("sqlsrv:server = tcp:nczf1z2h11.database.windows.net,1433; database = stonewashactions", "core", "exphaickyaleisudjak-"); $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) { //nada } try { $data = $conn->exec($finalstatement); } catch (exception $e) { die($finalstatement); }

.net - Multithread Windows Service -

how , multithread code. have windows service collects events windows system log. service forwards collected events remote service. code in vb.net. using addhandler , eventwritten detect when events generated. you use tpl , create tasks whatever want asynchronouos. afterwards use task.waitall let tasks complete. specify nothing real problem makes difficult give advice. suspect need start tasks sending events service. awaiting becomes dificult since model sound asynchronous. http://msdn.microsoft.com/en-us/library/dd460717.aspx

java - How to draw a gradient with opacity -

i have method, makes gradient, reason can not make gradient have opacity, such 60% opaque . public static int[] linear(int x1, int y1, int x2, int y2, color color1, color color2, int width, int height){ bufferedimage bimg = new bufferedimage(width, height, bufferedimage.type_int_argb); int[] pixels = new int[width * height]; graphics2d g = bimg.creategraphics(); g.setpaint(new gradientpaint(x1, y1, color1, x2, y2, color2, false)); g.fillrect(0, 0, width, height); bimg.getrgb(0, 0, width, height, pixels, 0, width); return pixels; } i call this: int pink = colors.rgba(187, 61, 186, 153); int yellow = colors.rgba(209, 192, 8, 153); this.spixels = gradient.linear(0, 0, img.getwidth(), 0, pink, yellow, img.getwidth(), img.getheight()); i can not life of me gradient 60% opaque . can make that? here more background: i have image, create gradient size of image (with above code). next blend 2 images using lighten : public static int lighten(int bg,

WordPress Popularity Score relative to all posts (score views, shares and comments) -

i trying find solution score posts in effort visually represent how "hot" are, relative other posts, or relative score of 1. i have views, total shares , comments available inputs, i'm unsure approach take score posts against each other, have relative score out of 1, i.e. .6, .8 etc. i came across following in search solution http://www.evanmiller.org/rank-hotness-with-newtons-law-of-cooling.html and hot content algorithm / score time decay any ideas on how can approach this? posts should take account time, have several years worth of posts. thank you i ended setting 5 scoring periods, scoring each post against highest score found in period. score takes in social media, post views , comments. provides rating!

unity3d - points on a plane in 3D -

i'm trying figure out way move objects on 3d plane faces camera using unity3d . want these objects constrained plane, can move in 3d space (the camera follows it). to end, thought i'd use plane's coordinate system move objects. figured x,y coordinate on plane have corresponding x,y,z coordinate in actual 3d space. problem is, can't figure out how access, use, or calculate (x,y) coordinates on plane. i've done research, , i've come across vectors , normals , such, don't understand how pertain particular problem. if i'm looking in right place, explain how? , if i'm not, can point me in right direction? lot. i thought i'd use plane's coordinate system move objects that's way go. i figured x,y coordinate on plane have corresponding x,y,z coordinate in actual 3d space. problem is, can't figure out how access, use, or calculate (x,y) coordinates on plane. yes that's true. unity3d gives access quite

PhoneGap Build + Facebook Plugin - iOS App Crashes when posting to wall w/ PG 2.5.0 (worked w/ 2.2.0) -

see below: i've been able recreate problem simple , hackbook examples. my ios app's facebook integration working great phonegap 2.2.0. once updated app phonegap 2.5.0 started having issue. able login facebook fine app, app crashes try post wall. not issue before 2.5.0. i have uploaded both simple , hackbook examples using facebook app id phonegap build figure out going on. uploaded both examples 2.2.0 , works. uploaded both 2.5.0 , works except when try post wall or friend's wall - app crashes. the variable changed 2.2.0 2.5.0 in config.xml file. i've asked question on phonegap builds support page . so, can go there see others have said. thank can offer! additional crash info got console: may 18 12:23:32 marks-iphone hackbook[9813] <error>: *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[__nscfdictionary removeobjectforkey:]: mutating method sent immutable object' *** first throw c

ios - How do I split the current time into 3 strings; hours, minutes, and seconds -

i'm making clock app, , want display current time, components (hours minutes, seconds) spaced out. think way separate time 3 strings. how do that? - (void)updatetime { [updatetimer invalidate]; updatetimer = nil; currenttime = [nsdate date]; nsdateformatter *timeformatter = [[nsdateformatter alloc] init]; [timeformatter settimestyle:nsdateformattermediumstyle]; lbltime.text = [timeformatter stringfromdate:currenttime]; updatetimer = [nstimer scheduledtimerwithtimeinterval:0.01 target:self selector:@selector(updatetime) userinfo:nil repeats:yes]; } a couple things here: 1 ) if want running timer, don't invalidate each time " updatetime " called (and call scheduledtimerwithtimeinterval: once... instead of @ end of each time " updatetime " called). 2 ) looks have single label displaying time. should make timeformatter ivar (instance variable, it's created , set once) , can set format via: timeformatte

haskell - Why does `take` with a large number return [] even though the list is infinite? -

i have doubt on why haskell couldn't handle following line prelude> take 1000000000000 $ repeat ' ' that line of code return: "" which not 1,000,000,000,000 spaces. if try 1 less zero, print long time. and thing bothers me if write prelude> repeat ' ' it work, being lot of more zeros. so, why couldn't haskell print long time did repeat alone? are on 32 bit system? suspect 1000000000000 wraps int negative number. it's equal 2^40 . you can check what's going on entering 1000000000000 :: int . take negative number returns empty list: prelude> take (- 1) [1,2,3] [] for reference, take takes int : prelude> :t take take :: int -> [a] -> [a]

avd - Android - I don't get the output I want -

i don't manage emulator working, shows menu screen doesn't go through screen "your total 0' , add button, substract button, i'm following tutorial: http://www.youtube.com/watch?v=hua_isgpthi&list=ec2f07dbcdcc01493a here screen of avd parameters: avd name: brixon device: 5.1 wvga(480x800:mdpi) target: android 2.2 - api level 8 cpu/abi: arm (armeabi) keyboard: checked skin: checked front camera: none back camera: none memory options: ram: 512 vm heap: 16 internal storage: 200 mib sd card: size (nothing) on launch options: skin: 480x800 density: medium (160) scale display real size: not checked wipe user data: not checked launch snapshot: checked save snapshot: checked it's code, follow strictly tutorial: package com.grolard.newboston; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.textview; import android.app.activity; public class mainactivity extends activity {

jquery select one item from li using class name -

i have ul>li structure using jquery mobile looks this: <div> <ul data-role="listview"> <li><a href="#" class="fooddrinkitem">hamburger<p class="fooddrinkprice">$9.00</p></a></li> <li> <a href="#" class="fooddrinkitem">club sandwich<p class="fooddrinkprice">$7.00</p></a></li> </ul> </div> i want price of item when click specific li.i classes because easier expand afterwards. $(document).ready(function(){ $(".fooddrinkitem").click(function(){ var price = $(".fooddrinkprice").text(); $("#popupfooddrinkprice").text(price); }); }); how can take classname.text() of selected li? working example: http://jsfiddle.net/gajotres/vwkm9/ $(document).on('click', 'ul li', function(){ alert($(this).find('.fooddrinkprice').text

c++ - Ambiguous call to overloaded function (with a variable argument list) -

i have following code: class foo { public: bool getbar(char** ptr); private: bool getbar(char** ptr, ...); }; foo* afoo = ...; char* aptr = ...; bool res = afoo->getbar(&aptr);//error c2668 which generates following error: error c2668: 'foo::getbar' : ambiguous call overloaded function foo.h: 'bool foo::getbar(char **,...)' foo.h: or 'bool foo::getbar(char **)' while trying match argument list '(char **)' is there way fix error without renaming 1 of getbar functions? (visual studio 2005)

vb.net - getting a color from a database entry and applying it to a label background -

i having trouble getting color user picks , saving database when reload program automatically apply labels background. i have let user chose color private sub button7_click(byval sender system.object, byval e system.eventargs) handles button7.click if colordialog1.showdialog = dialogresult.ok quiz.ltitle.backcolor = colordialog1.color end if end sub then have button save code far private sub btitlesave_click(byval sender system.object, byval e system.eventargs) handles btitlesave.click backgroundwork.title_settingsbindingsource.addnew() backgroundwork.title_bcolortextbox.text = quiz.ltitle.backcolor.toargb backgroundwork.title_settingsbindingsource.endedit() backgroundwork.title_settingstableadapter.update(backgroundwork.quizsettingsdataset) end sub backgroundwork form have databases running quiz form see. any appreciated you can try colorinhex ... private sub btitlesave_click(byval sender system.object, byval e system.eventa

regex - How to match all between two words with regular expression -

i have this: id 560 spec ... bla bla blah... blah... +#@% bla bla 43 bla ~ category other price $259.95 id 561 spec more blah blah... blah... blah... @#$^y% bla bla bla category other price $229.95 need between spec , category . work [.[:punct:]\r\n\s\t]+[^category]+ in notepad++ need in c#. in perl, it's simple /spec(.*?)category/gs . don't know regular expressions in c#, looking non-greedy match-all between 2 words.

c++ - Strange error while using valgrind? a bug maybe? -

i developing c++ program , when finished, wanted check memory leaks, have found strange error valgrind: ==9106== invalid free() / delete / delete[] / realloc() ==9106== @ 0x4006c58: free (vg_replace_malloc.c:427) ==9106== 0x42eb637d: free_mem (in /lib/libc-2.5.so) ==9106== 0x42eb5f16: __libc_freeres (in /lib/libc-2.5.so) ==9106== 0x4002451: _vgnu_freeres (vg_preloaded.c:61) ==9106== 0x42e38ea3: _exit (in /lib/libc-2.5.so) ==9106== 0x42dc0df3: (below main) (in /lib/libc-2.5.so) ==9106== address 0x403f818 not stack'd, malloc'd or (recently) free'd since did not tell line number invalid delete present, had use method of commenting blocks out. the surprise got until point commented code, , error still appearing. i have code: int main(int argc, char** argv) { /* ... other code */ return 0; } what happening here? vagrind bug? so, can safely ignore error? i running valgrind 3.7.0 way (under linux): $ valgrind -

ios - Preventing page curl from curling offscreen views -

i have navigation controller based application working on. uses iad display adds. when adbannerview has no add (based on bannerview:didfailtoreceiveadwitherror: ), banner view slid off of bottom of screen. there view shown root view controller using modal page curl transition. when banner view on screen, there no issues transition. however, when off screen, blank, banner view-sized box appended bottom of curled page. i have tried setting every view controller's view , apps window have clipstobounds set true avail. any ideas? just set banner view's alpha 0 after animated offscreen. [uiview animatewithduration:duration animations:^ { //move banner offscreen } completion:^(bool finished) { banner.alpha = 0; }]; typed on mobile, don't ship without testing sometimes best solution simplest one.

php - Passing two variables onclick back to same page -

i need able click on list element , depending on clicking, 2 variables displayed on same page. i have 2 variables defined in html code ( changed hardcoding them variables html ): <ul> <li><a href="#" onclick="('6','67')">text 1</a></li> <li><a href="#" onclick="('22','240')">text 2</a></li> <li><a href="#" onclick="('34','56')">text 3</a></li> </ul> later pick both variables php $_post this: <?php echo $_post['var1']; echo $_post['var2']; ?> how can achieve that? you this: <ul> <li><a href="#" onclick="myfunction('6','67')">text 1</a></li> <li><a href="#" onclick="myfunction('22','240')">text 2</a></li&

java - JAX-RS: Authenticate with multiple principals (more than just username) -

using jersey service, elegant method authenticate user more username , password? say, business id, , username principals, , password credential. i have postgres db users table, same username string can exist multiple business entities. (a unique constraint belongs 2 columns, business id , username together). i use basic authentication, having client send additional http header business id. how go on here? now, regarding authorization, how set roles , permissions, if roles created each business entity (each business can define it's own roles , connect permissions.)? permissions static. does apache shiro (or other pluggable security extension) offer solution in case? thanks. you might consider. implement auth logic in old servlet filter. jax-rs application normal www aplication, filters fits simple authorization mechanism. jax-rs interceptors (preprocessinterceptor) can implement auth logic need (calling database, etc.) "more idiomatic" while work

Uniting NodeLists in DOM (java) -

here's code: private nodelist union(nodelist left, nodelist right){ nodelist result=null; try{ documentbuilderfactory domfactory = documentbuilderfactory.newinstance(); domfactory.setnamespaceaware(true); // never forget this! documentbuilder newbuilder = domfactory.newdocumentbuilder(); document newdoc = newbuilder.newdocument(); element root = newdoc.createelement("root"); newdoc.appendchild(root); if(left!=null){ for(int i=0;i<left.getlength();i++){ node tmp=(node)left.item(i).clonenode(true); newdoc.adoptnode(tmp); newdoc.getdocumentelement().appendchild(tmp); //root.appendchild(newdoc.importnode((node)left.item(i), true)); } } if(right!=null){ for(int i=0;i<right.getlength();i++){ node tmp=(node)right.item(i).clonenode(true); newdoc.adoptnode(t

platform detection - Code / Ascii function in VBA Excel on MAC vs on PC -

on pc have these chars ascii code 178,188,189 respectively. when use code function on mac vba excel 95 3 different chars. char pc mac ² 178 95 ½ 188 95 ¾ 189 95 how can distinguish between these 3 chars on mac? or phrased differently, there function on mac vba excel gives me different values these 3 chars, if "mac ascii" values, long different the table gave ascii codes wrong. the correct table is: char pc mac ² 178 253 ½ 189 171 ¾ 190 243 hope helps

java - ObjectInputStream Blocking socket external ip madness -

when initialize objectinputstreams, after have initialized , flushed objectoutputstreams, this: client: java.net.sockettimeoutexception: read timed out @ java.net.socketinputstream.socketread0(native method) @ java.net.socketinputstream.read(unknown source) @ java.net.socketinputstream.read(unknown source) @ java.io.objectinputstream$peekinputstream.read(unknown source) @ java.io.objectinputstream$peekinputstream.readfully(unknown source) @ java.io.objectinputstream$blockdatainputstream.readshort(unknown source) @ java.io.objectinputstream.readstreamheader(unknown source) @ java.io.objectinputstream.(unknown source) @ start.refreshchangelog(start.java:87) @ start$2.windowopened(start.java:234) @ java.awt.awteventmulticaster.windowopened(unknown source) @ java.awt.window.processwindowevent(unknown source) @ javax.swing.jframe.processwindowevent(unknown source) @ java.awt.window.processevent(un

JQuery: Retrieve and update SINGLE span value inside a (wordpress) loop -

i've been struggling 2 days, because have little knowledge in jquery / javascript, , think i've searched thoroughly many times didn't answer need. i'm working wordpress loop, each loop item has: span class, , link trigger update via jquery span's value / content. what have far is: when click trigger-link - let's on first loop-item, of span's value / content on of item loop updated. i'm trying achieve simple as: when click trigger-link on first loop-item, update span's value / content on loop-item only. here's html: <div class="loop-item> <span class="count">123</span> <span><a class="update"></a></span> <p>some text</p> </div> <div class="loop-item> <span class="count">123</span> <span><a class="update"></a></span> <p>some text</p> </div> <div class="l

extjs - I am having trouble with a date field being displayed in a grid -

This summary is not available. Please click here to view the post.

vb.net - Visual basic - Questlon -

how have button generate number 0-255 (randomly) force display textbox in form field? make counts times have clicked button , have force text textbox? also how force textbox can input number 0-255. another question when "application.restart()" how force display top application (over other programs running.) on reload. for first value, use numericupdown instead of textbox. restrict integer values , allow specify minimum value (0) , maximum value (255). button can make use of random class , simple counter variable. display number of clicks in label value isn't meant changed user: public class form1 private sub form1_load(sender object, e system.eventargs) handles me.load numericupdown1.minimum = 0 numericupdown1.maximum = 255 label1.text = "clicks: 0" end sub private sub button1_click(sender system.object, e system.eventargs) handles button1.click static r new random static counter integer

python - Mechanize submit a form that creates a dynamic flie that needs to be downloaded -

so far have mechanize code this: goes site logs in submits form heres hit problems. need write response (a file) local file. pretty clueless far python interacting file system. thanks in advance edit: here of code have br = mechanize.browser() br.set_handle_robots(false) br.set_handle_redirect(true) br.set_handle_refresh(mechanize._http.httprefreshprocessor(), max_time=1000) br.addheaders = [('user-agent', 'mozilla/5.0 (x11; u; linux i686; en-us; rv:1.9.0.1) gecko/2008071615 fedora/3.0.1-1.fc9 firefox/3.0.1')] formcount=0 frm in br.forms(): if str(frm.attrs["id"])=="id-of-form": break formcount=formcount+1 br.select_form(nr=formcount) open('a filename', 'wb') f: shutil.copyfileobj(br.submit(name='submit', label='value of submit button'), f) if matters; i'm running mac os x the return value of submit file-like object. can copy data local file: import shutil open('dow

Connecting to MySQL remotely -

i quite new mysql , databases in general might straight forward answer. have following scenario: mysql server running on home network in country a. an application wanting communicate server different home network in country b. how 1 establish communication between them? main problem understanding ip address (host) specify within application trying connect mysql. if ip address belongs router in country a, specify in order reach server? thank you! use ip address assigned isp , make sure router forwarding proper mysql port.

merge many bytes arrays into one byte array in objective c -

i have used nsmutabledata merge byte arrays nsmutabledata *payload; payload = [[nsmutabledata alloc] init]; [payload appendbytes:cfbridgingretain((cm.msgbytes)) length:[cm.msgbytes length]]; nsstring *cmdata = [[nsstring alloc] initwithdata:[payload mutablebytes] encoding:nsutf8stringencoding]; i want keep on adding payload until done cmdata nil as initwithdata takes nsdata converted bytes nsdata result still same nsdata *bytesdata = [nsdata datawithbytes:[payload mutablebytes] length:[payload length]]; nsstring *cmdata = [[nsstring alloc] initwithdata:bytesdata encoding:nsutf8stringencoding]; i think you're confusing things in several places. api says "bytes", it's talking c array of bytes; says "data", it's talking nsdata object. assuming cm.msgbytes nsdata object, appears given retrieve .length , better version of code be: nsmutabledata *payload; payload = [[nsmutabledata alloc] init]; [payload appendda

parsing - How can I execute a command with multiple arguments in my shell in C? -

i want shell able run cat file.txt as as ls -l i'm not sure how this, because cat 2nd argument text file, however, commands such ls 2nd argument not, have execute differently. not sure how handle both cases properly. your shell should looking matching binary first parameter , passing in subsequent parameters strings first program. shell isn't responsible determining parameters mean, program runs is. your shell should call fork(), in child process (where return value of fork() == 0), call 1 of different exec commands run user-specified program. meanwhile, original process waiting on fork'd child complete waitpid(). http://linux.die.net/man/3/exec you see many of take array of character pointers parameter. you'll pass in subsequent parameters exec'd binary read in , parse itself.

How can explain the F# type casting output? -

i had problem f# type casting. here code. type person() = abstract member sayme : unit -> unit default u.sayme() = printfn "hi, person." type student() = inherit person() override u.sayme() = printfn "hi, student." let x = person() let x1 = student() let x2 = x1 :> person x2.sayme()|>ignore //***output:"hi, student." x2 person type. output should "hi, person." how can explain it? as others have noticed, override syntax defining virtual members . speaking, calling virtual method seeing: regardless of upcasts , actual method call found according actual type of object referred to, not type of reference. this document (msdn) provides more details. if don't want method virtual, don't use override . way, method in derived class hide parent's method. here's full code: type person() = member u.sayme() = printfn "hi, person." type student() = inherit pers

c# - Using Google for Image Search from a Mobile app -

i'd implement following: in mobile app (android, windows phone) user takes photo, , app searches such image on web. told google has that. found a page google image search , written deprecated. advises use custom search instead, didn't find image search there (only text search). question is: solution image searching mobile app exist? google provide api image search through keyword, looking search through image ? may can of google search image api? if looking search image tineye api useful

How can I change the way java.awt.Graphics draws my object? -

i'm creating game , have class player, class enemy, , class bullet. design of engine, logical draw graphics calling for (shape s : shapes { g.fill(s) } shapes existing list<shapes> of every object in game. works fine, bullet colored differently player, , player enemies. how can modify player, bullet, , enemy classes awt.graphics knows color draw them as? edit: acceptable answer maybe involve finding way sort through shapes , separate class, although seems counter intuitive complete list existing. you need use oop example interface shapes{ public color getcolor() ; } class player implements shapes{ public color getcolor() { return color.red; } } class enemy implements shapes{ public color getcolor() { return color.green; } } // paint (shape s : shapes} { g.fill(s.getcolor())};

java - Working of intrensic Lock -

public class check { public boolean tochange = false; public synchronized boolean getchange() { return tochange } public synchronized setchange(boolean change) { this.tochange = change } } when 2 different threads try access , set simultanoesuly , happen in synchronous way due lock on check object? since both methods non-static , synchronous , no 2 threads @ instance of time, can execute both methods simultaneously, if belong same instance. so yes, happen in synchronous way, within instances of class. when create check c = new check(); and 2 threads namely t1, t2 try access c.getchange() , c.setchange() simultaneously, 1 thread given access monitor (which instance c ) , other thread has wait until previous thread finishes work , releases monitor. here instance c default monitor used synchronize access