Posts

Showing posts from July, 2010

.net - When to Set ThreadApartmentState when using Component that is exposed to VB6 -

i have com component fixing @ moment used within vb6 application (and raises events) hosting vb6 program. this component uses multiple threads perform it's work internally , moves events out layer exposed vb6 application. in constructor of component called via vb6 application (new myobject) block of code within component gets called public sub new() msynccontext = system.threading.synchronizationcontext.current if msynccontext nothing using f new windows.forms.form msynccontext = system.threading.synchronizationcontext.current end using end if end sub within threads raiseevents received in outer object. the events find way commscommunicationserror , tricks onto correct thread raising events visualbasic6. private sub commscommunicationserror(byval theerrornumber integer, byval theorder order) mrecordingcounter += 1 dim args ordererroreventargs if theorder.parent isnot nothing args = new ordererroreventargs(theerrornumber, theo...

javascript - What ways can i do Authication Using POST Ajax? -

i trying send command through post ajax call, this. command suppose move ip camera left,right, down , up. file.cgi?move=right i post script using: $.ajax({ method: "post", username:"admin", password:"admin", url: "file/cgi-bin/view/cammove.cgi", data: "move=up" }); when using post not see results when in browser works, when remove username , password function returns 400 error. would know how work out? thank all.

c# - ThreadStaticAttribute in ASP.NET -

i have component needs store static values fore each thread. it's general component can used in many scenarios , not in asp.net. i thinking use [threadstatic] attribute achieve goal. supposing work fine in asp.net scenarios, because assuming every request called in own thread. after research found this blog post scott hanselman saying careful when using [threadstatic] in asp.net. however of comments (below post) not agree scott wrote, saying request run in 1 thread , thread not used request @ same time. that's believe love have opinion experts in here. nope, scott right: request doesn't have run on single thread entire duration. asp.net thread-agile in respect. there few points switch can happen, can happen. (i've tested myself.) you may wish read this blog post , this spring forum thread more details. basically should find different way of capturing context. relevant bit point of view @ end of blog post: this major pita, because fa...

flex - play video from a point defined by the users -

if broadcast video , divide packets, , when users connect netgroup , receive object group( user receive specific time let actual video 10 minutes , user connect group, , seek video last 5 minutes). how can achieve task. possible ? using flash player 10.1 yes, possible, little complicated. flash video on http uses progressive display , download. random access stream not technically possible. may work in instances when file in browser's cache, not reliable. if stuck http only, real option edit video chunks represent random access points. example, if have 1 hour video, can make twelve videos representing 5 minute offsets play end (ie, 60 min file, 55 min file, etc). there techniques use custom server , player inject metadata allow random access (i know colleagues have done this, have never had myself). flash video can play on rtmp connection. flash media server provides this, 1 or 2 alternates. rtmp / fms give lots more options streaming video , allows true ra...

html - Web visual editor -

can tell me open source (with source code) visual html editor. want editor able create buttons, text input etc. i'm trying build web edms. any ideas? you use free verion of ckeditor

python - How do I do greater than/less than using MongoDB? -

i'm using pymongo driver. can take @ pymongo , tell me how greater than? i"m used doing : everything. have seen the doc ? take manual : >>> d = datetime.datetime(2009, 11, 12, 12) >>> post in posts.find({"date": {"$lt": d}}).sort("author"): ... post ... {u'date': datetime.datetime(2009, 11, 10, 10, 45), u'text': u'and pretty easy too!', u'_id': objectid('...'), u'author': u'eliot', u'title': u'mongodb fun'} {u'date': datetime.datetime(2009, 11, 12, 11, 14), u'text': u'another post!', u'_id': objectid('...'), u'author': u'mike', u'tags': [u'bulk', u'insert']}

Visual studio exclude folders from rebuild -

Image
i'm building addon asp.net set of pages ontop of old classic asp system. the new pages in folder newversion/ folder need rebuilding when make changes, @ moment attempts build entire site results in lot of errors. can exclude other folders build configuration? edit please note, other pages still going edited (all classic asp ones) exlcuding them project etc doesn't help edit 2 here's screen shot vs select files exclude in solution explorer press f4 \ alt + enter open properties window. change build action property nnoe .

java - SAXReader() timeout -

im having saxreader() parse , read rss-feed. want ensure wont try read long period. want ensure if reader hasnt received response or within x seconds, abort. my code: saxreader reader = new saxreader(); document doc = reader.read(new url(myurl)); this inside try/catch. you can tweak urlconnection opening manually: url myurl = geturltoload(); urlconnection con = myurl.openconnection() con.setconnecttimeout(1000); con.setreadtimeout(2000); inputstream in = con.getinputstream(); // parse in want

Fsockopen and proxy authentication in PHP -

i'm trying integrate proxy usage (with authentication) script queries whois data. what i'm trying is 1) connect proxy ip , port 2) authenticate username , password 3) connect whois server , send domain details, receiving request in return. i have script working without proxies private function whois($domeinnaam, $whoisrule) { list ($server, $poort, $domein, $vrij) = $whoisrule; $domein = str_replace("{domein}", $domeinnaam, $domein); $fp = fsockopen($server, $poort); if($fp) { fputs($fp, $domein."\r\n"); $data = ""; while(!feof($fp)) { $data .= fread($fp, 1000); } fclose($fp); } else { $data = "error"; } // cache whois data $this->_whoisdata[$domein] = $data; return $data; } but how integrate proxy server , authentication code? curl has handy curlopt_proxy* options . this answer shows how use...

Mysql: Line breaks shown as squares in table -

any solution this? how rid of squares in mysql? it's \n or \r understand, why looking squares in mysql? thanks ;) you can 2 thing rid squares in mysql storage, either replace backslash double backslash e.g. \n = \n force write \n in mysql database. while entering data have add mysql_real_escape_string() function while storing data.

iphone - how to change the lock images to unlock images in cocos2d -

am having game 10 levels. want change second level lock image unlock when first level completed. am using 20 images ( 10 locked , 10 unlocked). am using cc menus display number images. example(code):- ccmenuitemimage *startbutton12 = [ccmenuitemimage itemfromnormalimage:@"ten_new-lock.png" selectedimage:@"ten_new-lock.png" target:self selector:@selector(ten:)]; menu1 = [ccmenu menuwithitems: startbutton3,startbutton4,startbutton5,startbutton6,startbutton7,startbutton8,startbutton9,startbutton10,startbutton11,startbutton12, nil]; menu1.position = ccp(240,30); [menu1 alignitemshorizontally]; [menulayer1 addchild: menu1]; am using below code remember level completed. int lastlevelcompleted= [[nsuserdefaults standarduserdefaults] integerforkey:@"levelcompleted"]; if(currentlevel >lastlevelcompleted){ nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setinteger:cu...

android - priority in textviews inside a table row -

i have 1 question textviews.. i have 1 table row in code, includes 1 image view , 2 textviews.. |_| textview1 textview2. the image view has android:layout_alignparentleft="true" , second textview has android:layout_alignparentright="true" the problem when write big text in first text view goes on second textview..i don't want put 1 particular number width first textview.any idea how can write big text in first textview , don't overlay second textview??something priority against textviews? <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dip" > <imageview android:id="@+id/icon" android:layout_width="wrap_content" android:layou...

java - Lock an Android Phone -

possible duplicate: lock android device programatically i want able lock android phone password when run method. have reference or sample code me refer. thanks edit have tried using keyguardmanager mgr = (keyguardmanager)getsystemservice(activity.keyguard_service); keyguardlock lock = mgr.newkeyguardlock(keyguard_service); lock.reenablekeyguard(); as said answer below, i'm still trying add password have entered database @ server side, way unlock phone enter password set edit http://developer.android.com/reference/android/app/admin/devicepolicymanager.html been trying work on ^ edit i have seen that device_admin_sample.xml with contents <device-admin xmlns:android="http://schemas.android.com/apk/res/android"> <uses-policies> <limit-password /> <watch-login /> <reset-password /> <force-lock /> <wipe-data /> </uses-policies> </device-admin> but put xml fi...

css - fix sized div over flowing content issue -

if have fixed height content div, it's possible content spill on div. fixed height stop footer floating middle of page on pages less content. in other words it's there footer in same place on every page. how fix this? you can either use min-height css property define minimum height content div, or position footer absolutely bottom: 0px

Starting and handling multiple CountDownTimers in Android -

in android, need start , display multiple countdowntimers @ same time, on same screen, 1 after another. how can proceed implementing this? using threads help? you can define , array or list each timer want run, , define timer decrements them every second. http://chat.stackoverflow.com/users/443141 has example on how schedule tasks every second. in method gets called every second, decrement values of arrays , update text-label. ... ( int i=0; < timers.length; i++) { if ( timers[i] > 0 ) { timers[i]--; // update textlabel } else { // change text color, flash,vibrate,... } } ... to reset timer set new seconds left value.

java me - how to check internet availability in j2me -

how check internet availability on mobile application.... in j2me.... use property detect available gprs connection on s40 series mobiles. com.nokia.network.access its returns networking access point type. possible values property are: * pd — packet data, example gprs * csd — circuit-switched data, example gsm csd/hscsd data call * bt_pan — bluetooth pan network * na — not applicable, implementation cannot determine type r for more info see wiki link . also try access url verify that. if got timeout or connection related exception means type of network not available.

How to customize the button and label text size for each field separately in blackberry application? -

i new bb application. want customized size button text , label text. i using code try { fontfamily alphasansfamily = fontfamily.forname("bbalpha serif"); font appfont = alphasansfamily.getfont(font.plain, 9, ui.units_pt); setfont(appfont); } catch (classnotfoundexception e) { } but using change size field using within constructor.but need different size different field .like title big size , other label text button text small size. i guessing calling when creating screen setfont() changes font full screen. you can call set font on required button or label , change font field e.g button.setfont(yourfont) are calling setfont() explicitly on field wish change?

unicode - Python encoding conversion -

i wrote python script processes csv files non-ascii characters, encoded in utf-8. encoding of output broken. so, in input: "d\xc4\x9bjin hornictv\xc3\xad" i in output: "d\xe2\x99\xafjin hornictv\xc2\xa9\xc6\xaf" can suggest encoding error might come from? have seen similar behaviour previously? edit: i'm using csv standard library unicodewriter class featured in docs . use python version 2.6.6. edit 2: code reproduce behaviour: #!/usr/bin/env python #-*- coding:utf-8 -*- import csv pymarc import marcreader # pymarc package available pypi: http://pypi.python.org/pypi/pymarc/2.71 unicodewriter import unicodewriter # unicodewriter from: http://docs.python.org/library/csv.html def getrow(tag, record): if record[tag].is_control_field(): row = [tag, record[tag].value()] else: row = [tag] + record[tag].subfields return row inputfile = open("input.mrc", "r") outputfile = open("output.csv", "wb"...

iphone - how to compile spatialite for iOS -

i new here , first topic. new on ios platform , trying use spatialiate extension sqlite3 couldn't this. making me crazy. don't know how , start. can give me suggestion? thanks. i'm guy shared libs on http:// ;-) did progress on easing integration of spatialite ios. i'm able build standalone static library of spatialite (2.3.1 embeds required geos , proj don't have take car of them). just download zip http://lionel.gueganton.free.fr/spatialite/spatialite2.3.1.zip , you'll .a x86 , arm + headers can use directly spatialite interface headers. once you've drag n drop .a (both required work in simulator , on real hardware), can initialize spatialite invoking spatialite_init(1) . the following should displayed on console log: spatialite version ..: 2.3.1 supported extensions: - 'virtualshape' [direct shapefile access] - 'virtualtext [direct csv/txt access] - 'virtualnetwork [dijkstra shortest path] ...

oop - How can I create a copy of an object in Python? -

i create copy of object. want new object possess properties of old object (values of fields). want have independent objects. so, if change values of fields of new object, old object should not affected that. have @ copy.deepcopy() function. should need. have @ this answer related question nice explanation.

php - Displaying user avatar or default avatar on search -

im having problem php search script. i'm building social networking site 1 can search user, event or club. search results display user avatar thumb or default thumb if none has been uploaded. im testing on localhost. user avatar's stored in user_images (c:\wamp\www\nnl\user_images) folder while default avatar stored in c:\wamp\www\nnl\style\images\default_avatar.png. the following php code: <?php while ($row_user = mysql_fetch_assoc($user)) { echo "\n<table width='500' border='0'>"; echo "\n\t<tr>"; echo "<td width='50' height='50' align='center' valign='middle'><a href='user_view.php?user_id=".$row_user['user_id']."'> <img src=user_images/$row_user[picture_thumb_url] !=''? $row_user[picture_thumb_url]: '../style/images/default_avatar.png' border='0' height='50' width='50'/></a></t...

iphone - Optimizing OpenGL ES application. Should I avoid calling glVertexPointer when possible? -

i'm developing game iphone in opengl es 1.1; have lot of textured quads in data structure each node has list of children nodes. traverse structure root, , render of each quad, childs , on. the thing is, each quad i'm calling glvertexpointer set vertices. should avoid calling each quad? improve performance calling once example? glvertexpointer copies vertices gpu memory or saves pointer? trying minimize number of calls not easy since each node may have different quad. have lot of equal sprites same vertex data, i'm not rendering 1 after since may drawing different sprite between them. thanks. glvertexpointer keeps pointer, incurs state change in opengl driver , explicit synchronisation, costs quite lot. when 'here's data, please draw', gpu starts drawing , continues in parallel whatever going on on cpu long can. when change rendering state, needs finish whatever doing in old state. changing once per quad, you're forcing concurrent proc...

php - $_SESSION['username']/hidden value -

<?php session start(); ?> <?php echo $_session['username']; ?>, please submit form book project room in business school. hi, i've been trying print out $_session['username'] on form. nothing gets printed. i've passed session start(); on necessary files still doesn't work :/ please advise. i've tried using hidden value also, doesn't work. :/ use session_start(); instead of session start(); . add var_dump($_session); after session_start() script, debugging.

jquery iterate ul within li -

i'm using following code iterate html element given below <ul id="sortable"> <li> <p> item 1</p> <ul id="nested-sortable"> <li> sub item 1 </li> <li> sub item 2 </li> <li> sub item 3 </li> </ul> </li> <li> <p> item 2</p> </li> </ul> javascript var jsonseqobj = {}; alert('hi'); $('ul#sortable li').each(function(index,pele) { alert($(pele).attr('id')); $(pele).children('ul#nested-sortable li').each(function(idx, chele) { alert(chele.attr('id')); jsonseqobj.push({ref_id:$(chele).attr('id') , new_seq_no:idx }); }); jsonseqobj.push({ref_id:$(pele).attr('id') , new_seq_no:index }); }); li ul li long, line wraps no indention alert(jsonseqobj); return jsonseqobj; but children thing not working error : object doesnt support property. is mar...

coldfusion - Adding a footer only to the last page when using cfdocument -

i'm creating multipage document using cfdocument (created using dynamic text have number of pages one). i can use <cfdocumentitem type="footer"> add footer every page, there way can add footer last page of document? thanks. just add evalatprint attribute. can use page number variables conditionally set footer. <cfdocumentitem type="footer" evalatprint="true"> <cfif cfdocument.currentpagenumber eq cfdocument.totalpagecount> last page </cfif> </cfdocumentitem>

multithreading - Inheritance problems in TThread, don't appear to work the same in D2010 as D7 -

in application have 2 thread objects (outer , sash) inherit base thread object (frameobject) of type tthread. works fine in d7. application needs extended , taking opportunity move d2010 - when try compile delphi complains frameobject create method declaration differs previous declaration. the class types , constructors shown below; tframeobject = class(tthread) constructor tframeobject.create(buildtype: tbuildtype; onbatchstep: tbatchnotify; onthreadcomplete: tnotifytermination); begin inherited create(true); ... end; touter = class (tframeobject) constructor create(buildtype: tbuildtype; onbatchstep: tbatchnotify; onthreadcomplete: tnotifytermination; exceptionhandler: texceptionhandler); begin inherited create(buildtype, onbatchstep, onthreadcomplete); fexceptionhandler := exceptionhandler; ... end; tsash = class (tframeobject) constructor create(buildtype: tbuildtype; onbatchstep: tbatchnotify; onthreadcomplete: tnotifytermination; exceptionhandler: texcept...

Using mySQL variables -

is possible in sequence of sql statements value of field , use name table in statement? i'm not sure if that's clear, here's psudo-example of i'm trying do: // datatype equal "ratings" @var = select datatype thetable anid = 5; // needs run "from ratings-table" select field1,field2 @var-table anid = 5; i've been reading http://dev.mysql.com/doc/refman/5.0/en/user-variables.html either don't understand this, or not solution i'm looking for. yes, can using prepared statements : set @tablename := 'ratings'; set @createquery := concat('select `field1`, `field2` `', @tablename, '-table` `anid` = 5'); prepare statementcreate @createquery; execute statementcreate;

Relative path to absolute path in C#? -

i have xml files contain href file paths images (e.g. "....\images\image.jpg"). hrefs contain relative paths. now, need extract hrefs images , turn them absolute paths in file system. i know getfullpath method, tried , seems work currentdirectory set, appears c: don't see how use that. , still, have absolute path of file containing hrefs, , href relative paths, since simple task me count number of "....\" parts based on absolute path of containing file, seems there must way programmatically well. i'm hoping there's simple method don't know about! ideas? assuming know real directory xml file lives in use path.combine, e.g. var absolute_path = path.combine(directoryxmllivesin, "..\images\image.jpg"); if want full path ..'s collapsed can use: path.getfullpath((new uri(absolute_path)).localpath);

Linux to Windows C++ port -

i trying port c++ application linux windows (visual c++). curious wheter know script/tool scan source code , check possible issues (such dirent.h etc). thanks. the first tool called compiler. tell if program compiles. the second tool called running whatever tests may have. tell if resulting binary works. what looking for, crystal ball save doing work? regardless of approach take or may read started, @ point have (1) compile thing , (2) check see works.

java - Spring - Do all beans get processed? -

i have beans.xml file ldap application writing. allowing user choice of several ldapcontextsource(s). each 1 have different bean, e.g. <bean id="ldaptemplate" class="yyy.ldaptemplate"> <constructor-arg ref="contextsource1" /> </bean> <bean id="contextsource1" class="xxx.ldapcontextsource"> ... </bean> <bean id="contextsource2" class="xxx.ldapcontextsource"> ... </bean> <bean id="contextsource3" class="xxx.ldapcontextsource"> ... </bean> you can see 1 of these context source beans gets instantiated, because 1 referred ldaptemplate bean. however, when run application, spring log messages in stdout provide information each context source, though 1 depended on. jan 25, 2011 11:56:36 org.springframework.ldap.core.support.abstractcontextsource afterpropertiesset info: property 'userdn' not set - anonymou...

java.io.IOException: Server returned HTTP response code: 403 for URL -

my code goes this: url url; urlconnection uc; stringbuilder parsedcontentfromurl = new stringbuilder(); string urlstring="http://www.example.com/content/w2e4dhy3kxya1v0d/"; system.out.println("getting content url : " + urlstring); url = new url(urlstring); uc = url.openconnection(); uc.connect(); uc.getinputstream(); bufferedinputstream in = new bufferedinputstream(uc.getinputstream()); int ch; while ((ch = in.read()) != -1) { parsedcontentfromurl.append((char) ch); } system.out.println(parsedcontentfromurl); however when trying access url through browser there no problem , when try access through java program, throws expection: java.io.ioexception: server returned http response code: 403 url what solution? add code below in between uc.connect(); , uc.getinputstream(); : uc = url.openconnection(); uc.addrequestproperty("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.0)"); however, nice idea allow type...

iphone - Get object properties from mapView.SelectedAnnotations -

i've got mapview , annotation view drops pins on region based on long/lat series of objects representing physical branches. i've got callout annotations prompting open shared application maps give them directions location.. but, can't figure out how address branch object/annotation , pass when calloutaccessorycontroltapped fires: branch objects: cllocationcoordinate2d newcord; newcord.latitude = 34.0038; newcord.longitude = -84.0965; corp = [[locationwithannotation alloc] initwithcoordinate:newcord]; corp.mtitle = @"corp office"; corp.msubtitle = @"123 main street, duluth ga"; [mapview addannotation:corp]; [corp release]; newcord.latitude = 33.0038; newcord.longitude = -84.3965; uga = [[locationwithannotation alloc] initwithcoordinate:newcord]; uga.mtitle = @"uga office"; uga.msubtitle = @"123 main street, atlanta ga"; [mapview addannotation:uga]; [corp release]; these annotations added map, when callout hit, want able ...

What's an easy way to dynamically generate some JavaScript in Seaside? -

i'm trying add disqus blog i'm writing. deal seaside sessions need either add unique discus_identifier or disqus_url js. overrode component's #script method can return string literal. i see 2 options: dynamically generate js, save file, , load file in component. add permalink each blog entry. is there easier way? or 1 (or both) of these ways easy do? i'm new smalltalk , seaside , unsure how accomplish either of these 2 things. yes there easier way. can generate correct discus js code directly in #script method. should return string literal can create string on fly. example using writestream. you blog entries need permalink. can use #initialrequest: method handle these permalinks.

flash - How to record / splice FLV clips? -

i'm working on application company wants create service users. company offers videos around 1.5 hours in length, , service want integrate ability user 'record' clips of larger video create, essentially, highlight reel. end result of service 3 minute video of user's favorite parts of huge 1.5 hour long video. make sense? for sake of simplicity in asking question, imagine user interaction basic. user watches video, he/she can press 'record' record clip of master video. now... i'm aware of flvslicer thibault @ bytearray, i've thought surely there other approach recording / splicing / merging flv clips guy's framework. and finally, question is: of have insight how might investigate best way create functionality aside using flvslicer? can't seem find other route "recording" clips videos this. (edit: vi gave fantastic response how accomplish outside of flash app, curiosity still aimed @ if can done purely within flash. high 5 ...

view - onTouchevent() problem android -

when run code below works fine,it's simple app 3 balls can move around... public class dragndrop extends activity { /** called when activity first created. */ private colorball[] colorballs = new colorball[3]; // array holds balls private static final string tag="mytag"; drawview myview; private int balid = 0; // variable know ball being dragged int x; int y; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); point point1 = new point(); point1.x = 50; point1.y = 20; point point2 = new point(); point2.x = 100; point2.y = 20; point point3 = new point(); point3.x = 150; point3.y = 20; // declare each ball colorball class colorballs[0] = new colorball(this,r.drawable.bol_groen, point1); colorballs[1] = new colorball(this,r.d...

How to update SQL Server Metadata using SharePoint? -

is possible view , update metadata sql server in sharepoint? i’m asking because create sharepoint site have “library” can search sorts of databases based on keywords, etc… , metadata of desired search result (.dbo metadata) appear , allow editable in sharepoint (without having go sql server , there- , @ same time, changes automatically register in sql server well). is possible? have considered storing metadata 'tags' in sharepoint list (or maybe differet categories of metadata in several sharepoint lists) , using lookup field (linked sharepoint 'tags' lists) allows multiple items selected metadata in field (or several fields) against documents in document library? way keep metadata managed nice , in sharepoint , can filter documents author custom development? hope helps or @ least gives option way @ solving problem...

actionscript 3 - Flash AS3 fisheye -

i hoping here point me in direction of flash as3 fisheye application. need can have images in fisheye able scroll closer right/left sides of container because images going overflow container. i think you're looking panorama viewer. i've never used any, i've heard things http://krpano.com/

javascript - listen to navigation control events in google earth plugin -

is there way listen navigation contol's click events. aware can listen 'viewchage' event want know when user clicks on nav controls. i have anmation playing on plugin , want add tilt , pan values playing camera values when user clicks on nav controls. sorry, genavigationcontrol not expose events afraid not possible. you create own controls , events handle functionality...but far trivial. also, pretty sure can't modify camera values in plugin whilst tour playing without exiting it. essentially there 3 types of control on camera/nativation a tour object controls camera/nativation (kml) you control camera/nativation programmatically (javascript api) the user controls camera/nativation (controls, mouse, keys) trying use of these @ same time produce unpredictable jerky results each method 'fights' control of view.

actionscript 3 - How To Dynamically Access Object Property? -

i have stored name of property of object string. in php, if object named $object , property variable named $key , accessed $object->$key . how can dynamically access properties in actionscript? you can access this: var obj = { property1: 'this property', property2: 'this property' } var key = 'property2'; obj[key]; // 'this property'

When to use SQL sub-queries versus a standard join? -

i working on rewriting poorly written sql queries , over-utilizing sub-queries. looking best-practices regarding use of sub-queries. any appreciated. subqueries fine unless dependent subqueries (also known correlated subqueries ). if using independent subqueries , using appropriate indexes should run quickly. if have dependent subquery might run performance problems because dependent subquery typically needs run once each row in outer query. if outer query has 1000 rows, subquery run 1000 times. on other hand independent subquery typically needs evaluated once. if you're not sure meant subquery being dependent or independent here's rule of thumb - if can take subquery, remove context, run it, , result set it's independent subquery . if syntax error because refers tables outside of subquery dependent subquery . the general rule of course has few exceptions. example: many optimizers can take dependent subquery , find way run efficiently join. example ...

javascript - dojo tree event on root nodes -

Image
**i'm building dojo tree using following code: the tree displayed expected. problem have onclick event fired on leaf nodes. when click on root level node(i have several root level) open showing child nodes. how can add "extra" onclick functionality root nodes? you've got openonclick set true tree. think api docs answer possibly could. http://dojotoolkit.org/api/dijit/tree/openonclick that said, looks you'd able connect _onclick instead , whatever want (that's method responsible calling onclick when openonclick false, anyway). or, if wanted feel little less guilty accessing private members, dojo.declare subclass of dijit.tree , extending _onclick fire function define public.

how to select or display records based on some query in django's admin -

(i'm django newbie) we need delete records django table (comments). i prefer admin , not directly using database engine (mysql, btw), because of naive assumption handle relastionships or software restrictions. there hundreds or thousands of records, , ideal put query somehow, , select all. how can filter recordset in admin? django: latest stable. thank you python script / django console option? there comment.objects.filter(**where_dict).delete() of course not best try directly on production environments :)

java - Problem in binary tree; need help -

can me please? making binary tree node insertion. how can insert new node current node in respect of bst rule? example: first root empty. input number: 50 this display "success!" insert number: 40 successfully inserted in left subtree of 50 insert number: 20 successfully inserted in left subtree of 40 insert number: 80 successfully inserted in right subtree of 50 can me please? thank in advance hoping positive response... here's code: class node { public int num; public node llink; public node rlink; } public class binarytreeoperations { //public node llink=null; // public node rlink=null; private node temp; private node current; private node root; public boolean isempty() { return root==null; } public void insertnum(int n) { temp=null; current=null; node newnode = new node(); newnode.num=n; newnode.llink=null; newnode.rlink=null; if(isempty()) { root=newnode; ...

silverlight - Does The Windows Phone 7 Emulator Show A Watermark? -

does windows phone 7 emulator show watermark along upper right edge of display? at first thought might nested grids not overlapping , creating thin vertical column of visual garbage in upper right. after creating new project , zooming in on both garbage areas turns out numbers. existing project: "000 000 000006 001 000 00.0000" new, empty project: "000 000 003296 002 001 00.0967" what these? way disable visibility? these frame rate counters used measuring performance. details here. jeff wilcox – frame rate counters in windows phone the post shows how disable display.

c# - Overloaded methods in interface -

my question today: overloaded methods in interface bad? know, "omit parameters if don't care, we'll figure out default values" kind of overloaded methods. that: void add(object item); void add(object item, bool shoulddosomething); void add(object item, bool shoulddosomething, iultraobscuredevicecontext context); in case tend think latter belongs interface , others should implemented in abstract class on top of it. again, i'm not sure. also, there times when want different overloads doing different work (stop me right there if overloaded methods should never used that). or can't stuff nulls in place of parameter, want exception thrown if null. should not use overloading in case? so i'm looking guidelines on overloaded methods in interfaces vs overloaded methods in abstract classes implementing these interfaces , on. in advance if defaults depend on receiver of method call, declare them interface methods. if defaults defaults irrespe...

open source .NET-based user management systems? -

every business app requires user registration, profile management , authorization system. looking open source .net system can usewithout change. saw few in java not found useful in .net. can use? the .net framework has lot of built in, of in system.web.security. should follow quickstarts , "securing application" one. login controls , user registrations included , customizable. there's no need add complexity (and potential security hole) of third-party solution here. if you're using mvc, check out relevant section of mvc music store tutorial.

android - intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bmp) image is off center -

i having tad of issue when creating shortcuts on android desktop. first, have 72x72 icon, load sd card bitmap object. with bitmap object set icon resource. the problem having when set it, image on shortcut appears off center , cut off. screen metrics size 72x72, not sure deal is. code: bitmap thebitmap = bitmapfactory.decodefile("/sdcard/icon.png"); intent.putextra(intent.extra_shortcut_icon, thebitmap) i've tried resizing , have got work utilizing canvas, drawable , bitmap, when restarting phone reverts small size. using same icon drawable resource makes perfect, not dynamic: parcelable iconresource = intent.shortcuticonresource.fromcontext(this, r.drawable.icon); intent.putextra(intent.extra_shortcut_icon_resource, iconresource); using samsung epic 4g w/ 2.1 i had similar issue. looked @ launcher source code , saw there's bug causes icon not appear correctly if initial bitmap size small. scale bitmap 128x128 first: bitmap scaledbit...

domain driven design - DDD How to fetch a list of value objects -

i have domain model customer - aggregate root - because order can't exist without customer order - entity orderstatus - value object in form need list of orderstatuses . should fetch empty customer entity(ar) repository empty order entity containing list of orderstatuses? awkward. i asked same thing time before. read link. how value objects saved , loaded?

jquery - Piecemaker fallback -

i wondering if there way include fallback functionality piecemaker, when website viewed on mobile, page falls using javascript based slider. any appreciated. so think found way around following crayon1's vein of thought , changing how embeds flash fallback child html can included. requires changing 2 files: javascriptflashgateway.js & piecemaker-main.php (assuming we're talking wordpress plugin) in javascriptflashgateway.js, find code: function flashtag(src, width, height) { this.src = src; this.width = width; this.height = height; this.version = '9,0,0'; this.id = null; this.salign = "tl"; this.scale = "noscale"; this.allowscriptaccess = "always"; this.allowfullscreen = "true"; this.bgcolor = 'ffffff'; this.flashvars = null; this.wmode = null; } and change this: function flashtag(src, width, height, fallback) { t...

javascript - jQuery .after() not working in IE -

i trying add table row table using .after() it's not working in ie, keep getting error "object required" , error seems coming line 5151 in jquery library. here code: $('#view').live('click',function(){ var parent = $(this).parent(); parent.after("<tr><td>test</td></tr>"); }); any ideas? a reason html code isn't valid without table tag. create elements separate elements instead: parent.after($('<tr/>').append($('<td/>').text('test')));

android - How to change default picture application to my own picture? -

when run application, it's automatically create droid-bot picture on surface of application. so, want change picture, should do? (1) create png image (say icon.png) , save in folder: res/drawable (2) then, in androidmanifest.xml of application add icon tag in application: android:icon=”@drawable/icon” e.g. <application android:name ="yourappmgr" android:icon="@drawable/icon" //... >

php - Need clarification regarding custom post types -

i'm working on custom post-types. once added post types can able post data. custom post types done using cms-press. after posted particular custom post - type post i'm not able see post in wordpress post list in front-end. , same it's not coming under buddypress too. how can make affect in places same normal post ?? , possible make theme based on post type?? 1 can me on this?? i think might have misunderstood purpose of custom post types. it's more helpful think of them custom 'entities' rather custom 'posts'. examples of custom entities 'cars', 'courses', 'locations' or else put on web site. once start thinking way, see how wordpress needs knowing how display entities. custom entities may added regularly; others may remain unchanged months or years. may small in number; other may need displayed in complex hierarchy or through search. that's why kept separate blog, in same way pages are. however, if custom...

iphone - Selecting only one button at a time -

i have placed 4 uibuttons on view, when run app possible select many buttons @ time( in highlighted state). though selector called on 1 button. in general how avoid multiple selection? set uiview-property exclusivetouch yes each uibutton .

How do I insert a special character such as ' into MySQL? -

i executing insert query shell script reads data multiple files. of data inserted contains ' in text , mysql keeps giving errors error 1064 (42000) @ line 1: have error in sql syntax; check manual corresponds mysql server version right syntax use near 's development & empowerment, youth affairs ',' himachal pradesh ' @ line 1 this actual text: women's development & empowerment, youth affairs . you need escape quote, so: 'women\'s development & empowerment, youth affairs' note, if you're generating sql statement language php, there functions available you. in php, instance, there mysql_real_escape_string , takes care of you. note, prepared statements prefered on this, it's harder wrong. see also: the mysql manual entry on strings php pdo prepared statements

asp.net mvc - MVC-pop up windows -

i need create pop windows in mvc(not new tab in browser). know how this? one possibility use jquery ui dialog . edit the idea have ajax action returns partial view. result of action (html) placed inside container of popup , on success handler of ajax call open popup. here sample code: @ajax.actionlink("open popup", "someaction", new ajaxoptions { httpmethod = "get", updatetargetid = "result", insertionmode = insertionmode.replace, onsuccess="openpopup" })<br /> <div id="result" style="display:none;"></div> <script type="text/javascript"> $(document).ready(function() { $("#result").dialog({ autoopen: false, title: 'title', width: 500, height: 'auto', modal: true }); }); function openpopup() { $("#result").dialog("open"); } </script> then have add action in con...

c++ - C++11 and the lack of polymorphic lambdas - why? -

i've been reviewing draft version of c++11 standard. section on lambdas , , confused reasoning not introducing polymorphic lambdas. for example, amongst 100001 ways polymorphic lambdas used, had hoped use code such following: template<typename container> void foo(container c) { for_each(c.begin(), c.end(), [](t& t) { ++t; }); } what reasons: was committee ran out of time? that polymorphic lambdas hard implement? or perhaps seen not being needed ptb ? note: please remember example above not one, , provided guide types of code. answers solely concentrate on providing workaround above piece of code not considered valid! related sources: lambda expressions , closures c++ (document number n1968=06-0038) can lambda functions templated? the reason don't have polymorphic lambdas explained pretty in this posting . it has concepts feature pulled c++11: essentially, polymorphic lambdas ordinary, unconstrained function templates , didn...

What happens when we use loop instead of while(true) with scala actors? -

what's difference of using loop instead of while(true) while using receive actors. loop seems work faster, why, , what's going on under bonnet? is there bad use loop instead of while(true)? more context. i'm doing performance tests within simple ping/pong code. , i'm using receive. this ping class: class receiveping( count : int, pong : actor ) extends actor {def act() { var pingsleft = count - 1 pong ! start pong ! receiveping while(true) { receive { case receivepong => if (pingsleft % 10000 == 0) console.println("receiveping: pong") if (pingsleft > 0) { pong ! receiveping pingsleft -= 1 } else { console.println("receiveping: stop") pong ! stop exit() } } }}} instead of while(true) performs better loop. thanks using loop releases thread other tasks, while while doesn't. so, if using many actors, use of loop mak...

Recommendations for a clean vanilla machine install Ubuntu LAMP setup with python on Amazon EC2 -

i'm setting ubuntu lamp server on ec2, can recommend simple machine image requirements: ubuntu server lamp python, python-imaging ( can self install ) the server testing python application. thanks this seems foot bill: https://10.cloud.ubuntu.com/faq/ they've got link images registered amazon.

objective c - How to browse and upload music file from iPhone Music Library? -

is there possible way browse , upload music file iphone music library? i m trying browse music file iphone/ipod music library through uiwebview... no success... thanks.... definitely not possible through web view, , not doable actual sdk either. trying accomplish?

HTML5 iFrame Seamless Attribute -

in html5 iframe has new attributes 'seamless' should remove borders , scrollbars. i've tried doesn't seem work, still can see scrollbars , borders (i'm using google chrome browser), here's code: <iframe seamless="seamless" title="google" width="600" height="300" src="http://www.google.co.uk"></iframe> any idea why it's not working? one more question, possible target specific section of page inside iframe? it's not supported correctly yet. chrome 31 (and possibly earlier version) supports parts of attribute, not supported.

c - World axis to local axis -

how can modify/rotate axis angle world coords object coords? see below: void rotatematrix4(float *m, float angle, float *axis); //this function rotates matrix in object space void rotatelocal(float angle, float *axis) { rotatematrix4(m, angle, axis) } void rotateglobal(float angle, float *axis) { //do axis here rotatematrix4(m, angle, axis) } you found answer - multiplication between tranformation matrix , vector - transforming axis vector object coords. look @ transformation matrix more information on transformation matrices. (i comment on answer - rank not yet high enough...)

Processing messages from a child process thorough stderr and stdout with Python -

my python code spawns child process, , prints out messages both stdout , stderr. need print them differently. i have following code spawn child process , stdout result it. cmd = ["vsmake.exe", "-f"] p = subprocess.popen(cmd, stdout=subprocess.pipe) line in iter(p.stdout.readline, ''): print line, sys.stdout.flush() pass p.wait() how can modify code check if child process prints out message through stderr also? added i need print out stderr , stdout child process prints out something. , cross platform implementation, should run on mac/linux/pc. p = popen(cmd, bufsize=1024, stdin=pipe, stdout=pipe, stderr=pipe, close_fds=true) p.stdin.close() print p.stdout.read() #this print standard output spawned process print p.stderr.read() #this need, error output <----- so error output gets redirected stderr pipe. if need more in real in time. mean lines printed spawned process prints stdout or stderr` can like: def print_pi...

C-style struct initialization from initialization list in C++ -

is there syntax allows use struct initialization syntax: struct { int a; int b; } int main() { a = { 1, 2 }; //syntax return 0; } in initialization list? e.g. class b { public: b(int a_, int b_) : obj { a_, b_ } { } private: obj; }; if have class public member variables, can automatically use same way structs. in c++ there's not way define arbitrary initializer list behavior. in c++0x there is, pointed out here . if happen using gcc, feature supported in gcc 4.4 , above (if compile parameter -std=c++0x)

cluster analysis - changing openlayers clutter radius -

i used openlayers clustter strategy cluster dataset geoserver. i used following code in styling of clusters. var mystyle = new openlayers.style( { pointradius :20, fillcolor :'#ffff00', fillopacity :0.5, strokecolor :'#ffffff', strokewidth :2, strokeopacity :0.5 }); var mystylemap = new openlayers.stylemap( { "default" :mystyle }); this works nicely if write code in html pages , in jsp pages. when want change cluster radius dynamically according data point count in each cluster had following change above code. var mystyle = new openlayers.style( { pointradius :"${radius}", fillcolor :'#ffff00', fillopacity :0.5, strokecolor :'#ffffff', strokewidth :2, strokeopacity ...

Download and autorun software trials via Flash? -

as software developer, offer free trial versions of software download. can see stats many download trials don't run them. main target user pc novices, think many of them doesn't realize have run downloaded installer. question: would possible write small download client in flash, starts when user clicks download button, automatically downloads .exe file , runs when downloaded? no, that's not possible, , dangerous security flaw. should make instructions clearer, somewhere around download button, users realize it.

javascript - difference between "void 0 " and "undefined" -

i'm using "closure compiler" , when compiling scripts spend following: before compiling: // ==closurecompiler== // @compilation_level simple_optimizations // @output_file_name default.js // @formatting pretty_print,print_input_delimiter // ==/closurecompiler== var myobj1 = (function() { var undefined; //<----- declare undefined this.test = function(value, arg1) { var exp = 0; arg1 = arg1 == undefined ? true : arg1; //<----- use declare undefined exp = (arg1) ? value * 5 : value * 10; return exp; }; return this; }).call({}); var myobj2 = (function() { this.test = function(value, arg1) { var exp = 0; arg1 = arg1 == undefined ? true : arg1; //<----- without declare undefined exp = (arg1) ? value * 5 : value * 10; return exp; }; return this; }).call({}); compiled: // input 0 var myobj1 = function() { this.test = function(b, a) { = == void 0 ? true : a; //<----- var c = 0; ret...

calling PHP based service from inside the Excel (using macro) -

i call php based web service every time cell in column added or modified , write resuts collumns b,c,d how achieve that? take @ tutorials on doing this, such consuming web services excel 2003

Modify OOB Publishing Approval workflow in SharePoint 2010 to add 2nd level approval step -

i looking customize out-of-box publishing approval workflow in sharepoint 2010, using spd 2010, in order add second approval step routed new group, "publishers", before pages , other publishing assets published on site. this public-facing internet site on sp2010 using publishing site template. i have site done, , default publishing approval workflow works fine, need add 2nd approval step. my questions are: can done sharepoint designer 2010 worfklows? not looking start scratch, rather "extend" oob publishing approval workflow, adding new step. is best customize existing workflow , save on it, or should "copy , modify"? if latter, how associate new custom publishing approval workflow publishing site template, replaces oob 1 pages libraries, master page libraries, etc? have several sub sites within site collection, workflow need used site in site collection. thanks! -- thiago go list contains pages have approval workflow associa...