Posts

c# - Parsing multiple groups -

i have html file(i can't use html agilitypack) want extract id of div(if has one) <div id="div1">street ___________________ </div> <div id="div2">cap |__|__|__|__|__| number ______ </div> <div id="div3">city _____________________ state |__|__|</div> <div id="div4">city2 ____________________ state2 _____</div> i have pattern extracting underscores __ : [\ _]{3,} now if have div in front of underscores want extract it, if not i'll underscores. i have build far pattern (<div id(.+?)>(\w)([\ _]{3,}/*))([\ _]{3,}) the first part build out of 3 groups 1 - div tag, 2 - label, 3 - underscores 1 - <div id(.+?)> , 2 - (\w) , 3 - [\ _]{3,}/* the div id div2 not take id because contains non-alfanumeric chars. q: wrong pattern ? desired matchs 4 divs: <div id="div1">street ___________________ ______ <div id="div3">city _____________...

android - Implications of using GLSurfaceView on power consumption and battery life -

my app using glsurfaceview displaying images (and fast transformation). i've noticed when merely initialize surface, fill solid color , don't call further opengl functions, after time of activity staying in foreground tablet starts getting hot. cpu consumption 0%, assume it's gpu. right? , if so, there way throttle gpu? operations i'm using opengl not @ performance-demanding. have set render mode rendermode_ondemand? see docs here: http://developer.android.com/reference/android/opengl/glsurfaceview.html#setrendermode(int)

Android activity onPause() method -

in current project, have activity named calendarview.java , launcher activity named firstscreenactivity.java should appear whenever user press home button/back button calendar.java . added interstitial ads in firstscreenactivity.java . now, problem when start calendarview.java , ads appears, activity goes in onpause() state, when cancel ads , comes on calendarview.java activity comes in onresume() state. here don't want activity finish in onpause() method, want i'm pressing home button , come firstscreenactivity.java should open. now want is, when click home button in calendarview.java , restart project firstscreen.java should appear, , when ads appear in calendar.java , user close ads user should remains on calendarview.java only. any positive response highly appreciated.

Converting a 2D Canny Edge image to 1D edge pixel array in CUDA - Strange behaviour -

i have cuda kernel takes edge image , processes create smaller, 1d array of edge pixels. here strange behaviour. every time run kernel , calculate number of edge pixels in "d_nlist" (see code near printf), greater pixel count each time, when use same image , stop program , re-run. therefore, each time run it, takes longer run, until eventually, throws un-caught exception. my question is, how can stop happening can consistent results each time run kernel? my device geforce 620. constants: threads_x = 32 threads_y = 4 pixels_per_thread = 4 max_queue_length = threads_x * threads_y * pixels_per_thread img_width = 256 img_height = 256 img_size = img_width * img_height blocks_x = img_width / (threads_x * pixels_per_thread) blocks_y = img_height / threads_y the kernel follows: __global__ void convert2dedgeimageto1darray( unsigned char const * const image, unsigned int* const list, int* const glob_index ) { unsigned int const x = blockidx.x * threads_x*p...

ios - AFNetworking synchronous calls (like/unlike) -

i need implement like/unlike functionality in app. api calls made afnetworking , success/errors handlers ( ios blocks ). problem when user making many clicks on button in short period of time, of request received server in wrong sequence , becomes wrong. example double or double unlike happens. is there way send request via afnetworking synchronously? if no best practice design kind of api requests? disabling button (like comments suggest) not bad idea, if throw spinner or ui change let user know processing change. otherwise, limit api calls allow single call out. if user presses button, fire call , change boolean or tracking value. if press button again hold unto change state locally wait first callback come in. if keep pressing button keep track of change never fire response until receive notification api call has completed (probably 10-30 second timeout in case fails). once call completed, see if new value user wants different. if is, send , prevent future ...

database - Mysql join query help to show 2 seperate records -

i have query returns courses has status = "offering" , offered user has course courseid "3" problem there sc_c_material table has 2 records against course want show 2 seperate rows against this, 1 row has sc_course data 1st record of sc_c_material , 2nd row again sc_course data 2nd record of sc_c_material the below query only return 1 record course has id 9 id 9 has 2 records in sc_c_materials table. want both of record sc_c_material table i hope have cleared point, because bit hard explain select c.`id`, c.`coursecode`, m.`title`, a.`author_name`, q.`quality`, m.`comments`, s.status, u.id, m.`material` sc_courses c, sc_status s, sc_c_materials m, sc_authors a, sc_quality q, users u c.`statusid`=s.`id` , c.`userid`=u.`id` , m.`qualityid`=q.`id` , m.`authorid`=a.`id` , c.`id`=m.`courseid` , s.`status`="offering" , c.`userid` in (select useri...

c++ - Qt connection type between threads: why does this work? -

while trying make multi-camera system work different thread handling different camera, couldn't signals , slots working correctly between different threads. knew wrong fact object sending signal , related slot's object living in different threads, , knew had find appropriate "connection type" parameter connection. eventually, ended discovering using qt::directconnection make work should. find simplified code below. here's small description of how should work. application main program supposed create threads , start them. in simplified version, waits worker finish jobs through slot "quit". worker object performs 1 of threaded tasks. in simplified example, wait time before finishing computation. worker emits signal directed application instance, allowed wait threads , quit qcoreapplication. what finding if don't use qt::directconnection in second connect, finished() signal of worker not trigger quit() slot of thread, means application rema...