Posts

Showing posts from March, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

security - WCF: The message could not be processed: -

i have created wcf service hosting application under site on iis7. running on 1 server , trying make run on second server. when call service following error: the message not processed. because action \u0027http://tempuri.org/imyservice/mymethod\u0027 incorrect or because message contains invalid or expired security context token or because there mismatch between bindings. i have set security in wshttpbinding none , in naive mind conclude not security problem. what might wrong , how should proceed determine exact problem is? maybe have same channel uri. change second server. can't use same uri boths.

iphone - Move UIView with relation to touch -

i'm trying move uiview relation user's touches. here's have @ moment: int oldx, oldy; bool dragging; - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; cgpoint touchlocation = [touch locationinview:self.view]; if (cgrectcontainspoint(window.frame, touchlocation)) { dragging = yes; oldx = touchlocation.x; oldy = touchlocation.y; } } - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; cgpoint touchlocation = [touch locationinview:self.view]; if (cgrectcontainspoint(window.frame, touchlocation) && dragging) { cgrect frame; frame.origin.x = (window.frame.origin.x + touchlocation.x - oldx); frame.origin.y = (window.frame.origin.y + touchlocation.y - oldy); window.frame = frame; } } - (void)touchesended:(nsset *)touches withevent:(uievent *)e

msbuild - What are the options to build an installer on a build-server without Visual Studio -

it seems it's still not possible build .vdproj on build-server without having visual studio installed. however, using wix seems lot more complicated. are there other options following task: visual studio 2010 solution multiple projects ( .csproj ) many loose content files (not inside assemblies) installer must built on build-server without visual studio on ( devenv.exe / devenv.com ) installer must create registry keys installer must associate file extensions installed product installer must support upgrades (version upgrades) installer should able register com components installer should able pre-jit assemblies my goal is: effort maintain installer low minimal changes if new project (assembly) added solution ideal: no changes if new content files added of projects maybe did not point wix, including project output (like in .vdproj ) seems complicated. any suggestions appreciated! ok decided go wix. found out using votive it's possible i

cakephp updateAll not working -

i have following code: $this->permissions->updateall( array('permissions.user' => $newuser), array('permissions.user' => $originaluser) ); but when run following error: warning (512): sql error: 1054: unknown column 'counterstaff' in 'field list' [app\cake\cake\libs\model\datasources\dbo_source.php, line 681] query: update `permissions` `permissions` set `permissions`.`user` = counterstaff `permissions`.`user` = 'counter' for reason thinks value want set column. have ideas why happening? problem update query put value in quotation update `permissions` `permissions` set `permissions`.`user` = "counterstaff" `permissions`.`user` = 'counter'

javascript - Can you apply visible binding based on the data currently being bound? -

i'm trying set content in template visible if item being rendered "current item". here code far, want able render part of inner template if data item being rendered has id == window.viewmodel.activeobject . <section data-bind='template: { name: "categorytemplate", foreach: categories }'></section> <script type="text/html" id="categorytemplate"> <section> <h2>${name}</h2> <section data-bind='template: { name: "objecttemplate", foreach: objects }'></section> </section> </script> <script type="text/html" id="objecttemplate"> <article> <h3>${name}</h3> (only render if object rendered has id equal viewmodel.activeobject) {{html text}} </article> </script> <script> $(document).ready(function(){ window.viewmodel = { categories :

.net - WPF - Can't assign Styles to a UserControl -

how can set properties of usercontrol styles? (i read related questions, none of them solved problem) i define simple usercontrol this: <usercontrol x:class="myproject.redsquare" ... height="10" width="10" background="red"> <grid> </grid> </usercontrol> i can manually assign width/height of control. but can´t assign properties styles. this not work: <window.resources> <style x:key="red" targettype="{x:type local:redsquare}"> <setter property="width" value="200" /> </style> </window.resources> ... <local:redsquare style="{staticresource red}" /> strange behaviour: can modify control´s margin style other properties not work? any ideas? your user control has hard-coded width , height: height="10" width="10" local property values have higher precedence val

Android : How to display more than one Marquee simultaneously (focus for two marquees) -

i want 2 marquees in application. 1 working always. if comment first one, second 1 work. otherwise first one. or 1 marquee getting focus @ time. if press down arrow, second 1 focus. how can both of these marquees focus? how can display 2 marquees @ same time? following code : <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/imglogotb"> <textview android:id="@+id/txt1" android:layout_width="wrap_content" android:text="start | lunch 20.00 | dinner 60.00 | travel 60.00 | doctor 5000.00 | lunch 20.00 | dinner 60.00 | travel 60.00 | doctor 5000.00 | end" android:layout_height="20dip" android:singleline="false" android:ellipsize="marquee" android:marqueerep

How to Add Views to the Scroll View in Android? -

i create following code create bar chart , pie chart using canvas. here code public class chartdemo extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //scrollview sv = new scrollview(this); linearlayout llay = new linearlayout(this); llay.setorientation(linearlayout.vertical); float[] values = { 50, 100, 50, 20, 30, 60, 100, 90 }; // bar chart bargraph barchart = new bargraph(this, values); llay.addview(barchart); //pie chart piechartview pie = new piechartview(this, values); llay.addview(pie); //sv.addview(llay); setcontentview(llay); //setcontentview(sv); } } the above code show barchart only. change code following gives black(blank)screen only.with out no error , exception public class chartdemo extends activity { /** called when activity first created. */ @override public void oncreate(bundle sav

Send the SIGHUP signal to a process in Perl -

i have unix daemon, wait of sighup refresh data. try send signal perl script (under apache www-data:www-data on same server) proc::killall ("killall('hup', 'mydaemon');"), have no permissions. suid bit doesn't work too. 'kill -n hup ' shell working. does have idea this? the usual work-around employ »touch file« indicate reload, see apache2::reload real life example. listen notifications set e.g. file::changenotify or anyevent::inotify::simple , reloading.

javascript - How can I detect browser and OS of user and use this to dynamically modify my MySQL database query from a PHP page -

i need able run mysql query , omit results if user using browser on os. database query takes place amfphp service , have javascript browserdetect script can use user browser , os. ideally want run browserdetect script when user arrives @ page , store in php session variables cannot see how pass javascript vars php session. allow database query script session , modify query accordingly. tried include browser detect script in amfphp script did not work - realise serverside vs client side problem. what other solutions work me? thanks why not accomplish php only? php capable of fetching browser , os... $_server['http_user_agent'] contains browser , os...

html parsing - Abnormal Program Termination In A Turbo C++ Web Browser -

i've been trying make workable web browser in turbo c++ (i can't it; supposed work within confines of educational system). essentially, have created simple parser takes in html file scans text tag delimiters, identifies tag, processes using turbo c++ default graphics library , perform required operation before outputting through interface created. essentially, i've been matching cases in long list of nested conditions. problem execution has been falling through , reason i've been continuously getting error of abnormal program termination. what wanted understand why execution falling through. moreover, error mean? here's entire source code. p.s. - first time on stack overflow if undefined, hazy or plain ridiculous please tell me. my friend figured out went wrong in code. turns out pointer wasn't initialized null , caused sort of cascading failure leading abnormal program termination error. lesson learned.

database connectivity in c# -

i working on c# windows project.i using microsoft access database oledbconnection connection.my database "email.mdb" in document directory , "email_db.udl" in "d: drive".this running on computer.but whenever making exe installer file installment on other pc not working.i placing "mdb" , "udl" file in same directory on pc.i supposing ('udl' file) not connected database. how resolve problem installation on windows pc. thanks you can put database files in project's directory (where sln file is) , access them through bare filenames (without d:...., filename). in case of installation have set installer put in installation folder (where exe file is) this way carry in 1 folder , organized. probably here have problem because "my document" directory has different path in every pc.

arm - How to reorder a quadword vector data using Neon Intrinsics? -

the question related arm neon intrinsics. iam using arm neon intrinsics fir implementation. want reorder quadword vector data. example, there 4 32 bit elements in neon register - say, q0 - of size 128 bit. a3 a2 a1 a0 i want reorder q0 a0 a1 a2 a3. is there option this? reading http://gcc.gnu.org/onlinedocs/gcc/arm-neon-intrinsics.html arm infocenter, think following ask: uint32x2_t dvec_h = vget_high_u32(qvec); uint32x2_t dvec_l = vget_low_u32(qvec); dvec_h = vrev64_u32(dvec_h); dvec_l = vrev64_u32(dvec_l); qvec = vcombine_u32(dvec_h, dvec_l); in assembly, written as: vswp d0, d1 vrev64.32 q0, q0

windows phone 7 - Updating ObservableCollection bound to Pivot crashes for SelectedIndex >= 2 (wp7) -

i have observablecollection bound pivot control in ui. when try update collection (clear() items , recreate) works fine unless selectedindex of pivot control bigger or equal 2. in case argumentoutofrange exception when try call add() observable collection. strange. i tried creating new observable collection , add() items there, seems work doesn't refresh ui unless call update function twice. what can wrong? bug? this known issue. unhandled exception when setting pivot control selecteditem/selectedindex property 3rd pivot item (wp7) not deferring navigation/(binding?) loaded event workaround.

Code Contracts trying to get build errors instead of warnings -

i'm trying vs2010 ultimate code contracts generate errors instead of warnings. i have simple test program: using system.diagnostics.contracts; namespace myerror { public class program { static void main(string[] args) { program prog = new program(); prog.log(null); } public void log(string msg) { contract.requires(msg != null); } } } it correctly determines there violation of contract: c:\...\program.cs(10,13): warning : codecontracts: requires false: msg != null in csproj file there property field debug: treatwarningsaserrors > true is there else have set in project settings turn these errors? it looks @ point microsoft has elected not make possible, considering future: http://connect.microsoft.com/visualstudio/feedback/details/646880/code-contracts-dont-listen-to-treat-warnings-as-errors-setting

MVC Why unit test controllers -

just provocative question why thing should unit test controllers in mvc why not write test against models or service layer. a example should 1 (in bdd-style): given user 'snehal' not exists when create new user credentials 'snehal' , 'so@123' , log in user should see welcome page this scenario expecting new user should see welcome page when log in first time. @ least me, controller's job , nice feature make sure works.

Is it considered accepted using var's as "shortcuts" in c#? -

one use var type in c# seems shortcuts/simplifying/save unnecessary typing. 1 thing i've considered this: myapp.properties.settings.default.value=1; that's ton of unnecessary code. alternative declaring: using myapp.properties; -- or -- using appsettings = myappp.properties.settings; leading to: appsettings.default.value=1 or settings.default.value=1 abit better, i'd shorter still: var appsettings = myfirstcsharpapp.properties.settings.default; appsettings.value=1; finally, it's short enough, , used other annoyingly long calls accepted way of doing it? i'm considering whether "shortcut var" pointing existing instance of whatever i'm making shortcut too? (obviously not settings in example) it's acceptable code in compiler take , know it. it's acceptable code logically in shortens code later. it's not different defining variable type (int/bool/whatever) rather saying var. when you're in studio, putting mouse

wcf - How does wsDualHttpBinding work? -

can tell me how wsdualhttpbinding work , difference between sockets , wsdualhttpbinding? i think microsoft did great job. never thought web service able call client again whenever wishes. how possible? never saw other language supporting type of webservice, not in java , not in php. there nice article on idunno.org showing an example of how use wsdualhttpbinding . showing how subscribe clients, push updates, etc.

c# - pascal-like string literal regular expression -

i'm trying match pascal string literal input following pattern: @"^'([^']|(''))*'$" , that's not working. wrong pattern? public void run() { using(streamreader reader = new streamreader(string.empty)) { var linenumber = 0; var linecontent = string.empty; while(null != (linecontent = reader.readline())) { linenumber++; string[] inputwords = new regex(@"\(\*(?:\w|\d)*\*\)").replace(linecontent.trimstart(' '), @" ").split(' '); foreach(string word in inputwords) { scanner.scan(word); } } } } i search input string pascal-comment entry, replace whitespace, split input substrings match them following: private void initialize() { matchingtable = new dictionary<tokenunit.tokentype, regex>(); matchingtable[tokenunit.tokentype.identifier] = new regex (

Flash IDE Project ActionScript 3 To Flex: How to convert? -

hi have project build flash cs3 ide , actionscript 3. need integrate feature file refrence class. avail in flex. want migrate flex(mxml).. how possible? i did code, doesn't work projectfile.mxml <?xml version="1.0" encoding="utf-8"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete = "initapp()" > <mx:script> <![cdata[ import mx.core.uicomponent; public function initapp():void { var app:applications = new applications(this); addchild(app); } ]]> </mx:script> </mx:application> applications.as applications class called fla earlier, need add base class mxml. package { import com.anotherclass; import flash.display.*; import flash.events.*; public class main extends sprite { public var _mystage:stage; public function main() {

c - Cross-platform (microcontroller-PC) algorithm development -

i asked develop algorithm network application on c. project developed on linux pc , transferred more portable platform, include microcontroller. there many microcontroller/companies out there provide nice , large libraries tcp/ip. software hold statistics on network performance. the whole idea of cross platform (uc - pc) seems rubbish me cause code should written in more platform specific way microcontroller, not expert judge anyway. is there clever way of doing or there did before? brainstorming has "wrapper library" , "matlab"... ideas? thx! i agree extent - want target system , system on developing in interim should close possible (it better if can match). nevertheless idea cross-platform started firmware development while hardware being designed. instead of doing on linux - use embedded os simulator. here steps - step 1: identify os embedded system; make sure os has simulator runs on pc (win or linux) typical embedded os simulator include vx

Flash Builder 4 import services .as files -

i working on shared project in flash builder 4. our data coming through web services. have put generated .as files vss can share them. can't figure out how import files. see files others have created under services directory can't figure out how them appear in data/services view. know how this? it looks information in file .fml extension. located in project.model directory. besides fact can't file within flash builder check out, don't know idea source control project file. looking @ options have maintain these service files.

jquery - Using fadeOut() and fadeIn() on mouseover and mouseout -

my problem when using fadeout() on mouseover , fadein() on mouseout() (on < li > component), not getting results expecting. happens when mouse not on object, buttons want fadeout() keep fading in , out in loop , loop stops , doesn't. what proper way of using fadeout , fadein mouseover , mouseout? here code: comment.onmouseout = function() {mouseout(comment);}; comment.onmouseover = function() {mouseover(comment);}; where comment basic < li > buttons children function mouseout(parent){ var children = parent.childnodes; var i=0; for(i=1;i<children.length;i++){ if(children.item(i).tagname=="input"){ $(children.item(i)).fadeout(); } } } function mouseover(parent){ var children = parent.childnodes; var i=0; for(i=1;i<children.length;i++){ if(children.item(i).tagname=="input"){ $(children.item(i)).fadein(); } } } using mouseenter , mouselea

java - 'The user must supply a JDBC connection' on weblogic restart -

i using weblogic 11. after initial deployment of jms configurations, jdbc configuration (from xads-jdbc.xml) , ears works properly. but after weblogic restart application fails initialize error caused by: java.lang.unsupportedoperationexception: user must supply jdbc connection @ org.hibernate.connection.usersuppliedconnectionprovider.getconnection(usersuppliedconnectionprovider.java:54) @ org.hibernate.tool.hbm2ddl.suppliedconnectionproviderconnectionhelper.prepare(suppliedconnectionproviderconnectionhelper.java:51) @ org.hibernate.tool.hbm2ddl.schemavalidator.validate(schemavalidator.java:130) @ org.hibernate.impl.sessionfactoryimpl.<init>(sessionfactoryimpl.java:349) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1327) @ org.hibernate.cfg.annotationconfiguration.buildsessionfactory(annotationconfiguration.java:867) @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:669) @ org.hibernate.ejb.hibernatep

wordpress - Undefined index errors (PHP) -

i'm getting notices of undefined index "id" on lines 3, 6 , 7 in code. can't figure out i'm doing wrong: if ( isset($_post['action']) && $_post['action'] == 'save' ) { foreach ($options $value) { if(($value['type'] === "checkbox" or $value['type'] === "multiselect" ) , is_array($_request[ $value['id'] ])) { $_request[ $value['id'] ]=implode(',',$_request[ $value['id'] ]); //this take array , make 1 string } $key = $value['id']; $val = $_request[$key]; $settings[$key] = $val; } i'm thinking small thing fix haven't had luck i've tried. 1 thing did run var_dump($key) , $key null , it's not. i'm assuming has this. this part of options page wordpress theme, way. code runs part of "save" function. the script works if debug mode turned off, when debug mod

c# - why does Enumerable.Except returns DISTINCT items? -

having spent on hour debugging bug in our code in end turned out enumerable.except method didn't know about: var ilist = new[] { 1, 1, 1, 1 }; var ilist2 = enumerable.empty<int>(); ilist.except(ilist2); // returns { 1 } opposed { 1, 1, 1, 1 } or more generally: var ilist3 = new[] { 1 }; var ilist4 = new[] { 1, 1, 2, 2, 3 }; ilist4.except(ilist3); // returns { 2, 3 } opposed { 2, 2, 3 } looking @ msdn page: this method returns elements in first not appear in second. not return elements in second not appear in first. i in cases this: var ilist = new[] { 1, 1, 1, 1 }; var ilist2 = new[] { 1 }; ilist.except(ilist2); // returns empty array you empty array because every element in first array 'appears' in second , therefore should removed. but why distinct instances of other items not appear in second array? what's rationale behind behaviour? i cannot sure why decided way. however, i'll give shot. msdn describes except thi

Access intermediary model values Django -

i have simple question. using example django above. how can example invite_reason person on group ? or joined dates groups person ? thanks. class person(models.model): name = models.charfield(max_length=128) def __unicode__(self): return self.name class group(models.model): name = models.charfield(max_length=128) members = models.manytomanyfield(person, through='membership') def __unicode__(self): return self.name class membership(models.model): person = models.foreignkey(person) group = models.foreignkey(group) date_joined = models.datefield() invite_reason = models.charfield(max_length=64) you'll need query membership model that, so: memberships = membership.objects.filter(person=person, group=group) membership in memberships: membership.invite_reason alternately, query based on relation: memberships = person.membership_set.filter(group=group) membership in memberships: membership.invit

uikit - Most performant way to use a background image throughout an iphone application -

i have image want use background every view in application including several modal views. right i'm creating new uicolor each view: view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"metal-bg.png"]]; this works part modal views there brief period during sliding animation before background image displays when can see through modal view view below it. is there better way this? such setting sort of global object views can use? have tried setting background image in viewwillappear:(bool)animated ?

Nginx + Passenger + Rails 3 Rack processes hang -

i have mysql backed rails 3 application. have scaling issues reads on database , working on fixing them independently. in meantime, since database queries take many minutes run, passenger spawns multiple rack processes (upto limit specified), of them wait / hang waiting database. at point, nginx refuses accept more connections. is there way can tell passenger timeout rails delegated calls , free resources can listen incoming requests? thanks. if you're handling queries in requests take many minutes, you're doing wrong. requests should fast possible. several minutes unacceptable. consider off-loading long-running queries delayed::job, can run in background instead of blocking other requests. also, don't know query you're running, if it's taking many minutes might want consider analyzing them.

delphi - How to test the type of a generic interface? -

i'm not sure if title makes sense, hope can understand question code. given following code publish/subscribe framework. type imessage = interface ['{b1794f44-f6ee-4e7b-849a-995f05897e1c}'] end; isubscriber = interface ['{d655967e-90c6-4613-92c5-1e5b53619ee0}'] end; isubscriberof<t: imessage> = interface(isubscriber) procedure consume(const message: t); end; tmessageservice = class private fsubscribers: tlist<isubscriber>; public constructor create; destructor destroy; override; procedure sendmessage(const message: imessage); procedure subscribe(const subscriber: isubscriber); procedure unsubscribe(const subscriber: isubscriber); end; that used this: tmymessage = class(tinterfacedobject, imessage); tmysubscriber = class(tinterfacedobject, isubscriberof<tmymessage>) procedure consume(const message: tmymessage); end; tmyothermessage = class(tinterfacedobject, imessage); tmyoth

ComponentNotFound exception Castle.Windsor -

i trying started castle.windsor , following comment made on samples available newbies (http://stw.castleproject.org/windsor.silvertlight_sample_app_customer_contact_manager.ashx?discuss=1), thought i'd take bull horns , update example provided here http://dotnetslackers.com/articles/designpatterns/inversionofcontrolanddependencyinjectionwithcastlewindsorcontainerpart1.aspx . this simple , straightforward console application making use of castle windsor, albeit outdated version. main method in program.cs follows: public static void main() { iwindsorcontainer container = new windsorcontainer(); container.install(fromassembly.this()); var retriever = container.resolve<ihtmltitleretriever>(); console.writeline(retriever.gettitle(new uri(configurationmanager.appsettings["fileuri"]))); console.read(); container.dispose(); } and service , components, in same file i.e. program.cs thus: public interface

php - How to kill a web process -

i have web script takes long time run (and it's supposed take long time). "web script" mean script that's run visiting page in browser , opposed executed on command line. script in php , i'm on lamp stack. how can find , kill process if want to? "kill" might wrong word. want script stop. conceivably make script "watch" state of system change, , halt when notices change. if that, i'm not sure best way be. in case, i'm open suggestions. when script starts, write pid file, file_put_contents(getmypid ().".pid","running"); and when script done, deletes file. you create script run form cron. looks pid files on age, , kill $pid on them simple.

powershell - Help inserting db query results to a CSV file -

i have table contains information pointing files stored on file server. i'm trying write powershell script verify each record in table has physical file associated on server, if not write csv file. i'm not having luck wit csv portion , hoping help? here have far (please let me know if there better ways this, im brand new powershell). want add records csv if test-path fails find file in question. [reflection.assembly]::loadfile("c:\ora10g\odp.net\bin\2.x\oracle.dataaccess.dll") $connectionstring = "data source=xxxxxx;user id=xxxx;password=xxxxxxxx;" $connection = new-object oracle.dataaccess.client.oracleconnection($connectionstring) $connection.open() $querystring = "select key, sequence, type, file filetable type in (2, 5)" $command = new-object oracle.dataaccess.client.oraclecommand($querystring, $connection) $mediaobjrs = $command.executereader() # loop through recordset while ($mediaobjrs.read()) { # assign variables recordset.

security - How to programmatically do a switch user on macosx -

i working on security agent plugin on mac os x , allow user switch user (in same way of button "switch user" displayed when lock account). after research, found this thread following solution command line: /system/library/coreservices/menu\ extras/user.menu/contents/resources/cgsession -suspend launching command line works when user logged in. however, in context of security agent plugin: "the security agent runs restricted permissions user must physically present, using graphical user interface, in order authenticated. graphical user interface elements can’t used through command-line interface such terminal application or secure shell (ssh) remote session" so command line call fails execute. there other solution simulate switch user, sending apple event? didn't find other solution. thanks in advance idea. best regards try making launchagent runs each user. in security agent plugin, connect agent current console user (eg using bsd socket

c# - Serialize as object using json.net -

i want properties serialized 'objects' , not strings. e.g. {"onclickhandler": onclickhandler, "onmouseout": onmouseouthandler} the class def this: public class handlers { public string onclickhandler; public string onmouseouthandler; } currently comes out as: handlers: {"onclickhandler": "onclickhandler", "onmouseout": "onmouseouthandler"} as can guess, these client side event handlers , correspond javascript functions defined elsewhere. emitting them within quotes, not interpreted functions literal strings. edit: taking cue out of dave's answer, figured out way: first little bit of scrubbing: for (var handler in this.handlers) { if(window[this.handlers[handler]]) this.handlers[handler] = window[this.handlers[handler]]; }; and call jquery bind normally $elem.bind(this.handlers); accepting dave's answer closest. as else mentioned, wouldn&

SQL Dynamic Column Query -

possible duplicate: is there way create sql server function "join" multiple rows subquery single delimited field? i have table of "events", , each event has a list of 1-4 (essentially variable #) "users". let's events today, , want list users dynamic number of columns, rather repeated rows. right have select e.eventid, e.time, u.name events inner join users u on e.userid = u.userid date = '12/20/2010' this brings me results like: eventid, time, name 211, '4:00am', 'joe' 211, '4:00am', 'phil' 211, "4:00am', 'billy' 218, '7:00am', 'sally' 218, '7:00am', 'susan' i can work , it's acceptable, duplication eventid , time (there more columns in actual query) seems wasteful me. in output this: eventid, time, name1, name2, name3 211, '4:00am', 'joe', 'phil', 'billy' 218, '7:00am', 'sally', '

javascript - Catch-all or error routes in Sammy.js -

is possible define catch-all route or error route in sammy.js? know can bind 'error' if no route matches not seem triggered. thanks! according documentation sammy routes , paths can defined strings or regular expressions. as such, should possible create route this, @ end of routes, catch-all: get(/.*/, function() { ... });

python - "too many values to unpack error" when trying to create a batch in pyglet -

i have been trying batches work in pyglet, confused error message "too many values unpack" coming pyglet/graphics/__init__.py file. guess that doing wrong syntaxwise when adding geometry batch. i cut down code essential parts create error: from pyglet.gl import * pyglet.graphics import * import pyglet batch = pyglet.graphics.batch() img = pyglet.image.load('pic.png') texture = img.get_texture() class textureenablegroup(pyglet.graphics.group): def set_state(self): glenable(gl_texture_2d) def unset_state(self): gldisable(gl_texture_2d) texture_enable_group = textureenablegroup() class texturebindgroup(pyglet.graphics.group): def __init__(self, texture): super(texturebindgroup, self).__init__(parent=texture_enable_group) self.texture = texture def set_state(self): glbindtexture(gl_texture_2d, self.texture.id) gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear) gltexparameter

python command line programming examples, recipes -

there has been need python command line utilities @ work lately , have no experience in writing cli's. regardless, must still pop them out. my biggest hurdle structure of these programs. also, method in getting , verifying input user. have been ending looong while loops , dont think efficient approach. could provide links open source cli programs may pick gain bit of understanding? or, books, tutorials, etc hands on. have dug around have had little success (my google skills must lacking). i baker . use so: % cat my.py import baker @baker.command def cmd(start, end): print '%s %s' % (start, end) if __name__ == '__main__': baker.run() % python my.py cmd 2010-12-01 2010-12-31 2010-12-01 2010-12-31

c# - upload several files at once -

i'm building website simple cms. built form input type="file" upload pictures, client wants upload several files @ once. i've looking , found uploadify , found bugs , want try else. help?? thanks in advance ;) have @ plupload . this plugin uses many different technologies upload multiple files server html5, gears, flash, html4, silverlight , select 1 best fits in user browser. it feature jquery ui plugin upload queue.

java - determining if a Class object is an instance of an abstract class -

i'm trying determine if generic class object instance of abstract class. far i'm not having luck. below code i'm trying use. abstractactivity name of parent class extend of activities from. public void startactivity(intent intent) { componentname name = intent.getcomponent(); if(name != null) { class<?> cls = null; try { cls = class.forname(name.getclassname()); if(cls.isinstance(abstractactivity)); { //do } else { super.startactivity(intent); } } catch (classnotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } } super.startactivity(intent); } i try: if(abstractactivity.class.isassignablefrom(cls)) { .... }

django - How to format unicode strings to utf-8 in Python? -

i'm reading in json string littered u'string' style strings. example: [ { "!\/award\/award_honor\/honored_for": { "award": { "id": "\/en\/spiel_des_jahres" }, "year": { "value": "1996" } }, "guid": "#9202a8c04000641f80000000003a0ee6", "type": "\/games\/game", "id": "\/en\/el_grande", "name": "el grande" }, { "!\/award\/award_honor\/honored_for": { "award": { "id": "\/en\/spiel_des_jahres" }, "year": { "value": "1995" } }, "guid": "#9202a8c04000641f80000000000495ec", "type": "\/games\/game", "id": "\/en\/set

opengl es - Android Graphics Memory Limits -

i creating android game using opengl , cocos2d port (http://code.google.com/p/cocos2d-android-1). targeting wide range of devices , want ensure performs well. test on nexus 1 , hoping input people experience on slower devices. currently game uses 2 1024x1024 textures 2 256x256 textures. within limits of devices? have rule of thumb or experience graphics memory limits in these cases? if gfx memory exceeded page normal memory? afaik memory limits textures same memory limits of app, 16 megs in situations believe, although might available phone memory that's accessible. i've loaded more apps before ran problems, @ least 1 2048x2048 texture , several 512x512 textures, 8888 in memory. i've never had oom error on texture binding, on loading bitmaps, hope helps.

How to add a Web Part Zone to a SharePoint wiki page? -

i have team site. understand default home page of team site wiki page. want add web part zone page. how can that? default has web part zone -. you can use sharepoint designer add web part zone , works fine. not able add web part zone using sharepoint web ui? ususally when have web part zone in page, using sharepoint web ui, allows add/remove web part. not case web part zone on default home page of team site. also there way can add web part zone page? know can add web parts wiki page content. want add new web part zone users can add/remove web parts. thanks, hitesh have tried adding web part zone in sharepoint designer? also, in case didn't know, can turn off wiki default page deactivating feature @ site level.

ruby - How to insert line endings in Sinatra -

i wondering how perform output in multiple lines in sinatra. eg. get '/test' array= ["one","two","three"] "#{array.each { |elem| elem}}" end ideally have output: one 2 3 not onetwothree i'm new sinatra , ruby (first day of study) please apology me basic question (can't find answer anywhere) plain text newlines ["one", "two", "three"].join("\n") or html line breaks: ["one", "two", "three"].join("<br>") reference: http://ruby-doc.org/core/classes/array.html#m002182 note: it's not sinatra problem. newlines intepreted differently in html, plain newlines aren't interpreted such html, unless inside <pre> block; outside <pre> <br> used linebreaks.

jsp - How to invoke another servlet in a servlet? -

this question has answer here: how execute multiple servlets in sequence? 2 answers as title metioned, how invoke servlet in servlet , invoked servlet response? use requestdispatcher instance available through httpservletrequest instance. however, if you're looking @ getting hold of single instance held servlet container [like using getservlet method in servletcontext instance], it's entirely different story. servlet specs have purposefully deprecated operation might allow such option. but, if really want invoke 1 servlet while executing other one, use include method of requestdispatcher instead of forward method.

android - How to strech the image to the width of the layout? -

hi, i want stretch image layout width, how can using xml layouts ? <linearlayout android:layout_width="700dp" android:layout_height="310dp" android:orientation="vertical"> <textview android:id="@+id/widget37" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="welcome ramesh kumar," android:paddingtop="5dp" android:textsize="10dp" android:textcolor="#02284d" android:gravity="left"> </textview> <textview android:id="@+id/widget37" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="employee id: 152490" android:textsize="10dp" android:textcolor="#02284d" android:gravity="left"> </textview> <relativ

apache - Sharing variables across multiple sessions -

i know cannot have global variable in backend code (java or php or else) , have different users (and hence sessions) see same value. if need share values across these user sessions need write them db , read out every time. seems awfully wasteful me. i understand apache process (or app server) fork , having global values not work if looking @ specialized application there web server lets me this? should possible in web server uses threads instead of forking processes. if need share global memory need have kind of locks access them. understand (and will) buggy degrade performance compared db? thoughts? pav i'm not sure that's entirely true. apache handle each user connection individually - correct. however, know in java possible have singleton object exists life of application, in potentially store values used across user sessions. when handling each user connection on server side, each access singleton access same object - therefore same values. you migh

C# Elegant way to handle checking for an item in a collection -

i've posted code sample below. firstly let me explain termstore.groups in code below collection of group objects (the exact class irrelevant). checking null : if (termstore.groups[groupname] == null) seems logical (clean) approach, if groups collection empty exception produced. using termstore.groups.contains not option either because expects strong type i.e: .contains(group)... not .contains(groupname string) can recommend clean / generic way can check if item exists in collection . thank you.... termstore termstore = session.termstores.where(ts => ts.name == termstorename).firstordefault(); if (termstore.groups[groupname] == null) { termstore.creategroup(groupname); termstore.commitall(); } update: exact class sharepoint taxonomy classes. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.group.aspx update 2, exact collection : http://msdn.microsoft.co

MySQL storing duration time - datatype? -

i need calculate time user spends on site. difference between logout time , login time give me "mr x spent 4 hours , 43 minutes online". store the4 hours , 43 minutes declared this: duration time not null is valid or better way store this? need store in db because have other calculations need use + other use cases. storing integer number of seconds best way go. the update clean , simple - i.e. duration = duration + $increment as tristram noted, there limitations using time field - e.g. " time values may range '-838:59:59' '838:59:59' " the days/hours/minutes/seconds display formatting won't hardcoded. the execution of other calculations surely clearer when working integer "number of seconds" field.

sql server - Why does SQL Management Studio add a cross join? -

i need run basic updates on join. example: update t1 set col1 = 'val1' table1 t1 inner join table2 t2 on t1.id = t2.t1_id t2.col3 = 'val3' this works perfectly, reason, in ms sql management studio express, wants convert to update t1 set col1 = 'val1' table1 t1 inner join table2 t2 on t1.id = t2.t1_id cross join t2 t2.col3 = 'val3' it adds crossjoin reason don't understand. now question is: why management studio think meant? must have genuine use, otherwise wouldn't suggest it. yet have no idea how , when (and why). according msdn cross join equivalent inner join. perhaps uses cross joins because cross join can used create cartesian products simpler joins - whereas inner join more limited.

joomla1.5 - joomla components donation -

can 1 please show me component can manage donation offer many way pay donation , show them in front end of joomla . thank you here simple module allows visitors donate money you. check out "donations" category in joomla extensions directory alternative modules

How to get the resultant array from a Mongoid::Criteria without an "each" block -

our application uses ajax heavily , result of have statements var items = #{@items.to_json} in our views. @items being set in controller @items=item.all . problem @items mongoid::criteria , doesn't have .to_json method. so, it's throwing error while rendering view. there easy way convert criteria object array without using code @items.collect {|i| i} use #entries method in criteria request: @items = item.all.entries

android - java convert object array to int array -

how can this? have object array id convert int array if object[] objectarray objectarray = {2,23,42,3} then public static integer[] convert(object[] objectarray){ integer[] intarray = new integer[objectarray.length]; for(int i=0; i<objectarray.length; i++){ intarray[i] = (integer) objectarray[i]; } return intarray; } if objectarray object[] objectarray = new integer[/*length*/]; you can cast (integer []) objectarray;

java - Redirect to foreign page by embedding request -

how call/redirect foreign page embedding request object servlet? that's not possible. need response object. response.sendredirect("http://google.com");

ruby - Problems with the rails console, RVM and readline -

i've installed rvm way of making sure local development version of ruby same server's particular app work on (ruby 1.8.7). i've done this, , installed ruby 1.8.7 ok. however, when try start rails console error: readline unable required, if need completion or history install readline reinstall ruby. may follow 'rvm notes' dependencies and/or read docs page http://rvm.beginrescueend.com/packages/readline/ . sure 'rvm remove x ; rvm install x' re-compile ruby readline support after obtaining readline libraries. couldn't load wirble: no such file load -- wirble i've read notes on page error refers (http://rvm.beginrescueend.com/packages/readline/), , followed instructions, involve installing readline, uninstalling ruby 1.8.7, installing ruby 1.8.7 again readline support. (actually page uses ruby 1.9.2 example i'm assuming should work 1.8.7 well. perhaps that's not case). but, still same error. has else been through , figured out?

replace - Delphi how to do SearchReplace in a component property in all the files of a project? -

i need searchreplace in forms (all dfm) changing occurences of ':' ';' in tquery.strings (of type tstrings ). how can accomplish this? i'd @ desing time: dfm contain ";", not runtime substitution. try e.g. cnpack, huge set of useful addons. in pack it's called property corrector.

javascript - jQuery animation if load() returns something different -

setinterval(function() { var prevtoparticle = $("#toparticles table:first").html(); $("#toparticles").load("myurloffeed.com/topfeed", function() { alternatebg(); var newtoparticle = $("#toparticles table:first").html(); if (prevtoparticle!=newtoparticle) { $("#toparticles table:first").effect("highlight", {color:"#faffc4"}, 2000); } }); }, 8000); so sets current first table item variable, loads toparticles div tables off url, , if different perform highlight effect, highlight effect anyway, unsure why isn't working. for reason 1 of articles outputting twitter link , other wasn't, thought feeds same. figured out using console.log of 2 var

php - phpdaemon (phpdaemon.net) -

im playing around script should used invocationscript service. uses mongodb datastorage. right im using apache webserver, im not satisfied perfomance. have been looking @ phpdaemon http://phpdaemon.net , , wants try out. cant figure out how make simple example run. i have installed phpdaemon , using example config. can run phpd , tells fastcgi up. here im stuck. if try call server browser on port 9000 nothing happens. could me setup simple example setup working? br/sune