Posts

Showing posts from May, 2010

sql - SQLite join optimisation -

if have query such as: select a.name, a.description inner join b on a.id1 = b.id1 inner join c on b.id2 = c.id2 group a.name, a.description what optimal columns index query in sqlite if consider there on 100,000 rows in each of tables? the reason ask not performance query group expect rdbms (sql server) when apply same optimisation. would right in thinking columns referenced on single table in query in sqlite need included in single composite index best performance? the problem you're expecting sqlite have same performance characteristics full rdbms. won't. sqllite doesn't have luxury of getting cache quite in memory, has rebuild cache every time run application, limited set number of cores, etc, etc, etc. tradeoffs using embedded rdbms on full one. as far optimizations go, try indexing lookup columns , test. try creating covering index. sure test both selects , code paths update database, you're speeding 1 @ expense of other. find indexing

Visual Studio 2010 doesn't start - missing ATL100.dll -

after installing visual studio 2010 premium , trying start it, following error message pops up: program can't started, atl100.dll missing. reinstall program solve problem. i searched atl100.dll , found in: "c:\program files (x86)\microsoft visual studio 10.0\vc\redist\ia64\microsoft.vc100.atl" "c:\program files (x86)\microsoft visual studio 10.0\vc\redist\x64\microsoft.vc100.atl" "c:\program files (x86)\microsoft visual studio 10.0\vc\redist\x86\microsoft.vc100.atl" copying file "c:\program files (x86)\microsoft visual studio 10.0\common7\ide" won't work. tips how fix problem can start vs 2010 ? if atl stands "active type library" helper dll it. because atl com based framework, necessary register dll. copying not work in case. regsvr32 atl100.dll just hint next time.

javascript - Can anyone explain this jQuery plugin to me? -

how this plugin works in translating other language. i want use plugin translating language. how works , need documentation plugin. can it.? suggestions please> i can't seem find documentation plugin (but others seem have). , homepage provided in code offline. as don't want analyse code suggest use jquery localisation plugin instead in part reused in plugin mention in question has nice documentation , examples

winforms - Main form not shown in Taskbar -

what reasons main application form not shown in taskbar? showintaskbar property set "true", form doesn't show there if after running application , before main form appears switch other window. form exists, until minimize apps above make visible, won't show in taskbar. update. form not have owner. i've added form.activate() after form.show(). jumps out when loaded, , doesn't lost under other screens. though not solution, crutch, responses welcome anyway.

javascript - Append bannercode from a webpage -

i've got problem i'm having trying append bannercode end of url. customer journey follows: person receives email contains link site (site1), url contain banner code e.g. www.site1.com?banner=helloworld once person on site, there 2 buttons take customer second site: button 1 goes https://www.site2.com/page1 button 2 goes same url/page2   $(document).ready( function () { var banner = string($.query.get('banner')); if(banner){ href = $('a[href^="https://"]').attr("href") + "?banner=" + banner; $('a[href^="https://"]').attr("href", href); } }); basically happens is, piece of code have makes both buttons go same url example button 1. how can script not change url buttons? in advance. do understand right: want add banner part every link, keep original part unchanged? $(document).ready(function(){ var banner=string($.query.get('banner')); if(

c# - Charting in Gtk / Gtk# -

i create simple charting system stock in gtk# (and c#), possibilities draw inside it. don't know start: it's best start scratch ? or using pre-made ? best use cairo ? or system.drawing ? there piece of code can reuse ? thanks medsphere has custom gtk# widgets , amongst them graph, have here overview , here graph documentation.

javascript - jQuery Tablesorter plugin doesn't work with rowspan in table body -

does plugin not work columns have rowspan? here example: http://www.dnsdebug.com/sortable-rowspan.html i presume i'm going have delve plugin make work? the plugin not support because not known how want handle "rowspaned" cell. gives value of rows uses ? or first ? even if clear in mind, computer cannot guess. recommend use tabs without rowspans because easier program , easier read , understand user.

Database table design for a multi-language dictionary application, any recommendation? -

i want build dictionary iphone app language associated many different languages. thus, 1 word in original language have different translations different languages. have recommendation such database design using sql? bunch guys/gals. #database: mysql #language: python #platform: google app engine #application: multi-language dictionary sounds one-to-many between table base language word , translation table have language, translated value, , foreign key base word.

iphone - positioning subclassed UIAlertView window with onscreen keyboard on iOS -

i'm using subclassed uialertview window login prompt in application (i know it's against apple guidelines not submitted appstore it's not problem). the code add text fields , position window on screen looks this: - (id)initwithtitle:(nsstring *)title delegate:(id)delegate { if (self = [super initwithtitle:title message:@"\n\n\n" delegate:delegate cancelbuttontitle:@"cancel" otherbuttontitles:@"login", nil]) { uitextfield *logintf = [[uitextfield alloc] initwithframe:cgrectmake(12.0, 55.0, 260.0, 25.0)]; // text field settings removed code clarity [self addsubview:logintf]; self.logintextfield = logintf; [logintf release]; uitextfield *passwordtf = [[uitextfield alloc] initwithframe:cgrectmake(12.0, 85.0, 260.0, 25.0)]; // text field settings removed code clarity [self addsubview:passwordtf]; self.passwordtextfield = passwordtf; [passwordtf release];

c# - Use cookies from CookieContainer in WebBrowser -

is there way can use cookies cookie container (taken webrequest previously) , use them in webbrowser control? if so, how this? winforms application in c#. you need make use of internetsetcookie . here sample ... public partial class webbrowsercontrol : form { private string url; [dllimport("wininet.dll", charset = charset.auto, setlasterror = true)] public static extern bool internetsetcookie(string lpszurlname, string lbszcookiename, string lpszcookiedata); public webbrowsercontrol(string path) { this.url = path; initializecomponent(); // set cookie internetsetcookie(url, "jsessionid", globals.thisdocument.sessionid); // navigate webbrowser.navigate(url); } }

http - hitting a URL using java -

possible duplicates: how send http request in java? how use java.net.urlconnection fire , handle http requests? using java, how hit url? for instance, opening of http://www.xyz.com/node1 in browser tell xyz.com node1 hit. in java program (which sends sms text 'node1' in example above embedded in url sms gateway server) how achieve without opening browser or using servlet. you can use httpurlconnection . but using directly overkill if want load url in question. this guide shows how open url. basically boils down to: url url = new url("http://www.xyz.com/node1"); urlconnection conn = url.openconnection(); conn.connect(); //...

Doxygen-like for .sql files in a php application -

we using doxygen document our php application , it's working have problem database structure: document .sql file using create tables (arround 60 tables far). no sql procedures (might in future). what have describe role of each table , meaning of each column. found hypersql (http://projects.izzysoft.de/trac/hypersql/) found little verbose: 008: /** logging messages 009: * (here log our actions) 010: * @table iz_logging 011: * @col number id id sorting purposes 012: * @col date log_time time entry made 013: * @col char(1) log_level logging level. here: "!" errors, "*" main (job start/end), "+" sub (e.g. switch next owner), "-" minor 014: * @col varchar2(4000) log_entry log message 015: * @author andreas itzchak rehberg 016: */ 017: create table iz_logging ( 018: id number, 019: log_time date, 020: log_level char(1), 021: log_entry varchar2(4000) 022: ); is there tool wouldn't ask me repeat column typ

oop - Why java interfaces can't contain static methods implementations? -

i'm curious, wouldn't more convinient allow interfaces contain implementations of static methods? such methods contain short commonly used(by interface implementors) logic. because interface describes what . doesn't describe how .

How I can retrieve webcam info in python? -

i need retrieve number of webcams instaled in system , brand, manufacturer, device id, etc., of webcam. there way in python, , independent of operating system? there's no cross-platform solution, on linux can use os.popen('lsusb') (or along lines) , scrape screen (using grep or else). finding out on windows, can try using twain binding python (it's windows webcam protocol, python binding exists here , it's not actively maintained). videocapture might have need.

forms - how to find the POST or GET variables posted by mechanize (python) -

i'm using mechanize submit form this... import mechanize br = mechanize.browser() br.open('http://stackoverflow.com') br.select_form(nr=0) br['q'] = "test" br.set_handle_robots(false) response = br.submit() print response.info() print response.read() using firebug can see actual variables posted are: q test how can retrieve these programatically using python script? please note i'm not scraping - using example! also, know in case posted variables obvious, since there's 1 specified - not case! thanks :) print br.form.get_value('q')

How to return AlertDialogs from a generic class in Android? -

within public class doesn't extend other class i'm doing evaluation stuff , return dialog if needs communicated user. i'm using asynctask run method of instance of class main ui: private onlineactivities onlineactivities = new onlineactivities(); new doonlineactivity().execute(getapplicationcontext()); private class doonlinestuff extends asynctask<context, integer, dialog> { @override protected dialog doinbackground(context... params) { return onlineactivities.start(params[0]); } @override protected void onprogressupdate(integer... progress) { log.v(runtimevars.getmyname(), "asynconlinetask in progess"); } @override protected void onpostexecute(dialog result) { if (result != null) result.show(); } } now, public dialog start() method of onlineactivities.java creates dialog using context assigned via it's parameter. when dialog returned onpostexecute receive followin

android - It is possible to add a permanent sub-menu in the down part of my app??? (like html frame style menu) -

i making android app, , need have submenu, permanent, same menu in windows. menu haves navegability between parts of app, (googlemap view, invite, config , tabhost listviews) i can menu changes superior part of window? mean, html frames how can it? thanks set global menu on android application i think may you're looking for.

asp.net - Multiple Web Projects in one solution, Config Transforms -

i attempting setup config transforms on project migrated vs 2010. web project works fine, have wcf host project seem unable add transforms. has had problem before? you can add transformations, sure actual web.config file setup debugging process transforms completed when publish project different location!

asp.net - how to go from sql database to ajax/jquery -

how can go sql statement ajax? know broad question here trying , have tried. i have using asp.net(vb) connected database , put information in dataset , datagrid. (i don't want use datagrid anymore) i know how make dataset xml , json. after stuck. from purely jquery standpoint, if print json out otherwise blank page, jquery able load data via $.getjson() or appropriate ajax function. make sure don't print else page html tags.

android - "Unable to open database file" when using SQLiteOpenHelper with instrumentation context -

i'm trying create database contains mock objects testing purposes. i'd prefer have db reside in test package instead of in application package. protected class mockobjectopenhelper extends sqliteopenhelper { mockobjectopenhelper() { super(instrumentation.getcontext(), file_name, null, database_version); } @override public void oncreate(sqlitedatabase db) { ... } } when create sqliteopenhelper within app, pass in instrumentation context path that's relative test package's database directory. think allow me create database in test package, doesn't seem case. "databases" directory never created in test package. is there way have app create , access database resides in test project? the exception: 14:50:13.917 pool-1-thread-1 android.database.sqlite.sqliteexception: unable open database file @ android.database.sqlite.sqlitedatabase.dbopen(native method) @ android.database.sqlite.sqlitedatabase.<init>

java - Spring MVC and JSR 303 -

i'm using spring 3 , jsr 303. have form backing object nested objects need validated. in example below, how validate formobject.getfoo().getbean()? when run code below, result parameter empty, if html page submits nothing, when validation should fail. note works(i.e. validation fails) when validate manually calling validate(formobject.getfoo().getbean(), bean.class) . @controller public class formcontroller { @requestmapping(method = requestmethod.post) public void process(httpservletrequest request, @valid formobject formobject, bindingresult result) { ... } // class needs validated. public class bean { @notblank private string name; } public class foo { private bean bean; } public class formobject { private foo foo; } } if want validation cascade down child object, must put @valid annotation on field in parent object: public class bean { @notblank private string name; }

ajax - Working with jquery.validationEngine and codeigniter -

i trying make form check if username available or not. started use jquery.validationengine ( link ) because looks extremely simple. however, since i'm using codeigniter, have problem validation... example on mentioned site looks like: $("#formid").validationengine({ ajaxsubmit: true, ajaxsubmitfile: "ajaxsubmit.php", ajaxsubmitmessage: "thank you, received inscription!", ajaxsubmitextradata: "securitycode=38709238423&name=john", success : false, failure : function() {} }) what need change ajaxsubmitfile: "ajaxsubmit.php", line match codeigniter's mvc pattern, tried like ajaxsubmitfile: "<?php echo site_url('register/check_user'); ?>", where register controller , check_user function within controller. no matter try here 404 error in validationengine debugger. does know how resolve problem? ok, found answer... editing wrong file time... supposed edit jq

windows - In Python, how do I check if a drive exists w/o throwing an error for removable drives? -

here's have far: import os.path op d in map(chr, range(98, 123)): #drives b-z if not op.isdir(d + ':/'): continue the problem pops "no disk" error box in windows: maya.exe - no disk: there no disk in drive. please insert disk drive \device\harddisk1\dr1 [cancel, try again, continue] i can't catch exception because doesn't throw python error. apparently, happens on removable drives there letter assigned, no drive inserted. is there way around issue without telling script drives skip? in scenario, i'm @ school labs drive letters change depending on lab computer i'm at. also, have 0 security privileges access disk management. use ctypes package access getlogicaldrives function. not require external libraries such pywin32, it's portable, although little clunkier work with. example: import ctypes import itertools import os import string import platform def get_available_drives(): if 'windows'

sql server - SQL query for parent-child chain -

i have single table can refer 1 other member in table parent. parent refer 1 other row parent...and on. id col1 col2 parentid 1 foo bar null 2 blah boo 1 3 fob far 2 4 wob lob null i return chain given id. if id 3 return row 3, row 2 , row 1. if id 2 return row 2 , row 1. if id 1 or 4 return row. thank you use recursive cte : declare @id int set @id = 3 ;with hierarchy ( select t.id, t.parentid your_table t t.id = @id union select x.id, x.parentid your_table x join hierarchy h on h.parentid = x.id) select h.id hierarchy h results: id --- 3 2 1

c# - self tracking pocos, how to tell if a property has changed? -

((iobjectwithchangetracker)user).changetracker.state seems give me "unchanged" every time. when call applychanges picked properly, able make determination in business layer on whether has changed particular property, if did want perform action. updated i believe has fact don't serialize entities triggers change tracking. using them in asp.net scenario time time persist them (serialize) session state or viewstate. updated added more information in answer @ bottom of page. several options, each ups , downs: you keep private "original" value on domain objects. populate them when object db, , can check if each field equals original value. cumbersome on large objects, however. another option have domain implement icloneable, , keep deep copy of original object in data access layer, along logic pull up. deep copy still mutable, have take care not modify it, , doubles memory footprint. you re-retrieve record new instance, , check fields. si

iphone sdk 3.0 - CoreAudio - how to determine the end of the playing aac file -

i playing coreaudio on iphone, , unable find how know when song has finished play. i put property listener on kaudioqueueproperty_isrunning , working when starting playing not @ end of file. it's work when stop audioqueue... do have idea ? thanks lot. ps : using sample code excellent book iphone cool projects : http://apress.com/book/downloadfile/4453 edit : there’s bug in code went out book. fix requires small modification -[audioplayer audiorequestdidfinish:] calls [queue endofstream]. this class uli kusterer illustrates functionality clearly. here's header: // // uksound.h // mobilemoose // // created uli kusterer on 14.07.08. // copyright 2008 void software. rights reserved. // #import <uikit/uikit.h> #import <audiotoolbox/audiotoolbox.h> #define knumberbuffers 2 @class uksound; @protocol uksounddelegate @optional -(void) sound: (uksound*)sender didfinishplaying: (bool)state; @end @interface uksound : nsobjec

c# - How to AllowDrop only for specific types? -

i use librarybar display items have relationship. since there different relationships between items, have multiple containers. default setting if set allowdrop true librarybar, possible drag elements librarybar, , items added collection dropped. now don't want that. don't want possible drag item 1 librarybar another. can't set allowdrop false, because want drag tagvisualizations librarybar. so defined in method handles dropevents: public void ontargetdrop(object sender, surfacedragdropeventargs e) { //only if tagvisualization if (e.cursor.data image) { ((sender librarybar).tag isourcefile).unexpand(); e.handled = true; } else { //todo: cancel drag&drop } } as can see allow drops if cursor's data image (and therefore tagvisualization). works, no longer possible drop item librarybar librarybar. animation played

spring - Using one Java source file in two different projects, both under development -

i developing spring (java framework server-side web-development)web application, respond client-side java application(which uses socket communication) json object. @ same time, i'm working on both server-side , client-side java applications. the problem have bunch of files(say, json variable interfaces) being used @ both projects. now, have duplicate copies of interface, in different packages in 2 projects. causes inconsistency, because have update both files whenever need make change in interface. does have neat solution this? thanks you should treat shared code @ package level , not file level. you should create package of interface definitions used both client , server side of architecture , whenever package changes, both sides have change accordingly. edit: i wasn't explicit zellus' suggestion importing common code jar one.

c++ - Anything available implemented like Loki's AssocVector but with the functionality of Boost's Bimap? -

i wonder if aware of library code has performance characteristics provided loki's assocvector (locality of reference of elements, lower per-element memory overhead compared map) boost's bimap functionality (able query map both sides of relation)? or using sorted std::vector of std::pairs , adding functionality lookup vector using either element of pair key way forward? it depends on want fast. loki::assocvector has o( n ) insert , delete, while boost::bimap has o(1) when use hash tables. if can live o( n ) operations on 1 "view" of data structure , o(lg n ) on other, proposed solution work fine , take little memory. may fast small data sets, if operations on 1 view dominate. you may consider using boost.intrusive or boost::bimap specialized allocators.

android crash when using setVisibility(View.VISIBLE) -

i seem getting application crashes at: parent.findviewbyid(r.id.a_1).setvisibility(view.visible); not sure im doing wrong code below layouttext.java public class layouttest extends activity { private spinner solvefor; private arrayadapter<charsequence> featuresadapter; private list<charsequence> featureslist; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); featureslist = new arraylist<charsequence>(); featuresadapter = new arrayadapter<charsequence>(this, android.r.layout.simple_spinner_item, featureslist); featuresadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); solvefor = ((spinner) layouttest.this.findviewbyid(r.id.solvefor)); solvefor.setadapter(featuresadapter); featuresadapter.add("velocity&qu

hibernate - Maven and pom.xml -

i'm using m2eclipse , trying learn tapestry. i'm trying update project pull different resources maven. (or @ least, think that's i'm trying do). here's part of pom.xml: <dependency> <groupid>org.apache.tapestry</groupid> <artifactid>tapestry-hibernate</artifactid> <version>${tapestry-release-version}</version> </dependency> the artifact id used tapestry-core, tutorial i'm using said change tapestry-hibernate can use hibernate. changed pom.xml , saved it, i'm not sure command i'm supposed execute exactly. tried using of plugin commands "update dependencies", still don't have hibernate.cfg.xml file generated, think should have, right? i changed pom.xml , saved it, i'm not sure command i'm supposed execute exactly. m2eclipse should setup new dependencies (and download if necessary) after changed pom.xml without requ

php - Adding an arrow to link with children -

here's code of simpliest multilevel menu: <nav> <ul> <li><a href="#">i 1st level link</a></li> <li><a href="#">i 1st level link children , want have arrow next me (or different background)</a> <ul> <li><a href="#">i 2nd level link</a></li> <li><a href="#">i 2nd level link children , want have arrow next me (or different background)</a> <ul> <li><a href="#">i 3nd level link</a></li> <li><a href="#">i 3nd level link</a></li> </ul> </li> <li><a href="#">i 2nd level link</a></li> </ul> </li> <li><a href="#&qu

flush() Not displaying output in PHP? -

i have code: set_time_limit(0); header("cache-control: no-cache, must-revalidate"); header("expires: mon, 26 jul 1997 05:00:00 gmt"); ob_flush(); flush(); $start = time(); $secs = time() - $start; while ($secs <= 300) { echo "this script has been running $secs seconds.\n"; ob_flush(); flush(); sleep(1); } what i'd when view page, see in real time how long script has been running, this: script has been running 1 seconds. script has been running 2 seconds. ............ script has been running 300 seconds. instead blank window continuous 'loading' sign 5 minutes, , after 5 mins i'm bombarded load of these messages should've been getting 1 message @ time. can explain i'm doing wrong? ob_flush not flush . ob_flush clears object buffer that's been opened. since don't have object buffer open, nothing flushed. also, web browsers ,

Hibernate talking to different databases -

i need app talk 2 different databases, replicated(using postgres streaming replication). reason want have reads happening against 1 database , writes against other. i use hibernate in application. there out of box way achieve this? -thanks edit: , yes, please comment on whether trying achieve makes sense. hibernate supports sharding. see if helps you: http://www.hibernate.org/subprojects/shards.html if using spring know there way dynamically switch datasource. find more information here this similar question stackoverflow: handling multiple databases nhibernate in single application also same kind of question in other forum discussion: http://forum.springsource.org/showthread.php?t=12665

c# - Should I use a listener interface or handler for event callbacks in Android development? -

i'm new java, i'm porting on our windows phone 7 library run on android. due syntax similarities has been simple far. our library abstracted http message queue provides data persistence , integrity on mobile platforms. provides asynchronous methods design choice. on wp7 make use of delegates call user supplied callback when async message has been processed , servers response received. to achieve same thing on android i've found 2 ways far - simple java listener interface contains onsuccess , onfailure methods user must implement, or using android handler class provides message queue between threads (http://developer.android.com/reference/android/os/handler.html). i've gone handler @ stage if i'm honest similar c# delegate. seems less work user of our library implement. example of user code make use of our library: connection.getmessage("http://somerestservice.com", getcallback); handler getcallback = new handler() { public void handlemessage

jquery - How can I determine which column was clicked in a table using tablesorter? -

i using jquery , tablesorter add column sorting data on page. i want to record column sorted. how can determine column clicked? there event can hook into? setting own click event on .tablesorter .header should provide easy way getting column clicked whilst avoiding conflicts other tables

compiler construction - Can I compile IronRuby project in VS2010 into DLL/exe file? -

after created ironruby project in vs2010 using ironruby v1.1.x, able use .net library importing them. can't compile ironruby exe/dll. see build option can't build exe or dll ironruby project. please ! you can't compile ironruby classes .net assembly , access them assembly. preet right nearest can embed ironruby scripts in (say) c# assembly. c# side possible instantiate ruby classes. given following ruby class: class helloworld def say_hello puts 'hello' end end you load resource file , run c#: using microsoft.scripting.hosting; using microsoft.scripting.runtime; using ironruby; var runtime = ironruby.ruby.createruntime(); var engine = runtime.getengine("ruby"); var assembly = assembly.getexecutingassembly(); var stream = assembly.getmanifestresourcestream("pathtoresource.test.rb"); string code = new streamreader(stream).readtoend(); var scope = engine.createscope(); engine.execute(code, scope); dynamic helloworldc

How to start Android test unit from command line -

im writing automatic test program. have completed writing on android. however, want write script run command line adb shell. know how it? test many components of program, running script save lots of effort. thanks. here manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wsandroid.test" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="android.test.runner" /> </application> <uses-sdk android:minsdkversion="3" /> <instrumentation android:targetpackage="com.wsandroid" android:name="android.test.instrumentationtestrunner" /> thanks see android developer documentation , there set of commands run 1 single unit test:

Is there a unified logging system for Ruby? -

i wondering if there unified logging systems out there can support rails and delayed jobs, , relatively easy set up. i want able log same server/file execution context in application (rails, delayed jobs, etc), if i'm not in rails context. love rails logger, can't log while in resque job. ideas? do mean file-logger, similar syslog? ruby's got both logger , syslog . logger can log rolling, handles severity levels, , used in lot of ruby modules logging. can define name of file log to, or use stdout/stderr or io stream. the docs syslog pretty barebones, can info browsing source code, or reading ruby syslog readme .

php - Want to Call Javascript in FCKeditor code -

i want call onblur function in fckeditors. here code. <?php $ofckeditor = new fckeditor('conf_emailtext['.$this->escape($data->conf_id).']') ; $ofckeditor->basepath = $this->baseurl().'/fckeditor/' ; $ofckeditor->value = $this->arrmaillist[$i]['conf_emailtext']; $ofckeditor->height ='400px'; $ofckeditor->width ='650px'; $ofckeditor->create() ; ?> can me sort out problem? thanks in advance. kanji don't think so, it's possible set in php. can achieve using javascript on html/template page. <script type="text/javascript" language="javascript"> function fckeditor_oncomplete( editor_instance) { editor_instance.events.attachevent( 'onfocus', dosomething ) ; editor_instance.events.attachevent( 'onblur', dosomething1 ) ; } </script>

jquery - PHP returns HTML rather than JSON -

i trying json response server. jquery got html. way using zend framework. idea? thanks you use: $this->_helper->layout->disablelayout(); or $this->_helper->viewrenderer->setnorender(); and output json.

python - how to filled the data in django templates -

i want email template in django. template has 1 variable name . want filled value. how that. context not working because don't need render page. of course need render template - , via context. how not working?

c# - Get exception details from batch statement -

i've got application connect mysql 5-server via odbc-driver. i'm using prepared/parameterized batch-statements move data around @ server. working great, until moment goes wrong... insert blabla select blablabla; insert blabla select bliblibli; update blabla; // etc. now if statement goes wrong, unhelpful exception: system.data.odbc.odbcexception error [hy000] [mysql][odbc 3.51 driver][mysqld-5.0.26-pro-nt]unhandled error mysql_next_result() @ system.data.odbc.odbcdatareader.nextresult(boolean disposing, boolean allresults) @ system.data.odbc.odbcdatareader.nextresult() @ system.data.odbc.odbcdatareader.firstresult() @ system.data.odbc.odbccommand.executereaderobject(commandbehavior behavior, string method, boolean needreader, object[] methodarguments, sql_api odbcapimethod) @ system.data.odbc.odbccommand.executereaderobject(commandbehavior behavior, string method, boolean needreader) @ system.data.odbc.odbccommand.executenonquery() @ myapp.myclass

javascript - Operators not working? -

ok did according suggestion looks amatuerish ha.. cos repeats same thing each percentage group: css , message. wondering if there way change it? if not, ok this.. if (69 < percentdiscount && percentdiscount < 101) { $(this).find("#percentoff").html('&gt; 70% off'); $(this).find("#percentoff").addclass('badge70'); } else if (49 < percentdiscount && percentdiscount < 70) { $(this).find("#percentoff").html('&gt; 50% off'); $(this).find("#percentoff").addclass('badge50'); } else if (29 < percentdiscount && percentdiscount < 50) { $(this).find("#percentoff").html('&gt; 30% off'); $(this).find("#percentoff").addclass('badge30'); } else if (19 < percentdiscount && percentdiscount < 30) { $(this).find("#percentoff").h

oracle - sqlplus pass a string containing ' ' such as 'index1','index2','index3' -

i need pass value sql file cause executing condition in. instance : delete table col in ('index1','index2','index3') i have issue when try call sql file cmd using sqlplus command set indexes = 'index1','index2','index3' sqlplus script %indexes% when that, index1 passed or there problem tried that set indexes = "'index1','index2','index3'" sqlplus script %~indexes% but there problem too here sql: delete table col in (&1) do have idea how can pass string need ? thank you oracle not come built-in string tokenizer. so, have build our own. there several different solutions on so. here 1 published , work on 10g or higher. earlier versions try this one .

ajax - Is it possible to implement server side sorting and pagging in dhtml grid? -

i want implement dhtml grid . required server side sorting , pegging ajax support. dose 1 having idea how implement this. if want implement server side sorting not matter technology using in front end. on conceptual level can following things: write sortingservlet takes grid , sorts according request parameters passed , renders output in form of json(not strictly required have) use jquery make ajax call servlet , format response when back.

Erlang calculating HMAC-SHA1 example? -

any examples or libraries caculate hmac-sha1 in erlang? i tried crypto module, apparently doesn't match exactly. examples? to expand on previous answer, here hmac module in python using sha-1 algorithm key 'hello' , message 'world': >>> import hashlib >>> import hmac >>> hmac.hmac(key='hello', msg='world', digestmod=hashlib.sha1).hexdigest() '8a3a84bcd0d0065e97f175d370447c7d02e00973' here's equivalent in erlang. i'd use more efficient method convert binary mac hex digest in typical code, used 1 brevity: 1> crypto:start(). ok 2> <<mac:160/integer>> = crypto:hmac(sha, <<"hello">>, <<"world">>). <<138,58,132,188,208,208,6,94,151,241,117,211,112,68,124, 125,2,224,9,115>> 3> lists:flatten(io_lib:format("~40.16.0b", [mac])). "8a3a84bcd0d0065e97f175d370447c7d02e00973"

typeid - C++: type_info to distinguish types -

i know compilers have freedom in implementing std::type_info functions' behavior. i'm thinking using compare object types, i'd sure that: std::type_info::name must return 2 different strings 2 different types. std::type_info::before must type1 before type2 exclusive-or type1 before type2 . // this: typeid(t1).before( typeid(t2) ) != typeid(t2).before( typeid(t1) ) two different specialization of same template class considered different types. two different typedef -initions of same type same type. and finally: since std::type_info not copyable, how store type_info s somewhere (eg: in std::map )? way have std::type_info allocated somewhere (eg: on stack or on static/global variable) , use pointer it? how fast operator== , operator!= , before on common compilers? guess should compare value. , how fast typeid ? i've got class a virtual bool operator==( const a& ) const . since a has got many subclasses (some of unknown @ compile tim

wpf - Is there a way to cancel TabControl.Items.CurrentChanging? -

there unfortunately no tabcontrol.selectionchanging event (selector.selectionchanging), struggling implement behavior can cancel changing request. i tried handle tabcontrol.items.currentchanging (the items property , itemcollection ) event setting e.cancel (of currentchangingeventargs ) true, ui is updated new tab although item not changed in collection. is there way prevent user switching different tabitem when condition dissatisfied? i don't know exact reason why happens, , annoys me greatly. but here's workaround it: in sample below, checkbox "locking" current tab. checked means user can't change tab. void items_currentchanging(object sender, currentchangingeventargs e) { if (checkbox1.ischecked.value) { var item = ((icollectionview)sender).currentitem; e.cancel = true; tabcontrol1.selecteditem = item; } } basically, happens (if understand correctly) visual tree gets updated, logical tree not. ab

jquery - single checkbox updates state of muliple checkboxes -

i have group of checkboxes, 1 of them has label of 'none'. when ticked, i'd others disabled. if 'none' checkbox unchecked, checkboxes disabled, enabled again. i have following code: $(document).ready(function(){ $("#select_none").click(function() { $('#select_blue').attr('disabled', true); $('#select_green').attr('disabled', true); $('#select_red').attr('disabled', true); $('#select_black').attr('disabled', true); $('#select_white').attr('disabled', true); $('#select_yellow').attr('disabled', true); $('#select_pink).attr('disabled', true); }); }); this disables if checkbox has been clicked on, doesn't toggle. could me toggle functionality? try code $(document).ready(function(){ $("#select_none").click(function() { if(this.checked) { $('#select_blue').attr('disabled',

sql - Deleting Duplicate Records in Oracle based on Maximum Date/Time -

i have following sample data duplicate information: id date emp_id name keep --------------------------------------------------------- 1 17/11/2010 13:45:22 101 ab * 2 17/11/2010 13:44:10 101 ab 3 17/11/2010 12:45:22 102 sf * 4 17/11/2010 12:44:10 102 sf 5 17/11/2010 11:45:22 103 rd * 6 17/11/2010 11:44:10 103 rd based on above data set, how can remove duplicate emp ids , keep emp ids have maximum date/time specified? so based on above, see ids: 1, 3 , 5. thanks. something like: delete the_table_with_no_name date_column != (select max(t2.date_column) the_table_with_no_name t2 t2.id = the_table_with_no_name.id);

open source - I want to extend existing Ruby gem. How can I patch it locally? -

there open source gem hosted on github. i have found bug , want fix , send pull request back. gem locally installed. how can accomplish task? brilliantly answered @ forking gem rails project .(hint: use bundler locally)

How to set the focus on a javascript modal window? -

our website involves javascript produces overlay modal windows. there 1 accessibility problem though, once modal triggered, focus still on trigger element , not on modal itself. these modals can include sorts of html elements, headings, paragraphs , form controls. focus begin on first element within modal, h4 tag. i have explored using focus() function not work number of html elements. one thought add empty a tag in window gain focus, unsure method. very late party, existing answers not respect accessibility. the w3c wiki page on accessible modals offers more insight what's asked in op, relevant part having tabindex=-1 on modal container (which should have aria-dialog attribute) can :focus . this accessible way of setting focus on modal, there more documentation keeping in modal - , returning element triggered modal - quite lot explained here, suggest interested check link above.

.net - Is there a possibility to assign CssClass to CheckBox within CheckBoxList -

i need assign display style (cssclass) every checkbox within checkboxlist. separately every checkbox. , last requirement have on server side within .net code. not explicitly. can use attributes: listitem myitem = checkboxlist1.items[itemindex]; myitem.attributes["bgcolor"] = "lightblue"; as far having each checkbox use cssclass, each checkbox listitem , class not support cssclass.

Versioning Ruby gems in a git repository -

what best practices storing gems in 1 git repository? should kept in 1 repository? should each gem versioned on own? i'm concerned gems shared on per project basis - though defeats purpose of gem, can reused , shared in other projects. wanted easy way keep of gems versioned, preferably without having worry 50 git repos.. , push them gem server whenever they're ready pushed. i agree maarons bundler and/or rvm gemsets best practice, if want keep gem code versioned part of applications repo, think solution you're looking vendor gems , add them submodules application's git repo. you can vendor current gems running rake task: rake gems:build any new gems want install can installed plugin running ruby script/plugin install your_plugin . should clone git repo of plugin you're interested in. see appropriate plugin docs more options (like grab specific release).

html - Dynamic/Infinate UL / LI Hover expand....? -

i have created php script makes lovely list.... using database creates lots of items , sub items. database, can infinitively deep list , sub lists. how can used css (or put code in ul/li directly) allow infinite sub items displayed , when parents hovered over? example: <ul> <li>welcome! - levelno:0 id:1 parent:0 order:0</a> <ul> <li>test - levelno:0 id:13 parent:1 order:-3</a></li> <li>cars - levelno:1 id:2 parent:1 order:0</a> <ul> <li>bugatti - levelno:2 id:5 parent:2 order:0</a></li> <li>bmw - levelno:2 id:6 parent:2 order:1</a> <ul> <li>1 series - levelno:3 id:8 parent:6 order:0</a> <ul> <li>1 series d- levelno:0 id:14 parent:8 order:0</a></li> </ul> </li> <li>3 series - lev

html - css class not being displayed properly in auto scroll div -

i have overflow div on jquery modal dialog. <div style="overflow: auto; height: 300px; width: 780px;"> <fieldset> <br /> <asp:textbox id="txtnote" runat="server" cssclass="notetext" width="740px" rows="6" textmode="multiline" bordercolor="#cccccc" borderstyle="solid" borderwidth="1px" /> <br /> &nbsp; </fieldset> <div id="notes"> <% dim note new note() response.write(note.shownotes(val(txtref.text))) %>

What would the C code display? -

possible duplicate: reason output hi, can please explain me output of code snippet? answer "d" void main() { short int a=5; clrscr(); printf("%d"+1,a); getch(); } thanks. "%d" + 1 pointer "d" , in fact executing printf( "d", ); .

compilation - My monotouch application refuses to compile for distribution with Array index is out of range -

i unable compile app in monotouch when select full enterprise distribution profile have setup. other profiles work ok. to specific: when hit build button get detecting signing identity... 0 errors 0 warnings, build failed. array index out of range i guessing provisioning issue , have failed important. there pointers on web adhoc ditribution builds no real documentation on full enterprise distribution. i have following: monotouch : enterprise edition apple : enterprise membership, have installed corp certificate & dev user certificate , downloaded provisioning certificates dev, adhoc & enterprise , created app id. i have spent 2 days scouring web similar problems have found nothing close. @ 1 point scrubbed profiles apple dev site , re imported them , resolved other issues having. having full enterprise rights/certificate means not need udids, have sign life away prevent illegal ditribution. thing other plain missing on provisioning front udid's h

Interactive Graph Visualisations in ASP.NET Website (Drag/Select/Link/Unlink) -

we have requirements create website (asp.net v4.0) displays graph. should able do: display nodes (with names , colours) display links between nodes, text on link (e.g. '85%') interact nodes/links drag/move/select layouts out nodes in clear manner automatically can add/remove nodes (asynchronously) , link/unlink easily javascript interaction events (onclick, ondrag) events must provide identification of selected nodes/links (javascript). ability zoom in/out (ideally) updates asynchronously (rather full postbacks) responsive when displaying >100 nodes flash not supported must support ie6 (just don't ask...!) development visual studio 2010 on .net framework v4.0 we using syncfusion diagram tool (v. 6.1.0.34) running on v2.0, upgraded v4.0 , breaking change in system.web viewstate management means need find alternative. possible latest version (v8.3) better, we're reclutant fork out few thousand pounds licenses if bad. we found syncfusion tool ok,

php - How to learn SOAP? -

i've created web application mapping component. want use geocoding service other google, ones i've found use soap communicate website. i've never used soap before. know of resources me figure out? i"m using php integrate build web app. edit: need use soap geocoding right now... if know services too, that'd great. thanks! edit again: need learn soap can interact http://www.nn4d.com/site/global/build/web_services/geocoding_reversegeocoding/map24geocoder51service/map24geocoder51service.jsp learning soap on own requires learn xml , lots of soap-specific stuff. however, you've tagged question php, assume you're asking learn how use soap web service through php. different learning soap because php (like other languages) abstracts messy xml bits of soap , turns easy-to-use object. that's theory, anyway. there 2 soap toolkits in common use on php. 1 called nusoap. works well, no longer in active development (it written before php provided

php - Error when trying an additional SET command in query -

the mysql query below works is. replaces field votes_up in mysql database whatever value there variable $votes_up . update submission set votes_up = $votes_up submissionid = $id however, when try add second condition simultaneously replace field called flag1 value of variable called $uflag , error message. query i'm trying use below. error message says unknown column 'admin' in 'field list' if value of $uflag "admin". also, value of $uflag not being put database. ideas why getting error? update submission set votes_up = $votes_up, flag1 = $uflag submissionid = $id you need add quotes string values: update submission set votes_up = $votes_up, flag1 = $uflag submissionid = $id should be: update submission set votes_up = $votes_up, flag1 = '$uflag' submissionid = $id

html5 - Only allow one audio element to play at a time -

i have multiple audio players, each play , stop button, on 1 page. issue have when click 1 play button, , another, play on top of 1 another. can me code need stop whatever song playing when play button clicked - there never more 1 song playing @ time?? thanks! here code: $(document).ready(function(){ $("#play-bt").click(function(){ $("#audio-player")[0].play(); }) $("#stop-bt").click(function(){ $("#audio-player")[0].pause(); $("#audio-player")[0].currenttime = 0; }) }) $(document).ready(function(){ $("#play-bt1").click(function(){ $("#audio-player1")[0].play(); }) $("#stop-bt1").click(function(){ $("#audio-player1")[0].pause(); $("#audio-player1")[0].currenttime = 0; }) }) $(document).ready(function(){ var allaudioels = $('audio'); function pauseallaudio() { alla

html - Remove blue selection bar around form -

i know links css is a:focus { text-decorations: none; -mozselectedsomethingorother: none; } or that, there way remove blue border http://cl.ly/1d20272p36180s3f1c36 if have anchor wrapped around image, css should work: a img { border:none; } a:focus { outline: none; } and....someone answered in comments :-)

internet explorer - msSiteModeActivate does not seem to work -

hi i'm working on ie9 task bar integration cant seem mssitemodeactivate() work. my code: settimeout("tvoverlay()", 30000); settimeout("tvactivate()", 35000); <script type="text/javascript"> function tvactivate() { try { if (window.external.msissitemode()) { window.external.mssitemodeactivate(); } else { } } catch (e) { } } function tvoverlay() { try { if (window.external.msissitemode()) { window.external.mssitemodeseticonoverlay('/tvoverlaygul.ico', 'tv overlay'); } else { } } catch (e) { } } </script> the tvoverlay() works fine icon never flashes when tvacti