Posts

Showing posts from August, 2011

php - Sorting 2 arrays to get the highest in one and lowest in another -

i have 2 arrays. keys represent player id in game (and same in both arrays) , value represents ping in 1 , score in other. trying player id (key) has highest ping , lowest score. can't head around of sorts this. i don't have use 2 arrays, don't know how else it. thanks. live demo : http://codepad.org/46m3mhih arranging type of architecture work better... $players = array( array( "name" => "l337 h4x0r", "score" => 10432, "ping" => 0.35 ), array( "name" => "el kabooom", "score" => 19918, "ping" => 0.45 ), array( "name" => "kapop", "score" => 10432, "ping" => 0.38 ) ); then more efficiently sort multi-dimensional array , , retrieve $lowestscore , $highestping values. $playersscore = subval_sort($players,'sco...

c# - Problem figuring out how if I am on the first row and column of a datatable? -

.net 2.0 trying find if on first row can comparison foreach(datarow row in tbl.rows) { if (row<something> == "first row") { continue; } foreach(datacolumn col in tbl.columns) { if (something == "first column) { continue; } .... but escaping me. quick 'n' dirty says can throw int counter in there. int rowcounter=0; foreach(datarow row in tbl.rows) { rowcounter++; if (rowcounter==1) { continue; } ... //do same columncounter first-column first-row }

java - When should a GWT widgetSet need to be recompiled? -

in gwt hello world example, if compile , run app, widgetset gets compiled has never been done. if change label in hello world app "hello world 2", should widget set need recompiled? i using maven , have stub widgetset defined in project inherits couple of other widgetsets. using vaadin think generic gwt issue. thanks. changing contents of label trigger full recompile of gwt application. gwt compiler monolithic - requires full view of every part of source because performs many optimizations on entirety of application. because of change in part of application require full compile. developer mode allow see changes more recompiling , redeploying application.

java - Read log4j.xml from within a jar in Spring app -

i trying read log4j.cml within jar. conf like <bean id="log4jinitialization" class="org.springframework.beans.factory.config.methodinvokingfactorybean"> <property name="targetclass" value="org.springframework.util.log4jconfigurer" /> <property name="targetmethod" value="initlogging" /> <property name="arguments"> <list> <value>classpath*:conf/prod/log4j.xml</value> </list> </property> </bean> it throws following exception: log4j:error not parse url [file:/users/sgoyal/workspace/matchmaker-service/classpath*:conf/prod/log4j.xml]. java.io.filenotfoundexception: /users/sgoyal/workspace/matchmaker-service/classpath*:conf/prod/log4j.xml (no such file or directory) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(fileinputstream.java:106) @ java.io.fileinput...

How to get alternate character from character array in java? -

i have character array array have 10 values .i want alternate character 1st,3rd,5th..... array .please 1 tell me how that for(int = 0 ; < arr.length ; i+=2){ system.out.println(arr[i]);//alternate chr }

regex - Checking PHP referrer -

so, need check referrer page using php, , if *.example.com, or *.anothersite.com, execute code, if not, redirect elsewhere. how go checking if http_referer equal values, wildcard character? thanks! edit: url contain more 1 domain, regex needs match first occurance found. $ref = $_server['http_referer']; if (strpos($ref, 'example.com') !== false) { redirect wherever example.com people should go } if (strpos($ref, 'example.org') !== false) { redirect wherever example.org people should go } of course, works if referer "nice". instance, coming google possibly have "example.org" in search term somewhere, in case strpos see it, , redirect, though came google.

windbg - Comparing two dump files for report on objects with highest growth -

for debugging managed applications if have 2 dump files, there anyway compare these 2 file? thinking scenario of memory leaks , if take process snapshots @ different time, wondering if there anyways of automatically comparing files , type of report on object has largest growth in count and/or size. know can generate these type of reports via ant memory profiler looking free tools/scripts purpose. can use !dumpheap -stat , compare results using powershell script?

Bringing the Android (NFC) TAG project to work -

used android project: tag after copying tag project workbench should import guava lib, solve of errors. nullable errors can fixed importing jsr305-1.3.9.jar regarding this solution after fixing error messages trying install tag app on nexus s, error message: installation error: install_failed_conflicting_provider logcat message: can't install because provider name com.android.apps.tag (in package com.android.apps.tag) used com.google.android.tag package couldn't installed in /data/app/com.android.apps.tag-1.apk i think message, because version of tags installed couldn´t removed via "manage apps". i hope can bring android tags app work, has foundation building nfc apps. have tried sample nfc demo "faketagsactivity", story. has idea how can install app? best regards alexander custom nexus s rom without com.android.apps.tag application installed should trick, or have thought of changing app package com.mytestapp...

multithreading - Thread pool configurations problems -

note i'm not talking specific implementation in specific language. lets have thread pool , task queue. when thread runs pops task task queue , handles - thread might add additional tasks task queue, result. time thread has handle task unlimited - meaning thread works until task finished , never terminates before that. what kind of problems (e.g. deadlocks) each following thread pool configurations susceptible to? possible thread pool configurations i'm concerned with: 1) unbounded task queue bounded num. of threads 2) bounded task queue unbounded num. of threads 3) bounded task queue bounded num. of threads. 4) unbounded task queue unbounded num. of threads also - thread has limited time handle each task, , forcibly terminated if doesn't finish task in time frame given. how change things? if have bounded number of threads can experience deadlocks if task running on pool thread submits new task queue , waits task --- if there no free thread new task...

android - changing focus on multiple edittext boxes -

i've written code test if user has changed values in of 6 edittext boxes, code looks bulky , redundant. i'm wondering if there more elegant way this. the user inputs numbers of 6 edittext boxes, , after each entry, calculation routine checks sure boxes have valid numbers before doing calculation. kistener has fire on lost foucus number in box before calculations done. , outputing result. if user want go , change value in 1 of 6 edittext boxes, calulation routine runs again.been i've set 6 listeners in oncreate section each edittext box. have 6 separate routines test each hasfocus==false. within oncreate section set listener each of 6 user input edottext boxes: et1.setonfocuschangelistener(this); . . . . et6.setonfocuschangelistener(this); then have method check if edittext box has lost focus, suggesting theat user changed data, , therfore re-run calulations. check each of 6 user input edittext boxes follows: @override public void onfocuschange(view v, bo...

javascript - What event fires when an AJAX request is sent? -

what handler should use catch moment when ajax request has been sent server within document.ready ? i think you're looking .ajaxcomplete() . $('#el').ajaxcomplete(function() { … }); edit try this: $(window).ajaxcomplete(function() { … }); note: these work if ajax request sent jquery.

Can't make sense out of this Perl code -

this snippet reads file line line, looks like: album=in between dreams interpret=jack johnson titel=better titel=never know titel=banana pancakes album=pictures interpret=katie melua titel=mary pickford titel=it's in head titel=if lights go out album=all lost souls interpret=james blunt titel=1973 titel=one of brightest stars so somehow connects "interpreter" album , album list of titles. don't quite how: while ($line = <in>) { chomp $line; if ($line =~ /=/) { ($name, $wert) = split(/=/, $line); } else { next; } if ($name eq "album") { $album = $wert; } if ($name eq "interpret") { $interpret = $wert; $cd{$interpret}{album} = $album; // assigns album interpreter? $titelnummer = 0; } if ($name eq "titel") { $cd{$interpret}{titel}[$titelnummer++] = $wert; // assigns titles interpreter - wtf? how can work? } } the while...

silverlight - VS 2010 loading slow - Xap packaging failed. Exception of type 'System.OutOfMemoryException' was thrown -

i'm having issue vs 2010. it's running slow , crashes when compiling , packaging xap file following error: xap packaging failed. exception of type 'system.outofmemoryexception' thrown. in local windows 7 temp directory \users\usernamexxxx\appdata\local\temp there thousands of files, removed them , vs faster. is else having similar issues? yes, have simmilar issue. when clear temp memory works fine after time temp directory showing file. and again message comes "out of memory exception". it issue in code. code leaking memory. code not disposing object properly.

actionscript 3 - flash as3 xml cdata bold tags rendered in htmlText with an embedded font -

i'm trying flash render bold text in dynamic text field embedded font, using data i've imported xml file using cdata. know how this? xml file: <description><![cdata[ past 2 years, <b>superfad</b> has worked closely <b>martin agency</b> visualize original works of <b>sport campaign</b>. campaign spotlights extreme athletes of various events artists in own world, using tools of sport create lasting works of art]]></description> and as3 code: project_desc = myxml.projects.project[cp].description.touppercase(); container.header.t_desc.htmltext = project_desc; wrap text want bold in span tags class name. <description><![cdata[ past 2 years, <span class="myboldtext">superfad</span> has worked...</description> then use stylesheet object style within actionscript. var my_stylesheet = new stylesheet(); var n:object = new object(); n.fontweight = 'bold'; my_styl...

Advanced Explanation of Android Layout Properties? -

i'm on quest learn how layout components in android. i'm seasoned css/mxml developer , having hardest time getting full understanding of layout properties in android components. one thing i'm not sure differences between these: layout_margin vs. padding layout_gravity vs. gravity vs. ignoregravity should use 1 on other linear, table or relative layouts? example of i'd learn having overall margin on layout separate components relating top/middle/bottom of screen. sdk docs start, don't show how things work in different situations. any tips on go learn more complex/comprehensive layout design? any attribute prefix layout_ layoutparams attribute. while view attributes parsed during view construction view itself, layoutparams special arguments parent view provide hints how parent should size , position child view. layoutparams valid on view depends entirely on type of parent view. layout_margin therefore instruction parent view supports ma...

java - Question about Encapsulation (Book: HF OOA&D ) -

i'm reading book (head first object oriented design & analysis). in chapter 5 there suggestion have other toughts it. book says: "when have set of properties vary across objects, use collection, map store proeprties dynamically." and further more, explaination why it: "you'll remove lots of methods classes, , avoid having change code when new properties added app". i understand advantage of approach isn't there downsize well? mean if use map store informations (in example string enum map) , provide getproperty(string) method access, caller of method has know strings allowed. don't somehow. mean of course can argue stated in javadoc input allowed. is way deal kind of problem there alternatives? understand doing inheritence not because of bulk of subclasses , subclasses not override add new properties isnt in opinon. i think using map instead of actual fields terrible idea. had misfortune work systems emp...

Display link to full change form for object in django admin -

because nested inlines not yet supported, wondering how display link related object alternative. came across question other day link app, can't seem find again. here looking @ doing: have manager model contains name, address etc. i have property model has inlines , related manager model. i wanting manager model able display link in change form each of properties related it. is can done? sure, can overwrite change view. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.modeladmin.change_view copy template real admin template directory , place anywhere (since can point @ change_form_template , , add in stuff display. i pretty commonly. class mymodeladmin(admin.modeladmin): change_form_template = 'myapp/new_change_form.html' def change_view(self, request, object_id, extra_context=none): properties = manager.objects.get(id=object_id).property_set.all() extra_context = { 'properties':propert...

Does a .NET assembly embed any personally identifiable information? -

i wondering if .net assembly contains traceble information? refer information might connect assembly computer made on, person made it, or maybe visual studio made with? debug symbols gives away file structure , assemblyinfo's give away meta-data well. strings might matter. date-of-modification set. semantically equivalent programs (read: small non-logic changes) can give different binary signatures.

Symbol or Convention for Representing Endianness? -

is there symbol, or other convention, indicating endianness of value/variable/what-have-you in technical writing? that is, if wanted describe algorithm or formula, , represent formula mathematical expression (e.g. x = p + 2 / y), there way of indicating endianness of 1 of variables? for example: the following formula shows how calculate new pointer value, npnt . when working old pointer value, stored in int variable pnt , keep in mind stored little-endian, while new , offset big endian. in order perform mathematical operations using value of pnt , must change pnt big-endian. int pnt = 0x1722 int new = 0x900f int offset = 0xf600 npnt = offset + new - pnt this random example. main thing concerned formula - without paragraph explanation above, there no indication of endianness of each variable in formula. the solution came superscript arrow symbol variables so: npnt → = offset → + new → - pnt ← or, better yet, put arrows di...

exec - PHP shell_exec() - having problems running command -

im new php shell commands please bear me. trying run shell_exec() command on server. trying below php code: $output = shell_exec('tesseract picture.tif text_file -l eng'); echo "done"; i have picture.tif in same directory php file. in shell can run without problem. it takes while run code, doesnt make text_file when run in command prompt. per comment: should write loop in shell instead? you can write simple shell script run command in loop. create script file first: touch myscript.sh make script executable: chmod 700 myscript.sh then open text editor such vim , add this: for (( = 0 ; <= 5; i++ )) tesseract picture.tif text_file -l eng done thats basics of (not sure else need), syntax should started. run script, if you're in same directory script: ./myscript.sh or specify full path run anywhere: /path/to/mydir/myscript.sh

How to receive return from HTML textbox using ruby? -

i creating chat client/server system in ruby. my server hosted on laptop or (this class project, not processing power needed) , plan client take place in web browser. i feed html 2 textboxes: 1 in user can type , other display chat history. my problem while can feed html code browser , display chat (navigate ip address:port) can't figure out how can return input in textbox server. does know how this? it sounds need basic knowledge of how cgis work. once know find easier work sinatra, @echoback recommended, or padrino, rails, or work other languages. this pretty basic cgi. generates simple form, along lines of talking about, walks through environment table passed ruby web server, sorts keys, , outputs table in sorted order. of fields directly apply either web server itself, or cgi, such query sent browser, along headers sent server saying capabilities are: #!/usr/bin/env ruby puts "content-type: text/html" puts puts "<html><head>...

firefox - AJAX XMLHTTP Request -

i have created mozilla extension button located on browser. button has javascript when clicked should send xmlhttlp request. want use local html file have created in url field of it. when use still can't view html page. why so? code goes this: custombutton = { 1: function () { var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","http://localhost/sample.html",true); xmlhttp.send(); } } the sample.html file located in htdocs folder of xampp. accessing local files xmlhttprequest n...

mouseevent - jQuery .trigger('click') inside interval function? -

this rephrased question here . after testing isolated problem, have no clue on fixing it. no need read previous question, simplified code: the problem -> trigger('click') executes, event doesn't trigger when inside looped (intervaled) function $(document.ready(function(){ var checkforconfirmation = function(){ clearinterval(checkinterval); $("#anchorlink").trigger('click'); } var checkinterval = setinterval(function(){checkforconfirmation()}, 5000); }); the function being called in intervals. when proper response replied, interval stops, , simulates click on anchor link. in html file there anchor link <a id="anchorlink" href="#hiddendiv">show</a> . points hidden div has content. i'm using fancybox plugin show hidden div when anchor link clicked. if click on show link fancybox shows, expected. if response back-end, code executes expected, fancybox not shown. if move $(...

c# - Adding AutoMapper Type Mapping Conventions For Generic Types in WCF Contract -

i have wcf service uses generics in data contract, example (simplified): public getdetails(statusfield<string> status); now wcf supports generics creating non-generic equivalent type every possible value of t in generic. so, above example, client consuming wcf service see following signature above function: public getdetails(stringstatusfield status); //... now client has copy of generic version of statusfield class. want use automapper in client, map between generic statusfield , types generated above wcf (such stringstatusfield) can call service. manually creating maps @ client startup, so: mapper.createmap<statusfield<string>, stringstatusfield>(); however laborious there 50+ possible values of wcf has converted. extending idea, use reflection automatically create maps types , solution using. ideally see solution ties architecture of automapper avoid having reflection manually. conceptually, require way of defining convention automapper use...

iphone - Is there any way to add identifier or tag custom event added in iCal? -

i setting reminder in app. have added custom event using ekevent ical . when retrieve events ical events present on day. there way get/retrieve events added through app only, tried eventidentifier property of ekevent readonly property. can help??? you loop through of calendar events match specific date not preferred method. each event created unique eventidentifier property. when save event can copy eventidentifier , next time want modify specific event can use ekeventstore eventwithidentifier method load event. a sample might this ekeventstore *eventstore = [[ekeventstore alloc] init]; nserror *err; ekevent *event = [ekevent eventwitheventstore:eventstore]; //modify event properties save [eventstore saveevent:event span:ekspanthisevent error:&err]; self.calendareventid = event.eventidentifier; [eventstore release]; later if want retrieve saved event previous code following //self.calendareventid nsstring property declared in .h...

c++ - Windows - VC++ - Can't "_ASSERTE" be used in static build -

i trying compile vc++ code in static mode(using /mt) in visual studio-2008. getting following error. error please use /md switch _afxdll builds i tried every options. errors due macro "_asserte". but, can't remove macros said super ordinate. awarded lots of thanks there error telling real wrong program. while _asserte may proximate cause, there deeper underlying issue here need address. your build scripts or source code #define-ing _afxdll, telling mfc plan use dll version of mfc. requires use dll version of crt well. /mt switch bringing in static version of crt. my recommended solution use /md switch use crt dll mfc dll. don't explain why trying use /mt, doing right choice. alternatively, if committed /mt route, should not define _afxdll. finally, there small chance not intending use mfc @ all. in case, stop including mfc headers (afx*.h) , error go away. martyn

iphone - Center UIPickerView Text -

so have uipickerview rows contain number 0-24 , looks bit silly since numbers left aligned leaving huge gap on right of pickerview. is there easy way center align text in uipickerview? - (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view { uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 300, 37)]; label.text = [nsstring stringwithformat:@"something here"]; label.textalignment = nstextalignmentcenter; //changed ns ui deprecated. label.backgroundcolor = [uicolor clearcolor]; [label autorelease]; return label; } or this.

java - Design pattern used in projects -

hi learning design patterns these days. want read design pattern used in various projects , how implemented. implementation helpful connect design pattern in broader picture , why deiced use pattern. problem open source projects not documented properly. can anone me sm online resource? ps: if possible need in c or c++ update: projects listed below : http://www.boost.org http://sourceforge.net/projects/loki-lib/ 'poco.' ace (the adaptive communication environment). if want add more please do. personaly looked @ above projects , found boost choice start. update: due nice post on java describe design pattern examples of gof design patterns in java's core libraries .i including other languages in tag know boost, written , documented library implements several design patterns. it's quite large library, , these implementations used in libraries. http://www.boost.org boost found in many projects, loki's worth reading: http://sourceforge.n...

c# - Looking for an example/tutorial for using P2PMessageQueue Class from the Smart Device Framework -

i have use interprocess communication in windows ce project hve no experience this. found out is, smart device framework has wrapper class p2pmessagequeue class don't know how use 1 communicate between running applications , how send objects between them. have small example or tutorial on how implement , use class exchange objects between running applications on same windows ce device? thank you twickl there's an example on msdn .

I can't use django-tinymce upload picture,I installed django-filebrowser -

i have question django-tinymce upload picture . django-filebrowser installed project , work well.i can use filebrosefiled upload files. next installed django-tinymce project,used tinmyce edit content,everything ok except upload image local. can't open brose page when click browse button,see ![enter image description here][1]picture!: the terminal return error message: "get /tinymce/filebrowser/ http/1.1" 500 71915 my setting file: # django settings max project. # coding:utf-8 debug = true template_debug = debug admins = ( # ('your name', 'your_email@domain.com'), ) managers = admins databases = { 'default': { 'engine': 'mysql', # add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'name': 'max_db', # or path database file if using sqlite3. 'user': 'root', ...

Can I make "not original looking" buttons for Android in Eclipse? -

i think, e.g. curved buttons, or circle button. if can how? it's bad ideia round buttons using rounded background image. (bad) experience... when in different resolutions appear pixilated. you should use drawable, shape rounded created you! something (selector have effects on press, on selected..): <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/greyer_bubble" android:state_pressed="true" /> <!--when selected, use --> <item android:drawable="@drawable/greyer_bubble" android:state_selected="true" /> <!--when not selected, use --> <item android:drawable="@drawable/green_bubble" /> </selector> example of 1 of rounded buttons defined above. <?xml version="1.0" encoding="utf-8"?> ...

how to expand an ini-file in perl -

i need expand ini-file in perl. have given ini-file can read config::inifiles, need add parameters ini file too. for example file looks like [section1] param1=val1 param2=val2 [section2] param1=val3 param2=val4 and need add params sections like [section1] param1=val1 param2=val2 param3=val5 [section2] param1=val3 param2=val4 param3=val6 i don't know if there module in cpan. didn't find 1 until job. thank ideas solve problem! config::inifiles allows add parameters in sections: see newval #!/usr/bin/perl use config::inifiles; $cfg = new config::inifiles( -file => "cfg.ini" ); $cfg->newval("section1", "param3", "val5"); # add new values in corresponding sections ... $cfg->rewriteconfig; read section bugs rewriteconfig .

List out all SVN repos created by various users in their own locations -

how list subversion repos created svnadmin create various users? want setup method backup repositories. first, should know list of them. many users might have created own repos multiple locations. you have scan svn repository folders. if find folder containing following items safe found svn repo: folder conf folder db folder hooks folder locks file fs-type

php - several files attached/uploaded -

i'm working on portfolio management in php, , i've come point want able attach/upload images when creating new project. right now, can attach 1 file, want able attach more 1 file. so question is: how can add function portfolio management allows me attach several files? thanks! :) you can use jquery uploadify plugin that. uploadify powerful , highly-customizable file upload script. in simplest form, uploadify easy , running minimal effort , little coding knowledge.

hashset - nhibernate Iesi ISet fails to Remove() -

i have 2 class'es handled nhibernate : assetgroup , asset assetgroup has iset _assets collection. constructor of assetgroup say _assets = new hashset<asset>(); i have operation add , remove asset in assetgroup public abstract class entity<tid> { public virtual tid id { get; protected set; } public override bool equals(object obj) { return equals(obj entity<tid>); } public static bool istransient(entity<tid> obj) { return obj != null && equals(obj.id, default(tid)); } private type getunproxiedtype() { return gettype(); } public virtual bool equals(entity<tid> other) { if (other == null) return false; if (referenceequals(this, other)) return true; if (!istransient(this) && !istransient(other) && equals(id, other.id)) { var othertype = other.getunproxiedtype(); va...

python - Is there an alternative to PyMedia -

is there alternative pymedia decode different video formats , able extract frames images further processing? currently have able following (not working code extract, give idea): demuxer = muxer.demuxer(format) streams = demuxer.parse(open(video).read(buffer_size)) codec = vcodec.decoder(codec) stream in streams: frame = codec.decode(stream[1]) fdata = frame.convert(2) img = image.fromstring("rgb", fdata.size, fdata.data) # ...further processing of image... you can try pyffmpeg https://code.google.com/p/pyffmpeg/ ...

visual studio 2010 - How to TFS-unmap without losing physical files? -

at moment when unmapping source on tfs source control in visual studio 2010, local downloaded files removed automatically. how can keep them untouched? nam. i have not seen behavior. when un-mapping, choosing re-download files in workspace? if so, choose not that, , files should preserved locally. keep in mind tfs no longer tracking changes @ point, lot of difficulty if inadvertently make changes files. what kind of process trying implement need keep these files around after unmap? maybe there's different way accomplish need? --edit-- when you're doing this, files files, could: do of files in workspace copy them folder on hard drive map new folder do "add files" on in new folder structure check in. you have rebind of projects/solutions source control when this.

javascript - JqueryUI Datepicker cannot correctly handle initial values -

i have following simple datepicker in jqueryui: $('#id_due_date').datepicker().datepicker("option", "dateformat", "yy-mm-dd"); $('#id_due_date').datepicker("setdate", new date($("input#id_due_date").attr("value"))); so, if has value shows date instead of blank (second line of code above). however, i'm having following difficulties: i want able show month of initial value in calendar. if date 3 months ahead, want show month in calendar. with code, if i'm not setting initial value, defaults today, kind of wrong application items can have missing due_date can please help? new date javascript native method , expects javascript dateformat correct check out alt field, altfield in jq ui use datepicker({option:value}) check changemonth option in jq ui check change year option in jq ui

button - Let PHP decide which part of the page to load -

i have 2 buttons. if 1 button clicked, part 1 of file should displayed. when other button clicked, other part should displayed. and have able switch between pages anytime. anyone idea how (in php)? first of all: should express have tried achieve , why things not working. really basic stuff , after reading php manual , html tutorials, should able thing going on own. the easiest way make buttons include different parameter: <button onclick="window.location.href='index.php?page=foo';">click me</button> <button onclick="window.location.href='index.php?page=bar';">click me</button> and read out parameter php: <?php if (isset($_get['page'])) { switch($_get['page']) { case 'foo': // include page foo break; case 'bar': // include page bar break; } } disclaimer: said easiest , not most elegant . :)

jquery - clone google map instance -

i have map on page displays several places markers , infowindows. i'd put fullscreen button , load map jquery-ui dialog, i've got problems. is there way copy google map instance i've created in 1 div, other div? or other workaround, changing div associated map... science-fiction?? i don't think google maps support such manipulation. although seems moving map quite simple. map has method getdiv returns node containing map. using jquery can manipulate dom: var mapnode = that.map.getdiv(); $('#destinationdiv').append(mapnode); it moves map div destinationdiv. tested in chrome , firefox , worked well, i'm not sure if works (if map's functionality isn't broken) in main browsers. but wasn't successful in copying map. utilizing jquery's clone method produces broken copy of map. if need copy it, guess way might create new map , create objects scratch.

iphone - using coredata for storing / caching non standard data types -

i'm rearching best ways store non standard types (string, int16 etc) on iphone. doing downloading xml file , storing values such date, title, name, mediaurl. i've discovered coredata data model , believe candidate storing such data don't have download xml next time app starts. what i'm unsure of limitations (if any) of can store in entity. example 1 of xml elements hold url small piece of audio (less 1mb) , url image. appropriate store audio data , image attribute in entity or should kept strings , ints etc , non standard types stored else where? i guess i'm asking is, datamodel suitable caching? ultimately i'm seeking solution storing data on device in location not tied 1 view, kinda atomic model need can dip no matter view i'm in. the data model suitable caching, because don't have explicit control of cache (you can fault data object may remain in memory), it's recommended separate large binary objects. store them resources on fi...

probability - Probabilistic logic vs. analog -

there research articles (e.g. chakrapani & palem ) , devices (e.g. lyric ) use so-called probabilistic logic. suppose idea outputs of such device, given inputs, converge probability distribution. difference between these devices , using analog signals? is, these devices still considered digital, analog, mixed-signal? this paper seems describe novel kind of (probabilistic) boolean logic, , not implementation. skimmed through paper, seems 1 of theories. there is, way, simple reason why probabilistic logics don't give classical logics give you, namely, not truth functional (i.e. value of & b not depend solely on value of , value of b). as implementing such thing on chip: think both possible. if digitally, you're calculating probabilities, , can run code on cpu. don't know analog implementations, guess elementary analog component (transistor, opamp etc) can seen performing kind of basic arithmetic operation on voltages , currents. whether circuit gives ou...

ssms - Query Designer toolbar grayed out? -

i using query designer in sql server management studio (on express 2008 database). created new query, chose design query in editor query toolbar , presented cool graphical query designer (a bit 1 in access). selected fields, generated t-sql, , executed query , thought awesome! however, can modify t-sql manually, cannot graphical designer query designer toolbar options grayed out. missing something? highlight query text, right-click, , select "design query in editor...".

dvcs - Step-by-step bazaar workflow -

where work, work (mostly) in pairs. have seen need version control, , using bazaar our distributed version control system, due apparent flexibility. after experimentation, have agreed in order set project, should use following steps: on server bzr init (initializes project) bzr add (tells bzr track files in current directory, please make sure not have unnecessary files in project skeleton before run command) bzr commit -m "initial commit" (commits added files bzr version control) on development machine on local machine, bzr branch project_dir daily routine we trying establish workflow work us. have agreed daily: pull down latest changes pull_path code , commit. nb. commits saved on local machine. see step 1. push changes push_path (nb. push_path = pull_path ) if there conflict: try bzr resolve first. if fails, partner , manual resolve (open file.other, file.base , file.this , make relevant changes). commit chang...

unpack - 128bit long doubles in ruby? -

in ruby code, i'm talking server responds 128bit long doubles ("128 bit long doubles", "binary128" or " quadruple precision floating points ") strings in binary format. is there way unpack these strings use in ruby? according documentation on string.unpack , maximum precision seems doubles. possible represent these 128bit floats in ruby @ all?

windows - Make PHP command line display phpinfo page by page? -

when use php cli phpinfo end last half. here command: > php -i i'm not sure call? there way of controlling output portion displayed piece @ time press of key? both on windows , linux php -i | more should work on both linux , unix. on linux, though, more alias equivalent less

mongodb - mongo + java + too many open files -

i using mongo-java2.4jar communicating mongo server. in webapp using mongo=new mongo("serverip","port") ever required , once processing complete, closing mongo connection using mongo.close() . but after time getting following exception : java.net.socketexception: many open files i think when close connection not closing sockets. please me out figuring issue. thanks! the mongo class transparently connection pooling , should have 1 instance per jvm process. please @ http://api.mongodb.org/java/2.5-pre-/com/mongodb/mongo.html if heavily create instances of class think acquire many connections before can released. create singleton on app startup whole application , place in application context. call close when app stops. cheers, sven

authentication - Cross Platform Login -

i working on application user authentication happens in coldfusion application (based on cfwheels), interactions file servers happen through node.js application. need make sure user logged in on cf application allowed access files in node server. thinking of setting cookie cftoken or node server can read , pass coldfusion asking "hey can token access file" my problem wasn't sure if cftokens re-used eventually, , if should use instead? if other people have other ways of doing sort of thing authentication needs reusable across multiple engines love hear strategies. that sounds fine way it. but, use cfcookie set cookie of own devising. the 2 servers have share domain name, of course, able read same cookie. have set cookie domain cookie. one clean way architect create whole cfc devoted security. it have methods generating , validating login tokens. your cf application use generate token, , have node.js application call via webservice using the ...

sql server - Copy database without sysadmin permission -

i want copy production database (all tables, views , sp's) sql server 2008 instance local development machine. since have access database , no administrative permissions on server itself, unable normal full backup/restore or run database copy wizard. i guess script database objects , export/import data tables seems tedious. there better way? the approach aware of script of objects (tables, views etc...) , run them against new database. there various database comparison tools should able automatically you, although can't remember 1 used last time needed this, these 2 ok , free http://www.sqldbtools.com/ http://dbdiff.codeplex.com/

visual studio - How do I manage SDF databases remotely? -

this silly question can't seem clear idea. sql server ce 4 not require sql. once copy .sdf file web host, want continue making changes remote version , not locally. sql database have connection string , thing. is same sdf file? attach them sql express server make changes? you can open sql compact files locally. if have access command prompt on host machine, can use command line utility: http://sqlcecmd.codeplex.com

image processing - C# - EMGU CV taking frames with higher resoultion? -

i trying capture frames higher resolution (eg. 800x600) , brightness using emgucv(emgucv 2.1.0.793). i using a4 tech pk-730mj web cam. i tried set capture property _capture.setcaptureproperty(emgu.cv.cvenum.cap_prop.cv_cap_prop_frame_height, 600); but capturing 640x480 frame. how set frame capture, brightness property? capture property camera specific? if yes, camera should use? logitech webcam pro 9000 work? hope solved problem. might interested, can set 1 of default resolutions, e.g 1280*1024, 600*480. guess 800*600 not 1 of default settings. try setting height 1024. works me. ^ ^

Using mongodb for storing almost all website text -

like web developers, used use mysql of db needs. i'm interested in mongodb, , trying integrate project i'm building. problem is, because don't have experience mongodb, i'm having little difficulty deciding on feature. never had live website using mongodb, i'm not sure if it's this. this site available in several languages. decided store text in place, able programatically fetch needed ones in correct language. if using mysql, not use purpose. i'm using mongodb, , seems logical use storing lot of text , later fetching. do think it's idea? it's document store, should ideal this, i'm imagining having lots of queries fetching data db, , doesn't seem good... also, think mongodb being local or remote should make difference on decision? and exact problem is? i assume have in mysql | key | language | text | it's trivial translate mongodb like { key: ...., translations : { 'de' : , 'en' : , }

Msbuild compile website without placing the site in IIS -

i trying create msbuild script compile , place test app folder on desktop. not want app published iis. have followed several blgos , looked through hashimi's book still cannot figure out. below script. thank much! <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <target name="clean"> <itemgroup> <binfiles include="bin\*.*" /> </itemgroup> <delete files="@(binfiles)" /> </target> <target name="compile" dependsontargets="clean"> <msbuild projects="test.vbproj"/> </target> <target name="publish" dependsontargets="compile"> <removedir directories="$(outputfolder)" continueonerror="true"/> <msbuild projects="test.vbproj" targets="resolvereferences;_copywebapplication" properties="webprojectout...

c++ - What library or graphics engine would be suitable for a full-screen professional retail tool? -

i find myself in unique position of having find suitable 2d graphics engine (or 3d easy-to-use support 2d interfaces) creation of simple, full-screen retail sales tool business. have been considering use of sdl library after briefly reviewing features. seems easy grasp, , have used before long long ago, before begin project felt need consult greater community make sure making right (read: easiest) decision. 1 concern have aptitude of sdl lack of native support guis. this major concern since project hinges on ability implement sleek radial menus , other custom widgetry (this word) ensure easy of use. software running on kiosk in store , serve sleek way browse stock, stock available online, , place orders. headed right way using sdl or there better engine, or perhaps language, more perfect fit? speaking of, know c++, python , perl engine or library native 1 of languages perfect. chose sdl because of hardware independence , c++ nativity. consider use of java system application runni...

mod rewrite - Mod_Rewrite Complicated! -

i'd set redirect/rewrite in .htaccess following: a few samples of redirects i'm trying accomplish: domain.com/08/04/10/file.php domain.com/new/file.php domain.com/06/01/11/file2.php domain.com/new/file2.php domain.com/07/12/07/file3.php domain.com/new/file3.php you idea. don't know start - there many sub-directories , sub-sub-directories head spinning. want them go /new/filename.php. there 3 subdirectories i'm trying redirect; /06/, /07/, , /08/. each has 2 levels below it, , few php files in 3rd level. suggestions on how start? rewriterule ^/([0-9]{2})/([0-9]{2})/([0-9]{2})/(.*)$ new/$4?d=$1,$2,$3 [l,r] this should turn first second. /01/02/03/myfile.php /new/myfile.php?d=01,02,03 i've assumed need folder names parameters in php call, , folders numeric, 2 characters, looks strangely 2-char-per-part data format ... if that's not case, let me know.

How to safely convert from a double to a decimal in c# -

we storing financial data in sql server database using decimal data type , need 6-8 digits of precision in decimal. when value through our data access layer our c# server, coming decimal data type. due design constraints beyond control, needs converted. converting string isn't problem. converting double ms documentation says "[converting decimal double] can produce round-off errors because double-precision floating-point number has fewer significant digits decimal." as double (or string) can round 2 decimal places after calculations done, "right" way decimal conversion ensure don't lose precision before rounding? the conversion won't produce errors within first 8 digits. double has 15-16 digits of precision - less 28-29 of decimal , enough purposes sounds of it. you should put in place sort of plan avoid using double in future, - it's unsuitable datatype financial calculations.

prompt - non-recursively replace built-in javascript functions -

i writing bookmarklets here , have questions related built-in javascript functions. let's want replace built-in prompt function (not in bookmarklet). seems easy enough, there way call builtin prompt function within replacement? prompt = function(message){ var tmp = prompt(message); hook(tmp); return tmp; } i couldn't scoping work out right; example yields infinite recursion. also there way restore default behavior of builtin javascript function has been replaced (without hanging on reference). (function () { var old_prompt = prompt; prompt = function (msg) { var tmp = old_prompt(msg); hook(tmp); return tmp; }; prompt.restore = function () { prompt = old_prompt; } // analogous other functions want replace })(); wrapping in (self-executing) function ensures old_prompt doesn't leak outside. need expose something though. chose provide function doing restoring, convenience , perhaps, 1 say, future-...

cqrs - How to "join" two Aggregate Roots when preparing View Model? -

assume book , author aggregate roots in model. in read model have table authorsandbooks list of authors , books joined book.authorid when bookadded event fired want receive author data create new authorsandbooks line. because book aggregate root, information author doesn't included in bookadded event. , cannot include because author root doesn't have getters (according guidelines of examples , posts cqrs , event sourcing). usually receive 2 types of answers on question: enrich domain event data need in event handlers. said cannot aggregates roots. use available data view model . i.e. load author view model , use build authorsandbooks row. the last 1 has problems concurrency. author data can not available in view model @ time bookadded event handling. what approach use solve this? thank you. as general advice, let event handlers idempotent , make sure can deal out of order message handling (either re-queuing or building in mechanisms f...

Looking up fields from multiple table MYSQL -

i trying show schedules student. map out: studentprofile -studentid registration -registrationid -studentid registrationschedule -regscheduleid(is not primary key,, not unique,,can have lot of instances) -registrationdid -scheduleid schedules -scheduleid i wanted show schedules of student. frustrated this. make happen? it seems following should work, it's based on information provided (which isn't much) there no guarantees: select s.* schedules s join registrationschedule rs on s.scheduleid=rs.scheduleid join registration r on rs.registrationid=r.registrationid join studentprofile p on r.studentid=p.studentid p.studentid=? you'd have pass value ? in clause in order schedule particular student.

c# 4.0 - Automatically create dropdown with EditorForModel() -

i have model public ienumerable<selectlistitem> selections {get;set;} , 1 public string selecteditem {get;set;} , how can override default behavior in asp.net mvc renders dropdown property? have generic edit ui can't things html.dropdownlistfor(... take @ custom templates: http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-4-custom-object-templates.html

Is it possible a unix or linux for 80286 machine (or any machine without memory page mechanism) -

is possible have unix os 80286 machine (or machine without paged memory mechanism segmented memory)? 80286 cpu without tlb, page tables; segmented virtual memory , segmented protection of memory. is possible have linux on such machine? upd: processor old, ask historic versions, not ultra modern linux 2.6.42.11 or solaris 13 or freebsd 10 or ... the linux/microcontroller project (µclinux) port of linux systems without memory management unit (mmu). there's older elks project too. however, due lack of mmu, many standard unix features (like fork , mmap ) not supported.

SAS: How do I use ODS layout to put 8 graphs on 2 PDF pages? -

i using sas ods create pdf documents. code below works put 4 graphs on 1 page. if try put 8 graphs on 2 pages, 4 graphs on 1 page. tried copying part between lines of asterixes , pasting again above "ods pdf close;" didn't work. tried adding "ods startpage = now;" between two, didn't work either. how can put 8 graphs on 2 pages? goptions reset=all; data test; input x y @@; datalines; 1 2 2 4 3 8 4 10 5 15 ; run; ods pdf file="[path]/output.pdf" ; **** ods layout start width=10in height=8in ; ods region x=0 y=5% width=45% height=45%; proc gplot data=test; title2 'plot #1'; plot y*x /name="mygraph1" noframe; run; ods region x=55% y=5% width=45% height=45%; title2 'plot #2'; plot y*x /name="mygraph2" noframe; run; ods region x=0 y=51% width=45% height=45%; title2 'plot #3'; plot y*x / name="mygraph3" noframe; run; ods region x=55% y=51% width=45% height=45%; title2 'plot #4'; plot y...

mysql - sql boolean truth test: zero OR null -

is there way test both 0 , null 1 equality operator? i realize this: where field = 0 or field null but life hundred times easier if work: where field in (0, null) (btw, why doesn't work?) i've read converting null 0 in select statement (with coalesce). framework i'm using make unpleasant. realize oddly specific, there way test 0 , null 1 predicate? it not work because field in(0,null) equivalent of field = 0 or field = null opposed field = 0 or field null . 1 option use case expression: case when field = 0 1 when field null 1 end = 1 the better option stick original field = 0 or field null makes intent clearer.

objective c - iPhone help with singleton class -

greetings, i'm looking @ matt gallagher's macro creating singleton classes. http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html basically, have app multiple views , want able access "global" data each of these views using singleton class. i have 3 strings want access in class: nsstring *uname, nsstring *details , nsstring *selecteddetails. do need make 3 singleton classes static variable in each? also, how , set string variables uname, details , selecteddetails? i'm bit mixed singleton stuff (i encountered such things today!) , wondering if point me in right direction. many in advance, here code i've done: #import <foundation/foundation.h> @interface details : nsobject{ } +(xxx *)sharedxxx; @end #import "details.h" #import "synthesizesingleton.h" @implementation details synthesize_singleton_for_class(xxx); @end do need make 3 singleton classes static variable in each? n...

delphi - saving strings that are 'connected' and reading them and their 'connected' -

this not @ familiar with. i want try make simple form 4 edit boxes, 2 @ top, 2 @ bottom, , button. want type couple of things in top 2 boxes related each other. when have them both filled in click on button , saves information in database, preferable external file (doesn't have text, think better if not). can couple of times. saving edit fields database. then when type 1 of words saved in 1 of edit fields @ bottom automatically types other word in last edit field. form should remember connect database every time it's opened when open time can still work edit fields. can advise me on how this? what looking known dictionary, if understand correctly. in other languages known associative array or hash. you going want modern version of delphi, i'd guess 2010 or xe. if can't access you'd need 3rd party library, or home grown based off tstringlist . in fact tstringlist can operate in dictionary mode it's bit clunky. you declare dictionary fo...