Posts

Showing posts from May, 2013

Python Fabric: executing interactive program such as less on remote? -

when execute like: run('less <somefile>') within fabric, prepends lines out: , interacting doesn't work expected. if run with: run('cat <something>', pty=false) the output isn't prepended , can pipe less locally, like: fab less | less however i'm not sure if that's recommended since feel may taxing on remote resource since cat continually piping through ssh. when quick less before whole file cat'd (it on 1gb), broker pipe error. what recommended way facilitate this? should use ssh directly like: ssh <remote host> less <something> if you're doing interactive work on remote host, maybe using ssh fine. think fabric useful when automating actions.

javascript - Looking for an algorithm to cluster 3d points, around 2d points -

i'm trying cluster photos (gps + timestamp) around known gps locations. 3d points = 2d + time stamp. for example: walk along road , take photos of lampposts, interesting , take 10 photos , others not don't take any. i'd cluster photos around lampposts, allowing me see lamppost being photographed. i've been looking @ k-means clustering , wanted intelligent snapping photos nearest lamppost. (i'm going write code in javascript client side app handing (2000,500) points @ time ) kmeans clustering indeed popular , easy implement algorithm, has couple of problems. you need feed him number of clusters n input variable. now, since assume don't know how many "things" want photoigraph, finding right n. using iterative kmeans or similar variations slides problem finding proper evaluation function multicluster partitions, that's in no way easier finding n itself. it can detect linearly separable shapes . let's walking around v

eclipse - Removing android-support-v7-appcompat -

i using android developer guide learn. on first run, ran number of problems setting v7 appcompat library caused more errors next steps ahead of guide. had restart coding guide. however, not sure how remove support library (i want start over), on same directory of app folder. using eclipse ide. can delete package explorer? wipe library clean? if not, how should remove library re-learn?

html5 - Displaying PDF file in the object tag -

i need display pdf file in spa application built using durandal framework. i'm leveraging "attr" knockout data-binding provide url of pdf file @ run-time. <object data-bind="attr: { data: documenturl() }" type="application/pdf" style="width: 100%; height: 100%"></object> the emitted html displays tag correctly, <object data="http://127.0.0.1:10000/devstoreaccount1/documents/tradeoverview.pdf" type="application/pdf" style="width: 100%; height: 100%; margin-right: 0px; margin-left: 0px; display: block; opacity: 1;" data-bind="attr: { data: documenturl() }" data-view="durandal/../../templates/tnc/tncdetails" data-active-view="true"></object> however, pdf file not displayed in browser! when run above emitted html in sample html file, works. not sure why not getting displayed through main app. pointers? thanks. this because browser inconsist

python - PyDev doesn't autocomplete for some modules (numpy, matplotlib at least) -

this similar, not question code-completion e.g. numpy, scipy or matplotlib not work in eclipse pydev my problem isn't pydev can't resolve variables specific type, can't numpy module functions. example import numpy np np.<ctrl+space> gives me nothing. these modules in list of forced builtins. autocomplete work many other modules (including qt/qwt, serial, struct) , programs run fine. however, every time use np.something eclipse thinks error(red line under it). "just work" else? edit (additional info): there errors in error log. however, java not having permissions run pylint , complaints invalid encoding. running eclipse 3.8.1 python 2.7 on ubuntu 13.04. historically, develop python in spyder, whatever missing has elipse nuances. it should 'just work' you. can check if 'numpy' on 'forced builtins' list (in interpreter configuration -- should added automatically, it's possible it's not there. see

libgdx check actor = stage.hit(..) as null -

i facing problem while checking stage.hit(..) actor or null actor actor = stage.hit(touchpoint.x, touchpoint.y, true); if(null != actor){ // } here after debugging come know actor getting null still control going if loop is wrong in above code ?? thanks

eclipse - Where to get the MWE2 libraries -

i'm trying mwe2 workflow running programmatically. when eclipse provides dependencies, works fine, , can new mwe2launcher().run(); call work. however, when i'm running outside of eclipse, don't know maven repo jars have depend on. i've tried getting them http://build.eclipse.org/common (tried http://build.eclipse.org/common/xtend/maven , http://build.eclipse.org/common/xtext/maven/maven-snapshot/final repo locations, aren't there. far know, need (at least) org.eclipse.emf.mwe.core (1.2.1, perhaps 1.3.0?) , org.eclipse.emf.mwe2.launch (2.4.0?) jars. does know in maven repo eclipse provides these dependencies? in advance! eclipse doesn't provide maven artifacts in general, because project's rely on osgi , p2. xtext project, maintains mwe hasn't yet uploaded jars maven repository. can find older version here : https://www.fornax-platform.org/nexus/content/groups/public/org/eclipse/plugins/ not sure if works you, there hasn't b

javascript - replace with regex then undo -

i have rather unique problem i'm trying run jquery logic replace text temporarily on page. run logic (i take screenshot tool i'm using). far works great, problem due legacy code need revert changes replace call did on page. any ideas on best way this? curious, have: $('body').html($('body').html().replace(/[a-za-z0-9\\*]*@.*\\.com/g,'[replaced screenshot]')) thanks! i'd question motives , reasoning, i'll provided answer nonetheless: var backup_body_html = $('body').html(); $('body').html(backup_body_html.replace(/[a-za-z0-9\\*]*@.*\\.com/g,'[replaced screenshot]')); afterwards: $('body').html(backup_body_html); (unless need keep hold of event handlers etc, in case cloning needed) cloning method: var body_children = $("body").clone(true,true).children(); //other stuff (i.e. replacements) //then: $("body").html(""); $("body").append(body_children)

pyqt4 - Python PyQt/PySide QMdiArea subwindows scroll not working in TabbedView -

Image
i have setup simple example using pyqt designer.see below. have mdiarea in in adding form subwindow. made form bit lengthier mainwindow see if scroll-bar appears child sub-window. problem: if set mdiarea setviewmode(qtgui.qmdiarea.tabbedview) scrollbars stop working , disappear. howeevr if dont use tabbedview, scrollbars work fine. can tell me whats wrong ? need tabbedview of mdiarea working scrollbars. i using python 2.7,pyqt 4.8.4/pyside 1.2.1 on win7. python sample code: comment line self.mdiarea.setviewmode see example working. import sys pyqt4 import qtcore, qtgui class ui_mainwindow(object): def setupui(self, mainwindow): mainwindow.setobjectname( "mainwindow" ) mainwindow.resize(500, 400) self.centralwidget = qtgui.qwidget(mainwindow) self.centralwidget.setobjectname( "centralwidget" ) self.verticallayout = qtgui.qvboxlayout(self.centralwidget) self.verticallayout.setobjectname( "vertica

html - How to highlight a whole cell when hovering over link -

i have horizontal nav bar highlight entire cell link in when hover on link, however, can immediate area around text highlight. appreciate pointers on how can achieve this. here js fiddle: http://jsfiddle.net/pykxb/1/ this css code: #horizontal-style { display: table; width: 100%; margin:0px; padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px; } #horizontal-style li { display: table-cell; vertical-align:middle; height:auto; padding:1%; } #horizontal-style a:link { display: block; border: none; text-align: center; margin:auto; padding:none; background:#ebebec; color:#005da4; text-decoration:none; font-family: arial, helvetica, sans-serif; font-weight:bold; font-size:90%; display:inline-block; vertical-align:middle; } #horizontal-style a:visited { display: block; border: none; text-align: center; margin:auto ; padding:none; background:

Difference between scripting and non scripting language -

i wondering difference between scripting , non scripting language. example lua , c++. because in game development read hiring programmer must know scripting language. thank you! some of historical in nature. non-scripted languages c , c++ compiled "raw machine code" (rmc). rmc run directly on machine. note rmc typically specific underlying cpu/hardware , supporting operating system. if want run c program on both linux , windows, has compiled each (two copies maintain , distribute). a scripted language typically not compiled. instead, source code passed interpreter understands language. interpreter typically written in language compiled rmc. interpreter's task read scripted language, , translate operations done rmc. the line has blurred in recent years (decades?) advent of systems java. languages java, source code compiled intermediate/portable language, , java virtual machine handles translation of portable language operations target cpu/os.

iOS UITableview simple drop down within table -

Image
wandering if can ios table view. background: ive got 4 entities: recorddate (relationship - records 1 many recordworkout) recordworkout (relationship - recexercises 1 many recordexercise) recordexercise (relationship - sets 1 many recordset) recordset currently displaying data through 4 different tableview controllers. what after display last 3 entities in 1 view controller drop down table. is possible? thanks tlindexpathtools has extensions both collapsable sections , expandable tree view. try running collapse , outline sample projects. if understand question, you've got two-level hierarchy, either of these extensions should work. the main difference between 2 that, collapsable sections, top level done section headers while tree view done cells. also, collapsable sections has scroll optimization, such when expand section, automatically scrolls display as section possible (though scroll optimization added tree view @ point).

Perl regex for -1 or any positive integer (but not 0) -

i need match integer either -1, or positive integer (but not 0). should possible using regex, i've found difficult grasp. i'd grateful if couldtell me how match it, , provide explanation @ same time, learn something. thanks. don't try cleaver. this: if (( $value == int( $value ) , $value > 0 ) or $value == -1 ) { .... } and avoid regular expressions can prone errors -- when overly complicated. this makes absolutely clear want. want integer that's greater 0, or -1. plus, wouldn't surprise me if more efficient parsing regular expression. let's @ solution: if ( $value =~ /-1|[1-9][0-9]*/ ) { .... } this match -1 , match 42 , not 0 . however, match -1344 , 1vvv . nor, match ٢٤ integer 42 in arabic. most of programming (or poor sucker comes after you) maintaining program: adding features, tracking down bugs. don't try cleaver. because takes fewer lines type doesn't mean more efficient or better.

How does mongodb replica compare with amazon ebs? -

i new mongodb , amazon ec2. seems me mongo replicas here : 1/ avoid data loss , 2/ make reads , serving faster. in amazon have ebs thing. understand global persistent storage, dropbox instance. there need have replicas if amazon abstracts away need of ebs ? in advance thomas let me clarify couple of things. ebs san volume if used working within existing technologies. can attached 1 instance, still has limited io throughout. using raid can maximize io, provisioned iops can maximize throughput. ideally however, mongodb, want have enough memory indexes can accessed within memory, performance drops if disk needs hit. mongo can use replicas, used failover , replication (you can send reads slave, writes need hit primary), , sharding used split dataset increase performance. still need these things anyway if using ebs storage.

Invalid request URI - Youtube API retrieve single user playlist -

i working on client site. have series of playlist set on there youtube account, load in video player depending on page of site user on. for example - homepage loads homepage playlist youtube account culture loads culutre playlist , on... i had set of playlists, , client said needed set rest of playlists in youtube account before add rest. got around creating playlists, , told me add them respective pages. some of them work, , dont. on ones not 'invalid request uri' error. ones do, load , work expected. both playlists set on same day, both being called in exact same way. why getting error? can json response each playlist, know playlist url correct. site: http://www.scrapple.tv i'm sending request url: http://gdata.youtube.com/feeds/api/playlists/playlistid?start-index=1&amp;max-results=50&amp;v=2&amp;format=5&amp;alt=jsonc playlistid id of playlist retreiving. ones client has created today , work on pages &#

extjs - Validation data in Ext.Model -

help me please. models have built-in support validations, executed against validator functions in ext.data.validations. code: ext.define('user', { extend: 'ext.data.model', fields: [{ name: 'name', type: 'string' },{ name: 'age', type: 'int' },{ name: 'phone', type: 'string' },{ name: 'gender', type: 'string' },{ name: 'username', type: 'string' }], validations: [ { type: 'length', field: 'name', min: 2 },{ type: 'format', field: 'username', matcher: /([a-z]+)[0-9]{2,3}/ }] }); var person = ext.create('user', { name: '

html - jQuery - Turn.js to use ONLY the page Peel effect -

im trying code use peel effect comes turn.js when user hovers on bottom right corner of page corner peels little , looks bending up. i not want actual turning of page effect, peel effect . according docs says can like: $("#flipbook").turn({peel: "br"}); but doesn't effect. here link jsfiddle i'm working on: http://jsfiddle.net/a9a7e/5211/ you can use turning event, , prevent turn happening. that, combined adding second page (so there's pages turn, activating effect) give effect you're after -- peelable corner without actual page turning. $("#flipbook").bind("turning", function(event, pageobject, corner) { event.preventdefault(); }); try here: http://jsfiddle.net/grmule/a9a7e/5215/ within event handler, can there trigger own reaction start of page turning, such loading new page or whatever have in mind. edit as mentioned in comments dc5, can manually trigger peel method (as showing in q

c# - Catching window creation message when application is launched -

i trying figure out how intercept message sent create window when application launched. want catch message, , somehow save , send out 10 seconds later. so can intercept message before creates application window , send out myself. the purpose isn't add 10 second delay on application, trying learn messaging system little more(how catch msg , send out myself.) unsure need filter catch window creation of application , how store message can send out. don't wan't delay whole process being launched, window creation. my application listens notepad being launched my application captures message create window my application stores message , delays window creation 5-10 seconds my application sends message out , notepad window created. can me out little accomplishing this? have no problem trying in c#, vb.net or c++. great. what looking exists in windows, referred "hooking" (no relation ladies of evening). native win32 code. here old article (11 yea

android - Facebook JavaScript SDK loading issue -

i copy/paste code (with minor adjustments) facebook apis site , not loading. code : <div id="fb-root"></div> <script> window.fbasyncinit = function() { // init fb js sdk fb.init({ appid : 'xxx', // app id app dashboard channelurl : 'channel.html', // channel file x-domain comms status : true, // check facebook login status xfbml : true // social plugins on page }); // additional initialization code such adding event listeners goes here alert('inited'); }; // load sdk asynchronously (function(d, s, id){ var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) {return;} js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/all.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'f

java - create servlet url-pattern with "/" -

i've created servlet named maincontent. , have such mapping <servlet> <display-name>maincontent</display-name> <servlet-name>maincontent</servlet-name> <servlet-class>ge.test.servlet.maincontent</servlet-class> </servlet> <servlet-mapping> <servlet-name>maincontent</servlet-name> <url-pattern>/main</url-pattern> </servlet-mapping> so, when go link: //localhost:8080/myappl/main enter servlets doget() method. create requestdispatcher forward index.jsp. everything works! requestdispatcher rd = context.getrequestdispatcher("/index.jsp?language="+ lang); rd.forward(request, response); everything works! question: now need change url-pattern. need that-:when enter localhost:8080/myappl/ need redirected servlet. create that: <url-pattern>/</url-pattern> ok, works! i'm redirected servlet. but wrong happend here. when servlet cr

Drupal 7: How to alter image field widget "alt" or title" label -

Image
i trying change "alt" , title" labels in image widget on node add form. i have tried both of these hooks: hook_field_widget_form_alter hook_form_alter i unable find needed go alter label. 1 please direct me appropriate way hook , alter them? i'm hitting these custom module if makes difference. hitting them via theme fine me well. any ideas anyone? you have add extra proccess function widget form. you can use dpm($element) devel module find more details available keys, options etc. // alter image title field_top_image instance function mymodule_field_widget_form_alter(&$element, &$form_state, $context) { // if image field type of instance 'field_image_top' if ($context['field']['field_name'] == 'field_image_top') { // loop through element children (there @ least one). foreach (element_children($element) $key => $child) { // add new process function element //dpm($element);

javascript - YouTube Video restarts when hiding and showing its container div -

i have youtube video embedded in page inside of div can hidden , shown button (using jquery/css). when hide , show show div video has reload , start form beginning. there way remember video's progress , playback form same position? or better yet way that video not have reload? here html5 div/you-tube video: <div id="you-tube-div"> <object width="640" height="390" data="http://www.youtube.com/v/fq2lnln2bok" type="application/x-shockwave-flash"> <param name="src" value="www.youtube.com/v/fq2lnln2bok"/> </object> </div> edit: here little jfiddle shows trying do: http://jsfiddle.net/ntk3b/ i recommend converting object embed newer iframe element embedding youtube video. using code stackoverflow post: how pause youtube player when hiding iframe? //via: https://stackoverflow.com/questions/8667882/how-to-pause-a-youtube-player-when-hi

android - Restarting phones getting many notification's -

i have simple reminder app. app's problem when restart phone or device, app starts throw many notifications. this source code of java files. onbootreceiver : public class onbootreceiver extends broadcastreceiver { private static final string tag = componentinfo.class.getcanonicalname(); @override public void onreceive(context context, intent intent) { remindermanager remindermgr = new remindermanager(context); remindersdbadapter dbhelper = new remindersdbadapter(context); dbhelper.open(); cursor cursor = dbhelper.fetchallreminders(); if(cursor != null) { cursor.movetofirst(); int rowidcolumnindex = cursor.getcolumnindex(remindersdbadapter.key_rowid); int datetimecolumnindex = cursor.getcolumnindex(remindersdbadapter.key_date_time); while(cursor.isafterlast() == false) { log.d(tag, "adding alarm boot."); log.d(tag, "ro

io - Is it possible to override this virtual method in C++? -

in program i'm trying read data serial port data being read form port not in format (comes out in large chunks). want override how readbytes works. bstr buffer_bstr; hr = pcom->readbytes( &buffer_bstr ); so readbytes found in library header called acomport.h made company activexperts. when go declaration of readbytes this virtual /* [helpstring][id] */ hresult stdmethodcalltype readbytes( /* [retval][out] */ bstr *__midl__icomport0001) = 0; what saying? looking implementation of readbytes change things around see this. mean? that's not "real" c++ function, it's member function on com object presented c++ wrapper. unless implement object implements same com interface, can't override or overload function.

iphone - App launches a blank screen after creating a new target in Xcode -

i having problems getting target archive validate decided delete target , make fresh one. problem solved app validates fine launches blank screen , hangs there. can give me pointers on this? have been searching internet hours , i'm drawing blank. appreciated. thanks

iphone - Animate UICollectionView Cell Insert along a curved path -

i have circular uicollectionview places each item distance apart each other along circular path. when insert item i'm specifying it's starting position in - (uicollectionviewlayoutattributes *)initiallayoutattributesforappearingitematindexpath:(nsindexpath *)itemindexpath then, how understand, layout perform animation start point, point specify in - (uicollectionviewlayoutattributes *)layoutattributesforitematindexpath:(nsindexpath *)path this results in straight line animation, point point b. able specify path animation, move along curved path rather straight one. any ideas?

actionscript 3 - How can I stop a skin animation? -

i have custom component skin attached it. there several different skins component, , animated differently. therefor i've contained animations skinclasses. when component no longer in view, need able stop animations don't run in background. how can call stop function on skin? my guess add 2 skin states: "animationstate" , "idlestate". following code not stop animation when close() called. skinstate not change. package { import spark.components.supportclasses.skinnablecomponent; [skinstate("animationstate")] [skinstate("idlestate")] public class animatedcomponent extends skinnablecomponent { public function animatedcomponent { setstyle("skinclass", myanimatedcomponentskin); } public function start():void { _isanimating = true; invalidateskinstate(); } public function close():void {

MySQL Return all unique values in a column along with the last date associated with each -

i have table relative trying pull unique id s first , last date associated each one. far, have query below, returns each unique id along first date in table associated each id . how modify query (or run second one) return each unique id along last date in table associated id ? select `id`, `date` `relative`.`datatable` group `id` this basic aggregation query: select `id`, min(`date`), max(`date`) `relative`.`datatable` group `id`; and, @rogoas points out, query not guaranteed return minimum date. return arbitrary date each id.

Using an if statement within a for loop- Excel VBA -

i'm having trouble using if statement inside loop in excel vba. output of debugger not expect. can post full code of trying accomplish, think have narrowed down don't understand. here code: private sub worksheet_change(byval target range) dim integer = 9 60 step 3 if cells(i, "dr").value < cells(i, "eb").value debug.print & "-ifloopstart" cells(i, "dr").value = 999999 debug.print & "-ifloopend" end if next end sub the output of debugger is: 9-ifloopstart 33-ifloopstart 51-ifloopstart 51-ifloopend 33-ifloopend 9-ifloopend however, expected: 9-ifloopstart 9-ifloopend 33-ifloopstart 33-ifloopend 51-ifloopstart 51-ifloopend can explain how works? seems looping beginning of if statement instead of finishing if statement. how can modify code output expect? i've been struggling hours , seems simple :( . each time worksheet updated cells(i, "dr").value = 999999 , workshe

geometry - Sphere and nonuniform object intersection -

i have 2 objects: sphere , object. object created using surface reconstruction - not know equation of object. want know intersecting points on sphere when object , sphere intersect. if had sphere , cylinder, solve equation , figure out area , problem here object not uniform. is there way find out intersecting points or area on sphere? i'd start finding intersection of triangles sphere. first find intersection of each triangle's plane , sphere, gives circle. find circle's intersection/s triangle edges in 2d using line/circle tests. result many arcs guess approximate lines. i'm not sure go here without knowing end goal. if it's surface area you're after, maybe numerical approach better. i'd cover sphere in points , count number inside non-uniform object. find if point inside, maybe trace outwards , count intersections surface (if it's odd, point inside). use stencil buffer if wanted (similar stencil shadows). if want volume of intersecti

javascript - disable a link after it's selected -

when click on link gets class named selected after gets class needs disabled until loses class "selected" can't affect other li without class or class "none" function abreplanta(idplanta, desc, image){ h = screen.height; if ($('li').hasclass("selected")) { return false; } $('#image_preview').html('<img src="../interface_test/images/loading.gif" />'); $('ul li.selected').removeclass('selected').addclass('none'); $(this).closest('li').addclass('selected').removeattr("disabled"); if(h >= 960){ size = 100; } else if(h < 960){ size = 90; } $.get('2.php', { id_planta: idplanta, size: size }, function(img){ $('#image_preview').html(img); }); $('#description').html(desc); $("#imagezoom").attr("src", "../../images/plantas/sso/

SVG transform only on path coordinates not lines and thickness -

as understand, svg transformations such scaling apply whole svg object, i.e. not vector-points, thickness , width of lines. i.e. `transform= "scale(10)" operation means, line width 10 times thicker without transform. is there way apply such transformation vertices of paths only? keep consistent path widths. lets have following svg file: <?xml version="1.0" encoding="utf-8"?> <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" xmlns="http://www.w3.org/2000/svg" > <polygon transform="scale(10) translate(100,100)" style=" fill: rgba(255,255,255,0); stroke: black; " points=" 100.0,0.0 49.99999999999997,86.60254037844388 -49.99999999999998,86.60254037844388 -100.0,1.2246467991473532e-14 -49.999999999999964,-86.60254037844388 49.999999999999936,-86.6025403784439 100.0,-2.4492935982947064e-14" /> </svg>

web services - How to pass anyType arguments in Python Suds? -

i have soap function definition (provided suds): getpaths(xs:anytype[] accessions, xs:string clienttype, ) in wsdl, inputs this: <xs:complextype name="getpaths"> <xs:sequence> <xs:element name="accessions" type="xs:anytype" minoccurs="0" maxoccurs="unbounded"/> <xs:element name="clienttype" type="xs:string" minoccurs="0"/> </xs:sequence> </xs:complextype> i tried call in python program: result = client.service.getpaths([“string1”, “string2”], "string3") get fault: suds.webfault: server raised fault: 'com.xyz.someexception: java.lang.classcastexception: org.apache.xerces.dom.elementnsimpl cannot cast java.lang.string' i think not provide data anytype incorrectly. cannot find documentation or information web on how specify anytype data. assuming can pass types. server side working fine cause there happy java clie

How to write zsh/python filename expansion with backreferences? -

i have files following structure env1.current/bin/env1/filename env2.current/bin/env2/filename env3.current/bin/env3/filename env4.current/bin/env3/filename how list above files? similar below? ls (.*).current/bin/\1/filename #doesn't work! is possible in list in python? glob module doesn't support backreferencing.

assembly - Example program crashes on TASM5, why? -

i have compiled wap32 program. example program in tasm directory. tasm32.exe wap32.asm tlink32.exe wap32.obj when start it, crashes. what's problem? maybe processor? have amd athlon(tm) xp 1700+ on other hand, turbo assembler assembler nowadays 32-bit programming? mean, that's not problem, has been relased 20 years ago? thank you, hye

ios - Filter NSArray of NSNumber with NSArray of NSNumber with NSPredicate -

i have custom class: @interface mymodel : nsobject @property (nonatomic,strong) nsstring *id_name; @property (nonatomic,strong) nsarray *genres; @end the genres array array of nsnumber s. fill array mymodel object, example: mymodel *m = [[mymodel alloc] init]; m.id_name = @"2345"; m.genres = [nsarray arraywithobjects:[nsnumber numberwithint:3],[nsnumber numberwithint:5],nil]; mymodel *m2 = [[mymodel alloc] init]; m2.id_name = @"259"; m2.genres = [nsarray arraywithobjects:[nsnumber numberwithint:7],[nsnumber numberwithint:10],nil]; mymodel *m3 = [[mymodel alloc] init]; m3.id_name = @"25932as"; m3.genres = [nsarray arraywithobjects:[nsnumber numberwithint:7],[nsnumber numberwithint:10],[nsnumber numberwithint:15],nil]; myarray = [nsarray arraywithobjects:m,m2,m3,nil]; now want filter myarray such genres contained within elements of array: nsarray *a = [nsarray arraywithobjects:[nsnumber numberwithint:7],[nsnumber numberwithint:10],nil];

user interface - GUI button calling another GUI with autohotkey -

i attempting make decision tree type program multiple gui's in autohotkey. have figured out how make work 1 time, reason can't more once. code works: gui, add, text, x72 y20 w220 h20 , type of request? gui, add, button, x12 y50 w100 h30 , password gui, add, button, x132 y50 w100 h30 , apperror gui, add, button, x252 y50 w100 h30 , accessrequest gui, add, button, x252 y90 w100 h30 , notsure gui, add, button, x132 y90 w100 h30 , hardwareproblem gui, add, button, x12 y90 w100 h30 , rightschangerequest gui, show,center, decision tree return exitapp buttonpassword: gui, destroy gui, add, text, x72 y20 w220 h20 , passwords: user trying access? gui, add, button, x12 y50 w100 h30 , windows gui, add, button, x132 y50 w100 h30 , outlook gui, add, button, x252 y50 w100 h30 , remoteapps gui, add, button, x252 y90 w100 h30 , notsure gui, add, button, x132 y90 w100 h30 , ao gui, add, button, x12 y90 w100 h30 , voicemail gui, add, button, x132 y130 w100 h30, gui, show,center, passwords

wpml - wordpress: WP_QUERY return the homepage as a result -

i'm using code query, returns home page result, hope can me it. $taxonomies_to_search = array( 'type' => 'type', 'status' => 'status', 'location' => 'location', 'general_status' => 'general status', ); $tax_query = array( 'relation' => 'and', ); foreach ($taxonomies_to_search $t => $l) { $var_name = 'dp_'. $t; $entradas_term_obj = get_term_by( 'slug', utf8_encode($_get[$var_name]), $t); if(isset($_get[$var_name])){ if ($_get[$var_name] != "0") { $tax_query[] = array( 'taxonomy' => $t, 'field' => 'id', 'terms' => icl_object_id($entradas_term_obj->term_id, $t, true) ); } } } $search_values = array( 'post_type' => 'machines', 'tax_query' => $tax_query, 'paged' => (get_query_var('paged&#

python 3.x - How do I do user inputs -

what wish ask question user (user inputs) (answers: yes, no) if yes, happens, if no, else happens. i.e: ask user if want have race in how fast can type compared computer. if yes, have race, if no, can continue else. what looking input : user_input = input('yes or no?: ') if user_input == 'yes': print('you said yes!') elif user_input == 'no': print('you said no!') else: print('you said neither.') if want ensure user user inputs either yes or no can do: while true: user_input = input('yes or no?: ') if user_input in ['yes', 'no']: break else: print('that not valid option!') if user_input == 'yes': print('you said yes!') else: print('you said no!')

javascript - How to execute a query when selected item changes for a drop down -

i have bunch of rows , each row has drop down same values. when user selects item drop down in particular row, issue request rest api update record value selected. here jsbin of working example local data http://jsbin.com/ocayoyo/84/edit i'm building view this: {{view ember.select contentbinding="app.names.content" }} how can add observe such executes query on api save record id just add selectionbinding select: {{view ember.select contentbinding="app.names.content" selectionbinding="propertywhereyouwantthevaluetoboplaced" }}

python - Can attributes be assigned anywhere within a class? -

can attributes assigned anywhere within class? if so, how scope rules works each of following cases? class greatcomposers(object): def __init__(self, name, birthday, instrument): # attributes assigned in __init__ self.name = name self.birthday = birthday self.instrument = instrument def setfullname(self) # attributes assigned in other class methods self.fullname = self.name + self.birthday self.job = self.instrument + 'ist' # attributes assigned outside functions self.nationality = 'german' no, doesn't work @ class scope ( self.nationality = 'german' in example), there no name self in scope @ point. , doesn't work in other cases because methods or self parameter somehow special. attributes can assigned anywhere have reference object . includes methods, other code has access object in question.

objective c - expected identifier error in Xcode mail -

here code: -(void) sendemailto:(nsstring *)to withsubject:(nsstring *) subject withbody:(nsstring *)body { nsstring *mailstring = [nsstring stringwithformat:@"mailto:?to=%@&subject=%@&body=%@", [to stringbyaddingpercentescapesusingencoding:nsasciistringencoding], [subject stringbyaddingpercentescapesusingencoding:nsasciistringencoding], [body stringbyaddingpercentescapesusingencoding:nsasciistringencoding]]; [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:mailstring]]; } -(void) send:(id) sender { [self sendemailto:[phonenumberentry @"@txt.att.net"] withsubject:[settingssubjectbox] withbody:[settingsmsgbox]]; } -(ibaction)launchbomb:(id)sender { sender; } in "void send sender" brackets, there "expected identifier" error. how fix? [self sendemailto:[phonenumberentry @"@txt.att.net"] withsubject:[settingssubjectbox] withbod

javascript - Ember Application Alerts -

i have application following application , view. want able flash these notifications during various points in application. current emberscripts file includes class candidate.applicationcontroller extends ember.arraycontroller alerts: ember.object.create success: [ 'tada!' 'here go!' ] error: [ 'what did now!?' ] candidate.alertsview = ember.view.extend templatename: 'views/alerts' candidate.alertview = ember.view.extend templatename: 'views/alert' class: (-> return 'alert alert-' + @type ).property() close: -> @$().slideup 'normal', => @destroy() and handlebars view/alerts looks this: {{#each alerts.success}} {{view candidate.alertview messagebinding=this type="success"}} {{/each}} and views/alert : <div {{bindattr class="view.class" }}> <i class=&q

case insensitive unix ls command -

i trying find way have results of ls command printed in case insensitive manner. currently ls command results in: apple boy chart dock apples boys charts docks what want this: apple apples boy boys chart charts dock docks is possible? ls (at least if you're using gnu coreutils version; ls --version check that) sorts file names according current locale. the set of available locales varies system system ( locale -a list), on system this: lc_collate=en_us.utf8 ls sorts names a , a before b , b -- though might not exactly in order you're looking for. this works when ls lists files in multiple columns, that's difficult sort -f . (i have $lc_collate set c locale-sensitive sorting done in ascii order.)

java - In Mule how could I log the http response without changing the original output stream -

my mule http call , response client, want log http call result, status code , response body. @ first log #[payload], it's stream, know <object-to-string-transformer/> works, don't want change response, put transformer enricher, result still changed, why? my code: <http:outbound-endpoint exchange-pattern="request-response" address="http://#[payload]" doc:name="call service in pool"/> <enricher source="#[payload]" target="#[flowvars['responsebody']]" doc:name="message enricher"> <object-to-string-transformer doc:name="object string"/> </enricher> <logger level="info" doc:name="log response" message="response, http status: #[message.inboundproperties['http.status']], body: #[flowvars['responsebody']], org: #[payload]"/> log output: org.mule.api.processor.loggermessageprocessor: response, http status: 200, bo

python - How to use PyGame.sprite -

i ditching python desk top , writing zombie game friends. have looked , looked don't understand it. explain how use pre-existing image , make sprite, check sprite collision? top down, way. this python 2.7 , pygame 1.8.1. alright, pygame sprite object bass class can used create other classes can use things collision detection: class player(pygame.sprite): def __init__(self): self.image = pygame.image.load("player.png").convert_alpha() self.rect = self.image.get_rect() self.pos = self.rect.x, self.rect.y #etc.......

Deprecated: Function eregi() is deprecated in C:\xampp\htdocs\user_registration\send-password.php on line 4 -

<?php $email = $_post["email"]; $email_test = eregi("^([a-za-z0-9_-]+)(\.[a-za-z0-9_-]+)*@([a-za-z0-9_-]\.)*([a-za-z0-9_-]+)\.[a-za-z]{2,}$", $email); if($email_test){ include("db.inc.php"); //file important mysql information $server_un = 'ddagar251'; //username of website email address (change own) ex: admin $domain = $_server["gmail.com"]; //domain name extension; ex: (wcetdesigns.com) $server_email = $server_un.'@'.$domain; //your website's email address $query = mysql_qenter code hereuery("select * register email='".$email."'"); $numrow = mysql_num_rows($query); $result = mysql_fetch_assoc($query); if($numrow&&$result["email"]){ $to = $email; $subject = "forgot password"; $headers = "from: site <".$server_email.">\r\n"; $headers .= "content-type: text/html\r\n&qu

java - How to programmatically search text in jar file? -

i want search sources.jar occurrence of search token. in bash, extract jar stream , grep string: unzip -p sources.jar | grep $search_token in java, reading entries via jarinputstream looks rather tedious. there better/simpler way (for both, looping , grepping)? is there better/simpler way (for both, looping , grepping)? in short, no (probably). (i guess might lucky, , find existing java utility command has written. don't rate chances though.) update it lucky day! http://metastatic.org/source/jargrep.java note code gpl 2. respect license!

Android - Setting date to RelevantDate with an CursorAdapter -

let me give example of requirements trying fulfill. (sorry if it's kind of dumb question brain little fried right , i'm working on myself) i have cursoradapter (w/ sqlite on backend) using listview display content. 1 of fields in list item displaying date item added listview. so... case: if today december 31st, 2013 , created list item display " today ". on january 1st, 2014 date change " yesterday ". , finally, on january 2nd, 2014 date change " 12/31/2013 ". what simple or elegant way of fulfilling these requirements? don't want checking whole listview dates , mean cpu. ideas on best practice of saving date appreciated! thanks! i think i've got working... use method in activity listview , call every oncreate, onstart, , onresume. public void setrelevantdate() { simpledateformat year = new simpledateformat("mm/dd/yyyy", locale.us); date date = new date(); string current_date = year.format(da

Android JSON Parsing with multiple arrays -

i need parse json file multiple arrays. array in format: { "list": { "something": [ { "name": "john", "phone": "test" } ] "somethingelse": [ { "name": "smith", "phone": "test" } ] } } problem don't know wold next array name. possible parse data arrays without name of , without changing structure of it? thanks. there comma missing in json after something value, apart that, can parse using json parser.

C# Exclude Parameters From File Paths -

i'm reading startup items registry , checking if associated files exist. example registry values: "c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe" msrun c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe msrun "c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe" /parameter "c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe" -paramaeter1 -parameter2 c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe -msrun /parameter "c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe -msrun /parameter" how can exclude parameters? want c:\program files (x86)\ati technologies\ati.ace\core-static\amd64\clistart.exe part. how operating system makes separation? is chance homework exercise? anyway, achieve wanted result. return yourpath.trim('\"').substr

changing java project module hirarchy -

when create new java project in intelij module : com.example.projectname . how can use own domain ? : us.mysite.projectname i've tried , didn't found answer. thanks! this name of java package. in order change package, package foo.domain.project line must changed along name of directory in code lies. seen here packages can created varying names through intellij(including possibly when creating new project), or file can change: package foo.domain.project; to package bar.dom.proj; and move sources src/foo/domain/project directory /bar/dom/proj directory.

Why is list element replacement slower than string element replacement in python? -

i trying replace set of elements in data-structure other value. seems doing such kind of replacement faster in strings in lists in case of python (as revealed benchmarking tests below). can please explain why. note: these tests performed on using python 2.7. def string_replace_test(s, chars): """replaces set of chars 0""" new = s c in chars: new = new.replace(c, '0') return new def list_replace_test(s, chars): """replaces set of chars 0""" in xrange(len(s)): if s[a] in chars: s[a] = '0' if __name__ == '__main__': import timeit s = """ lorem ipsum dolor sit amet, consectetur adipiscing elit. donec etfringilla purus. pellentesque bibendum urna @ neque consectetur @ tincidunt nulla luctus. pellentesque augue lacus, interdum id lectus vitae, laoreet suscipit arcu. """

asynchronous - C# invoke chained delegate methods asynchronously -

suppose have delegate refers bar number of methods. when invoke delegate either somedelegate(someparameter); or somedelegate.invoke(someparameter); , methods delegate refers invoked synchronously, 1 after another, right? there way make calls asynchronous ? you can use begininvoke instead of invoke . call individual delegates asynchronously - still serially. (you should call endinvoke in callback pass begininvoke . see msdn more details.) if want call delegates in parallel , use multicastdelegate.getinvocationlist them individually, parallel.invoke invoke them.

Not Skipping exceptions in spring batch -

spring batch not able skip below exception. can body suggest did miss here? <batch:job id="runpromotion"> <batch:step id="readpromotionstep"> <batch:tasklet ref="processpromotion"></batch:tasklet> <batch:next on="success" to="getpromotionalpoints" /> <batch:end on="failed"></batch:end> <batch:listeners> <batch:listener ref="queryprovider"/> </batch:listeners> </batch:step> <batch:step id="getpromotionalpoints"> <batch:tasklet > <batch:chunk reader="transactiondatareader" writer="userpromotionwriter" commit-interval="100" skip-limit="100"> <batch:skippable-exception-classes >

c# - Multi-threading in Web Application (WCF / WebAPI) -

i have "engine" want expose via http layer (hosted webapi / wcf). this engine simple read operations on large volumes of data , can benefit parallelism. simple switch for(...) parallel.for(...) wonders. now think shouldn't these kind of multi-threading in web server, i'm trying figure out best way host this. ideally i'd hosted in iis standard web app either webapi or wcf. if not solution, alternative? would better self host webapi or wcf in standard windows service? i'm not sure if issues here iis or asp.net specific. or maybe not problem , i'm worrying much? any inputs appreciated. thanks i'm not entirely clear concerns i'll try give basis on can decide: you can use multithreading in iis/asp.net safely. of course, many parallel request don't need because parallelism happens @ higher level (in fact, thoughput suffer, slightly). few parallel requests though can reduce latency using parallelism @ lower level ( parall

php - Login authentication fails in laravel 4 -

in laravel4,i have written following code in routes redirect me login page. have googled , found on stack overflow , tried solutions not succeeded.i sure silly mistake kindly track out.thank you routes: route::post('login', function () { $user = array( 'username' => input::get('username'), 'password' => hash::make(input::get('password')) ); /* store entered username , password in array named 'user' */ print_r($user); if (auth::attempt($user)) { return redirect::route('home')->with('flash_notice', 'you logged in.'); /* authentication success!!..redirect user home page */ } else { return redirect::route('login') ->with('flash_error', 'your username/password combination incorrect.')->w