Posts

java - Selecting a class dynamically at runtime -

im trying come solution class processes "message" selected @ runtime depending on message type. know can use if msg_type = "a" msgaprocessor.execute(message); else if msg_type = "b" msgbprocessoror = execute(message); .... .... .... i dont want use above approach dont want code know message types processing. want able in future add new message processor new message type. solution thinking of @ moment follows there 3 message processors @ moment msgaprocessor msgbprocessor msgbprocessor all 3 classes have method called execute process message in own way. have created interface called msgprocessor , added execute() method in interface. now having difficulty in knowing message processor caller should call without having check message type. example, cant this msgprocessor proc = new msgaprocessor() proc.execute() the above stil required in if statement needs called after finding out message type. avoid instantiating using implementation...

.net 3.5 - any way to simulate OUTPUT clause in SQl Server Compact 3.5? -

i implementing email queue system. basic idea store emails in sql ce db , read them through windows service , send them. assuming there 200 rows in db need fetch 10 records first , needed output clause run this update mailqueue set status='fetched' queueid in (select top(10) queueid mailqueue status='queued' order queueid asc) **output** deleted.* if not possible can think of removing rows permanently db , processing them , incase of failure store them in failqueue table. in case can select , delete done using sqlcetransaction class???? if there better way implement please advise. thanking all performing select , update in single sqlcetransaction trick.

Android touch events when screen is dark(ish)? -

i've got samsung galaxy tab, likes dim light on device after half minute. when touch screen, turns on light again, sends touch event whatever view located touched, end clicking on didn't mean click. is there way know screen has dimmed lights, touch events shouldn't sent through views? update: use flag keep_screen_on each activity, don't want to. auto-dimming restrains battery use, if it's possible i'd else. you should able read current brightness setting here: http://developer.android.com/reference/android/provider/settings.system.html#screen_brightness i found quite annoying well, don't know if should app's job fix it.

algorithm - Database Design : Creating database and User Interface for recurring events -

we creating web-application of bus service people search , book seat. want give ui admin s/he can specify recurring trips. for example volvo bus run city1 city2 every day 9:00 except tuesday. there can number of such criteria. how should store such different recurring trips can searched without perfomance hit? how should representd in ui easy admin work with. current database design: table : trip_master trip_id name table : timetable id trip_id city_id arrival_time departure_time seq_no your options a) store entities representing each occurrence of recurring trip (as might populate calendar table row representing each day of year), approach leverages sql or b) store rule representing recurring schedule, require more procedural code throughout application. favor option a), though requires routines populate trip-occurrences table on periodic basis.

xml - How to use XSL to create HTML attributes? -

why using xml data style html tags illegal? example: <li style="width:<xsl:value-of select="width"/>px"> why can't this? there alternative methods out there? why can't this? <li style="width:<xsl:value-of select="width"/>px"> because xsl xml itself . , anything… not xml. you mean attribute value template : <li style="width:{width}px"> or explicit form, more complex expressions: <li> <xsl:attribute name="style"> <xsl:choose> <xsl:when test="some[condition = 'is met']">thisvalue</xsl:when> <xsl:otherwise>thatvalue</xsl:otherwise> </xsl:choose> </xsl:attribute> </li> or dynamic attribute names (note attribute value template in name): <li> <xsl:attribute name="{$attrname}">somevalue</xsl:attribute> </li> additional no...

iphone - ASIHTTPRequest on iPad: "The request timed out" -

my application allows user download relatively large files (~120 mb) own dedicated server. i'm using asihttprequest library downloading. it may sound weird, worked fine until yesterday. i've tried downloading files countless times both app (on ipad) , mac, , while on mac download succeeds, on ipad randomly times out. goes until 100%, reaches 30%-40% or , asihttprequest's downloadfailed: selector gets called. if print out error's localizeddescription , "the request timed out". what mean? problem of app? or problem server, or connection? realize depend on several factors, please ask me information need if necessary. thanks. i had weird network situations timeouts on ipad when using wifi started after upgrade 4.2, intermittent. going settings -> general -> reset network settings , reentering wifi settings solved me. (also check hasn't setup new nearby wifi access point on same channel network!)

objective c - create, delete folders and cut and copy files -

is there tutorials following: create , delete folders @ main bundle of application remove folders document folder specific folder list folders @ main bundle any suggestion , please read nsfilemanager class reference. you can nsfilemanager instance doing: nsfilemanager *filemanager = [nsfilemanager defaultmanager]; by example can delete file by: nserror *error; [filemanager removeitematpath:mypath error:&error]; see here class reference: class ref