Posts

Showing posts from June, 2010

c# - Why doesn't an interface work but an abstract class does with a generic class constraint? -

the code below shows generic class type constraint ( pub<t> ). class has event can raise allowing pass message subscribers. constraint message must implement imsg (or inherit imsg when it's abstract class). pub<t> provides subscribe method allow objects subscribe notify event if , if object implements ihandler<imsg> . using .net 4, code below shows error on baseimplementer.notifyeventhandler stating that: "no overload 'ihandler<imsg>.notifyeventhandler(imsg)' matches delegate 'system.action<t>'" question: (with updated subscribe method) why error go away change `imsg` abstract class instead of interface? public interface imsg { } // doesn't work //public abstract class imsg { } // work public class msg : imsg { } public class pub<t> t : imsg { public event action<t> notify; public void subscribe(object subscriber) { // subscriber subscribes if implements ihandl...

python - Am I using super() correctly? -

i made small chunk of code because i'm still trying figure out specifics of using super() . why chunk run typeerror ? = secondclass() typeerror: __init__() takes 2 arguments (1 given) then, secondclass.meth() function supposed print string, i'm missing conceptually. class firstclass (object): def __init__ (self, value): self.value = value print self.value class secondclass (firstclass): def meth (self): super (firstclass,self).__init__(value = "i strange string") = secondclass() a.meth() this isn't super . don't define __init__ secondclass explicitly - but, because inherits firstclass , inherits firstclass 's __init__ . can't instantiate object without passing in value parameter. edit ok. first point, others have mentioned, must use current class in super call, not superclass - in case super(secondclass, self) . that's because super means "get parent of class x", mean "get...

ios - Changing the color of the selected item in a UISegmentControl -

i have uisegmentedcontrol black tint selected element not visually different other elements ios darkens selected item , hence black remains unchanged. know how make selected element lighter color/shade without using undocumented methods? have achieved graduated layer there must easier way! here description how can set tintcolor each segment. http://www.framewreck.net/2010/07/custom-tintcolor-for-each-segment-of.html

scheme - Exporting a populated hashtable from a library -

here's library exports hashtable. library contains expressions populate hashtable: (library (abc-1) (export tbl) (import (rnrs)) (define tbl (make-eq-hashtable)) (hashtable-set! tbl 'a 10) (hashtable-set! tbl 'b 20) (hashtable-set! tbl 'c 30)) here's version of library exports procedure can used populate hashtable: (library (abc-2) (export tbl init-tbl) (import (rnrs)) (define tbl (make-eq-hashtable)) (define (init-tbl) (hashtable-set! tbl 'a 10) (hashtable-set! tbl 'b 20) (hashtable-set! tbl 'c 30))) is considered bad form take first approach? i.e. have library executes arbitrary expressions? there drawbacks approach? a related issue... in library, non-definition expressions must occur after definitions. work around constraint, i'm using macro: (define-syntax no-op-def (syntax-rules () ((_ expr ...) (define no-op (begin expr ...))))) for examp...

css - rounded corner with html table -

i have following html table make rounded corner box. <div class="tipholder" > <table width="200" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff"> <tr> <td><img src="png\tile_top_left.png" style="float: right;" ></td> <td id="tiptop"><!-- blank top section --></td> <td ><img src="png\tile_top_right.png" ></td> </tr> <tr> <td id="tipleft"><!-- blank left section --></td> <td> <!--################### enter content here ################### --> rgergergfthrthrthr </td> <td id="tipright"><!--blank right section --></td> </tr> <tr> <td ><img src="png\tile_bottom_left.png" style="float: right;" ></td> <td id="tipbottom"><!--blank bottom section...

.net - How to handle c# WPF thread in MVVM view model -

i having bear of time figuring out how handle thread class outside viewmodel. the thread originates track class. here responseeventhandler code in track : public delegate void responseeventhandler(abstractresponse response); public event responseeventhandler onresponseevent; when "command" method processed within track object, following code runs onresponseevent , sends message in thread viewmodel: if (onresponseevent != null) { onresponseevent(getresponsefromcurrentbuffer()); } getresponsefromcurrentbuffer() merely returns message type pre-defined type within track . my mainwindowviewmodel constructor creates event handler onresponseevent track : public mainwindowviewmodel() { track _track = new track(); _track.onresponseevent += new track.responseeventhandler(updatetrackresponsewindow); } so, idea every time have new message coming onresponseevent thread, run updatetrackresponsewindow() method. method append new message stri...

flash - Alternative to locking file type on FileReference.save() AS3 -

Image
update: as discussed in jacob's reply below, limiting or correcting behaviour of filereference.save isn't possible. can suggest alternative (server apache/php) matches of criteria post , avoids pitfalls discussed jacob? end edit i'm saving image as3 app using filereference.save(). code, works fine: var encoder:jpgencoder = new jpgencoder(80); var bytedata = encoder.encode(mybmd); //bitmap data object created earlier var file:filereference = new filereference(); file.save(bytedata, "myimage.jpg"); this opens save file dialog expected. i'm using rather sending bytedata php because want user have familiar dialog box lets them set own file name. the problem comes when users have operating system configured display file extensions, do. means in save dialog file name contains extension seen in image below, , easy user delete extension when rename file. because default file type box 'all files', if extension deleted file saved no type....

java - how can I tell xalan NOT to validate XML retrieved using the "document" function? -

yesterday oracle decided take down java.sun.com while. screwed things me because xalan tried validate xml couldn't retrieve properties.dtd. i'm using xalan 2.7.1 run xsl transforms, , don't want validate anything. tried loading xsl this: saxparserfactory spf = saxparserfactory.newinstance(); spf.setnamespaceaware(true); spf.setvalidating(false); xmlreader rdr = spf.newsaxparser().getxmlreader(); source xsl = new saxsource(rdr, new inputsource(xslfilepath)); templates cachedxslt = factory.newtemplates(xsl); transformer transformer = cachedxslt.newtransformer(); transformer.transform(xmlsource, result); in xsl itself, this: <xsl:variable name="entry" select="document(concat($prefix, $locale_part, $suffix))/properties/entry[@key=$key]"/> the xml code retrieves has following definition @ top: <!doctype properties system "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key=...

javascript - Load jQuery only once on many-framed page -

a key screen in application involves html page several iframe s performing various functions. of these need access jquery. in interest of speeding loading time, , reducing http traffic (though know caching this), if jquery code loaded once. if page so <html> <head> <script src="jquery-1.5.js" type="text/javascript"></script> </head> <body> <iframe src="other.html"></iframe> <div id="foo"> ... stuff here ... </div> </body> </html> then inside other can refer parent.$('#foo') refer parent's "foo" element, not child's. there way use parent's "instance" of jquery on child document or elements in it? have tried: var $ = window.parent.$; $('#foo'); // parent's frame's #foo, same "window.parent.$('#foo');" and: var $ = window.parent.$; $('#...

git - Why is it necessary to lose untracked files when you set up github pages? -

github has feature can put html pages. ( details here ). anyway, used put aforementioned page. basics of instructions are: // in order create new root branch, first ensure working directory clean committing or stashing changes. following operation lose uncommitted files! might want run in fresh clone of repo. $ cd /path/to/fancypants $ git symbolic-ref head refs/heads/gh-pages $ rm .git/index $ git clean -fdx // after running you’ll have empty working directory (don’t worry, main repo still on master branch). can create content in branch , push github. example: $ echo "my github page" > index.html $ git add . $ git commit -a -m "first pages commit" $ git push origin gh-pages so went fine; advertised, untracked files wiped i'd made copy of dir , moved necessary. switching , forth between branches (i use smartgit) doesn't seem wipe untracked files. however, i'm interested in expanding basic knowledge of git, , wondering why necessary wipe...

jquery - JavaScript not working in Mobile Safari -

ok, problem js code using not work in mobile safari straight away. works fine in desktop safari, chrome, etc. in mobile safari (iphone 4 , ipod touch 2nd gen tested) page blank. if navigate page , click back, loads fine! could tell me on earth happening here? thanks :) here link site http://osmithcouk.ipage.com/exposed/index.php and here js code note have edited code since ryuutatsuo recommended still not working :( <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".slidingdiv").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ $(".slidingdiv").slidetoggle(); }); }); and here html goes alongside that. <a href="#" class="show_hide"><b><?php include 'headline1.txt'; ?...

character encoding - Python: Converting from ISO-8859-1/latin1 to UTF-8 -

i have string has been decoded quoted-printable iso-8859-1 email module. gives me strings "\xc4pple" correspond "Äpple" (apple in swedish). however, can't convert strings utf-8. >>> apple = "\xc4pple" >>> apple '\xc4pple' >>> apple.encode("utf-8") traceback (most recent call last): file "<stdin>", line 1, in <module> unicodedecodeerror: 'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in range(128) what should do? try decoding first, encoding: apple.decode('iso-8859-1').encode('utf8')

visualization - Easiest way to visualize 10,000 shaded boxes in 3D -

i have simple task: have 10,000 3d boxes, each x,y,z, width, height, depth, rotation, , color. want throw them 3d space, visualize it, , let user fly through using mouse. there easy way put together? one easy way of doing using recent (v 3.2) opengl be: make array 8 vertices (the corners of cube), give them coordinates on unit cube, (-1,-1, -1) (1, 1, 1) create vertex buffer object use glbufferdata array vertex buffer bind vertex buffer create, set up, , bind textures may want use (skip if don't use textures) create vertex shader applies transform matrix read "some source" (see below) according value of gl_instanceid compile shader, link program, bind program set instance transform data (see below) cube instances depending on method use communicate transform data, may draw in 1 batch, or use several batches call gldrawelementsinstanced n number of times count set many elements fit 1 batch if use several batches, update transform data in betwe...

flash - Send a SMS text message after period of time via PHP -

i have flash application. i'm trying send users text messages via php after did things on flash. for example, text user 1 hour after did thing#1. text user 10 minutes after did thing#2. text user 1 day after did thing#3. .... i'm thinking of setting table list of things trigger text. have cron job set check timestamps of each user finishing things. is there better way out there doing this? that sounds approach take. whenever have action takes place @ different time web request, need "queue" action completed later. need script runs (however want) checks queue (i.e. db table) , processes items in queue. you're on right track.

problem with java 2 me app, cant access the commands -

problem fixed, if interested missing. birthform.setcommandlistener(this); in getbirthform() function missing, same getloginform() missing loginform.setcommandlistener(this);. here fixed codes package badisapp; import java.io.ioexception; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import java.util.vector; public class badismidlet extends midlet implements commandlistener { //=========== fields ======================== private loginform loginform; // login form private notifybirth birthform; // birth notification form private vector birthtype; private vector gender; //========= properties ====================== /** * create login form * @return login form */ public loginform getloginform() { if (loginform == null) { loginform = new loginform("sign in", this); loginform.setcommandlistener(this); } return loginform; } /** * create birth notification form * @return birthform */ public notifybirth getbirt...

c# - How can I map this navigation property? -

i have 2 collections. parent has many children, stores current child's id. public class foo { public int id { get; set; } public icollection<bar> bars { get; set; } public int? currentbarid { get; set; } // adding causes error below public virtual currentbar currentbar { get; set; } } public class bar { public int id { get; set; } public int fooid { get; set; } public virtual foo foo { get; set; } } when add currentbarid property persisted correctly. however, when add currentbar property exception thrown when bar created. i exception: {"invalid column name 'foo_id'."} how can map navigation property in context? update i have played around bit , ended with: modelbuilder.entity<foo>() .hasoptional(x => x.currentbar) .withoptionaldependent() .map(map => { map.totable("bar").mapkey("currentbarid"); }); now following error. in right directi...

Does Aptana 3 provide a PHP plugin as good as Aptana 1.5.1? -

has tried out aptana 3? php plugin suck as did 2.0? still running aptana 1.5.1 here... it's built in. aptana studio 3 great tool although experience bit buggy when working on large projects.

javascript - Chrome popup "blocker" loads hidden page & plugins - any way around this? -

if launch window flash game in it, , chrome's popup blocker suppresses it, user hears music game, sees nothing. because chrome doesn't block window; hides it. chrome loads page favicon , page title, can display in popup blocker dialog (which see when clicking icon in address bar). don't close window. plugins run, scripts can call opener - it's regular window, invisible. (okay, malware developers, please stop drooling.) chrome parse contents of <head> tag retrieve <title> , favicon <link/> tag without loading page. close hidden window after they've retrieved icon/title. show url instead of icon/title. instead, bug continues fester since 2008... http://code.google.com/p/chromium/issues/detail?id=3477 http://code.google.com/p/chromium/issues/detail?id=38458 anyhow, question is: can detect when happens? perhaps there's in window.chrome javascript object indicate window in invisible state, can close or remove flash? __ bas...

webserver - check last blank line of HTTP request using perl chomp -

i'm pretty new perl. perl program getting http request message browser, want detect last blank line. i trying use $_ =~ /\s/ , doesn't work: while (<connection>) { print $_; if ($_ =~ /\s/) {print "blank line detected\n"; } } the output get / http/1.1 blank line detected host: xxx.ca:15000 blank line detected user-agent: mozilla/5.0 (x11; linux i686; rv:5.0) gecko/20100101 firefox/5.0 blank line detected accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 blank line detected accept-language: en-us,en;q=0.7,zh-cn;q=0.3 blank line detected accept-encoding: gzip, deflate blank line detected accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 blank line detected connection: keep-alive blank line detected cookie: __utma=32770362.1159201788.1291912625.1308033463.1309142872.11; __utmz=32770362.1307124126.7.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=manitoba%20locum%20tenens%20program; __utma=70597634.1054437369.1308785920.1308...

latitude longitude - How to test if a point inside area with lat/lon and radius using Java? -

i've write method has following signature public class position { double longitude; double latitude; } boolean isinsidethearea(position center, double radius, position point); so if point inside area has center center , radius radius in miles , should return true , false otherwise. use haversine formula compute distance between center , point . if distance greater radius , return false ; otherwise return true . pseudocode: def haversinedistance(a, b): # snip... return foo def isinsidethearea (center, radius, point): return haversinedistance(center, point) <= radius

linq - C# Visitor pattern Expressions to build result Unit of measure -

i embarking on project involving calculations , have started straightforward uom (unit of measurement) adaptation based on cureos framework. far good, i've got basic units represented. one of things build upon foundational units in order arrive @ calculated values. instance, if have length (or distance ) , time , can arrive @ velocity (distance / time) or acceleration (distance / square(time)). my units flexible; can show them either english, si, or whatever system happens in whatever quantity need, whether feet, inches, meters, centimeters, etc. or in case of time, milliseconds, seconds, minutes, etc. what i'd report actual unit @ moment of calculation. if units meters , seconds, i'd report "m/s" velocity or "m/s^2" acceleration. or, if units feet , milliseconds, report "ft/ms" or "ft/ms^2", respectively. so... story backdrop, entertaining possibility of expressing these more complex units (if will, maybe it's unit...

c# - Regex for: Must contain a numeric, excluding "SomeText1" -

i need regex pattern (must single pattern) match text contains number, excluding specific literal (i.e. "sometext1"). i have match text containing number part: ^.*[0-9]+.*$ but having problem excluding specific literal. update: .net regex. thanks in advance. as verbose regex: ^ # start of string (?=.*[0-9]) # assert presence of @ least 1 digit (?!sometext1$) # assert string not "sometext1" .* # if so, match characters $ # until end of string if regex flavor doesn't support those: ^(?=.*[0-9])(?!sometext1$).*$

python app engine restful service using DAL -

i building restful service in python app engine , able separate datastore operations (like queries) request handlers. i can build own dal, i'm wondering if there libraries out there. know of or have suggestions on how build one? help. if want portable outside google app engine try web2py dal api. you code this: db = dal('gae') rows = db(db.mytable.myfield!=none).select() row in rows: print row.myfield web2py supports these db flavors: google app engine sqlite mysql postgresql mssql firebird oracle db2 ingres informix

Simplifying an xPath query -

simplify following xpath small possible still identifies element in question /html/body/div[@id='vwd4_page']/div[@id='vwd4_content']/div[@id='layout']/div[@id='footeraction']/div[3]/form[@id='searchform']/span/input[@id='searchfield'] can use this? //input[@id='searchfield']

c# - Static Dropdown populating incorrect value -

i have static dropdown following html. <asp:dropdownlist width="100px" id="dropdownactive" runat="server"> <asp:listitem text="inactive" value="0"/> <asp:listitem text="active" value="1" /> </asp:dropdownlist> i try populate selected value based off of data, has the value of 0 before , not accept new value. dropdownactive.selectedvalue = (support.active)? "active": "inactive"; the values of dropdown "0" , "1", not "active" , "inactive" dropdownactive.selectedvalue = (support.active)? "1": "0";

string - Problem with php bin2hex function -

i using php function bin2hex on strings, , 1 of them have division sign character ÷ (dec: 247, hex: f7). but when try: echo bin2hex('÷'); i get: c3b7 the first problem c3 character added , have no idea comes (c2 gets added before other characters). and second , main problem, php giving me hex string "b7" representation of division sign ÷, b7 represents · , not ÷. anyone knows whats going on here? it seems source code unicode-encoded editor encodes '÷' in unicode (eg. utf-8). "c3b7" two-byte encoded form of '÷' (see here ). make sure source code ascii-encoded effect desire.

qt - Painting using PYQT -

i trying implement program paint in pyqt. trying use code of scribble example in pyqt package can found in: c:\python26\lib\site-packages\pyqt4\examples\widgets. regarding have 2 questions: in scribble program, when painting, paint doesn't updated visually in real-time holding mouse button , scribbling. found out problem comes function drawlineto class scribblearea, line: self.update(qtcore.qrect(self.lastpoint, endpoint).normalized().adjusted(-rad, -rad, +rad, +rad)) now if replace line self.update() the problem solved, cursor not in exact location paintin happens. do know parameters can add in self.update() solves both problems? i want open image scribble , paint on , save paint blank lets white background (without original image in ground). can tell me how this? i appreciate answer either of questions. thanks! just learning pyqt, modified code take care of cursor mismatch problem (and modified openimage method keep image size in sync window): ...

asp.net mvc - Clever way to put azure MVC app into maintenance mode -

does have quick , clever ways flip mvc app running on windows azure "maintenace mode" i don't have huge need because use azure staging environment lot have need make sure there no users in production instance of application (mainly database updates). i'd able on fly without uploading new code or swapping deployment slots. suggestions? the friendliest way on login. when user authenticates, check maintenance mode flag in database , don't let them log in. let active users continue use application until log out or session times out. keep activity log can know when users have expired. of course means take time when put app maintenance mode , when ready, it's not nice boot out active user. if usage pattern of app makes methodology not ensure no activity in reasonable time, can add timeout on top of this. check same maintenance flag request every often. doesn't have every request every 5 minutes or so. if necessary can cache maintenanc...

objective c - Box2D dynamic body falling off screen -

i have rectangular object (like spear) , have ground body. problem is, when spear hits ground, doesn't bounce back, falls though , off screen. here physics setup: (ignore ball reference, suppose called spear (rectangular)) -(id) init { if( (self=[super init])) { cgsize winsize = [ccdirector shareddirector].winsize; self.isaccelerometerenabled = yes; self.istouchenabled = yes; // create sprite , add layer _ball = [ccsprite spritewithfile:@"spear.png" rect:cgrectmake(0, 0, 100, 10)]; _ball.position = ccp(100, 100); [self addchild:_ball]; // create world b2vec2 gravity = b2vec2(0.0f, -20.0f); bool dosleep = true; _world = new b2world(gravity, dosleep); // create edges around entire screen b2bodydef groundbodydef; groundbodydef.position.set(0,0); b2body *groundbody = _world->createbody(&groundbodydef); b2polygonshape groundbox;...

c# - Parameterize database column names in controller action -

i want controller action "professorstatus" queries "professor" table , returns list of active professors particular school. here controller action have, struggling parameterizing "school" columns public actionresult professorstatus(string schooltype) { var activeprofessors = (from p in prof.professortable.where(a => a.engineering.value == true) group p p.professorid g select g.key).tolist(); return view(activeprofessors); } now, in above controller action. instead of hard coding "engineering" want parameterize "schooltype". so if pass schooltype = medicine controller display professors medicine school , on other school types. how can avoid hardcording here? in advance. if not in position redesign whole database , systems use it, can still around using expressions. public actionresult professorstatus(string schooltype)...

java - checking a String for anything other than an integer or character a - z -

this dealing java start. goal take in vin number , store string. make sure has no more 9 characters. vin number supposed contain numbers , letters a-z or a-z. if user inputs invalid vin number should loop around , prompt new vin number. problem telling whether string contains other integers or letters. i've seen utility.isalphanumeric method can't figure out how implement or whether it's java method. netbeans gives me errors whenever try use it. private static string checkvin() { scanner input = new scanner(system.in); string vinnumber = ""; { system.out.println("please enter vin number of car"); vinnumber = input.next(); if (vinnumber.length() > 9) { system.out.println("invalid input vin number"); } (int = 0; < vinnumber.length(); i++) { char currentcharacter = vinnumber.charat(i); if ((currentcharacter < '0' || currentcharacter ...

c# - How to check for the current background color of a grid? -

i'm trying make toggle button change background color of windows phone 7 app. i'm changing background color of grid named layoutroot using code: layoutroot.background = new solidcolorbrush(colors.white); after i've done that, want check value of layoutroot.background in if statement (to serve toggle). i'm running problems. can't seem come way check value. when layoutroot.background.tostring() , system.windows.media.solidbrushcolor value. suppose makes sense, since background solidbrushcolor. how access value, can check in if statement? you can do: solidcolorbrush brush = layoutroot.background solidcolorbrush; if (brush != null) { if (brush.color == colors.white) { // } } other possible brushes include lineargradientbrush , radialgradientbrush, solidcolorbrush 1 of many possible brush types. why there if-statement checking null.

php - How to Parse Nested XML to nested Array? -

how pass xml array use in soap function. $res=$client->ota_hoteldestinationsrq($myarray); <ota_hoteldestinationsrq version="1.0"> <pos> <source> <uniqueid id="username:password" /> </source> </pos> <destinationinformation languagecode="en" /> </ota_hoteldestinationsrq> you can use code this: function process( domnode $node){ // special handling character data if( $node instanceof domcharacterdata){ return $node->data; } // has text inside: if( ($node->childnodes->length == 1) && ($node->childnodes->item(0)->nodename == '#text') && ($node->childnodes->item(0) instanceof domcharacterdata)){ return $node->childnodes->item(0)->data; } // attributes $result = array(); foreach( $node->attributes $item){ $result[ $item...

Datetime to filetime (Python) -

any links me convert datetime filetime using python? example: 13 apr 2011 07:21:01.0874 (utc) filetime=[57d8c920:01cbf9ab] got above email header. i found link, seems describe looking for: http://reliablybroken.com/b/2009/09/working-with-active-directory-filetime-values-in-python/

iphone - shouldAutorotateToInterfaceOrientation not working in an universal app -

i have written universal application , have returned yes in "shouldautorotatetointerfaceorientation" method. method getting called whenever change orientation of iphone or ipad view not rotate. have set autoresizessubviews this due because other innerview not allow/set orientation change. make things clear, when rotate device, method shouldautorotatetointerfaceorientation called every viewcontroller hangs on view tree. if of them returns no, interface won't change. for example, if have tabbarcontroller viewcontrollers a, b, c , d, method called of them, doesn't matter if being shown right now. so sure have changed in views.

iphone - UIImagepickercontroller crash in 4.3.3, using older SDK ( 3.2.5) -

i'm using uiimagepickercontroller in app without problems. sdk version xcode 3.2.5. far test devices haven't ran problems. one of testers (at long distance) experiencing crashes whenever he/she tries take picture or choose picture form library, after clicking "use" app crashes. has ios 4.3.3 installed. tester has 4g iphone , ipad, both of them actualized latest version, unlike devices: ipad 1g ios 4.2 ipod 4 ios 4.1 iphone 3g ios 4.2.1 the crash doesn't happen on of devices. i realize should upgrade xcode , devices soon, still understand cause of crash. know it's not memory, because old 3g can choose several pictures without problems, while tester's ipad , ip4 suffer consistant crashes every time tries select picture. maybe has hdr ( i'm not supporting or handling)?, maybe deprecated method ?, important difference may cause problem ?. any hint or small suggestion attack problem more welcome. , sorry grammar errors. thanks ! u...

java - How listen for check box in JFace Table Viewer -

i using table viewer check boxes following: final tableviewer legendviewer = new tableviewer(parent, swt.check); what solution listen check boxes selection/unselection in viewer ? thanks in advance, manu you listen swt.selection events on table , check event.detail == swt.check ... see example actual code....

java - Log4j output on console instead of configured file -

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

jquery - Trigger is not working in my case -

hi trying fire click event of on input changing in it.but not working. please find mistakes have done in code.below html <table> <tr> <td><input type="radio" id="a"><div class="x"><label for="a">clickhere</label></div></td> <td><input type="checkbox" id="b"><div class="x"><label for="b">clickhere</label></div> </td> </tr> <tr> <td><input type="radio" id="c"><div class="x"><label for="c">clickhere</label></div></td> <td><input type="checkbox" id="d"><div class="x"><label for="d">clickhere</label></div></td> </tr> </table> below jquery code.. $('table tbody tr').delegate(':radio','cha...

android - Possible to observe network status? -

i'm wondering if there's way somehow register observer network access (and have callback function run when internet avaliable), or if polling way. thanks! you can register receiver: //callback private final broadcastreceiver mnetworkstatereceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { //network state changes, can process it, inforamtion in intent } }; //registering recievr in actibity or in service intentfilter mnetworkstatefilter = new intentfilter(connectivitymanager.connectivity_action); registerreceiver(mnetworkstatereceiver , mnetworkstatefilter); detail at: http://developer.android.com/reference/android/net/connectivitymanager.html

html - Manage files with PhoneGap - Templating engine? -

i'm developing mobile application in html/css/javascript using phonegap. the question have how manage files in project. seems application runs faster if html placed 1 file. in case, application should contain several pages , can't think dealing more-than-2000-lines index.html, repeating each time same code different views. i'm coming know solutions you've found make simple foreign developer understand , work on easily. i'm using jquery mobile beta 1. i've heard jquery tmpl appears me solution clear code , reuse html, there trick? thank answers. hope topic useful else. phonegap not support multipage app. mustache js https://github.com/janl/mustache.js managing of multiple html files.

asp.net - How to parse Link, HashCode and ScreenName in Twitter Feeds using C# -

i using following code parse string in javascript. , working fine. wants same thing in c#. want parse string using c#. how can it. (feedtext).parseurl().parseusername().parsehashtag() string.prototype.parseurl = function () { return this.replace(/[a-za-z]+:\/\/[a-za-z0-9-_]+\.[a-za-z0-9-_:%&\?\/.=]+/g, function (url) { return url.link(url); }); }; string.prototype.parseusername = function () { return this.replace(/[@]+[a-za-z0-9-_]+/g, function (u) { var username = u.replace("@", "") return u.link("http://twitter.com/" + username); }); }; string.prototype.parsehashtag = function () { return this.replace(/[#]+[a-za-z0-9-_]+/g, function (t) { var tag = t.replace("#", "%23") return t.link("http://search.twitter.com/search?q=" + tag); }); }; you should try , first. here's starting point: http://dev.twitter.com/pages/open_source#csharp

localization - How does ASP.Net detect the Culture -

i have asp.net site have default.aspx.resx , default.aspx.no.resx. have configured browser (chrome) "norwegian bokmål (nb)", "norwegian (no)" , "english (en)". with culture , uiculture set auto in web.config, assume no.resx file chosen, entry before english entry. however, unless no first option, default chosen. also, "norwegian bokmål (nb)" fallback should "norwegian (no)". am missing settings, or asp net not functional in aspect, , need implement own culture detection algorithm? using resources localization asp.net

c# - How to get image URL-s from Google image search -

i need simple method helps me search images @google, , can extract url with. need first 20 images, , don't need visualize it, urls. need short code if possible. this general question, should try first yourself, , afterwards ask again if have problem. the google image search api offers access through restful interface, described here , on api reference page. you can use class make request (dunno in c #) , json library parse results.

return value - Perl: How to check what is being returned from a subroutine -

i have subroutine return 2 hashes when goes well. sub checkouts output of command , if matches pattern, returns "-1". there anyway check return of subroutine called it? kinda like: if (return_value == -1){ something} else go normal hashes you function should return references 2 hashes on success , nothing upon failure. can check truth value of function call. sub myfunc { %hash1; %hash2; return (\%hash1, \%hash2); } $ref1; $ref2; unless (($ref1, $ref2) = myfunc()) { print "something went wrong\n"; } else { print "ok\n"; }

Eclipse Failed to start Android app in Emulator -

i following output on eclipse console (started uac on win 7): (nothing on logcat) [2011-07-01 18:13:42 - test_android_2_2] ------------------------------ [2011-07-01 18:13:42 - test_android_2_2] android launch! [2011-07-01 18:13:42 - test_android_2_2] adb running normally. [2011-07-01 18:13:42 - test_android_2_2] performing nx.android.test_android_2_2activity activity launch [2011-07-01 18:13:44 - test_android_2_2] launching new emulator virtual device 'test_avd' but still there no trace of application on emulator. shows regular menu items & api demos & other stuff. am missing something? p.s. -adb kill-server & adb start-server did not help. -launching sdk, adb & emulator before eclipse not help. while launching app eclipse doesn't see currently running emulators i'm forced start new one. thanks, nisheeth barthwal strange may be. went logcat console , noticed had nothing. while people on net said logcat log. that led me thi...