Posts

Showing posts from April, 2015

chess - how to communicate with uci protocol using matlab -

i'm looking method communicate chess engine uci protocol using matlab. chess engine rybka , exe file. when run rybka.exe, can communicate via dos command prompt want via matlab. think have use streampipe , stdin , stdout don't know how use it. i found code in python , works fine i'm looking matlab version: import subprocess, time engine = subprocess.popen( 'a.exe', universal_newlines=true, stdin=subprocess.pipe, stdout=subprocess.pipe, ) def put(command): print('\nyou:\n\t'+command) engine.stdin.write(command+'\n') def get(): # using 'isready' command (engine has answer 'readyok') # indicate current last line of stdout engine.stdin.write('isready\n') print('\nengine:') while true: text = engine.stdout.readline().strip() if text == 'readyok': break if text !='': print('\t'+text) if it...

DataNucleus JDO on MySQL fails with FK violation on 1:1 relations -

i have issues persisting simple 2 classes on datanucleus 3.1.3 on mysql, datanucleus seems create invalid foreign-keys, ending in "foreign key constraint fails" -exception database. here classes: // datastore since dont care identity here @persistencecapable(identitytype = identitytype.datastore) class { @persistent int x; @persistent int y; } // identity type:application here enable id lookups @persistencecapable class b { @primarykey @persistent(valuestrategy = idgeneratorstrategy.native) long id; @persistent double longitude; @persistent double latitude; // simple 1:1 unidirectional @persistent a; } the schematool created tables (innodb) looks good, insert fails, here logs: 12:54:11,369 debug [datanucleus.datastore.native] - insert `a` (`x`,`y`) values (<1>,<1>) 12:54:11,387 debug [datanucleus.datastore.persist] - execution time = 18 ms (number of rows = 1) 12:54:11,398 debug [datanucleus.dat...

unit testing - Missing DbAdapter dependencies in Zend Framework 2 PHPUnit -

i have simple controller action <?php namespace application\controller; use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel; class indexcontroller extends abstractactioncontroller { public function myaction() { return new viewmodel(); } } and want test it: <?php namespace applicationtest\controller; use zend\test\phpunit\controller\abstracthttpcontrollertestcase; class indexcontrollertest extends abstracthttpcontrollertestcase { public function setup() { $this->setapplicationconfig( include '../../../config/application.config.php' ); /* $test = $this->getapplicationconfig(); print_r($test); die('~~~'); */ parent::setup(); } public function testindexactioncanbeaccessed() { $this->dispatch('/my'); $this->assertresponsestatuscode(200); $this->assertmodulename('applic...

Displaying errors in Ruby on Rails -

i have trouble displaying errors in rails. here controller def new if current_user @edible = edible.new else flash[:notice] = "you need signed in action" redirect_to root_path end end def create @edible = edible.new(params[:edible]) if @edible.valid? && current_user.edibles.push(@edible) if(params[:edible][:pickup] == "1") respond_to |format| format.html { redirect_to new_user_edible_pick_up_adress(current_user.id, @edible.id) } end else respond_to |format| format.html { redirect_to(user_edible_path(current_user.id, @edible.id), :success => "product saved") } end end else respond_to |format| format.html { redirect_to(new_user_edible_path(current_user.id, :alert => "error happend...

nfc - Android Beam: Is there any callback or error code if receiver is not authorised -

i developing android application uses beam send custom message device. if application present on both devices works fine. if not present @ receiver end still @ sender onndefpushcomplete() success callback. i wondering if there result code or callback tell has been delivered default application or may contraint might cause message delivered authorised application(in case same application). appreciate help. the call onndefpushcomplete() tells (low-level) nfc peer-to-peer data transfer successful. not provide information app data has been delivered to. on android, way force data delivered particular app, add android application record. however, can still overridden on receiving device app running in foreground , has activated nfc foreground dispatching (forcing nfc intents delivered app long in foreground).

android - how can I get image id on button click on and get off image id on button click off -

i want add picture gallery favorite categories when click on button , delate favorite categories when click off button.i dont know how this.i'm new in android.i think first need id of background image when click on button on , after send picture id in database it's can safe , delate.i'm right on way?button switch when click on her.(grey , yellow color) there sorce code final string my_log = "mylog"; gallery gallery; imageview imageview; button sportbutton; int[] imgid = { r.drawable.sport_0, r.drawable.sport_1, r.drawable.sport_2, r.drawable.sport_3, r.drawable.sport_4, r.drawable.sport_5, r.drawable.sport_6, r.drawable.sport_7, r.drawable.sport_8, r.drawable.sport_9, }; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.sport); imageview = (imageview) findviewbyid(r.id.imagesportview); imageview.setimageresource(imgid[0]); gallery = (gal...

swing - Java Adding JScrollPane to JComponent -

java: have jcomponent draws image can rescaled. need have scroll bars appear when image becomes large. passed jcomponent jscrollpane , added jscrollpane north section of jframe, scroll bars appeared when jframe resized not when image rescaled. set preferred size of jcomponent didn't work. i tried adding jcomponent jpanel first passing jpanel jscrollpane didn't work either. here portion of code inside constructor of jframe: jcomponent component = new jcomponent() { public void paintcomponent(graphics g) { graphics2d g2 = (graphics2d) g; g2.drawimage(image1, zoom, this); } }; component.setpreferredsize(new dimension(800, 600)); jscrollpane scroller = new jscrollpane(component); add(scroller, borderlayout.center); override getpreferredscrollableviewportsize jscrollpane override getpreferredsize instead of component.setpreferredsize(new dimension(800, 600)); dimension returns jpanel must larger dimension jviewport (visible re...

c# - WPF Converters DLL - Failed to Add Reference -

Image
i´m using kent boogaart dlls wpf converters im vs2008 http://wpfconverters.codeplex.com/downloads/get/648993 when try import kent.boogaart.converters.dll, receive error. is release vs2012 ? http://wpfconverters.codeplex.com/releases/view/104331

asp.net mvc 3 - Complex SQL to LINQ in C# -

i'm newbie in linq , lamda expressions. have bit complex sql statement retrieves information several database tables: select a.orderid, a.formjdeno, a.title, b.descr, c.code, c.descr, d.modificationdate orderform left join orderpriority b on a.orderpriorityid = b.orderpriorityid left join stockclass c on a.stockclassid = c.stockclassid left join audittraillog d on a.orderid = d.objectid d.columninfoid= 487 , d.oldvalue='1' , d.newvalue='2' , a.formstatus=2 , a.formtype=3 , b.orderpriorityid=1000001 , c.stockclassid=1000002 , a.deptid in ( select deptid department instid = 1000006 ) , datediff(m,d.modificationdate, a.vendordeliverydate) >= 3 i have linq done, using .contains() method replacing where...in sql clause, need make de joins restricting results basing on values belongs other tables , using datediff equivalent in linq. have got , working fine, no restricting results above sql statement. tried several ways no success. need equivalen...

regex - Apache mod_rewrite rule for complex sitemap + index xml files -

we manage sitemap (sitemap.org) files have in range of 500k links, changing enough want dynamically generate them, don't worry, we'll cache results period it's mod_rewrite rules i'm having problem with. being have more 50k links need using sitemap index files. both sitemaps , index files redirected sitemap.php file use filename pattern ( $_server['request_uri'] ) figure out list present. the filename patterns follows: www.domain.com/sitemap.index.xml www.domain.com/sitemap.some_theme.xml www.domain.com/sitemap.different_theme.xml the mod_rewrite covers off our web application i'll include of in case else may overriding or conflicting i'm trying accomplish: rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^sitemap\.(.*)\.xml$ sitemap.php/ [nc,l] rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php/ [nc,l] errordocument 404 / the line i've ...

c# - Change color of selected items in listbox -

this question has answer here: change background color selected listbox item 7 answers currently when item selected (but control not) item in light grey (almost not visible) - happens when load window , programatically set selecteditems (restore user had done) - until click on item selections pretty not visible. so want change color of selected item in listbox ... have today: <listbox name="lbdates" selectionmode="multiple" itemssource="{binding days}" selecteditem="{binding path=selecteddays, mode=twoway}"> </listbox> you can create style listboxitem , apply triggers on it <style x:key="listboxitemstyle" targettype="{x:type listboxitem}"> <style.triggers> <trigger property="isselected" value=...

mysql - Mixing two tables together -

i have 2 tables db2: id, db1id, text, count_db1 db1: id, text db2 above created by select *, count(`db1id`) count_db1 `db2` group `db1id` order count_db1 desc so last column added , whole output sorted descendingly count_db1. db1ids ids of db1. want to select * db1 ordered value of count_db1 in db1. if id of db1 not existant in db2 db1id should added end of list(ie assigned value of 0 count_db1). example: db2: id, db1id, text, count_db1 1,4,hello,5 2,4,hello,5 3,4,ho,5 5,4,yeah,5 6,4,no,5 4,3,no,1 db1: id, text 3, yeahright 4, whatever so in db2 db1id 4 occurs 5 times, db1id 3 occurs 1 time. order entries of db1 such id 4 comes before id 3. result should be: whatever yeahright a simple left join count should want; select db1.* db1 left join db2 on db1.id=db2.db1id group db1.id, db1.text order count(db2.id) desc an sqlfiddle test with .

timer - if specific time passed show messagebox in C# -

so, want this: if specific time passed (for example 9 hours) loading form, want show messagebox said "9 hours passed". code this: public partial class form1 : form { stopwatch stopwatch = new stopwatch(); public form1() { initializecomponent(); stopwatch.start(); } private void button1_click(object sender, eventargs e) { double sec = stopwatch.elapsedmilliseconds / 1000; double min = sec / 60; double hour = min / 60; if (hour == 9.00d) { stopwatch.stop(); messagebox.show("passed: " + hour.tostring("0.00")); } } } and problem don't know write part of code: if (hour == 9.00d) { stopwatch.stop(); messagebox.show("passed: " + hour.tostring("0.00")); } so, write code? if have better way of doing this, please show me. what people not appreciating is unlikely dou...

sql - Querying XML data types which have xmlns node attributes -

i have following sql query: declare @xmldoc xml set @xmldoc = '<feed><product><name>foo</name></product></feed>' select x.u.value('name[1]', 'varchar(100)') name @xmldoc.nodes('/feed/product') x(u) this returns: name ---- foo however, if <feed> node has xmlns attribute, doesn't return results: declare @xmldoc xml set @xmldoc = '<feed xmlns="bar"><product><name>foo</name></product></feed>' select x.u.value('name[1]', 'varchar(100)') name @xmldoc.nodes('/feed/product') x(u) returns: name ---- this happens if have xmlns attribute, else works fine. why this, , how can modify sql query return results regardless of attributes? if xml document has xml namespaces, need consider in queries! so if xml looks sample, need: -- define default xml namespace use ;with xmlnamespaces(default 'bar') se...

javascript - How to record timing for keypress event? -

i trying build small script shows, on call back, when press key q after 1 second press w should show q , w obviously, but when, press q , w not @ same time, in less 1 second, should show other single character ex: x , stuck jsfiddle or full code. <script type="text/javascript"> function check(e){ var text = e.keycode ? e.keycode : e.charcode; switch(text){ case 81: text = 'q'; break; case 87: text = 'w'; break; } if(text == 8){ var str = document.getelementbyid("out").innerhtml; var foo = str.substring(0, str.length -1); document.getelementbyid("out").innerhtml = foo; }else { document.getelementbyid("out").innerhtml += text; } } </script> <input type='text' onkeyup='check(event);' id='in' /> <div id='out' ></div> ...

neo4j - No Relationship class found in neo4jphp when using neo4jphp.phar -

when running neo4jphp/neo4jphp.phar on local machine, seems noe4j - 1.9.rc2 works correctly. also, web interface available. when runnning command (below) $arthuroutgoingrelationships = $arthur->getrelationships(array(), relationship::directionout); , having php fatal error: class 'relationship' not found in /var/www/index.php in apache error log. downloaded latest available version of neo4jphp registered autoloader: spl_autoload_register(function ($classname) { $libpath = '/var/www/neo4jphp/lib/'; $classfile = str_replace('\\',directory_separator,$classname).'.php'; $classpath = $libpath.$classfile; if (file_exists($classpath)) { require($classpath); } }); you can work around downloading library github , copy everyman folder subfolders in root directory , use need. in example require("phar://neo4jphp.phar"); use everyman\neo4j\relationship;

Sphinx search: Use OR option with attributes and text -

i need results multiples queries sphinx. there's no problem when there attribute conditions. for example: $this->cl->setselect ( "*, item_fkprogram=700 or item_fkuser=350 mycond" ); $this->cl->setfilter ( "mycond", array(1) ); $results=$this->cl->query("","item"); it works fine, need add text queries. example: items that: have item_fkprogram=700 or have item_fkuser=350 or have search string "text1" can done? in advance if can reduce pairs numerical value, can use mva. i explain 1° choose value each "param" - item_fkprogram <- 00 - item_fkuser <- 01 - item_fkfoo <- 02 2 concat so index this select id, concat (item_fkprogram,'00,',item_fkuser,'01,',item_fkfoo,'02') orattr table and add sql_attr_multi = uint orattr field; there can search filter=sql_attr_multi,70000,35001 another way transform values in "words" , use ...

winapi - Can't seem to figure out how this works -

i'm trying determine password in challenge code, can't figure out how works. have tips on how go figuring out does? .text:00401000 public start .text:00401000 start: .text:00401000 mov esi, offset loc_401013 .text:00401005 .text:00401005 loc_401005: ; code xref: .text:00401011j .text:00401005 cmp esi, offset byte_40105f .text:0040100b jz short loc_401013 .text:0040100d xor byte ptr [esi], 0cdh .text:00401010 inc esi .text:00401011 jmp short loc_401005 .text:00401013 ; --------------------------------------------------------------------------- .text:00401013 .text:00401013 loc_401013: ; code xref: .text:0040100bj .text:00401013 ; data xref: .text:starto .text:00401013 xor bl, al .text:00401015 test eax, 44...

webgl - bufferData - usage parameter differences -

while reading specification @ khronos, found: bufferdata(ulong target, object data, ulong usage) 'usage' parameter can be: stream_draw, static_draw or dynamic_draw my question is, 1 should use? advantages, differences? why choose use other instead static_draw? thanks. for 'desktop' opengl, there explanation here: http://www.opengl.org/wiki/buffer_object basically, usage parameter is hint opengl/webgl on how intend use buffer. opengl/webgl can optimize buffer depending on hint. the opengl es docs writes following, not same opengl (remember webgl inherited opengl es ): stream the data store contents modified once , used @ few times. static the data store contents modified once , used many times. dynamic the data store contents modified repeatedly , used many times. the nature of access must be: draw the data store contents modified application, , used source gl drawing , image specification commands. the common us...

sql server - MS Analysis Cube - one-to-many joins -

i building olap cube in ms sql server bi studio. have 2 main tables contain measures , dimensions. one table contains date | keywords | measure1 where date-keyword composite key. one table contains looks like date | keyword | product | measure2 | measure3 where date-keyword-product composite key. my problem there can one-to-many relationship between date-keyword's in first table , date-keyword's in second table (as second table has data broken down product). i want able make queries when filtered given keyword: measure1 measure2 measure3 ============================================================ tuesday, january 01 2013 23 19 18 ============================================================ bike 23 car 23 16 13 motorcycle 23 caravan 23 2 ...

c# - Unable to open project in design/code mode? -

if have big software package check licence serial number upon starting. app wont start unitll correct licence number entered (real or trial one) the problem here can not open code in visual studio (design or code mode) if don't provide licence details. i know licence form (where user enters licence details) in form of usercontrol. questiono : which part of visualstudio defines code run upion opening form in design/code window ? is csproj file or ? aware of post-build or pre-build tasks code run before open package start coding !!!! ps: here code found in project.csproj where newlicenseform form used enter reg details. how can disable form firing upon opening project in design mode ? <compile include="newlicenseform.cs"> <subtype>form</subtype> </compile> <compile include="newlicenseform.designer.cs"> <dependentupon>newlicenseform.cs</dependentupon> </compile> <compile include="newlice...

What diagrams can be used to visualize 4-dimensional arrays? -

how can understand visualize 4 dimension array in head? 1 dimension pretty easy: x x x x x x 2 dimension still have no problems: x x x x x x x x x x x x x x x x x x 3 dimensions, can not draw here can imagine more x 's coming out each x in 2 dimension array. how 4 dimension? for 4d, imagine having dimension, there 3d cube @ each point along dimension. more dimensions. think how 4d arrays work in java, or c - in both cases arrays of arrays of arrays. can visualize them that. but in many cases, 4d-array used cache, array[iteration][object_id][g-force][whatever] . thre no point in visualizing that.

jquery - wrong html output from the javascript -

i wrote script populating selectbox bunch of options. initially data in form of string of format "key=value;key2=value2;etc...": //split string distinguish between different options populate selectbox var values = data.split(';'); //reset length of selectbox populated document.getelementbyid(child).options.length = 0; //create first default option document.getelementbyid(child).options[0] = new option('all', '0'); for(var = 0; < values.length; i++){ //check , remove unnecessary characters values[i].replace(/\s+/g, ''); //split option key , value separately var options = values[i].split('='); if(!isempty(options[0]) && !isempty(options[1])){ //insert new element selectbox document.getelementbyid(child).options[i+1] = new option(options[1], options[0]); } } the example above populates selectbox given html output: <option value="0">all</option> <option...

jquery - How to use serialized and send ajax (johnny sortable plugin) -

i use http://johnny.github.io/jquery-sortable/ i can not understand how send serialized data? my html <ul> <li data-id="1">item 1</li> <li data-id="2"> item 2 <ul> <li data-id="4">item 4</li> <li data-id="5">item 5</li> </ul> </li> <li data-id="3">item 3</li> </ul> js $(function () { $("ul#menulist").sortable({ handle: 'i.icon-move', itemselector: 'li', placeholder: '<li class="placeholder"/>', ondrop: function (item, container, _super) { //var datatosend = $("ul#menulist").sortable("serialize").get(); $.ajax({ url: "ajax_action.php", type: "post", data: datatosend, ...

xml - How do I receive push notifications with Indy? -

i have device uses restful web services , have used request/response functionality whereby send command via http , responds appropriate xml. i need use device's pus notifications. have tried same approach above whereby supply tidhttp.get procedure relevant http url , stream in place response, doesn't seem work. call get doesn't come back. makes sense me in push notifications opening http stream of communication between device , program , connection remain open streaming until closed. my problem though don't know how xml stream if get method doesn't return. if program has hung. have tried put communication via device , reading of stream thread can continue on own , main application can check resultant xml not work. i wondering if on complicating , if there simple solution. when send request , response, works fine; it's push streaming can't work. if use url in internet explorer can see xml returned "busy" logo running indicating stream...

objective c - Regex stringByReplacingMatchesInString -

i'm trying remove non-alphanumeric character within string. tried following code snippet, not replacing appropriate character. nsstring *thestring = @"\"day's\""; nserror *error = null; nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:@"^\\b\\w^\\b" options:nsregularexpressioncaseinsensitive error:&error]; nsstring *newstring = [regex stringbyreplacingmatchesinstring:thestring options:0 range:nsmakerange(0, [thestring length]) withtemplate:@""]; nslog(@"the resulting string %@", newstring); since there'e need preserve enclosing quotation marks in string, regex becomes bit complex. here 1 it: (?:(?<=^")(\w+))|(?:(?!^")(\w+)(?=.))|(?:(\w+)(?="$)) it uses lookbehind , lookahead match quotation marks, without including them in capture group, , hence not deleted in substitution empty string. the 3 parts handle initial quotation mark, characters in mid...

YouTube API Quota Limits & Applications that Scale -

i'm working on app requires video uploading via youtube. plan share video in app via the youtube api. according documentation share video on youtube requires "approximately 16000 units.", each app having complementary quota of 5 million allowing aprox. 312 video posts day. this app have thousands of users "complementary" quota limit won't enough, in app dashboard when pressing "request more..." following message displayed: "we not approving quota requests." obviously there many apps out there millions of users such "social cam" or "talking tom" exceeding complementary quota. so question how can app increase quota? if paid pricing structure? actually, days quota cost uploading videos 1600 per video upload. , quota limit decrease 100000 per day. uploading 312 videos per day can cost 312*1600=499200. less 100000 quota limit. if want more videos uploaded can increase data limit little knowledge of php. ...

animation - CSS KEYFRAMES with links -

i have images scroll nicely in keyframes @-webkit-keyframes headimage /* safari , chrome */ { 0% {background:url(../images/homebackground1.jpg) no-repeat left top #d8e3e9;} 10% {background:url(../images/homebackground2.jpg) no-repeat left top #d8e3e9;} 30% {background:url(../images/homebackground3.jpg) no-repeat left top #d8e3e9;} 50% {background:url(../images/homebackground4.jpg) no-repeat left top #d8e3e9;} 70% {background:url(../images/homebackground5.jpg) no-repeat left top #d8e3e9;} 90% {background:url(../images/homebackground1.jpg) no-repeat left top #d8e3e9;} } however want make 1 of these images clickable link, example want homebackground1.jpg link google.co.uk when visible others wont link anywhere when on display. is there way of doing ? thanks to expand bit on , the code insert html a <section id="journey"> </section> and css #journey { height:400px; /* border-bottom: 5px solid #e64097; border-top: 5px solid #e64097;*/ ...

listview - Android first row with checkbox and the rest without -

i have listview 4 rows. i'd first row has checkbox other rows keep plain clickable rows. possible or need create 2 listviews , put them underneath each other , make first listview custom adapter? or there better way this? summary: i'd have listview first row clicked , checkbox changes states , other rows keep acting rows. best way making 2 listview 1 custom view , normal one? or possible in 1 listview? create custom adapter. in getview() method check if(position == 0) { //add checkbox } else { //without checkbox }

css - JQuery- Rotating a div clockwise and anticlockwise -

i found link on how rotate div using jquery. rotating div element in jquery , more articles too. the code follows $(function() { var $elie = $("#wheel"); rotate(0); function rotate(degree) { // webkit browsers: e.g. chrome $elie.css({ webkittransform : 'rotate(' + degree + 'deg)' }); // mozilla browser: e.g. firefox $elie.css({ '-moz-transform' : 'rotate(' + degree + 'deg)' }); $elie.css({ '-ms-transform' : 'rotate(' + degree + 'deg)' }); // animate rotation recursive call settimeout(function() { rotate(++degree); }, 5); } }); could please me extend code rotating element clockwise , ant...

actionscript 3 - How to get only the parent of the parent of the component -

i trying apply glow filter parent container of parent container of child, event comes child. so: [parent] has [another parent] has [child] event fired child , want top level parent. i have tried: targetowner.parent.parent.parent.filters = [glow]; but applies glow parent containers , need top level one, possible achieve way? appreciated. thank you cant have parent glow child not. should divide parent 2 mocievlips, 1 have non-glowing childs, other have glowing parts of parent.

asp.net mvc - Breeze Todo Example - Why does the TodosController return a string on purge and reset? -

i'm going on todos example in breeze angular , have question unable find answer for. why todoscontroller return string on both purge , reset? doesn't seem matter if return string, null, or nothing @ all... code snippet: // ~/breeze/todos/purge [httppost] public string purge() { tododatabaseinitializer.purgedatabase(_contextprovider.context); return "purged"; } // ~/breeze/todos/reset [httppost] public string reset() { purge(); tododatabaseinitializer.seeddatabase(_contextprovider.context); return "reset"; } thanks! aj you correct, not matter, in fact thi call has more entity framework breeze. string message clarity , can nice if using tool fiddler , shows http requests , information them. in case, see purged in http response body in fiddler, know call succeeded. doesn't it's used on client though.

database - Class diagram for online store -

Image
i need on designing database table online store. here class diagram : so wonder there wrong tables? because seems separated. example, how online store works. first, needy resident creates product link store needy resident table product table. then, when customer order product, information of needy resident pass along product table ordered product table. after that, check payment. if ordered product status paid, ordered product price pass payment table , payment table, can update store needy resident's sales amount. it's complicated , quite blur of also. so question is, can please me check if class diagram got error linking? thanks in advance.

javascript - events that fire all at once in Jquery without queue -

i new jquery. the idea create 2 divs when clicked on it, clicked div increase size whereas other decreases. these 2 divs have link when clicked, div flip independantly , not affecting other div. i having 2 divs (say div1 , div2) flip independently on clicking link inside it. on clicking div(say div1 here), maximize adding class maximize have defined in css. , minimize other class. able achieve all.. events happening 1 one. looks wierd. posting code below. $('.recharge-panel').click(function (e) { $(".search-panel .flipper").hide(); $('.recharge-panel').removeclass('minimized'); $('.recharge-panel').addclass('maximized'); $('.search-panel').addclass('minimized'); $('.search-panel').removeclass('flip'); $(".recharge-panel .flipper").show(); }); $('.search-panel').click(function (e) { $(".recharge-panel .flipper").hide(); $...

sql - Postgres Update column with another rows data -

ok have 2 tables measures attr_id, period, net_orders, ref_1 (key = attr_id,period) and policy attr_id, lead_time what need grab 'net_orders' measure @ period (which date), add 'lead_time' , update measure table 'ref_1' period = period+lead i have select gets me data need keep losing myself in head when trying figure out clauses. select m.attr_id, m.period, m.net_orders, p.lead_time, date(m.period) + cast(p.lead_time integer) updateperiod measures m inner join policy p on p.attr_id = m.attr_id i stuck of following query - aka incomplete update measures m set ref_1 = (select m1.net_orders measures m1 m1.attr_id = m.attr_id , m1.period = m.period) attr_id = (select m3.attr_id measures m3 m3.attr_id = m.attr_id , m3.period = m.period) , m.period = (select date(m2.period) + cast(p2.lead_time integer) measures m2 inner join policy p2 on p2.attr_id = m2.attr_id ...

build - MPLAB IDE- building an empty project -

i trying build empty project on mplab using device pic18f452. error getting: debug build of project 'c:\users\rabbiya\desktop\myproject.mcp' started. language tool versions: mpasmwin.exe v5.35, mplink.exe v4.35 preprocessor symbol __debug' defined. thu may 09 20:03:42 2013 make: target "c:\users\rabbiya\desktop\18f452tmpo.o" out of date. executing: "c:\users\rabbiya\desktop\new folder (2)\microchip solutions v2011-07-14\mpasm suite\mpasmwin.exe" /q /p18f452 "new folder (2)\microchip solutions v2011-07-14\mpasm suite\template\object\18f452tmpo.asm" /l"18f452tmpo.lst" /e"18f452tmpo.err" /o"18f452tmpo.o" /d__debug=1 make: target "c:\users\rabbiya\desktop\myproject.cof" out of date. executing: "c:\users\rabbiya\desktop\new folder (2)\microchip solutions v2011-07-14\mpasm suite\mplink.exe" "new folder (2)\microchip solutions v2011-07-14\mpasm suite\lkr\18f452_g.lkr" "18f452t...

python - How yield catches StopIteration exception? -

why in example function terminates: def func(iterable): while true: val = next(iterable) yield val but if take off yield statement function raise stopiteration exception? edit: sorry misleading guys. know generators , how use them. of course when said function terminates didn't mean eager evaluation of function. implied when use function produce generator: gen = func(iterable) in case of func works , returns same generator, in case of func2: def func2(iterable): while true: val = next(iterable) it raises stopiteration instead of none return or infinite loop. let me more specific. there function tee in itertools equivalent to: def tee(iterable, n=2): = iter(iterable) deques = [collections.deque() in range(n)] def gen(mydeque): while true: if not mydeque: # when local deque empty newval = next(it) # fetch new value , d in deques: # load d...

run an .exe file onload in VB.NET codebehind -

i have song data (title , artist) display on web page. display info on twitter account , have found great twitter .exe file tweet ever want twitter account. how run .exe file code behind page execute twt.exe file? you use process.start method: process.start("c:\somepath\twt.exe") and if wanted pass arguments: process.start("c:\somepath\twt.exe", "arg1 arg2 arg3 ...") or better, take @ twitter oauth developer page , directly use public api.

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

i've tried various ways coerce xterm (versions 285 , 292) copy selection clipboard clipboard whenever press ctrl-shift-c. promising way far has been, in ~/.xresources, put this: xterm*vt100.translations: #override \ ctrl shift <keypress> c: copy-selection(clipboard) \n\ ctrl shift <keypress> v: insert-selection(clipboard) ctrl-shift-v works perfectly, copying has nuance... if restart xterm, highlighting text puts things in primary clipboard; expected, proper, default behavior. if hit ctrl-shift-c, copies current selection clipboard clipboard. the bug, however, if highlight text after first time pressed ctrl-shift-c, you'll see highlighting copies both primary and clipboard. cannot figure out how stop xterm updating clipboard upon selection... , doesn't make sense me in first place. i said, @ specific point in time, copy selection clipboard... yet starts updating automatically upon selection after doing once... anyone have workaround...

javascript - d3 clustered force layout, distance between cluster center -

Image
(i'm d3js newbie) i'm using d3.layout.force visualize graph of nodes divided clusters, (even if in version every cluster's node keep gravity focus set cluster's center): http://bl.ocks.org/mbostock/1747543 what i'd accomplish keep each cluster separated other min distance. i set random points each cluster center @ initial stage: for(var = 0; < clusterlength; i++) { var basex = 3 var basey = 7 var x = halton(i + 1, basex) * width + (math.random() * 50) var y = halton(i + 1, basey) * height + (math.random() * 50) clustercoords.push({ x: x, y: y }) j += 1 } then i'd able reposition each cluster keeping distance between others. hope it's clear. this padding variable used in mbostock example. see example padding set 30: http://bl.ocks.org/mccannf/5548435

extjs - Duplicated header on click on toggle panel extjs4 -

Image
i have problem collapsible panels. have toolbar on top toggle icon if click on panel's header expand , header duplicated. if click on toggle button collapse duplicated header collapsed. here's code: ext.define('pollini.ricercatarghe', { extend: 'ext.panel.panel', title: '<center>ricerca per targa</center>', collapsed: true, region: 'north', id: 'ricercatarghe', height: 255, layout: 'border', initcomponent: function(){ var me = this; ext.applyif(me, { items: [ searchtarga, ristarghe ], tools: [ { type: 'toggle', handler: function(){ me.togglecollapse(true); } } ], listeners: { expand: function(){ /* stuff */ } } }); ...

asp.net mvc 4 - Is it possible to use Disqus without using links? -

so need comment system site when reading tutorial on how install it, seems comments linked url. site not have that, have instead bunch of grid elements news inside them , want users able comment , discuss current grid element user clicked, maby add popup window , disqus in possible? any kind of or tips appreciated. note: on web application built asp.net mvc 3 :) every thread need link - use give users link comments things email notifications, or when aggregating content in other areas (e.g. discovery). if site utilizes hashbangs (#!) in url, that's acceptable url pass disqus. documentation shows how reload disqus thread without changing pages: http://help.disqus.com/customer/portal/articles/472107

ember.js - Fetch search result from controller -

app.exam = ds.model.extend({ examtype: attr('string'), examdate: attr('date'), gradetext: attr('string'), coursename: attr('string'), coursename__startswith: attr('string'), typename: attr('string'), numberof: attr('number'), grade: attr('number'), }); here model want access controller. filter model using this app.examcontroller = ember.controller.extend({ // initial value of `search` property search: '' ,query: function() { // current value of text field var querycoursename = this.get('searchcoursename'); this.set('searchresult',app.exam.find({coursename: querycoursename}) } }); is correct way store results of app.exam.find() ? if how access searchresult property controller , iterate through values? depending on want do, if set property searchresult on examcontroller doing this: ... this.set('searchresult', app.exam.find({co...

python - py2exe exe crashes when os module starts -

py2exe crashes when start part of program, open folder program uses os.listdir(). works in python shell, fails when used in exe . don't errors, in exe , crashes. need add setup? here setup: from distutils.core import setup import py2exe setup(console=['drbosbeta0.35(unfinished).py']) change file name: setup(console=['drbosbeta0.35(unfinished).py']) to this setup(console=['drbosbeta0_35_unfinished.py']) than try again.

ios - Why must block be copied and not retained? When do you not need to copy a block? -

why must block copied , not retained? difference between 2 under hood? under condition not need copy block, if any? usually when allocate instance of class, goes in heap , sticks around until gets deallocated. if declare block inline code, goes on stack. when stack frame goes away, block instance-- unless copy it, creates heap-resident instance. basically, if want continue using block after stack frame gets popped, need make copy somewhere.

html - How can I access Javascript from Dialog page in Google Developer Console? -

on chrome, know how allow google developer console access javascript file linked html page requested dialog page? in website, javascript files accessed window contains html page, when open dialog box through jquery request html page, linked javascript file won't come in console. here's how launch dialog box html (link) embedded: function load_dialog(link, title, width, height){ //take care of options first. var options = { autoopen: true, position: "top", closeonescape: true, title: title, width: width, height: height, modal: true, resizable: false, show: {effect:"fade", duration:500}, close: function (event, ui){ dialog_box.dialog("destroy").remove(); } }; //launch dialog. var dialog_box = $("<div></div>").load(link).dialog(options); return false; } i should add possible see javascript linked html when open dialog box through new window. thanks in advance! ...

variables - Android getting Bitmap dimensions depending on resolution of device? -

i trying create grid of multiple squares (should minesweeper grid 1 day). now solution of getting every mine specific position using loop: for(int = 0; < cols; i++) { for(int j = 0; j < rows; j++) { mines[i][j].setcoordinates(xcounter, ycounter); xcounter+=150; } ycounter+=150; xcounter = 0; } now 150 should display width or height of 1 square because if 1 mine on (0,0) next should on (minewidth,0) fit nice , snuggly. but question is, how can independend of 150? i got number trying out number makes grid without spacing. when use lower density device images smaller distance each other remain 150 pixels. now how can independent of constant? first thought use .getwidth() method width of bitmap stored in "mine" class. didn't work out so... has got idea create grid independent of density device has? you can try width , height of screen(in dp) , use factor determine width each grid.. you can add below c...

c++ - Access violation error using ofstream/fstream? -

Image
i writing file, using ofstream . the writes rapid 1 thing, file closed , opened extremely frequently . below code: if( !(is_error(wcstombs_s( (size_t*)&out, fileregnot, 1536, finalizedmessage, 1536 ))) ) { while(reporttransferinprogress); regfilebeingwritten = true; if(fileregreportsent) { file.open("c:\\filereglog.txt", ios::out); fileregreportsent = false; } else file.open("c:\\filereglog.txt", ios::out | ios::app); if(file.is_open() && file.good() && !file.fail() && !file.bad()) { file<<fileregnot<<"\n"; file.close(); } regfilebeingwritten = false; } the access violation occurs @ statement file.close() . program breaks , compiler jumps following code in standard fstream file (the highlighted line breaks): this call stack(startrecievingnotifications name of function wrote in file being written): now these states of...

str replace - Php str_replace limit in Array -

$orjinal =$_post['orjinal']; $false = file_get_contents("false.txt"); $true = file_get_contents("true.txt"); $false1 = explode("\n", $false); $true1 = explode("\n", $true); $new = str_replace($false1, $true1, $orjinal); working changes 2 times same words false.txt" apple melon true.txt melon strawberry $orjinal="i eating apple" i want output; "i eating melon" output ; "i eating strawberry" you have 3 options: 1. fix false.txt , true.txt: false.txt: apple true.txt: melon 2. call str_replace() twice (or needed): $new = str_replace($false1, $true1, $orjinal); $new = str_replace($false1, $true1, $new); 3. sit , think once more want achieve , if simple str_replace() works way intended or not.

ios - Why does VerificationController crash inside of didReceiveData -

here function crashes. exact line of code 1 with: removeobjectforkey. when test function empty crashes on removeobjectforkey. note: i'm passing in empty function callback. currently, have arc off, need turn on? if possible, arc off, because turning on mean dealing alot of compile issues. the function non-retained objects, hence memory issue. - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data { nsstring *responsestring = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; // got receipt data. check out? bool isok = [self doestransactioninfomatchreceipt:responsestring]; verifycompletionhandler completionhandler = _completionhandlers[[nsvalue valuewithnonretainedobject:connection]]; [_completionhandlers removeobjectforkey:[nsvalue valuewithnonretainedobject:connection]]; if (isok) { //validation suceeded. unlock content here. nslog(@"validation successful"); compl...