Posts

Showing posts from January, 2012

binding - Multiselection combobox display text silverlight -

i have grid, contains loads of columns. in 1 of columns have combobox, data template containing x number of checkboxes. <datatemplate> <combobox itemssource="{binding data}" dropdownclosed="combobox_dropdownclosed" loaded="combobox_loaded" selectionchanged="combobox_selectionchanged"> <combobox.itemtemplate> <datatemplate> <checkbox content="{binding subproject}" ischecked="{binding checked, mode=twoway}"/> </datatemplate> </combobox.itemtemplate> </combobox> what show summary of items checked in combobox when it's closed. "sub1, sub2, sub8". however, haven't been able find way of doing this. got idea? i found later on, , kind of answered question. combobox display value in silverlight

url - Local sub-domains on httpd apache -

i have on machine wampp server installed use run php applications. there many folder in htdocs inside projects , can see in browser @ url: localhost/folder-name/. i'd see every project in custom url like: dev.name-folder.com with iis easy that, can explain how apache, using wampp server? thanks. you can change c:\windows\system32\drivers\etc\hosts file map domain names dev.name-folder.com local system. (otherwise you'll have use dns server). to configure vhost in apache create file each domain/project you'd serve: <virtualhost *:80> serveradmin email@domain.tld servername domain.tld documentroot /var/www/htdocs/domain.tld/html <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/htdocs/domain.tld/html> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </d...

symfony1 - Zend Framework or Symfony -

i in process of migrating new php framework. have been involved in heavy development using codeigniter framework, finding little lightweight needs now. i have boiled choices down either zend framework or symfony. know learning curve both relatively high. however, wanted rough idea of worth getting stuck (as spending quite lot of time getting familiar chosen framework). if helps narrow answer down little. not looking build simple blog or that. in need support full-fledged development of e-commerce systems, customer relationship managers , content management systems. personally have been working zf since in version 1.6, , pretty happy , had seen improvement since 1.6 , think zf missing ideas : 1- orm , later on great implementation between zf + doctrine 1.2 has taken popularity , depend on zf + doctrine in many projects , these days can see great integration between zf + doctrine2 2- symfony's bundle forgotten in zf do think zend framework misses symfony...

java - Calling grails commands from grails events? -

i need call plugin arguments grails event script. how do this? specifically, i'm trying hook eventcompile call generate-dto --all , sending y stdin. the easiest (and slowest) way invoke grails in event handler. bit tricky, since generate-dto generates compile event, can make conditional on system property. second problem required input. convention, grails scripts supposed accept --non-interactive , not prompt user, dto plugin seems not follow this. workaround posix systems linux or macos x pipe in yes command grails input. here's how got working: // scripts/_events.groovy eventcompilestart = { args -> if (boolean.valueof(system.getproperty('in.generate', "false"))) { // skip } else { ['bash', '-c', 'yes | grails -din.generate=true generate-dto --all'].execute() } }

c# - How do I show a Save As dialog in WPF? -

i have requirement in wpf/c# click on button, gather data , put in text file user can download machine. can first half of this, how prompt user "save as" dialog box? file simple text file. both answers far link silverlight savefiledialog class; wpf variant quite bit different , differing namespace. microsoft.win32.savefiledialog dlg = new microsoft.win32.savefiledialog(); dlg.filename = "document"; // default file name dlg.defaultext = ".text"; // default file extension dlg.filter = "text documents (.txt)|*.txt"; // filter files extension // show save file dialog box nullable<bool> result = dlg.showdialog(); // process save file dialog box results if (result == true) { // save document string filename = dlg.filename; }

wpf - ResourceDictionary Source Binding to Module (for Localization) -

i have xaml window has set of strings bound objects so: <label content="{staticresource labelusername}" horizontalalignment="right" name="label1" verticalalignment="center" /> this code works fine when define resoucedictionary this: <window.resources> <resourcedictionary > <resourcedictionary.mergeddictionaries> <resourcedictionary source="/strings/strings_en-us.xaml" /> </resourcedictionary.mergeddictionaries> <objectdataprovider x:key="objlogon" objecttype="{x:type starutilities:logon}" /> </resourcedictionary> </window.resources> however, want beable change strings bound from, created module looks this: public module localizationchooser public readonly property getlocalization uri return new uri("/strings/strings_en-us.xaml", urikind.relative) end end propert...

c# - How performant is the DBNull.Value.Equals() check? -

i know it's not enough worried about, how performant dbnull.value.equals() check? public ienumerable<dynamic> query(string sql, params object[] args) { using (var conn = openconnection()) { var rdr = createcommand(sql, conn, args).executereader(commandbehavior.closeconnection); while (rdr.read()) { var e = new expandoobject(); var d = e idictionary<string, object>; (var = 0; < rdr.fieldcount; i++) d.add(rdr.getname(i), dbnull.value.equals(rdr[i]) ? null : rdr[i]); yield return e; } } } in particular, line: d.add(rdr.getname(i), dbnull.value.equals(rdr[i]) ? null : rdr[i]); versus original code (from rob conery's massive class): d.add(rdr.getname(i), rdr[i]); there's bound @ least small impact, again not noticable, i'm curious. reason conversion because it's easier testing null in asp.net mvc views. if in .net reflector c...

How to write the following SQL query in NHibernate -

hey - i'm battling figure out how write following using nhibernate icriteria (multi criteria?) following: (it's query list of first names ordered popularity in table in last day) select firstname,count(firstname) occurances registrants timestamp between dateadd(day,-1, getdate()) , getdate() group firstname order count(firstname) desc also, given couple of columns table, excluding id, , nhibernate needs id's it's objects, what's easiest way "fake" id can results? you need use projections , transformer this. here's background info http://nhibernate.info/doc/nh/en/index.html#querycriteria-projection var criteria = session.createcriteria<registrant>() .add(restrictions.between("timestamp", datetime.now.adddays(-1), datetime.now) .addorder(order.desc(projections.count("firstname"))) .setprojection(projections.projectionlist() .add(projections.groupproperty("firstname"), "firstn...

android - How does one drag an image form one layout to another layout -

how 1 drag image 1 layout layout. attaching have done far. have 2 layouts in single view. can move image on initial layout. problem cant move image different layout. please me find solution problem. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <imageview android:id="@+id/imageview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/icon" android:scaletype="m...

javascript - Fire an event after preloading images -

this code use preload images, i'm not sure if it's best one. question is, how can fire , event, example alert(); dialog after has finished loading images? var preload = ["a.gif", "b.gif", "c.gif"]; var images = []; (i = 0; < preload.length; i++) { images[i] = new image(); images[i].src = preload[i]; } you can use new "$.deferred" if like: var preload = ["a.gif", "b.gif", "c.gif"]; var promises = []; (var = 0; < preload.length; i++) { (function(url, promise) { var img = new image(); img.onload = function() { promise.resolve(); }; img.src = url; })(preload[i], promises[i] = $.deferred()); } $.when.apply($, promises).done(function() { alert("all images ready sir!"); }); might little risky leave image objects floating around, if fixed shifting closure. edit in fact i'll change myself because it...

Creating Access 2007 Subforms on a Tab Control -

the main entity in database has hundred fields. organized fields between many tables , added 1-to-1 relationship between tables. for data entry (and later data editing), envision "wizard" form each table , "next" button advance next screen/table. primary key entered on first screen , subsequently passed remaining screens. i have heard tab control subforms might way go. what steps should perform create wizard? note: use following schema simplified example of database. sample schema (can't upload images work) you can use hidden textfield in parent form contains primary id. every of subforms set in properties subform linked content of textfield. way can subforms synchronized.

c++ - DeferWindowPos weird behaviour -

this happens activex controls. if reposition activex control deferwindowpos hdwp hdwp = begindeferwindowpos(1); deferwindowpos(hdwp, m_pactivex->getsafehwnd(), null, left, top, width, height, swp_nozorder); enddeferwindowpos(hdwp); it goes there but moves/resizes old rectangle once click anywhere inside control . if use movewindow instead m_pactivex->movewindow(left, top, width, height); this doesn't happen. it doesn't happen other type of control, activex controls, happens of them. made test confirm this, creating new activex control project , didn't make changes, , problem still there. you never got appropriate answer. i'll try out bit here. the issue mfc hides lot of trickiness hosting activex control within it's framework. specifically, if step movewindow call, not wrapper around win32 movewindow function. calls ole control container support classes. says, if have control site interface, call colecontrolsite::movewindow, otherwise ...

python - replicating borders in 2d numpy arrays -

i trying replicate border of 2d numpy array: >>> numpy import * >>> test = array(range(9)).reshape(3,3) array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) is there easy way replicate border in direction? for example: >>>> replicate(test, idx=0, axis=0, n=3) array([[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [3, 4, 5], [6, 7, 8]]) edit : the following function did job: def replicate(a, xy, se, n): rptidx = numpy.ones(a.shape[0 if xy == 'x' else 1], dtype=int) rptidx[0 if se == 'start' else -1] = n + 1 return numpy.repeat(a, rptidx, axis=0 if xy == 'x' else 1) with xy in ['x', 'y'] , se in ['start', 'end'] you can use np.repeat : in [5]: np.repeat(test, [4, 1, 1], axis=0) out[5]: array([[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [3, 4, 5], [6, 7, 8]]) but larger/variable arrays more ...

asp.net fileupload control and file name -

i'm using asp.net file upload control. i'd able upload , save on server different name. can or need upload first , figure out how rename once it's on server. wondering options are. thanks fileupload.postedfile.saveas http://msdn.microsoft.com/en-us/library/system.web.httppostedfile.saveas.aspx

java - Reading a text file dynamically on user selection in Android -

i building android application reads text files. now,i have multiple text files in sdcard . location of files /sdcard/textfile/ filenames: abc.txt def.txt ghi.txt i want when users select 1 of file,the selected file should read. know code read single file i.e file sdcard = environment.getexternalstoragedirectory(); file file = new file(sdcard,pathtofile); bufferedreader br = new bufferedreader(new filereader(file)); pathtofile stores path file abc.txt defined . is there way can pass filepath file object file user selected currently,it works abc.txt have defined path in pathtofile you can make list of items in textfile folder , save in list user can choose from. public class directorybrowser extends listactivity { private list<string> items = null; private file currentdirectory; private arrayadapter<string> filelist; @override public void oncreate(bundle icicle) { super.oncreate(icicle); currentdirectory = new file("/sdcard/textfil...

javascript - Get json value from response -

{"id":"2231f87c-a62c-4c2c-8f5d-b76d11942301"} if alert response data see above, how access id value? my controller returns this: return json( new { id = indicationbase.id } ); in ajax success have this: success: function(data) { var id = data.id.tostring(); } it says data.id undefined . if response in json , not string then alert(response.id); or alert(response['id']); otherwise var response = json.parse('{"id":"2231f87c-a62c-4c2c-8f5d-b76d11942301"}'); response.id ; //# => 2231f87c-a62c-4c2c-8f5d-b76d11942301

objective c - updating table view with data in array? -

i creating ipad 2 view controllers. 1 view controller firstviewcontroller , other secondviewcontroller . in firstviewcontroller , fill array numbers. in secondviewcontroller , have table view. want put array created in firstviewcontroller secondviewcontroller table view? how do this? please me! you need reference nsarray object in secondviewcontroller, means of delegate. delegate instance variable contains pointer delegate, in case firstviewcontroller. in firstviewcontroller add property nsarray if instance variable, , call delegate.somearrayname in secondviewcontroller

c# - Loading a Null String and Silverlight 4 -

i maintain silverlight 4 application. while out of office, database structure changed , table dropped , fields combined existing table. now, i’m receiving following error after create new item , proceed "summary" screen: “value cannot null. parameter name: text @ system.windows.controls.textbox.set_text(string value)” this happens newly created entries, not older entries information on next screen complete (data converted excel spreadsheet , loaded database). so, i’ve narrowed down this: child window used create new record doesn’t have fields added table because of information isn’t available when record created. google search turned null strings can’t passed in silverlight. the summary screen loaded via ddssummaryloadeddata domain service. if don’t include “new” fields, values aren’t loaded existing entries, new entries don’t cause error. if include them, older entries load correctly new ones give above error. is there workaround create empty fields until the...

excel - Add random images to labels -

Image
userform 2 = 36 buttons (btn1 thru btn36) each button has image on it. when click "add" button 3 randon images on buttons show in userform 1 3 lables says random image 1. to choose random button image you'll need use collection me.controls on form. example: dim ccont control each ccont in me.controls 'do stuff here next ccont if put watch on variable ccont, can see properties each control has. first, have filter out controls buttons. have @ image property button grab , set on second form. finally, introduce random element, use rand() function. return random number between 0 , 1. if multiply number of controls in me.controls, , round integer, random control. make sure control indexed button, , can use button's image 1 of random images.

javascript - What HTTP headers/responses trigger the "onerror" handler on a script tag? -

i'm inserting script tag dom (think jsonp): var s = document.createelement('script'); s.src = "http://abc.com/js/j.js"; s.onerror = function() { alert("error loading script tag!"); }; document.getelementsbytagname('head')[0].appendchild(s); now, know 404 response abc.com script above trigger event... other headers/responses cause script tag throw error? i'd imagine varies little bit browser, if has sort of list helpful. thanks! 4xx , 5xx should result in error - @ least defined error codes. [edit] tested in fx 3.5 - that's correct statement. here's test code if want test other browsers (quick , dirty...) var codes = [100, 101, 102, 122, 200, 201, 202, 203, 204, 205, 206, 207, 226, 300, 301, 302, 303, 304, 305, 306, 307, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410], 411, 411, 412, 413,414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 444, 449, 450, 499, 500, 501, 502, 503, 504, ...

java - How can I remove just the Maximize button from a JFrame? -

i have jframe , want remove maximize button that. i wrote code below, removed maximize, minimize, , close jframe . jframe frame = new jframe(); frame.add(kart); frame.setundecorated(true); frame.setvisible(true); frame.setsize(400, 400); i want remove maximize button jframe . make not resizable: frame.setresizable(false); you still have minimize , close buttons.

interpreter - Why is java bytecode interpreted? -

as far understand java compiles java bytecode, can interpreted machine running java specific cpu. java uses jit interpret bytecode, , know it's gotten fast @ doing so, why doesn't/didn't language designers statically compile down machine instructions once detects particular machine it's running on? bytecode interpreted every single pass through code? the original design in premise of "compile once run anywhere". every implementer of virtual machine can run bytecodes generated compiler. in book masterminds programming , james gosling explained: james : exactly. these days we’re beating c , c++ compilers pretty always. when go dynamic compiler, 2 advantages when compiler’s running right @ last moment. 1 know chipset you’re running on. many times when people compiling piece of c code, have compile run on kind of generic x86 architecture. none of binaries particularly tuned of them. download latest copy of mozilla,a...

svn - Exclude a particular Revision from Subversion directory -

i have multiple revisions in svn repository. say 5-10. update local directory pointing svn. so, directory updated latest revision. (here 10) now, if want remove revision number 7 local directory, how should proceed. still need 5,6,8,9,10. thanks in advance if understand correctly, need revert changes specific revision. the way depends on svn client. example, in tortoise svn may open log of directory, right click on revision want revert , select "revert changes revision". take account may not succeed if there changes overlapping changes being reverted.

phpunit - PEAR error require_once(Structures/Graph/Node.php): failed to open stream -

i'm trying install phpunit using pear. whatever command run pear install phpunit/phpunit , pear install structures_graph , pear upgrade , pear upgrade --force --alldeps ... ends warning: require_once(structures/graph/node.php): failed open stream: no such file or directory in pear\structures\graph.php on line 37 php warning: require_once(structures/graph/node.php): failed open stream: no such file or directory in c:\wamp\bin\php\php5.3.4\pear\pear\structures\graph.p hp on line 37 warning: require_once(structures/graph/node.php): failed open stream: no such file or directory in c:\wamp\bin\php\php5.3.4\pear\pear\structures\graph.php on line 37 php fatal error: require_once(): failed opening required 'structures/graph/node .php' (include_path='c:\wamp\bin\php\php5.3.4\pear') in c:\wamp\bin\php\php5.3.4 \pear\pear\structures\graph.php on line 37 fatal error: require_once(): failed opening required ...

How do I remove TFS connections from a Visual Studio 2010 C# project/solution? -

i have been given full source code work on locally (c#.net/xaml/visual studio 2010), not have access tfs. every time open solution, asks tfs have cancel every time, code developed locally here on out , not have access. how "disconnect" tfs build? you can either choose work offline, or unbind projects: file->source control->change source control

Best method to build data entry forms in WPF? -

when building wpf forms used data entry (e.g. bunch of labels next bunch of textboxes , comboboxes) i've seen 2 methods: create master grid, divide 2 columns, , add rows height="auto" each field , 2 rows header , footer (and submit button), , each label , text box has own row. the other method create master stackpanel , inside horizontal stackpanel each pair of label-textbox. how design data entry forms? i'm torn between 2 methods, maybe there's alternative i'm unaware of? edit: henk said should define best , think agree, best mean easiest maintain, create, align , add or remove fields demands change. so far criteria grid better ease of alignment. definately first method! it's aligned, use of sharedsizegroup can have same alignment eg in different groupboxes.

c++ - Accessing the intrinsic type hash functions for tr1/unordered_map -

i'm messing around unordered_map class template, , i'd write custom hasher class. documentation mentions default hashing functions provided intrinsic types. so, if declare: std::tr1::unordered_map<std::string, int> foo; you automatically hasher defined you. there's example on here on how provide functor if want custom hash function. however, if have complex class has std::string member use key insertion/deletion unordered_map ? don't want rewrite own hasher. want leverage written std::string type. the default hash functor provided std::hash<t> returns size_t . so can combine hash several members of class e.g. computing (std::hash<t>()(a) + prime * (std::hash<t>()(b) + prime * std::hash<t>()(c))) .

algorithm - fitting n variable height images into 3 (similar length) column layout -

i'm looking make 3-column layout similar of piccsy.com . given number of images of same width varying height, algorithm order them difference in column lengths minimal? ideally in python or javascript... thanks lot in advance! martin how many images? if limit maximum page size, , have value minimum picture height, can calculate maximum number of images per page. need when evaluating solution. i think there 27 pictures on link gave. the following uses first_fit algorithm mentioned robin green earlier improves on greedy swapping. the swapping routine finds column furthest away average column height systematically looks swap between 1 of pictures , first picture in column minimizes maximum deviation average. i used random sample of 30 pictures heights in range 5 50 'units'. convergenge swift in case , improved on first_fit algorithm. the code (python 3.2: def first_fit(items, bincount=3): items = sorted(items, reverse=1) # new - improves firs...

linux - make uses "cc" instead of "arm-none-eabi-as" -

i have problem when building program makefile. there problem when make tries compile assembly file named "startup.s". looks make uses compiler "cc" if specify "arm-none-eabi-as" in makefile (take @ variable as). here makefile: shell := /bin/bash root := $(shell pwd) inc := $(root)/inc src := $(root)/src str := $(root)/str exe := exe := arm-none-eabi-as -mcpu=arm926ej-s -c -wall -i $(inc) -i$(src) -i $(str) gcc := arm-none-eabi-gcc -mcpu=arm926ej-s -c -wall -i $(inc) -i$(src) -i $(str) ldscript := test.ld ld := arm-none-eabi-ld -t $(ldscript) headers := $(notdir $(wildcard $(inc)/*.h)) sources_gcc := $(notdir $(wildcard $(src)/*.c)) sources_as := $(notdir $(wildcard $(str)/*.s)) objects_gcc := $(sources_gcc:.c=.o) objects_as := $(sources_as:.s=.o) vpath := $(str):$(src):$(inc) : $(exe) @echo konec postopka: izvrsljiv program po imenu $(exe) se nahaja v mapi $(root) $(exe) : $(objects_as) $(objects_gcc) @echo objekti so: $(objects_as) $(obje...

jsf 2 - @ManagedProperty annotated type returns null -

i have service bean: @stateless public class bookservice { @persistencecontext(unitname="persistentunit") protected entitymanager entitymanager; public bookmodel find(long id) { return entitymanager.find(bookmodel.class, id); } } and backing bean facelet page is: @managedbean(name = "bookbean") @requestscoped public class bookbean implements serializable { @ejb private bookservice bookservice; @managedproperty(value="#{param.id}") private long id; private datamodel<bookmodel> books; private bookmodel currentbook; @postconstruct public void init() { if (id == null) { // update: retrieve list of books. } else { // update: id shouldn't null here. // detail info book using id currentbook = bookservice.find(id); } } public long getid() { return id; } public void setid(long id) { this...

Calling C++ functions from Java -

i developing java application in need call c++ functions (from google talk library libjingle) . objective run on google app engine (which supports python or java). how can this? you need define native methods in java code whatever want implemented in c++ , directly access native code. run javah on code , generate c header files , you'll need provide c++ implementations. the native methods can call java code other methods , still they'll have implementation written in c++ , talking whatever other native library directly. you need set java.library.path system property include shared c/c++ libraries require: google library , own jni implementation library required in case.

utf 8 - python print statement with utf-8 and nohup -

i have python code prints log messages. when run @ command line, fine utf-8. log messages contain special characters print out fine. however, when run in background under nohup, barfs on utf-8 characters. nohup python2.7 myprogram.py & the error see usual "try encode utf in ascii" error: unicodeencodeerror: 'ascii' codec can't encode character u'\u2013' in position 71: ordinal not in range(128) i assume because nohup signals python doesn't have normal terminal, defaults ascii. there way either tell nohup run utf-8 enabled or set utf-8 characters won't cause crash when running under nohup in background? use pythonioencoding : export pythonioencoding=utf-8 nohup python2.7 myprogram.py & for example, if myprogram.py : unicode_obj=u'\n{infinity}' print(unicode_obj) then running nohup python2.7 myprogram.py > /tmp/test & produces /tmp/test : unicodeencodeerror: 'ascii...

javascript - How to wait for image load from ajax() success data? -

i have jquery ajax() function: $.ajax({ type: "post", url: 'ajax.php', data: 'url='+variable, success: function(data){ $('#mydiv').html(data); } }); my ajax response ( data variable) similar this: <a id="90" href="mylink"><img src="myimagelink90.jpg" /></a> <a id="91" href="mylink"><img src="myimagelink91.jpg" /></a> <a id="92" href="mylink"><img src="myimagelink92.jpg" /></a> <a id="93" href="mylink"><img src="myimagelink93.jpg" /></a> <a id="94" href="mylink"><img src="myimagelink94.jpg" /></a> <a id="97" href="mylink"><img src="myimagelink97.jpg" /></a> <a id="98" href="mylink"><img src="myima...

c++ - How to Make a vector of template structs -

possible duplicate: c++ template problem hi everyone: i'm stuck trying following: template <typename t> struct test { t* value; test(int num_of_elements) { value = new t[num_of_elements] }; } std::vector<test *> fields_; i.e. want make vector of pointers set of test structs different types value? how do this? thanks ross you use boost::any . example documentation illustrates use case (at least, you've described far): struct property { property(); property(const std::string &, const boost::any &); std::string name; boost::any value; }; typedef std::list<property> properties;

sql server - SQL query inner join -

i want modify query in forum code, return 2 fields table tblprofile. table has 2 fields, 'emailaddress' , 'emailverified'. this original query: select * (select top 10 [scirra].[dbo].[tblforumthread].thread_id, [scirra].[dbo].[tblforumthread].message, [scirra].[dbo].[tblforumthread].message_date, [scirra].[dbo].[tblforumthread].show_signature, [scirra].[dbo].[tblforumthread].ip_addr, [scirra].[dbo].[tblforumthread].hide, [scirra].[dbo].[tblforumauthor].author_id, [scirra].[dbo].[tblforumauthor].username, [scirra].[dbo].[tblforumauthor].homepage, [scirra].[dbo].[tblforumauthor].location, [scirra].[dbo].[tblforumauthor].no_of_posts, [scirra].[dbo].[tblforumauthor].join_date, [scirra].[dbo...

union - How to add a row to the result of a SQL query with INNER JOIN? -

in times past, when need add row result of sql statement, write statement this: select cola, colb my_table union select 'foo' cola, 'bar' colb; however, suppose i've written following sql: select t1.cola, t1.colb, t2.colc my_table t1 inner join my_other_table t2 how can add row my_table when inner joined table this? update : wow, goofed. it's going-home time. forgot clause! select t1.cola, t1.colb, t2.colc my_table t1 inner join my_other_table t2 on t1.colb = t2.colc select (t1.cola, t1.colb my_table union select 'foo' cola, 'bar' colb) t1 inner join my_other_table t2 on . . .

c# - Examining all active Sessions and their contents in ASP.NET -

is there utility let me examine contents of session objects website running on iis 7/framework 3.5 on dev box? i've huge code-base stores lots of data in session state (in-proc) , i'm trying find out being stored. of course can find out type of data searching through code wondering if there external utility so. :) i looked @ looping through session.contents gives current session's data while want examine existing sessions. thanks! you can use sql server mode session state , query tables used it. http://msdn.microsoft.com/en-us/library/ms178586.aspx

mysql - WordPress 'Custom Post Type' gets set to wrong Taxonomy Term IDs -

first , foremost , need stress how appreciate takes time respond - in advance, thank you, thank you, thank you! i feel pictures of great service explaining things, start off, here's of illustration of issue: http://i.stack.imgur.com/b9oxr.png preface: my site has 400 posts under "dir_listing" custom post type each "dir_listing" post can associated terms "listing category" custom taxonomy and/or "listing_region" custom taxonomy i have 210 "listing_category" terms, , 155 "listing region" terms the issue in summary: when publishing or updating "dir_listing" post type, term ids recorded 'term_relationships' table without issue, , other times recorded erroneously. even so, when go edit 1 of "dir_listing" post types checkboxes desired parent/child terms correctly marked. actions related? a number of "listing_category" terms have been shuffled around. (e.g. parent t...

c# - How does .NET implement a mutex? -

i understand concept of mutex. explained here . but want know mutex is. guess .net taking primitive system resource (maybe memory address?) , wrapping in object calls mutex. anyone know how mutex achieved in .net? how mutex gets implemented quite hardware-dependent. cpus have sort of atomic compare-and-swap instruction provides guts of thing. but yes, under hood, it's semaphore — thing (word, probably) value indicates whether signaled or not. os provides means thread or process idle wait, waiting semaphore enter desired state. implementation, believe don't guarantee order in thread might gain ownership of mutex — because first in line, doesn't mean you'll first it.

java - Automatically scaling font to fit panel -

i have swing app main panel divided 3x2 grid of charts, , app can resized, charts (jfreechart) auto scaling. 1 of these panels display apdex rating in, text (e.g. '0.89 [0.5]*'). use application display on monitor visible everyone, , scale multiple instances of app monitor different data centers. scaling apdex font size fit available panel space i'm after. any ideas? after re-reading , rethinking question suggest try calculating use of fontmatrics stringwidth string , iteratively increasing font size until can, i.e. size evaluated versus available space. a ready algorithm nice didn't hear of any. good luck, boro.

repository pattern - mvc: same query for different repositories? -

my friends, me in bad situations :) thank you. have 2 or more repositories working in own contexts return data joining same base query: public iqueryable<lq_group> getadminedgroupsq(user user) { try { return (from ap in context.lq_permissions join g in context.lq_groups on new { groupid = ap.objectid, grouptypeid = ap.objecttypeid } equals new { groupid = g.groupid, grouptypeid = dict.objecttype[objecttype.group].id } ((ap.subjectid == user.id) && (ap.subjecttypeid == dict.objecttype[objecttype.user].id)) select g); } catch (exception ex) { throw new unknownrepositoryexception(ex.message); } } result used user, group, groupmember , others reposotories. best way implement that? dont idea h...

python - AJAX in Django with jQuery quite confusing -

i'm jquery noob here, please help! much appreciated! my urls.py: url('^xhr_test/$','posts.views.xhr_test'), my views.py: def xhr_test(request): if request.is_ajax(): message = "hello ajax" else: message = "hello" return httpresponse(message) so, simple. setup works if 1 of 2 versions of html page. html version 1 success: <script type="text/javascript"> $(document).ready(function() { $.get("xhr_test", function(data) { alert(data); }); }); </script> that's that. ajax request made whenever page done loading. works, , nice alert box says "hello ajax" now html version 2 not work: $(document).ready(function() { $("a").click(function() { alert("hi"); $.get("xhr_test", function(data) { alert(data); }); }); }); <a href="">click here</a> so when click "click he...

c# - Edit and Continue broken on converted VS 2008-2010 project -

i've looked through many posts on broken eac can find still can't find solution. i'm running vs2010 express on win7 64bit xna4.0 framework, running vs2008 express before on 32bit xp xna3.1 installed. did conversion of project, , eac doesn't work. gives me error: http://smars.se/misc/eac.jpg it's debug build, code not optimized, x86 build, i've tried clearing .user/.chachefile/.suo/bin/obj folders. when create new projects eac works. still can't working in project. any ideas? rather trying fix this, might suggest quicker , easier recreate project file(s)? if open them in text editor, can copy out <itemgroup> has source files. create fresh project xna 4.0 template. edit new project file , paste on <itemgroup> source files. obviously need go through , reset things default namespace, output assembly name, , on. if wanted cleverer copy more sections of project file over. or diff the broken project file fresh 1 figure out m...

ActionScript - Trace Update Value from Tweener -

tweener doesn't update myvalue while passing param while tweening. why? public var myvalue:number = 0.0; tweener.addtween(this, {myvalue: 1.0, time: 2.0, onupdate: tracevalue, onupdateparams: [myvalue]}); private function tracevalue(value:number):void { trace(value); } primitive values passed value in actionscript, never reference. tweener updating value, gets passed tracevalue original value. in code above it'll trace out 0. solution pass in reference target object instead, , read value each time. if pass in field name can done dynamically flexibility. eg: public var myvalue:number = 0.0; tweener.addtween(this, {myvalue: 1.0, time: 2.0, onupdate: tracevalue, onupdateparams: [this, 'myvalue']}); private function tracevalue(target:object, field:string):void { trace(target[field]); }

javascript - dojo wrapper or adapter classes -

i have started using dojo, wondering if there anyway implement wrapper/adapter class. in pure javascript following function person(name){ this.name=name; } function employee(name,id){ this.person=person; this.person(name); this.id=id; this.promotedemployee=promotedemployee; } function promotedemployee(employees){ this.employees=employees; //number of people working him/her } var employee=new employee("john stamos",123); employee.promotedemployee(10); //promote manage 10 people how do dojo. such not work dojo.declare("person",null,{ constructor: function(name){ this.name=name; } }); dojo.declare("promotedemployee",null,{ constructor: function(employees){ this.employees=employees; } }); dojo.declare("employee",[person],{ constructor: function(name,id){ this.id=id; }, promotedemployee=promotedemployee; }); var employee=new employee("john stamos"...

iphone - Xcode consistency error: Setting the No Action Delete Rule... is an advanced setting -

after creating data model in xcode, it's throwing following error each of object relationships: consistency error: setting no action delete rule on [object relationship] advanced setting what xcode trying tell me, , how should respond? core data uses inverse relationships , delete rules keep object graph consistent let's have a.foo <1—1> b.bar , a.foo = b . automatically (effectively) performs b.bar = a . now let's [b delete] . "nullify" rule, b.bar.foo = nil . "cascade", [b.bar delete] . "no action", nothing; a.foo "dangling core data object reference". it's not dangling pointer; standard memory management rules mean b still exist in memory while a points (until a turns fault), a.foo forever refer deleted object, raises exception when try access properties. i'm not sure happens when save , re-fetch a either. with many-to-many relationship, gets more complicated. implementation details: re...

c - how does scanf() check if the input is an integer or character? -

i wondering how standard c library function scanf() check if input integer or character when call scanf("%d",&var) when character number? know when encounters non-integer puts input buffer , returns -1 how know input not integer? you're correct in each character represented 8-bit integer. solution simple: @ number, , see if in range 48-57, range of scii codes characters '0' - '9'. starting on line 1315 of scanf() source code can see in action. scanf() more complicated, though - looks @ multi-byte characters determine numeric value. line 1740 magic happens , character converted number. finally, , possibly useful, strtol() function looping perform conversion.

visual studio - in VS, how do I navigate backwards in code by file? -

in vs, i'm using control+minus , control+plus go forwards , backwards in code. however, many times want spot is not in same file. for instance, write code in file @ position a1 , jump down position a2 , write more code. navigate file b (usually control-click on identifier), , write code @ positions b1 , b2. --> i'd modified control-minus knows i'm not interested in jumping previous points in same file, , jumps me a2. aside pressing ctrl - - several times, maybe option use bookmarks: ctrl-k ctr-k create/delete bookmark ctrl-b ctrl-n cycle next bookmark in list of course don't want leaving bookmarks everywhere otherwise becomes tedious use...

java - How to use a value outside for loop -

in following code need value of vararray[i] executing if-else statements if-else statements executed once. if place if-else statements outside loop if-else statements execute correctly. when place if-else statement inside loop if-else statements executed multiple times. for (int i=0;i<vararray.length;i++) { vararray[i]= rand.nextint(1999)-1000; system.out.println(vararray[i]); if(d==vararray[i]) { system.out.println(d); system.out.println(i+1); } else if(d!=vararray[i]) { system.out.println(d); system.out.println(0); } } need on this. have been searching hours you can use break; exit loop when if statement true. for (int = 0; < vararray.length; i++) { vararray[i] = rand.nextint(1999) - 1000; system.out.println(vararray[i]); if (d == vararray[i]) { system.out.println(d); system.out.println(i + 1); break; } else if(d != vararray[i]) ...

visual studio 2010 - Cannot compile code using Intel Cilk -

i use intel parallel studio xe 2011 .it says supports cilk.when include cilk_for statement in code not compile.it says symbol undefined.i have included cilk.h @ beginning of code , under include directories put location of cilk.h (c:\program files (x86)\intel\composerxe-2011\compiler\include\cilk).can tell me missing? how can compile code. my guess not picking cilk header correctly. try using cilk keywords (_cilk_spawn, _cilk_sync, , _cilk_for) instead , see if works without header. if does, @ least know cilk stuff in compiler working , header. try using "#include <cilk/cilk.h >" , using cilk_for see if picks header correctly. shouldn't have specifying location of cilk.h file if set correctly. doing on command line or using microsoft's visual studio? if using ms vs sure specifying use intel compiler?

android - How to program RS232 over Ethernet? -

an existng system, server , terminals communicating on rs232. now terminals replaced android slate pcs , minimal changes should made server. i presume use rs232 ethernet convertors @ server, how traffic android? protocol? how read , write ascii string? this depends entirely on hardware buy, done on telnet or similar. while telnet have basic protocol gets followed terminals, connect on specific port (such 23) , send , receive data. data relayed rs232.

Printing Arrays in separate Function in C -

i'm trying print of values in 4 arrays sending them separate function. problem can't function print of integers in array because i'm not sure set true false statement in 'for' loop to, universal array of size. right function prints first 11 numbers assume that's because first number in array 11. #include <stdio.h> void print_array(int a[]); void find_max(int b[]); void find_min(int c[]); void search(int d[]); void sort(int e[]); int main(void) { int first[11] = {7,7,7,7,7,7,7,7,7,7,7}; int second[14] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2}; int third[16] = {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; int fourth[23] = {-3, 4, 33, 22, 9, -100, 2, 56, 57, 55, 2, 90, 2234, 32, 8, 123, 2, 33, 22, 22, 33, -1, -3}; print_array(&second[0]); return(0); } void print_array(int a[]) { int i; for(i=0;i<*a;i++) ...

php - Updating indexed documents of Zend Search Lucene indexes -

i have read question creating , updating zend_search_lucene indexes . but has failed answer problem. this article zend, tells updating document not possible. update effectively, every document have deleted , re indexed. $removepath = ...; $hits = $index->find('path:' . $removepath); foreach ($hits $hit) { $index->delete($hit->id); } now, not work me. gave index path in $removepath , tried code. didn't work. if use relative particular index such $index->find("title:test"); throws fatal error: exception thrown without stack frame in unknown on line 0 i tried using $query = new zend_search_lucene_search_query_term(new zend_search_lucene_index_term('test', 'title')); $hits = $this -> index->find($query); but gave same result. i not know how debug type of error. , gets debugged, searched items rather documents. so, documents not deleted. can anyone, tell me doing wrong. how update search indexes? ...

c++ - Merge-sorting a linked list -

i'm required sort linked list using merge sort. i've put code, i'm running weird error. my linked list populated random numbers. however, after sorting, displays numbers larger first element of linked list, in sorted order. here of code: node* mergesort(node *my_node) { node *secondnode; if (my_node == null) return null; else if (my_node->next == null) return my_node; else { secondnode = split(my_node); return merge(mergesort(my_node),mergesort(secondnode)); } } node* merge(node* firstnode, node* secondnode) { if (firstnode == null) return secondnode; else if (secondnode == null) return firstnode; else if (firstnode->number <= secondnode->number) //if reverse sign >=, behavior reverses { firstnode->next = merge(firstnode->next, secondnode); return firstnode; } else { secondnode->next = merge(firstnode, secondnode->next); ...

json - Set a variable to what json_encode() outputs in PHP -

json_encode() returns string... so shouldn't following code work? class testclass { private $test = json_encode("test"); } php outputs parse error: syntax error, unexpected '(', expecting ',' or ';' in /home/testuser/public_html/test.php on line 10 you can not assign expression or variable while declaring class property. literal constants such __file__ allowed here. they have literal value, such string, or constant. there work. private $test= 98; private $test= "test value"; private $test= constant; private $test= __file__; but these not private $test= 98*2; private $test= "test value"."some other value"; you can use constructor function __construct() { $this->test = json_encode("test"); }