Posts

Showing posts from January, 2010

c# - Adding OnClick event to ASP.NET control -

i create onclick event panel . far of google results more or less this: adding onclick event aspnet label . there way, call codebehind function javascript or panel attributes? because redirect user new page , before save information in viewstate or sessionstate. suggestions? in java script method raise __dopostback call server side method . <script type="text/javascript"> function yourfunction() { __dopostback('btntemp', '') } </script> where btntemp server side button , write onclick event of button on server side, can processing , redirect other page. you can have understanding of dopostback @ dopostback understanding

wxwidgets - TinyXML2 and C++ -

i want read data wxgrid , write xml file. wxgrid like: jahr | monat ------ |------------- 2012 | 03 2009 | 08 what want have: <sql> <datensatz> <jahr>2012</jahr> <monat>03</monat> </datensatz> <datensatz> <jahr>2009</jahr> <monat>08</monat> </datensatz> </sql> what got: <sql> <datensatz> <jahr>20122009</jahr> <monat>0308</monat> </datensatz> <datensatz> <jahr>20122009</jahr> <monat>0308</monat> </datensatz> </sql> my code: xmldocument doc; xmlelement* xesql = doc.newelement("sql"); xmlnode * xnsql = doc.insertfirstchild(xesql); xmlelement* xejahr = doc.newelement("jahr"); xmlelement* xemonat = doc.newelement("monat"); xmltext* datensatzjahr = doc.newtext("...

javascript - Sum associative array key values and group it by key -

i have table follows : <table> <thead> <th>product</th> <th>quantity</th> <th>area</th> <th>price</th> <th>total</th> <tr> <td id="name">sweets</td> <td id="qty">10</td> <td id="area">250</td> <td id="price">16.50</td> <td id="total">160.50</td> </tr> <tr> <td id="name"">dry foods</td> <td id="qty">5</td> <td id="area">100</td> <td id="price">10.25</td> <td id="total">51.25</td> </tr> <tr> <td id="name">fresh</td> <td id="qty">20</td> <td id="area">250</td> <t...

.net - Lambda Expression to get the cells vertically for a section containing rows -

i have iterate through each section , create cells rows create table. here each section has rows 0....n , , rows have cells 0...n for example illustrated below: row 0-> cell0 | cell1| cell2 | cell3 | cell4 | cell5 row 1-> cell0 | cell1| cell2 | cell3 | cell4 | cell5 row 2-> cell0 | cell1| cell2 | cell3 | cell4 | cell5 .. i want create lambda expression (say): var allcolumns = ........... to cell0's cell1's, cell2's etc... can iterate in loop , create table each. requirement not want me go row row wants me go column column (cell illustrated above in diagram, create the cell0's first cell1's cell 2's etc, in loop below. foreach(cell c in allcolumns){ //i want iterate in loop , create cells , rows. } can give me lambda expression this. i tried doing var allcolumns = sections.rows.selectmany(a=>a.cells).groupby(what should come here). can impr...

Reinitialize jQuery plugin after AJAX call -

i'm using infinite ajax scroll: https://github.com/webcreate/infinite-ajax-scroll the user possibility sort results name example or filter results. but, when have update navigation links. the plugin launched (for example): jquery.ias({ container : ".listing", item : ".post", pagination : "#content .navigation", next : ".next-posts a", loader : "images/loader.gif" }); how reinitialize plugin after ajax call new navigation links work plugin? you have call again, when ajax call done: $.ajax({ url: "yoururl." }).done(function() { jquery.ias({ container : ".listing", item : ".post", pagination : "#content .navigation", next : ".next-posts a", loader : "images/loader.gif" }); });

After I stop a mysql import do I have to start again or can I start where I left off? -

i stopped mysql import , wondering if have drop table , start again or run command load data local infile... again , continue insert records left off. it not continue left off, begin beginning of file (it have not idea left off), because using local keyword, documentation: if specify ignore, input rows duplicate existing row on unique key value skipped. ... local, default behavior same if ignore specified so data has been loaded ignored. can read on documentation load data here .

sdk - Android development - can Eclipse / AVD run error free? -

i new android development , eclipse. have been given android app , asked make simple changes it. can build project , run in emulator, see errors in logcat window in eclipse. i put aside app given , wrote hello world app, following hello world tutorial on developer.android.com. simple app, surprised see many errors , stack dumps in logcat window. closed eclipse , re-launched it. after waiting eclipse finish initializing, logcat empty. started hello world app clicking run button. after while entries appeared in logcat, including many errors. with such simple app, copied tutorial, guessing errors arise development environment and/or virtual device rather app itself, able run apps without errors. is reasonable expectation able run android apps eclipse on avd without errors? or state of art development environment logs many errors , dumps stack traces when running "normally"? if reasonable, pursue each error until have cleaned environment , application. prefer this, kn...

javascript - Why are some scientific numbers automatically rounded and others aren't? -

why numbers in scientific notation starting 9.999999999999999 rounded 1 while others remain same? for example, in google chrome 20 following happens. (9.999999999999999e+306).tostring() === "9.999999999999999e+306" // true but (9.999999999999999e+303).tostring() === "1e+304" // true why that? floating point issue? however strangest thing in opera 11.64 (1e23).tostring() === "9.999999999999999e+22" . tried report 1e23 bug opera no 1 replied. live demo here: http://jsfiddle.net/3ekdk/3/ source code of demo var console = console || {}; console.logtobody = function( str ){ document.body.innerhtml += "" + str + "<br/>"; }; var parts = ["9.999999999999999e", 310 ], tmp, tmp2; while( parts[1]-- ){ tmp = +(parts.join('')); if( /9.9{3,}e/.test( +tmp ) ){ console.logtobody( tmp + " doesn't convert " + (+tmp).toprecision(1) ); } tmp2 = "1e"+par...

phpexcel - Extracting images from an Excel file (xlsx) using PHP -

how can read images excel file using phpexcel , save images in server , display them? extension of file .xlsx. my code: $objphpexcel = phpexcel_iofactory::load($path); foreach ($objphpexcel->getactivesheet()->getdrawingcollection() $drawing) { if ($drawing instanceof phpexcel_worksheet_memorydrawing) { ob_start(); call_user_func( $drawing->getrenderingfunction(), $drawing->getimageresource() ); $imagecontents = ob_get_contents(); ob_end_clean(); } } thanks!! $objphpexcel->getactivesheet()->getdrawingcollection() will return arrayobject of image objects in active worksheet. these objects either phpexcel_worksheet_drawing or phpexcel_worksheet_memorydrawing objects: can identify using [is_a()][1]. can use methods appropriate class (as described in api) either read image data file (for phpexcel_worksheet_drawing objects) or directly phpexcel_worksheet_memorydrawing object it...

c++ - File generating for cmake -

i have project automake build system , there flex/bison files there. can't understand how include them cmake build system. i'm trying manually. here project tree: +root |---cmakelists.txt |---sources/ | |---flex | |---main | |---cmakelists.txt |---includes/ in flex folder there 2 files: player_command_parser.ypp; player_command_tok.lpp . these files robocup soccer server . i don't know how use them new build system decided generate files manually hands: flex --c++ player_command_tok.lpp this command generates lex.rcsspcom.cc starts following code: #line 3 "lex.rcsspcom.cc" #define yy_int_aligned short int /* lexical scanner generated flex */ #define flex_scanner #define yy_flex_major_version 2 #define yy_flex_minor_version 5 #define yy_flex_subminor_version 35 #if yy_flex_subminor_version > 0 #define flex_beta #endif /* c++ scanner mess. flexlexer.h header file relies on * following macro. required in order pass c++-multi...

Shutting down Netty server when client connections are open -

i'm trying shutdown netty server has open connections it, , hangs. here's do. start server on 1 machine , client on another. send message client server response. shutdown server using ctrl-c i've registered shutdown hook on server closes channelgroup , calls releaseexternalresources on serverbootstrap (or i'm using duplextcpserverbootstrap of protobuf-pro-duplex library that). anyway, shutdown hook called on shutdown, never returns. when take thread dump of what's happening can see 2 interesting stacks: java.lang.thread.state: timed_waiting (parking) @ sun.misc.unsafe.park(native method) - parking wait <0x00000006b0890950> (a java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject) @ java.util.concurrent.locks.locksupport.parknanos(locksupport.java:226) @ java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.awaitnanos(abstractqueuedsynchronizer.java:2082) @ java.util.concurrent.threadpoolexec...

ruby on rails 3 - How to render collection with template in rails3? -

if there _post.html.erb in app/views/posts/, can input <%= render @posts %> in app/views/posts/index.html.erb , if _post.html.erb file in app/views/users/posts/, how write? i tried <%= render @posts, :template => 'users/posts/post' %> , not work. <%= render :partial => 'users/posts/post', :collection => @posts %>

bash - Creating incremental backup with tar - --listed-incremental -g -

i have problem tar linux program. create incremental backup. use following tar command first full backup: tar --create --gzip --listed-incremental=$savedir/backup.snar --file=$savedir/$date.tar.gz $exclude $directory $exclude contains example "--exclude test/testdir --exclude test/testdir2" $directory contains "-c /users/user1/desktop/ test" if execute command following error: tar: option --listed-incremental=/users/hofmeister/desktop/test/backup.snar not supported usage: list: tar -tf <archive-filename> extract: tar -xf <archive-filename> create: tar -cf <archive-filename> [filenames...] help: tar –help if change --listed-incremental option -g =$savedir/backup.snar . get: usage: list: tar -tf <archive-filename> extract: tar -xf <archive-filename> create: tar -cf <archive-filename> [filenames...] help: tar --help what went wrong? use following version of tar: bsdtar 2.8.3 - libar...

jquery - How to check if a variable is a Timeout in Javascript? -

i decided contain code object separate out areas applied. advice here appreciated: appconfig.loadelement , appconfig.cerrorelement these html elements: <div id="loading" style="display:none;">loading...</div> <div id="cerror" style="display:none;">connection error.</div> var loadingtimeoutinstance = null, cerrortimeoutinstance = null, requestobj = { reset: function() { $(appconfig.loadelement).hide(); $(appconfig.cerrorelement).hide(); cleartimeout(loadingtimeoutinstance); cleartimeout(cerrortimeoutinstance); }, initiate: function() { loadingtimeoutinstance = settimeout(requestobj.timeout, appconfig.loadingdelayms); }, timeout: function () { cleartimeout(loadingtimeoutinstance); $(appconfig.loadelement).show(); cerrortimeoutinstance = settimeout(requestobj.cerror, appconfig.cerrordelayms); }, cerror: function () { ...

Akka: defining an actor in Scala with non-default constructor and creating it from Java code -

an akka scala actor must extend akka.actor.actor an akka java actor must extend akka.actor.untypedactor therefore, when defining scala actor non-default constructor , creating java code, run problem: actorref myactor = system.actorof(new props(new untypedactorfactory() { public untypedactor create() { return new myactor("..."); } }), "myactor"); of course, untypedactorfactory expecting create object of type untypedactor, actor of type actor. what's workaround ? edit: following instructions viktor use akka.japi.creator, works: props props1 = new props(); props props2 = props1.withcreator(new akka.japi.creator() { public actor create() { return new myactor("..."); } }); actorref actorref = main.appclient().actorof(props2, "myactor"); pass in akka.japi.creator instead of untypedactorfactory in case. also, @ least in 2.0.1 , forward doesn't require untypedactor: trait un...

RequireJS and dependencies of 3rd party libraries eg. Backbone dependent on Underscore and jQuery -

i understand backbone dependent on underscore, jquery , maybe json2. possible specify when module dependent on backbone, include dependencies of that? or whats way around this? requirejs makes easy dependencies can declare when define module. libraries don't support amd (underscore , backbone being 2 primary examples) use of shim configuration required. here example config: require.config({ baseurl: 'scripts/', paths: { 'backbone': 'lib/backbone', 'jquery': 'lib/jquery', 'underscore': 'lib/underscore' }, shim: { 'backbone': { deps: ['underscore', 'jquery'], exports: 'backbone' } } }); now if require backbone dependency in 1 of modules underscore , jquery available. a lot of is covered in documentation .

how to select two nodes (pairs of nodes) randomly from a graph that are NOT connected, Python, networkx -

i want extract 2 nodes graph, catch being shouldnt connected i.e. no direct edge exists between them. know can random edges using "random.choice(g.edges())" give me random nodes connected. want pairs of nodes not connected (a pair of unconnected edges). me out guys...thanx simple! :) grab random node - pick random node list of nodes excluding neighbours , itself. code illustrate below. :) import networkx nx random import choice # consider graph # # 3 # | # 2 - 1 - 5 - 6 # | # 4 g = nx.graph() g.add_edge(1,2) g.add_edge(1,3) g.add_edge(1,4) g.add_edge(1,5) g.add_edge(5,6) first_node = choice(g.nodes()) # pick random node possible_nodes = set(g.nodes()) neighbours = g.neighbors(first_node) + [first_node] possible_nodes.difference_update(neighbours) # remove first node , neighbours candidates second_node = choice(list(possible_nodes)) # pick second node print first_node, second_node

plsql - Oracle Stored procedure - NOT IN (SUBQUERY) CONSUMES A LOT OF TIME -

i have oracle procedure same work following: create or replace procedure my_test_procedure ( cur out sys_refcursor ) begin open cur select * mytable1 mytable1.somerowname not in (select somerowname mytable2); end my_test_procedure; but there lot of data in 2 tables, approximately 300000 rows in each. takes plenty of time finish. can decrease amount of time. have tried declaring sys_refcursor , reading data cursor following: create or replace procedure my_test_procedure ( cur out sys_refcursor ) declare existing_items sys_refcursor; begin open existing_items select somerowname mytable2; open cur select * mytable1 mytable1.somerowname not in existing_items; end my_test_procedure; but time ora-00932 error occurs. can do? thanks in advance. use query join below: select mytable1.* mytable1 left join mytable2 on mytable1.somerowname = mytable2.somerowname mytable2.somerowname null

silverlight - is it safe to use public static variables in WCF? -

i'm reading emails in silverlight 4 app (vs2010, c#), i've created wcf handles email operations (through imap), , consume functions in silverlight app (in fact silverlight app going user control in parent silverlight application). can declare public static variables username, password, imap server address , other items? application have several users, safe use public static variables in wcf or should pass username, password, imap address, port , other stuff wcf functions each user? options here? should use mechanism such sessions or can safely use static variables? happen if several users call service @ same time? thanks if parameters going same users in simple case can read them config file instead of hard-coding them in static variables. in way if server or port changes can update web.config without going recompile. if parameters changes user user better idea create class in service side contains parameters. there no problem in using static variables in w...

Java generics and overloading with Groovy -

i write unit tests java application groovy, junit , easymock. in easymock there several overloaded methods capture() have been deprecated note "because of harder erasure enforcement, doesn't compile in java 7". methods take parameter object of type capture<t> . there exist, among others, following methods: static boolean capture(capture<boolean> captured) static boolean capture(capture<integer> captured) ... static <t> t capture(capture<t> captured) this not allowed more in java if invoke code directly java right method gets invoked. e.g. when execute code capture<myclass> myclasscapture = new capture<myclass>(); mockobject.somemethod(capture(myclasscapture)); the right method (the last in list) gets invoked. on other hand, if invoke same code inside groovy, first method in list invoked , gives error in test. think has how java , groovy resolve methods. assumption java binds method @ compile time while groovy ...

css - jquery ui button padding override -

html markup follows: <button id="refresh"><img src="refresh.png" /></button> i creating button jquery ui button following code: $("#refresh").button(); calling function produces following markup: <button id="refresh" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"> <span class="ui-button-text"> <img src="refresh.png"> </span> </button> this works fine. result button padding of .4em 1em; defined in jquery's css. ( .ui-button-text-only .ui-button-text ) i have several buttons on page, , padding of them. however, 1 button in particular i'd have no padding. realize change css .ui-button-text-only , .ui-button-text screw other buttons using style, , them way are. so i'm wondering if there's way override css just 1 button . took @ jque...

webforms - javascript window redirect doesn't fire up -

this problem seems odd me , can't seem fix it. have simple html form; inside, have textbox , button shown down here: <form id="form1" method="get"> <!-- note: no action property --> <div> <h1> simple test form</h1> <table border="0" width="400"> <tr> <td align="right"> of these words </td> <td> <input name="txtall" id="txtall" type="text" value="testing keyword" /> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="submit" onclick="myjs(this);" /> </td> </tr> ...

php - json_encode not working inside while loop -

i have json_encode in php script seems fail jquery side of things if json_encode called inside while loop. when view result in browser window other page need result in can see work. for example: while ($row = mysql_fetch_array($result)) { $id = $row['id']; $title = $row['title']; $content = $row['content']; $data = array("id" => $id, "title" => $title, "success" => true ); echo json_encode($data); // inside while loop } and output in browser is: {"id":"15","title":"advanced booking examples","success":true} {"id":"14","title":"advanced booking fields","success":true} {"id":"11","title":"add new driver","success":true} {"id":"10","title":"registering driver \/ add new vehicle","success...

c# - HttpRuntime.Cache deleted after update in Asp.net mvc -

i'm using httpruntime.cache repeat task. every cache expire work , create new cache. cache start application_start . have 1 problem. when update web application dll , cache deleted (not expired) , application_start won't work how can solve problem? how create non deletable cache? when modify web.config or contents of /bin directory, cause worker process reset. so, application shuts down, , starts anew next request. the asp.net cache not durable through application restarts. if need durable cache, need use external caching service memcache, velocity, ncache, sharedcache, etc. "application_start won't work" sounds bewildering. if provide more detail problem, can try , that, too.

porting - What is the equivalent of IVisitor.CONTINUE TRAVERSAL in wicket 1.5 -

i'm porting our wicket 1.4 app wicket 1.5. visitors very different . know how handle continual_traversal in wicket 1.5? existing 1.4 code below: public class myformvisitor implements ivisitor<component, object>, serializable { private static final long serialversionuid = 7271477325583441433l; private set<component> visited = new hashset<component>(); @override public object component(component c) { if (!visited.contains(c)) { visited.add(c); c.add(new mandatorybehavior()); c.add(new errorhighlightbehavior()); } return ivisitor.continue_traversal; } just convert method , should fine: @override public void component(final component c, final ivisit<void> visit) { if (!visited.contains(c)) { visited.add(c); c.add(new mandatorybehavior()); c.add(new errorhighlightbehavior()); } } as can see in documentation linked, traversal contr...

tablet - Running full-screen Android application with screen/backlight off -

here's need do. want use android tablet science research, need programmatically control screen/backlight. specifically, there mode app need communicate other systems via wifi, play sounds, , have touchscreen active, backlight must off; in mode, device cannot emit light, or interfere science. obviously, cannot sleep mode! feasible? i've looked around bit, , this sounds promising, isn't crystal-clear (to me, anyway!) whether work. can vouch that? finally, matter tablet choose? basically, there seem 3 possibilities: backlight controlled switch (doubt done anymore), cpu can turn on or off, or cpu can adjust fully. writing makes me feel rather silly being concerned, samsung rep yesterday told me can't on galaxy. care recommend tablet? thanks! specifically, there mode app need communicate other systems via wifi, play sounds, , have touchscreen active, backlight must off android not support "have touchscreen active, backlight must off...

xcode - Voice Recording above particular Frequency for ios -

now i'm working under voice analysis based project, in have record voice signal having frequency more 17000 hertz. below rate, signal should neglected. hope there voice filter record rate, if having ideas regarding means please assist me helpful me, thank you.. sounds me like implement high-pass filter. the wikipedia page regarding these pretty thorough. where got voice signal frequency components of on 17khz beyond me since human voice not capable of producing frequencies close 10khz.

python - Hadoop Non-splittable TextInputFormat -

is there way have whole file sent mapper without being split? i have read this wondering if there way of doing same thing without having generate intermediate file. ideally, existing option on command line hadoop. i using streaming facility python scripts on amazon emr. just set configuration property mapred.min.split.size huge (10g): -d mapred.min.split.size=10737418240 or compress input file using codec isn't splittable (gzip). .gz extension, textinputformat return false issplittable(filesystem, path) method

swing - Java - JScrollPane with JTable not shown -

i have jpanel add jscrollpane (see class below). added jtextfield verify works (instead of jscrollpane) , text field added panel. when try add jscrollpane nothing (white background) shown. how can fix that? protected jpanel createcontentpanel() { jpanel panel = new jpanel(); panel.setlayout(new borderlayout()); final string[] columnnames = { "test1", "test2", "test3" }; final string[][] data = { { "foo1", "foo2", "foo3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "bar3" }, { "bar1", "bar2", "ba...

iphone - ASIHttprequest get progress for chunked transfer encoding? -

the asiprogressdelegate setprogress method 1 when downlonding chunked encoding? how progress of downlonding chunked encoding? thanx! in chunked-encoding, sometimes, not know content-length before hand, won't able know overall progress. can know number of bytes received far.

dns - Where to find the IP address for a Windows Azure preview web site -

for web site published using quick create feature of new windows azure preview portal , how ip address create records dns entry site? help says, "you can discover ip address within windows azure management portal." can't find said address anywhere. can ping mysite.azurewebsites.net address? when create windows azure website (shared) in windows azure preview portal, website created shared website part of hundred other websites on windows server farm. windows azure website (shared), can not set custom domain name website. that's why don't see ip address listed website @ preview portal. once change windows azure website "reserved" mode website run on own virtual machine (it not free , charged 1/3 during preview mode) can set cname settings website. finally link suggested above related web/worker role reserved websites.

Why my "PURE JAVASCRIPT BASED" offline file is not supporting "onload" events? -

i have offline "htm" file on pc use test html codes. html editor. compiles html codes. have problem it. supports kinds of css , javascript , javascript based libraries jquery not support events like- "onload, $(document).ready()" don't know why? have tried many things able nothing. so see source code of editor- <html> <script type="text/javascript"> function showresult() { my_window = window.open("about:blank", "mywindow1"); my_window.document.write(x); if(my_window.document.title=="") { my_window.document.title="no title specified" } } </script> <body> <textarea style="height:400px;width:750px;overflow:auto;" onblur="x=this.value"> </textarea><br /> <button onclick="showresult()">see result!</button> </body> </html> please tell me mistake have done? why me file no...

.net - is there any difference between reduce and reduceBack -

i'm learning f# msdn , looking , trying out reduce , reduce back, can't find difference, signature same ('t -> 't -> 't) -> 't list -> 't and both throw same error on empty list, why there 2 of them, there should difference others explained difference - reduce elements in different order. for of operations can use reduce or reduceback , difference not matter. in more mathematical terms, if operation associative (such numeric operations, max, min or sum functions, list concatenation, etc.) 2 behave same. an example can nicely see difference building tree, because shows how evaluation works: type tree = | leaf of int | node of tree * tree [ n in 0 .. 3 -> leaf n] |> list.reduce (fun b -> node(a, b)) [ n in 0 .. 3 -> leaf n] |> list.reduceback (fun b -> node(a, b)) here 2 trees result (but note if flatten them, same list!) reduce reduceback ------------------------------------- t...

java - Error creating bean ... could not load JDBC driver class [oracle.jdbc.driver.OracleDriver] -

i have written code run query using jdbc on spring exception (see below) here's context.xml <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="oracle.jdbc.driver.oracledriver"/> <property name="url" value="jdbc:oracle:thin:@mohsen-pc:1521:mydb"/> <property name="username" value="system"/> <property name="password" value="123"/> </bean> <bean id="lobhandler" class="org.springframework.jdbc.support.lob.oraclelobhandler"> <property name="nativejdbcextractor" ref="nativejdbcextractor"/> </bean> <bean id="nativejdbcextractor" class="org.springframework.jdbc.support.nativejdbc.commonsdbcpnativejdbcextractor"/> <bean id="jdbctemplate...

python - How to detect (view) an area of the screen surrounding a mouse pointer -

i'm on linux, , want try recreate nattyware's pixie tool web development. gpick ok, pixie around better. i want able detect , display area around mouse pointer. i've been trying find way show area around mouse pointer, zoomed in python. i have no idea start that. don't want save of images, show zoomed in area of mouse in window. edit : got can potentially works. don't run this, crashes! import sys, evdev xlib import display, x pyqt4 import qtgui pyqt4.qtgui import qpixmap, qapplication, qcolor class printimage(): def __init__(self): self.window = qtgui.qmainwindow() self.window.setgeometry(0,0,400,200) self.winid = qapplication.desktop().winid() self.width = 150 self.height = 150 self.label = qtgui.qlabel('hi') self.label.setgeometry(10, 10, 400, 100) self.label.show() def drawview(self, x, y): self.label.settext('abc') pix = self.getscreenarea(x, y) self.pic.setpixmap(pix) def render(self...

java - Saving audio byte[] to a wav file -

been having bit of trouble on last few days trying work. want have application sends raw data on network. read binary data in , want save wav(any audio) file. might @ compression later. so problematic code: byte[] allbytes = ... inputstream b_in = new bytearrayinputstream(allbytes); try { audioformat format = new audioformat(8000f, 16, 1, true, true); audioinputstream stream = new audioinputstream(b_in, format, allbytes.length); //audioinputstream stream = audiosystem.getaudioinputstream(b_in); have tried use above statement exception: javax.sound.sampled.unsupportedaudiofileexception: not audio input stream stream . think happening because stream raw audio data , not have wave header throwing exception? file newpath = new file(systemconfiguration.getlatest().voicenetworkpathdirectory + currentphonecall.filename); if (!audiosystem.isfiletypesupported(type.wave, stream)) { logger.error("audio system file type not supported"); } ...

sql server 2008 - SSRS data source connection error -

i've updates working report had change location of database, should work fine i've changed everywhere needs changed i'm sure when try run the report server cannot process report. data source connection information has been deleted. (rsinvaliddatasourcereference) i've check data source , correct be? thanks. fixed it. data source not set right value. after changing (inside report properties) worked fine.

Wordpress youtube plugin - Changing feed from channel to favourites (PHP Guru required) -

i not new wordpress, new php. have managed plugin working (thumbnails etc) cannot seem change default feed default youtube channel favourites. found post dev says edit url feed on line 268 of /core/parse.php looks this: 'url' => 'http://gdata.youtube.com/feeds/api/users/'.$v.'/uploads?orderby=published&max-results='.$z.'&start-index='.$i, i searched google high n low, found this: https://gdata.youtube.com/feeds/api/users/default/favorites and tried different variations of it. 0 videos imported. http://wordpress.org/extend/plugins/automatic-youtube-video-posts/ according url: https://developers.google.com/youtube/2.0/developers_guide_protocol_favorites the correct code 'url' => 'http://gdata.youtube.com/feeds/api/users/'.$v.'/favorites?orderby=published&max-results='.$z.'&start-index='.$i,

What is the Big-O complexity of a MySQL SELECT statement that uses BETWEEN clause? -

i interested in theoretical big-o analysis of following mysql query: select id, value mytable lat between %s , %s , lon between %s , %s; in particular, know how between clause affects complexity of query. mysql version 5.1 mytable defintion: create table mytable ( id varchar(255) not null unique, \ value decimal(12,9) not null, \ lat decimal(9,6), \ lon decimal(9,6), \ primary key(id(50)), \ index(lat, lon)) engine=innodb; describe mytable; +----------+---------------------+------+-----+---------+-------+ | field | type | null | key | default | | +----------+---------------------+------+-----+---------+-------+ | id | varchar(255) | no | pri | null | | | value | decimal(12,9) | no | | null | | | lat | decimal(9,6) | yes | mul | null | | | lon | decimal(9,6) | yes | | null | | +----------+---------------------+------+-----+---------+-------+ ...

Allow CORS REST request to a Express/Node.js application on Heroku -

i've written rest api on express framework node.js works requests js console in chrome, , url bar, etc. i'm trying working requests app, on different domain (cors). the first request, made automatically javascript front end, /api/search?uri=, , appears failing on "preflight" options request. in express app, adding cors headers, using: var allowcrossdomain = function(req, res, next) { res.header('access-control-allow-origin', '*'); res.header('access-control-allow-methods', 'get,put,post,delete,options'); res.header('access-control-allow-headers', 'content-type, authorization, content-length, x-requested-with'); // intercept options method if ('options' == req.method) { res.send(200); } else { next(); } }; and: app.configure(function () { app.use(express.bodyparser()); app.use(express.methodoverride()); app.use(app.router); app.use(allowcrossdomain...

git - Can not see a push notification on GitHub after i push to the remote repository -

after commit , push remote repository command line: git commit -m 'id: xxxxxx comments' git push origin feature/xxxxx up-to-date but when go github, can't see push on news feed, luca pushed feature/xxxx @ xxxxxxxxx i on concerned branch, checked git branch command. am missing ? the git message everything up-to-date indicates remote branch pushing in sync local branch being pushed. hence, there no news feed on github since nothing on remote branch changed. if local branch out of sync remote branch, executing: $ git status will show message such following: # on branch master # branch ahead of 'origin/master' 1 commit. now when push local branch remote branch, git displays message such as: $ git push origin master counting objects: 5, done. delta compression using 2 threads. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 290 bytes, done. total 3 (delta 2), reused 0 (delta 0) git@github.com:user/project.git d47...

ruby on rails 3 - unknown attribute X, but X is not in argument of update_attributes in rails3 -

i trying set object's field in form accept_nested_attributes. in controller when : @device.update_attributes(params[:device]) i : activerecord::unknownattributeerror "unknown attribute: device_id" but device_id, attribute of other non-related model, not included in params. params following. {"utf8"=>"✓", "authenticity_token"=>"xja5gcnrutpzn2c4wkesx0ko6snezh09kwmpq0/0hys=", "id"=>"5", "device"=>{"routes_attributes"=>{"0"=>{"name"=>"", "origin_attributes"=>{"name"=>"", "lat"=>"", "lng"=>""}, "destination_attributes"=>{"name"=>"", "lat"=>"", "lng"=>""}}}}, "commit"=>"create device"} what can thought cause. here codes. view <%= fo...

iPhone / Android Intents -

in android development, can start android app data own app using intents. for example: in app, have have typed text, click button, app of mine starts , displays typed text other app. now question: possible in iphone development? can start app data app? yes can use url schemes, take on this

google maps api 3 - Javascript errors on IE 8 -

i'm little confused errors being thrown internet explorer 8, not firefox. i seeing following errors: webpage error details user agent: mozilla/4.0 (compatible; msie 8.0; windwos nt 5.1; trident/4.0; .net clr 2.0.50727; .net clr 3.0.4506.2152; .net clr 3.5.30729) timestamp: wed, 13 jun 2012 08:33:22 utc message: object expected line: 3 char: 1 code: 0 uri: http://<ipaddress>/.../locations.js message: syntax error line: 34 char: 11 code: 0 uri: http://<ipaddress>/.../testmap1.html i using following files... testmap1.html: <div id="map_canvas" style="width: 1200px; height: 700px;">map div foo</div> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="/static/app/foo/locations.js"></script> <!--<script type="text/javascript" src="/static/app/foo...

iphone - Check if NSMutableArray contains text from textfield -

i want check if text inserted in textfield in nsmutablearray. let's nsmutablearray has these objects: "hey, hello, no, yes". when user enters text: "hello" want there appear uialertview. have following: for (int slt = 0; slt < [zouten count]; slt++) { if (zout.text = [zouten objectatindex:slt]) { alert = [[uialertview alloc]initwithtitle:@"goedzo!" message:[nsstring stringwithformat:@"je hebt een zout gevonden"] delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil]; } } [alert show]; but somehow message appears every word. doing wrong? when compare this: if (zout.text = [zouten objectatindex:slt]) you assigning instead of comparing true always.therefore instead of using =, should compare this: if ([zout.text isequaltostring:[zouten objectatindex:slt]]) your code should be: for (int slt = 0; slt < [zouten count]; slt++) { if ([zout.text isequaltost...

php - Doctrine Common trying to create an annotation -

i trying use doctrine common create own annotation. http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html not match https://github.com/doctrine/common because call undefined method doctrine\\common\\annotations\\annotationreader::setdefaultannotationnamespace , php fatal error: call undefined method doctrine\\common\\annotations\\annotationregistry::registerannotationnamespace . checked source, not there. according git log removed year ago. i have psr-0 autoloader going (from symfony). have file psr-0 loader expects: namespace my\test; /** * @annotation */ class foo { } another class namespace my\annotated /** * @my\test\foo */ class test { } reader: namespace my\reader use reflectionclass; use doctrine\common\annotations\annotationreader; use doctrine\common\annotations\annotationregistry; use my\test\foo; $reader = new annotationreader(); $reflectionclass = new reflectionclass('my\\annotated\\test'); $class...

tcpdf - Populate editable PDF form fields with php -

i've got existing pdf form office has created has form fields user fill out (electronically) , print. before passing user open existing pdf , populate (if not all) of data using php. i've looked extensions tcpdf , fpdi, i'm unable confirm want possible looking @ examples , documentation. have of done before? i did see tcpdf::setformdefaultprop , looked promising... pdftk has fill_form command. since doesn't have php bindings you'll have install on server , invoke exec() et al it's pretty easy. use you'll have generate fdf file, pdftk given generate_fdf command, plug desired data it. can find information on fdf files here , example php code here , here . in truth think put generated fdf file in pdf script and, given right escaping, fill values in string, pipe pdftk fill_form .

autofac - QuartzNet Server + Dependency Injection to Jobs -

i using quartznet server, created own dll contains jobs , configured server load jobs, far well. my problem arises when started looking way inject dependencies jobs (in main project i'm using autofac), couldn't find way of doing started looking way run quartz server different ijobfactory or schedulerfactory couldn't find anything. i'm close writing own quartz service or giving , using static/singleton solution (i hate myself :) ) any 1 has nice solution ?

ios - Delete a row from Core Data UITableView with custom button -

i have uitableview populated cells core data , nsfetchedresultscontroller . have custom button on custom cells, i'm planning on using delete cell. it's easy add standard swipe-to-delete, i'd rather use custom button. know how hook action button delete entry data model , delete cell uitableview ? cannot find solution life of me. edit: this code have delete using standard swipe-to-delete. way modify work button? if (editingstyle == uitableviewcelleditingstyledelete) { [self.tableview beginupdates]; // delete task task *tasktodelete = [self.fetchedresultscontroller objectatindexpath:indexpath]; nslog(@"deleting (%@)", tasktodelete.name); [self.managedobjectcontext deleteobject:tasktodelete]; [self.managedobjectcontext save:nil]; // delete row [self.tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; [self performfetch]; [self.tableview endupdates];...

javascript - Table not displayed -

hi want display table way have in code below not displayed in screen, code using html , javascript <body id="page"> <center> <table id="tables" border="1px" cellspacing="50px" style="margin-top:70px" > <script type="text/javascript"> var row=2; for(var j=1;j<=2;j++){ $('#tables').append("<tr id='row"+j+"' style='margin-bottom:50px'>"); for(var k=1;k<=5;k++){ $("#row"+j).append("<td id='table"+k+"' class='button' width='150' height='150' onclick='printbill("+k+")' background='images/green.png' align='center'>"+ "<font size='+8'><b>"+k+"</b></font>"+ ...

upload file to network drive in php -

php script uploading file mapped network drive not working . following php script: $newfilename = "something.wav"; $path = 'y:\\uploaded\\'.$newfilename; copy($_files['ufile']['tmp_name'], $path); i have check permission network drive folder.i have y drive mapped network drive(10.4.4.32) d drive within uploaded folder. have full control permission. have tried following path network drive: y:\uploaded\ \\10.4.4.32\d$\uploaded\ move_uploaded_file($_files['ufile']['tmp_name'], $path); but, works on local drive like: d:\uploaded\ file uploaded in local drive not uploaded in network drive. have used php 5.3 , iis 7 application errors showed: warning: copy(\10.4.4.32\d$\uploaded\test.wav): failed open stream: permission denied in c:\inetpub\wwwroot\myapp\upload.php on line 107 i have allow permission of full control in properties of uploaded folder user. there other permission , should fixed. first, check if ...

deployment - Stuck with deploying django with apache + mod_wsgi -

i 500 internal server error , in log files writes: [thu jun 14 16:30:22 2012] [error] [client 127.0.0.1] importerror: not import settings 'mysite.settings' (is on sys.path?): no module named mysite.settings here httpd.conf: servername localhost <virtualhost *:80> serveradmin ttt@mysite.com servername mysite.com serveralias www.mysite.com documentroot /var/www/mysite/ loglevel warn wsgidaemonprocess processes=2 maximum-requests=500 threads=1 wsgiscriptalias / /var/www/mysite/mysite/wsgi.py alias /media /var/www/mysite/mysite/static/media/ </virtualhost> wsgi.py: import os os.environ.setdefault("django_settings_module", "mysite.settings") django.core.wsgi import get_wsgi_application application = get_wsgi_application() this problem covered in both mod-wsgi documentation http://code.google.com/p/modwsgi/wiki/integrationwithdjango , django deployment documentation https://docs.djangoproject.co...