Posts

Showing posts from August, 2015

wpf - Does StringFormat work with this.DataContext -

i binding textblock collection in code-behind via this.datacontext = sellerlist; output correct when apply stringformat, see no result. following code textblock on xaml page <textblock name="datedtkey" grid.row="1" grid.column="2" horizontalalignment="right" verticalalignment="bottom" text="{binding path=date, stringformat={}{0:dd-mm-yyyy}}" style="{staticresource textstyletextblock}"/> the source binding string, if detailssellerlistingtemplate resource should use {staticresource detailssellerlistingtemplate} . also, textblock doesn't need datacontext binding work since it's using source. <window.resources> <local:detailsseller x:key="detailssellerlistingtemplate"/> </window.resources> <textblock name="datedtkey" horizontalalignment="right" verticalalignment="bottom" text=...

iis 7 - application pool memory usage monitor -

i have website in iis 7 , need monitor memory usage of website when there concurrent requests it. can please let me know how can this? there tool available or possible use feature of iis? windows performance monitor should able pretty close want. there literally hundreds of metrics in there use. to access it, start -> run -> perfmon there, select 'performance monitor' in left pane, , click '+' button begin adding in counters. if asp.net based web site, can select 1 of 'asp.net apps' counter categories (may have more 1 if have more 1 version of asp.net installed) , click on 'managed memory used' counter. in list below that, actibe websites displayed , can add counter that. can watch counter in realtime or elect save data disk or db later analysis. there w3svc_w3wp counter category allows examine metrics specific app pools nothing (that can see) offer memory used per app pool. depending on trying determine though, may able find ...

xml - Precious Metals API/Webservice wanted -

is there free webservice/api (on yahoo or other platforms) can return live stock prices precious metals rates (gold, silver, platinium, palladium)? here paid service : http://www.kitco.com/market/ (it great if comes yahoo query language) if need free , hourly updated 1 - precious metals xml feed perfect you.

My .net windows application uses an access database...is access runtime required? -

will .net application function if user doesnt have access on machines? if not components need? you don't need access installed on machines. if using jet driver, can needs without access being physically installed. can't stop myself recommending @ sql ce 4 (free) or sql express (free) rather using access though. if having trouble install, ping error message.

objective c - Disable (grey out) main menu when displaying modal window? -

i load custom file import window in cocoa app using: [nsapp runmodalforwindow:window]; the window displays fine, , modal. however, application main menu still active (e.g. file menu , items), making modal display redundant. i've googled this, searched stackoverflow , cocoa-dev, , searched apple docs, can't find way turn menu off, or @ least selected menu items. someone suggested using this: nsmodalsession session = [nsapp beginmodalsessionforwindow:window]; [nsapp runmodalsession]; but doesn't seem work either. again, window displays modally main menu still active. can suggest how turn main menu off (grey out menu items) when displaying modal window please? is there way in 1 go @ menu-level, or need turn off each individual menu item? i must missing point somewhere, sort of menu behaviour common in cocoa apps. thanks darren. i needed implement (in appdelegate) following method: - (bool)validateuserinterfaceitem:(id <nsvalidateduser...

c# - Building a progress bar for Silverlight MediaElement -

i want simple progress bar , time label shows current position of movie. google gave me few examples using javascript: don't want that. key thing keep progress bar , time updated througout movie. can find event? there no event hook into. instead user timer periodically check mediaelement.position mediaelement's current position , update progress bar. something like: private void timer_tick(object sender, eventargs e) { timespan currentposition = media1.position; this.slider1.value == currentposition.totalseconds }

flash - How to get node value from this xml? -

use actionscript 2.0. need time string simple xml: <?xml version="1.0" encoding="utf-8"?> <root> <time> 2011,01,25,10,58,02 </time> </root> i used trace(_myxml.firstchild.firstchild.nodevalue); trace(_myxml.firstchild.firstchild[0].nodevalue); trace(_myxml.firstchild.nodevalue); but returns ever undefined ... what's wrong? is there way access xml like: _ myxml.root.time.value ? thanks. try this var xmldata:xml = new xml(); xmldata.ignorewhite = true; xmldata.load("nomeofyourxml.xml"); xmldata.onload = function():void { qtd = this.childnodes[0].childnodes.length; trace(qtd) (i=0; i<qtd; i++) { _xml = this.childnodes[0].childnodes[0].childnodes; trace(_xml); } } my trace result is: (2011,01,25,10,58,02)

Watir Radio Button not found -

i want set radio button in watir not finding it: html: <input type="radio" style="-moz-user-focus: normal;" tabindex="2421" handlenativeevents="false" value="3g" $9a="$9b" $89="isc_radioitem_3" id="isc_1hv" name="network"> ruby: if browser.radio(:value => '3g').exists? browser.radio(:value => '3g').set end could because our code contains uppercase radio? (generated smartgwt) any workarounds this? another alternative. if it's not responding radio because it's not radio button (as watir understand it) need find way click object. can try clicking container see if works, if not you'll need use hardware click. can find hardware click solution duck punch (it's under 1 of answers: here ). can customise code accept x , y modifiers, if like, can use .left_click hardware click element, including containers. left_click radio container x ,...

asp.net - Checkbox Custom Validator with ValidationSummary not working -

i have following validation working fine rest of fields, trying custom validator work part of validation summary checkbox no joy. this have @ moment <script language="javascript" type="text/javascript"> function validatetandcs(source, args) { args.isvalid = document.getelementbyid('<%= optin.clientid %>').checked; } </script> <asp:validationsummary cssclass="highlight" id="validationsummary1" headertext="<p>please amend these errors below continue application.</p>" runat="server" /> <asp:checkbox id="optin" runat="server"></asp:checkbox> agree terms , conditions of site , wish opt in registration. <asp:customvalidator id="valtandcs" clientvalidationfunction="validatetandcs" validationgroup="validationsummary1" runat="server" errormessage="pleas...

javascript - Error in UpdateProgress -

i using updateprogress show progress during postback , getting run time error "microsoft jscript runtime error: 'this.get_element().style' null or not object" this script: var prm = sys.webforms.pagerequestmanager.getinstance(); prm.add_beginrequest(beginrequesthandler); prm.add_endrequest(endrequesthandler); function beginrequesthandler(sender, args) { //shows modal popup - update progress var popup = $find('<%= mdlprogress.clientid %>'); if (popup != null) { popup.show(); } } function endrequesthandler(sender, args) { //hide modal popup - update progress var popup = $find('<%= mdlprogress.clientid %>'); if (popup != null) { popup.hide(); } } design code: <table> <tr> <td> <ajaxtoolkit:modalpopupextender id="mdlprogress" runat="server" targetcontrolid="updateprogress" popupcontrolid=...

java - Zoomable panel in netbeans -

i have create application in java, allow user display url in small panel, , should allow user zoom panel covers other components in frame. i suggest using layeredpane , putting component on top of other components. here tutortial on how use them: http://download.oracle.com/javase/tutorial/uiswing/components/layeredpane.html

ios - Deleting all the files in the iPhone sandbox (documents folder)? -

is there easy way delete files(images) saved in documents folder of app? nsfilemanager *filemgr = [[[nsfilemanager alloc] init] autorelease]; nserror *error = nil; nsarray *directorycontents = [filemgr contentsofdirectoryatpath:documentsdirectory error:&error]; if (error == nil) { (nsstring *path in directorycontents) { nsstring *fullpath = [documentsdirectory stringbyappendingpathcomponent:path]; bool removesuccess = [filemgr removeitematpath:fullpath error:&error]; if (!removesuccess) { // error handling ... } } } else { // error handling ... }

How easily we can create rounded corner crossbrowser DIV using css -

please me how create rounded corner crossbrowser div using css. thanks css 3 supports rounded corner. check out link: http://www.css3.info/preview/rounded-border/

How to restrict an element to be non-empty through xsd -

i need restrict elements in xml file non empty using xsd files. can force elements contain cdata sections? the tool have xs:string pattern restriction in below. cdata alternative escaping entity references. should use entity references in pattern. <simpletype name="newtype2"> <restriction base="string"> <minlength value="5"></minlength> <maxlength value="30"></maxlength> <pattern value="(&lt;html&gt;).*(&lt;/html&gt;)"></pattern> </restriction> </simpletype>

java - Catching the IllegalArgumentException thrown by PropertyEditors in Spring -

i have propertyeditor in order translate ids persons , it's setastext (string text) follows: public void setastext(string text) throws illegalargumentexception { try { int id = integer.parseint(text); person person = peopleservice.get(id); this.setvalue(person); } catch (numberformatexception ex) { // ... throw new illegalargumentexception("not number!: " + text); } catch (personnotfoundexcetion ex) { // ... throw new illegalargumentexception("impossible person: " + text); } } and peoplecontroller has method follows: @requestmapping("/getperson") public void ver (@requestparam person person, model model) { model.addattribute (person); // ... } i want catch illegalargumentexception in order show friendly message user, such "sorry, person looking isn't here", don't know that... thanks! general exception handling can done in wa...

jquery - Json returned my HTML <br /> in unicode form \u003cbr /\u003e . Causing the <br /> printed as a text rather than making a new line -

i'm using asp.net mvc3 , returned model in json format using jquery.ajax , pass jquery template printed out. for example json server returned {"key":2,"content":"i'm jason\u003cbr /\u003ehow you"} instead of {"key":2,"content":"i'm jason <br /> how you"} when append div using jquery template printed out this: i'm jason <br /> how you while intended result should be i'm jason how am suppose prevent server encoding string in server side? think may cause security issue. therefore think have decode json string in client side no luck far. can show me appropriate way deal kind of problem? thanks *updated tested jquery('#somediv').append(data.content); , print out intended. problem related jquery template i'm using code pass data jquery template jquery('#sometemplate').tmpl(data).appendto('#somediv'); jquery template <script id="som...

windows - Using Subversion via IntelliJ IDEA With NTLM -

does know how can automatically use current ntlm credentials in idea when working subversion? i have idea 9.0.4 , "not logged in subversion '[ad realm]' (http://[branch])". (replace [information] actual technical details) when try update/commit/etc. try setting following system property -dsvnkit.http.ntlm=jna - make svnkit use native windows api through jna support jna. native implementation may work better you. both pure java , jna-based implementations of ntlm support in svnkit unfortunately not work in environments.

multipart - I need Multi-Part DOWNLOADS from Amazon S3 for huge files -

i know amazon s3 added multi-part upload huge files. that's great. need similar functionality on client side customers part way through downloading gigabyte plus file , have errors. i realize browsers have level of retry , resume built in, when you're talking huge files i'd able pick left off regardless of type of error out. any ideas? thanks, brian s3 supports standard http "range" header if want build own solution. s3 getting objects

html - Getting "prefix 'soap' is not defined" in xslt file -

i trying transform string xml data (response web service). tried start simple getting name: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <table> <tr> <th>name</th> </tr> <xsl:for-each select="soap:envelope/soap:body/abrsearchbyabnresponse/abrpayloadsearchresults/response/legalname/"> <tr> <td> <xsl:value-of select="givenname"/> </td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> however, ...

javascript - Trouble with XPCOM XPathEvaluator -

i'm having trouble evaluating xpaths using nsidomxpathevaluator mozillas xpcom. i'm running following javascript code through xpcshell: [...] var mypaths = new array(); mypaths[0] = "/"; mypaths[1] = "/node()"; mypaths[2] = "/html"; for(i in mypaths) { mypath = mypaths[i]; var document = doms[0]; var xpeval = components.classes["@mozilla.org/dom/xpath-evaluator;1"].createinstance(components.interfaces.nsidomxpathevaluator); var ns = xpeval.creatensresolver(document.documentelement); var type = components.interfaces.nsidomxpathresult.unordered_node_snapshot_type; var res = xpeval.evaluate(mypath, document.documentelement, ns, type, null); dump("\npath: "+mypath+"\n"); dump("result length: "+res.snapshotlength+"\n"); ( var i=0 ; < res.snapshotlength; i++ ) dump("... node: "+res.snapshotitem(i)+"\n"...

c++ - failed to link example program using id3 library -

i trying use lib id3 access mp3 tags ultimate aim of accessing album art mp3 music files. the problem have failed compile example programs come id3 library. problem 1. trying compile example program in project first generates error 1>*** notice *** (not real error) 1>* should include define in project reflect how link library 1>* if use id3lib.lib or libprj/id3lib.dsp (you link static) should add 1>* id3lib_linkoption=1 preprocessor definitions of project. 1>* if use id3lib.dll (you link dynamic) should add id3lib_linkoption=3 1>* preprocessor definitions of project. when try add #define id3lib_linkoption 1 to source file , many more errors. 1>linking... 1>msvcprtd.lib(msvcp90d.dll) : error lnk2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@du?$char_traits@d@std@@@std@@qaexh_n@z) defined in id3lib.lib(tag_parse.obj) 1>msvcprtd.lib(msvcp90d.dl...

c# - Is there a way to watch LINQ queries as they happen? -

i have been looking linq , wanted know more , searching simple method of visualizing queries bit more detail on going on during query. does know of tools openly available accomplish this? thanks, josh you might want take @ article on visual linq @ jon skeet's blog. visual linq tool allow visually watch linq query in action. you can directly download files here . hope helps. edit: scott gu's blog has article on linq sql debug visualizer , might out.

c++ - figuring out how many blocks and threads for a cuda kernel, and how to use them -

i have been trying figure out how make thought simple kernel take average of values in 2d matrix, having issues getting thought process straight on it. according devicequery output, gpu has 16mp, 32cores/mp, blocks max 1024x1024x64 , have max threads/block=1024. so, working on processings large images. maybe 5000px x 3500px or that. 1 of kernels taking average of values across pixels in image. the existing code has images stored 2d array [rows][cols]. kernel, in c, looks you'd expect, wtih loop on rows, , loop on cols, calculation in middle. so how set dimension calculation portion of code in cuda? have looked @ reduction code int sdk, single dimension array. doesnt have mention of how set number of blocks , threads when have soemthing 2d. i thinking i'd need set so, , i'd chime in , help: num_threads=1024; blocksx = num_cols/sqrt(num_threads); blocksy = num_rows/sqrt(num_threads); num_blocks = (num_rows*num_cols)/(blocksx*blocksy); dim3 dimblock(blocksx, ...

objective c - How to convert a number range from 0-200 into 1-5 range -

i have value 0 200 0 better quality , 200 worst quality. how convert (in obj-c/cocoa framework) integer 0-5 being 5 best?. for example 200 0 , 0 5. hopefully rounding works here: int input; int output = 5 - (int)floorf( ((float)input)/40.0f); you may same results doing int output = 5 - (input/40); but depends on compiler's math settings.

objective c - Bind custom control to NSArrayController -

i've subclassed nstextfield create custom control, , want bind property (which nsarray ) of custom control nsarraycontroller . don't know how propagate array control nsarraycontroller . key-path i'm using on nsarraycontroller arrangedobjects.name . example, if i'm trying propagate array (@"one", @"two", @"three") , use: [boundobject setvalue:myarray forkeypath:@"arrangedobjects.name"] it set value of each element of arrangedobjects.name array (@"one", @"two", @"three") . want happen have first element in arrangedobjects.name set @"one" , second value set @"two" , etc. nstablecolumn this, know it's possible, can't figure out how implemented. what's best way achieve this? ok, think may have answered own question. won't mark correct answer right away in case can tell me better way this. way pretty hack. anyway, reading nsarraycontroller here...

c# - User Control obstructing underlying User Control from recieving drag and drop content -

i have wpf application there toolbox on left objects can drag , drop in large area right. large area treated time line. there slider @ top used scrub through time line , there ruler across bottom displaying time increments. in middle, there area receives drag , drop content. slider (top) , ruler (bottom) contained in scroll viewer, in own separate user control, sits "on top" of drag , drop area. problem user control obstructing drag , drop area receiving content. tried experimenting "ishittestvisible" property on various elements , did not help. when disabled ishittestvisible property on proper elements, allowed drag , drop ability looking for, in turn disabled slider , scroll viewer. ideas on how bypass problem? in advance! -matt a bypass... create drag , drop event on "blocking" controls , route event function.

html - Why doesn't the textbox resize to the entire div in IE? Chrome is fine -

a ie resizing problem!? code pretty simple: i've got div , want text-box that's 100% of div. must show red line of div (if use height:100%, width:100% eats away border :-( ). html: <div> <textarea></textarea> </div> css: div{ width:500px; height:500px; border:solid 1px red; padding:1px; position:absolute; top:100px; } textarea{ position:absolute; top:0px; bottom:0px; right:0px; left:0px; } i hope guys have clue. dtd in example html strict. code example: http://jsfiddle.net/qjyuz/ i'm trying find reason why well. please specify links blogs / specifications why problem occurs. ie doesn't support setting both left , right (nor top , bottom ) @ same time. instead try setting width , height 100% (but you'll need remove padding , border in case): textarea{ position:absolute; top:0px; left:0px; width: 100%; height: 100%; border: none; pad...

Visual Studio 2010 Find in Files - not finding files! -

please save me going totally mad here. project, keep finding "find in files" works fine when search on views directory in asp.net mvc project, not when go 1 level project directory: ---- find "<relatedsections", subfolders, keep modified files open, find results 2, "c:\users\james\documents\visual studio projects\developerfusion\developerfusion.web.ui", "*.spark" no files found in. ---- and yet when doing: ---- find "<relatedsections", subfolders, keep modified files open, find results 2, "c:\users\james\documents\visual studio projects\developerfusion\developerfusion.web.ui\views", "*.spark" c:\users\james\documents\visual studio projects\developerfusion\developerfusion.web.ui\views\community\index.spark(108): <relatedsections /> c:\users\james\documents\visual studio projects\developerfusion\developerfusion.web.ui\views\content\article\index.spark(13): <relatedsections /> c:\us...

Jquery binding woes -

i've read number of explanations seems can't grasp concept of binding. in following code how make 'this' refer object rather element called 'search' function? <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <meta charset=utf-8 > <title></title> </head> <body> <input id="inpt"> <script> obj = { theelement: null, func1: function(inpt) { this.theelement = $(inpt); this.theelement.keyup(this.search); }, search: function(e) { alert(this); //'this' refers input element (#inpt) want refer 'obj' } }; obj.func1('#inpt'); </script> </body> </html> hope makes sense... two ways: 1. use own closure: obj = { theelement: null, func1: function(inpt) { var self = this; this.theelement = $(inpt); this.theelement.keyup(functi...

c# - Alphabetically Ordering a SelectList in MVC -

similar example problem selectlist might have data(plus it's format [ford iv 200 xyx]) in want retire(by displaying records has bit value of true in it's 3rd column need figure out how do), big problem if user adds in ford display way @ bottom of drop down messy , overlooked ideas? p.s. added jquery tags in case possible solution since able use in project. edit - 3rd column bit value filter here's solution you use orderby extension method: <%: html.dropdownlistfor( x => x.modelid, new selectlist(model.vehiclemodels.orderby(x => x.name), "id", "name"), "-- select model --" ) %>

asp.net - Add a handler to allow dowloading script or a MIME map -

i created script internet explorer can installed using gm4ie (greasemonkey internet explorer) , has extension .gm4ie. when try give download link file on server, gives error: http://i.stack.imgur.com/k7rs4.jpg page requesting cannot served because of extension configuration. if page script, add handler. if file should downloaded, add mime map. how add this hanlder or mime map , add this? try adding mime type iis. for iis7: http://technet.microsoft.com/en-us/library/cc725608(ws.10).aspx you can of course zip if don't wish add mime type.

.htaccess - Subdomain and Zend Framework -

i have zend framework application subdomain works in local development environment. i'm trying put on live location, in shared hosting environment. have made subdomain in directadmin. this default content of .htaccess in public_html rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] i have removed folder public_html/subdomain because want goes through index.php. problem if go subdomain.example.com 500 internal server error. how can solve this? this sounds host-specific issue. typically, if running own apache server, create virtualhost directive point subdomain application's public folder. i know hosts treat each domain / subdomain it's separate folder. if host expecting have public_html/subdomain folder, why not try making subdomain folder symbolic link application's public folder? ln -s /path/to/zf/public/f...

file - Log monitor problem with Java and org.apache.commons.io.input.Tailer -

i trying use monitor log file , put log lines in database come in. problem having seems while thread containing tailerlistener running, cannot delete or rename log file. being case, not sure how react when log file rolls over, happens nightly. glanced @ code tailer , appears handle log rollover, can't see how when file being monitored locked. there should no reason file cannot deleted reading it. think once file deleted/renamed throw type of exception. since tailer seems written aiming @ functionality of "tail -f". the exact error getting when trying delete file: "this action can't completed because file open in java(tm) platform se binary" here sample code project: public static void main(string[] args) { // todo code application logic here file pcounter_log = new file("c:\development\temp\test.log"); try { tailerlistener listener = new pctaillistener(); tailer tailer = new tailer(pcounter_log, li...

Have a repeating alarm start thirty seconds once started then once a day afterward in Android -

i have set alarm run service grab events internet. following how implemented seems run , not delay alarm @ all. alarmmanager = (alarmmanager)getsystemservice(alarm_service); am.setrepeating(alarmmanager.elapsed_realtime_wakeup, systemclock.currentthreadtimemillis()+30000, alarmmanager.interval_day, newsalarm); check alarmmanager documentation , think might want use: am.setrepeating(alarmmanager.rtc_wakeup, system.currenttimemillis()+30000, alarmmanager.interval_day, newsalarm);

c# - Best way to save/load large amout of data in a .Net application? -

what best way save large amount of data .net 4.0 application? right using lists , serializing file in "user data" folder, , working ok, want know if there better/faster way of saving/loading large amount of data. the data saving contains lots of words, documents. the size of data 1 mb. that depends on type of application. wouldn't use sql database of sort load , save operation of data not need query or transform. time take map object graph relational model not worth it. don't believe ever faster simple serialization due overhead associated databases (connection management , mapping) my recent experience binnaryformatter had excellent results (files ~ 15mb). worse come worse can write own formatter.

javascript - Why can't I call this object's function from an in-line anchor? -

html: <a href="javascript:alert('hey.')">alert</a><br/> <a href="javascript:alert('in anchor:\n' + objection.sustained());">alert</a> javascript: var objection = { sustained : (function() {return ("accroches-toi ton reve")}) }; alert("in script: \n" + objection.sustained()); $("outdat").text( +"<br/>\n"); working sample just curious here, why can't call objection.sustained() anchor tag, it's ok script region? it seems not know object exists when using anchor. happens in several major browsers believe design? variable scope. fiddle placing variable in document load scope you're anchor code can not see it. @kjy112 mentioned, remove code blocks , should work fine.

How do I use error_messages on models in Django -

i understand form documentation http://docs.djangoproject.com/en/dev/ref/models/fields/ can add error_messages model field , supply own dict of error messages. however, keys of dict supposed pass? class mymodel(models.model): some_field = models.charfield(max_length=55, error_messages={'required': "my custom error"}) if easier on modelform used work, however. rather not have create explicitly creating each field , type again. trying avoid: class mymodelform(forms.modelform): some_field = forms.charfield(error_messages={'required' : 'required error'}) update 2: test code used in project my model: class mytestmodel(models.model): name = models.charfield(max_length=127,error_messages={'blank' : 'blank','required' : 'required'}) my form: class edittestmodel(modelform): class meta: model = mytestmodel my view: tf = edittestmodel({'name' : ''}) print tf.is_valid...

SAP BW - BOBJ Webi question -

i have created bw bex report , used source webi report. when execute webi report not seeing data see data when run bex. ideas ? thanks help. probably need more details on trying do. have installed sap integration kit? http://www.sdn.sap.com/irj/boc/index?rid=/webcontent/uuid/806c9894-42a5-2b10-648a-d900489b76da maybe there wrong universe? you can dump mdx statement using sofa log. can use transaction mdx_test , insert mdx statement. there can confirm if mdx statement returning results.

client server - Silverlight analog in Java environment -

is there analog microsoft silverlight in java world? requirement use native language , share written libraries while hosting in web browser on client side. silverlight great technology, doesn't work on linux. please don't remind me of moonlight. please don't suggest actionscript it's not java. thanks. javafx springs mind, sort of hangs around in flash/silverlight space. it's pretty immature, though, , not heavily used. for more general rcp platform, try eclipse rcp .

asp.net - Consolidate/Merge data from TWO IEnumerable Lists into ONE -

i have following domain objects in application: [serializable] public class supplier { public virtual string suppliertype { get; set; } public virtual string suppliercode { get; set; } public virtual string name { get; set; } public virtual string description { get; set; } public virtual string rating { get; set; } public virtual string websiteurl { get; set; } public virtual ilist<address> address { get; set; } } [serializable] public class cargosupplier : supplier { public virtual ilist<image> images { get; set; } public virtual string openingtime { get; set; } public virtual string closingtime { get; set; } public virtual ilist<product> products { get; set; } } i have goto 2 seperate repositories getting descriptive content (from database) , pricing (from external webservice) , have 2 seperate enumerations populated data (descriptive con...

php - Convenient way to populate fields in codeigniter -

codeigniter has convenient way repopulate field on validation failure set_value() in app want allow user edit entity using same form use create it. cannot use set_value() populate fields while form in editing mode. i there convenient way it. thanks. you give set_value() second parameter initial value on loading. i using @ supress errors if piece of data not exist set_value('input_name',@$input_value); for this, form element prefilled $input_value if exists

May have a memory leak in Java webapp - have question about garbage collection and session attributes -

i've been profiling webapp locally on pc visualvm. i'm pretty have small memory leak. after taking snapshot of application, chose object had instantiated objects , looked through allocation call tree see if find class (of mine) contributing 'potential leak'. i found 3 of classes in tree, , took @ method's pinpointed. here snippet of code (a method) 1 of servlets - method gets names of session attributes want keep in session , removes rest. public void dopost(httpservletrequest req, httpservletresponse res) throws servletexception, ioexception { connection conn = null; statement stmt = null; resultset rs = null; try { conn = ds.getconnection(); stmt = conn.createstatement(); httpsession session = req.getsession(); getexemptsessionattributes(customer_number,rs,stmt,session); }//try catch (exception e) { } { ...

.net - Are nested Try/Catch blocks a bad idea? -

let's have structure so: try ' outer try code, can fail more generic conditions, ' know less , might not able handle try ' inner try code, can fail more specific conditions, ' know more about, , handle appropriately catch innerex exception ' handle inner exception end try catch outerex exception ' handle outer exception end try i have seen opinions nesting try blocks discouraged, not find specific reasons. is bad code? if so, why? there circumstances they're idea, e.g. 1 try/catch whole method , inside loop want handle exception , continue processing rest of collection. really reason if want skip bit errored , carry on, instead of unwinding stack , losing context. opening multiple files in editor example. that said, exceptions should - exceptional. program should handle them try avoid them part of normal execution flow. they're computationally expensive in most languages (python being notable except...

jquery - Iterate Through Nested JavaScript Objects - Dirty? -

i have javascript wrote in pinch, think optimized smarter me. code runs on relatively small objects, runs fair amount of times, worth getting right: /** * determine maximum quantity can show (ever) these size/color combos * * @return int=settings.limitedstockthreshold */ function getmaxdefaultquantity() { var max_default_quantity = 1; if (inventory && inventory.sizes) { sizecolor_combo_loop: (var key in inventory.sizes) { if (inventory.sizes[key].combos) { (var key2 in inventory.sizes[key].combos) { var sizecolor_combo = inventory.sizes[key].combos[key2]; if (isbackorderable(sizecolor_combo)) { //if 1 backorderable, can break out max_default_quantity = settings.limitedstockthreshold; break sizecolor_combo_loop; } else { //not backorderable, largest quantity (sizecolor_...

How to open an external web page from a Wicket modal dialog -

i have modal dialog in wicket contains link. need open external web page (for example, http://www.google.com ) clicking on link. target of link set dynamically. how can this? i think question hasn't been clear(i apologize that). need open web page modal dialog. actually, can explain problem in example of modal dialog @don roby has proposed me (wicketstuff.org/wicket14/ajax/modal-window.0). if click "show modal dialog page" link in example, there shown modal dialog link called "open modal dialog". clicking on link, want open web page (for example: www.google.com). question is: how open web page in situation? you can use pagecreator (instead of setcontent()), , return redirectpage: modalwindow modal = new modalwindow("modal"); modal.setpagecreator(new modalwindow.pagecreator() { @override public page createpage() { return new redirectpage("http://www.google.com"); } }); add(modal);

c# - Declare a variable using a Type variable -

i have code: type lefttype = workitem[leftfieldname].gettype(); i want declare variable of type: lefttype somevar; is possible? you can these , cast them known interface. var somevar = convert.changetype(someoriginalvalue, workitem[leftfieldname].gettype()); var somevar = activator.createinstance(workitem[leftfieldname].gettype()); if replace var dynamic (and using .net 4), can call methods expect on somevar object. if don't exist, you'll missingmethodexception.

php - Merge two functions that basically do the same thing -

i'm using 2 functions delete each folder after 1 minute same thing (just different folders called). wondering if merged one? function deletefromfolder1() { $captchafolder = 'folder1/'; $filetypes = '*.jpg'; $expire_time = 1; foreach(glob($captchafolder . $filetypes) $filename) { $filecreationtime = filectime($filename); $fileage = time() - $filecreationtime; if($fileage > ($expire_time * 60)) { unlink($filename); } } } function deletefromfolder2() { $captchafolder = 'folder2/'; $filetypes = '*.jpg'; $expire_time = 1; foreach(glob($captchafolder . $filetypes) $filename) { $filecreationtime = filectime($filename); $fileage = time() - $filecreationtime; if($fileage > ($expire_time * 60)) { ($filename); } } } pass folder name argument. function deletefromfolder($captchafolder) { $filetypes = '*....

How are Drupal Blocks ordered? -

i know weighed through interface found @ admin/build/block (and through weight field in users table) beyond that, there ordering used on blocks of same weight? block sorted region, weight, module name. no title. follows insert order on blocks table. see http://api.drupal.org/api/drupal/modules--block--block.module/function/block_list/6

objective c - What does Apple mean when they say that a NSManagedObjectContext is owned by the thread or queue that created it? -

it seems in november, apple updated both nsmanagedobjectcontext class reference , core data programming guide documents explicitly bless serial gcd dispatch queues , nsoperationqueues acceptable mechanisms synchronising access nsmanagedobjectcontext . advice seems ambiguous , possibly contradictory, , want make sure i've understood properly. previously accepted wisdom seemed nsmanagedobjectcontext accessed thread created it, , using serial queue synchronisation not sufficient; although serial queues perform 1 operation @ time, these operations can potentially scheduled on different threads, , moc doesn't that. but now, programming guide, have: you can use threads, serial operation queues, or dispatch queues concurrency. sake of conciseness, article uses “thread” throughout refer of these. so far, (although conflation of threads , queues unhelpful). can safely use single context per (serial) queue, instead of 1 per operation/block, right? apple has visual dep...

ocaml - How do I return a binary string (bytea) in a PL/Python PostgreSQL routine? -

i'm trying write procedure in pl/python perform conversion of data, return result bytea . (it's quite ugly, actually: marshalling data in ocaml! ugly in python , ocaml @ once; should medal?) here's looks like: create or replace function ml_marshal(data varchar) returns bytea $$ import tempfile, os fn = tempfile.mktemp() f = open(fn, 'w') dest_fn = tempfile.mktemp() f.write("let outch = open_out_bin \"" + dest_fn + "\" in " + "marshal.to_channel outch (" + data + ") [marshal.no_sharing]; " + "close_out outch") f.close() os.system("ocaml " + fn) os.unlink(fn) f = open(dest_fn, 'r') res = f.read() f.close() os.unlink(dest_fn) return res $$ language plpythonu; in short, writes out small ocaml program tempfile creates tempfile data want. read tempfile in, destroy them both, , return result. only doesn...

javascript - Jquery plugin for this effect? and what is the effect called? -

i've implemented effect myself several times in raw jquery code, want have plugin. problem don't know it's called search plugin. basically, input field has label in pale gray inside field itself. when user clicks, gray label disappears. if user exited field without typing anything, gray label returns. otherwise, whatever user types stays there. it's simple, have name, , there plugin like $('#blabla').effectname('label'); sorry if stupid question i'm blanking out on one. it sounds you're describing ' placeholder '. built html 5, , supported in (as of writing) webkit (chrome + safari), firefox 3.7 , above, , ie 9 beta (i think). just doing bit of searching around found jquery plugin - jquery placeholder .

Does Rails 3 have find_by association magic? -

specifically, let's assume have 2 sensible models: tiedyecentipede , has_many :legs leg , has :color attribute. being tiedyecentipede , no 2 legs ever same color. in fact, particular leg's color unique among all of legs of of our tiedyecentipedes . based on uniqueness, want find particular centipede particular color of leg -- let's :deep_sky_blue . i like: critter = leg.find_by_color(:deep_sky_blue).tie_dye_centipede however, there find_by_* method on tiedyecentipede class use well? no magic: tiedyecentipede.joins(:legs).where(:legs => {:color => 'deep_sky_blue'}).first some magic: def self.find_by_leg_color(color) tiedyecentipede.joins(:legs).where(:legs => {:color => color}).first end

Valuechangelistener Doubt in JSF -

hi, please see following code: <h:selectonemenu id="countries" value="#{countrybean.selectedcountry}" onchange="submit() valuechangelistener="#{countrybean.changecountry}"> <f:selectitems value="#{countrybean.countries }" /> </h:selectonemenu> backing bean public void changecountry(valuechangeevent event){ string newvalue = (string)event.getnewvalue(); string oldvalue = (string)event.getoldvalue(); system.out.println("new value : " + newvalue); system.out.println("old value : " + oldvalue); if ("1".equals(newvalue)){ this.countries = new arraylist<selectitem>(); this.cities.add(new selectitem("1","delhi")); this.cities.add(new selectitem("2","mumbai")); } if ("2".equals(newvalue))...

jquery ui - JqueryUi slider range doesn't apear after async call -

i have 2 pages, let's page1.php , page2.php in page2.php have jqueryui slider range (ex.http://jqueryui.com/demos/slider/range.html) if open page in browser works fine, if try call page page1.php ajax async slider not shown. i know have reinitialize slider on client side... how? tried eval http response but... nothing:( any ideas? thanks in advance how calling slider on page 2? might need wrap code initializes slider in function can call when ajax load.

How to use subprocess to execute programs with Python -

hello using subprocess.popen() class , succesful execute commands on terminal, when try execute programs example script written on python , try pass arguments system fails. this code: argpath = "test1" args = open(argpath, 'w') if self.extract.getbyattr(self.block, 'name', 'args') != none: args.write("<request>"+self.extract.getbyattr(self.block, 'name', 'args')[0].toxml()+"</request>") else: args.write('') car = popen(shlex.split('python3.1 /home/hidura/webapps/karinapp/suite/foreingcode/savecss.py', stdin=args, stdout=subprocess.pipe, stderr=subprocess.pipe)) args.close() dataout = car.stdout.read().decode() log = car.stderr.read().decode() if dataout!='': return dataout.split('\n') elif log !...

Difference between null and empty ("") Java String -

what difference between null , "" (empty string)? i have written simple code this: string = ""; string b = null; system.out.println(a==b); // false system.out.println(a.equals(b)); // false and both statements return false . seems, not able find actual difference between them. "" actual string, albeit empty one. null, however, means string variable points nothing. a==b returns false because "" , null not occupy same space in memory--in other words, variables don't point same objects. a.equals(b) returns false because "" not equal null, obviously. the difference though since "" actual string, can still invoke methods or functions on like a.length() a.substring(0, 1) and on. if string equals null, b, java throw nullpointerexception if tried invoking, say: b.length() if difference wondering == versus equals, it's this: == compares references, if went string = new string(...

wxPython: TextCtrl problem -

i trying build first wx application have browse button in panel, user adds file. processing on file. want show information in textctrl user may modify it. need write in file. dont know how many textctrl box needed before processing file. using browse button event have got file, extracted information also. dont know how show information user. any suggestion appreciated. if you're doing showing 1 file, need 1 textctrl. give widget wx.te_multiline style , add sizer expand flag: sizer.add(mytxtctrl, 0, wx.expand) then user can see file , can save data save button or menu item. handler grab text control's contents using it's getvalue() method.

c# - string handling -

i know if have english dictionary in text file best way check whether given string proper , correct english word. dictionary contains 100000 english words , have check on average of 60000 words in 1 go. looking efficient way. should store strings first or process them generated. thanx 100k not great number, can pop in hashset<string> . hashset lookup key-based, lightning fast. example how might in code is: string[] lines = file.readalllines(@"c:\mydictionary.txt"); hashset<string> mydictionary = new hashset<string>(); foreach (string line in lines) { mydictionary.add(line); } string word = "aadvark"; if (mydictionary.contains(word)) { console.writeline("there aadvark"); } else { console.writeline("the aadvark lie"); }

rest - HTTP CacheControl with Jersey and json implementation -

i want add cachecontrol intormation service use json binding. found add cachecontrol response rest service sound this: @get @path("cacheheadertest") @produces({"*/*"}) def testcache():javax.ws.rs.core.response { val rb:response.responsebuilder = javax.ws.rs.core.response.ok("chached test message") val cc = new cachecontrol() cc.setmaxage(60) cc.setnocache(false) rb.cachecontrol(cc).build() } but have rest service produce json messages , jersey library transform automaticcally java object java xml/json. @get @path("jsontestcache") @produces(array(mediatype.application_json, mediatype.application_xml)) def myjsontestservice(@headerparam("x-tokenid") tokenid: string, @queryparam("clientid") clientid: string):com.test.myresultclass = { val response= new com.test.myresultclass [...] response } how can add cache control response of myjsontestservice service? need use filter , append cachecontrol ...

objective c - Mac Installer Certificates -

i'm @ point i'm ready submit app - apple doesn't elaborate on how sign , submit apps. have both wwdrca certificate , 1 created @ loss on put them.. add them via drag n' drop xcode? why need wwdrca? have info on this? appreciated first, make sure have correctly installed installer, developer , wwdr certs in keychain. in xcode, edit target build settings , under 'code signing entity' , select developer certificate. build app using 'build , archive'. finally, open organizer (via window menu) verify , submit app. at least, that's theory. agree it's tricky. apple developer forums have several instructive postings potential pitfalls. luck!

css - Method for full-screen vertically-centered HTML page? -

i'm looking valid cross-browser solution html page which: consumes 100% of screen height, no overflow (i.e. no scrolling) has vertically (and horizontally) centered <div> hold main content i know vertical centering possible when wrapping container has static height. adjusting height browser window height feasable? (preferably, no js should used.) depends on mean "cross browser". following works fine current, standards compatible ones (thus not ie6): html: <div id="a"> <div id="b"> <div id="content"></div> </div> </div> css: html, body, #a { margin: 0; padding: 0; height: 100%; width: 100%; } #a { display: table; } #b { display: table-cell; margin: 0; padding: 0; text-align: center; vertical-align: middle; } #content { border: 5px solid red; width: 100px; height: 100px; margin: auto; } live exampl...

datetime range vb.net for loop -

i have 2 datetime values in vb.net application. dim startdate datetime dim enddate datetime now want make loop each day between startdate , enddate like: for each day integer in ?????????? next someone have idea? c# : for(datetime currentdate = startdate; currentdate < enddate; currentdate = currentdate.adddays(1)) { } vb.net : dim currentdate datetime = startdate while currentdate < enddate currentdate = currentdate.adddays(1) end while

flex - File() FileStream in web app -

i've made desktop app, , want work web app. errors on lines file() type , filestream, there way bypass ? to piggyback on @florian f's correct response, here how might implement it: create interface abstract file access public interface igetthestuffservice { function getsometofu():tofu; } create file-based implementation public class filestuffservice implements igetthestuffservice { public function getsometofu():tofu { // file-based implementation } } and http-based implementation public class httpstuffservice implements igetthestuffservice { public function getsometofu():tofu { // http-based implementation } } in consumer, rely on igetthestuffservice [inject] public var tofuservice:igetthestuffservice; public function dosomestuff():void { var tofu:tofu = tofuservice.getsometofu(); // act on tofu } notice inject meta tag. dependency injection (di) system push in dependency based on configuration (files...

Joomla main menu customization -

how can customize joomla main menu this: http://www.ruckuswireless.com/ that's not going quick , easy hack, might able pull off html override. if want close, can close 1 of mega menu extensions. if want hack yourself, need copy of joomlainstall/modules/mod_mainmenu/tmpl/default.php , put in joomlainstall/templates/yourtemplate/mod_mainmenu/default.php once have made modifications. you can use menu item image image @ top of dropdown. menu description little trickier, menu systems use menu title purpose. when put in title need separator can split title in the title , description. format have menu title|menu description. this pretty big modification general idea.

Rails way to offer modified attributes -

the case simple: have markdown in database, , want parsed on output(*). @post.body mapped posts.body column in database. simple, default activerecord orm. column stores markdown text user inserts. now, see 4 ways offer markdown rendered version views: first , in app/models/post.rb : # ... def body markdown = rdiscount.new(body) markdown.to_html end allowing me call @post.body , rendered version. see lots of potential problems that, e.g. on edit textfield being pre-filled rendered hmtl instead of markdown code. second option new attribute in form of method in app/models/post.rb : # ... def body_mardownified markdown = rdiscount.new(body) markdown.to_html end seems cleanest me. or, third in helper in app/helpers/application_helper.rb def markdownify(string) markdown = rdiscount.new(string) markdown.to_html end which used in view, instead of <%= body %> , <%= mardownify(body) %> . the fourth way, parse in postscontroller . ...