Posts

Showing posts from May, 2015

Linq Select if vb.net -

i have dollar amount in database column. can place data in column based on whether or not amount negative or positive, produces "0.00" in false column. how leave column blank? the code have follows. dim query = t in ds.hnbsavings order t.date descending, t.id descending select t.id, t.date, t.desc, debit = if(t.amount >= 0, t.amount, 0), credit = if(t.amount < 0, t.amount, 0) dgbank.itemssource = query.tolist() so results 5.0000 under debits if it's positive , 0.0000 under credits functionality works, results little difficult read. i have tried changing false declaration null, , works returns 1.0000 in false column. changed empty string " ".tostring(), runtime exception. thanks in advance. you returning numbers if(...) statements , there no such thing blank number. closest 0, why see result. return strings instead can show empty string. dim query = t in ds.hnbsavings order t.date desce

objective c - NSSplitView xcode like fixed size headers -

Image
i want have 2 subviews in splitter , header each subview on top of it. xcode's utilities side bar i need move 2 splitters togather middle subview (header) have fixed height

Maven, run a java method or script before war is about to be built -

i thinking of using template engine generate web.xml , other things. is there way to run java file or script before maven install command ? or before war generated. i not sure phase should be, before else looks @ web.xml can touch make new valid one . you can use exec-maven-plugin run either program/script (using exec goal ) or java program (using java goal ). the phase before package prepare-package (see default lifecycle in lifecycle reference ), use that. might prefer generate web.xml earlier in lifecycle (even generate-resources ). putting these together, might try this: <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.3.2</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>exec</goal> </goals> </execution> </exec

javascript - Do something if Array element starts with a certain letter -

this question has answer here: how check if string “startswith” string? 17 answers (or not start letter) consider array: myarray = ['m1','m2','a1'] and: if ( myarray[1] !== *start m* ) { // }; is there selector can use? thanks in advance. if ( myarray[1].indexof('m') != 0) code within if block execute if string not start 'm'

python - How to output difference between two text files? -

i'm wondering how can compare 2 text files, highlighting difference between each of them? example: file1.txt aaaaa bbbbb ccccc file2.txt aaaaa bbbbb i'd have following output after comparison of 2 files: ccccc i'm using python, , tried sed , grep no luck (i'm interested in linux shell ways of doing too). sort file1.txt file2.txt | uniq -u

c++ - Alternative to RTTI for Comparing Subclasses -

i have think should simple design i'm having trouble coming solution doesn't involve rtti (or methods return type). have generic shape interface contains pure virtual draw method only. elsewhere in program, have vector of pointers shapes, , invoke draw call on each shape. now, extend functionality of shape allow shapes compare 1 , return whether or not overlap. obviously, code depends on specific type of subclass of shape -- is, code determine whether 2 circles overlap different code determine whether circle , rectangle overlap. right now, using typeid followed dynamic cast dispatch 2 objects correct overlap code, seems kludgy. there pattern or technique can use avoid use of typeid , static_casts?

ios - Objective-C, How to rotate images and stretch for PDF printing -

Image
i trying app prints 4 photos onto pdf. these photos size , orientation. i trying these photos printed specific places in pdf. if image portrait want printed, if landscape want rotate before print it. want photo fill entire of space. i have been trying while , closet have got. as can see bottom 2 photos (landscape have been rotated) narrower portrait ones @ top. can see issues code below. apologise, attempt after attempt might not 100% clear. acutal calls [pdfcreator drawphoto:image1 : cgrectmake(60, 60, 226, 340)]; [pdfcreator drawphoto:image2 : cgrectmake(326, 60, 226, 340)]; [pdfcreator drawphoto:image3 : cgrectmake(60, 407, 226, 340)]; [pdfcreator drawphoto:image4 : cgrectmake(326, 407, 226, 340)]; code + (void) drawphoto : (uiimage*) photo : (cgrect) location{ [[pdfcreator imagewithimage:[pdfcreator scaleandrotateimage:photo] scaledtosize:cgsizemake(location.size.width, location.size.height) ] drawinrect:location]; } + (uiimage*) scaleandrotateimage: (u

knockout.js - Knockout dependency injection -

i've seen in great ko manual example of creating new class within self invokation function, in way "should not pollute global namespace". not understand why send myapp (the current namespace) "inner scope", if anyways existed in outer scope. far know, if send object js function, passed ref, change reflected outside of function either. why 'injecting' myapp inside? : window.myapp = {}; (function (myapp) { function product() { var self = this; self.sku = ko.observable(""); self.description = ko.observable(""); self.price = ko.observable(0.00); self.cost = ko.observable(0.00); self.quantity = ko.observable(0); } myapp.product = product; }} (window.myapp)); thanks !!! i can think of these reasons scope variable. let minifiers replace variable shorter name inside function. keep reference original object if global variable overwritten. prevent local variables

html - How to move title of header for it to line up with main content of the page? -

i have row columns on main content section , gave width of 1000px , centered margin:0 auto. title of header way left of course , want line right row begin. how can achieve this? http://jsfiddle.net/zck9c8ud/ <header> <nav> <ul> <h1>title of page</h1> <a href="#"><li>home</li></a> <a href="#"><li>portfolio</li></a> <a href="#"><li>about</li></a> </ul> </nav> </header> <div class="row"> <div class="col">col1</div> <div class="col">col1</div> <div class="col">col1</div> </div> *{ margin:0px; padding:0px; } header{ background:orange; color:white; padding:10px; } header h1{ display:inline; position:relative; left:200px; } nav ul{ display:inline; } nav u

PHP count rows from foreach loop -

i'm using "foreach" loop in php create tables mysql data what i'm trying achieve count amount of rows being returned loop the loop creating new tables each "machine" , fills "contracts" new rows whenever try count rows returns count tables instead of single one. here's code: <?php foreach ($this->datatitle $head) { $cards = 1; echo '<table id="cards" class="cards">'; echo '<tr>'; foreach ($this->datacount $datacount) { echo '<td>' . $head->machine_text . ' ' . $head->machine_name . ' [' . $datacount->count . ']</td>'; } echo '</tr>'; echo '<tr>'; echo '<td>'; echo '<ul id="sortable" class="connectedsortable">'; foreach ($this->data $body) { if ($head->machine_text == $body->ma

my .PHP file doesnt seem to work -

Image
i have rather simple .php file following code: <!doctype html> <html> <head> </head> <body> <p>hello world</p> <?php echo "test"; ?> </body> </html> yet when run see "hello world", checked firebug , showed me and in chrome comments php out am missing important here? php pre-processed, interpreted language means web server (like apache) php interpreter installed must serve you. must install webserver on local machine , access via url http://localhost . php cannot viewed same way locally-served html files (like happens when double click them) through file:// prototcol. but never fear, not hard webserver installed. try xampp , install apache, php, , mysql , give nifty little control panel.

php - Different array structures and breaking of foreach -

i generate xml file dynamic content 2 array types images: first array type when there more 1 images, example: array(1) { ["images"]=> array(3) { [0]=> array(2) { ["url"]=> string(57) "http://example.net/image1.jpg" ["default"]=> bool(true) } [1]=> array(2) { ["url"]=> string(57) "http://example.net/image2.jpg" ["default"]=> bool(false) } [2]=> array(2) { ["url"]=> string(57) "http://example.net/image3.jpg" ["default"]=> bool(false) } } } second type when had 1 image, example: array(1) { ["images"]=> array(2) { ["url"]=> string(57) "http://example.net/image111.jpg" ["default"]=> bool(true) } } how can make second type use type of first array, because when looping th

I can't get some external jquery to work -

i hate ask simple questions these i've been working @ couple hours now. i've checked common mistakes: i'm using .ready(), code call after jquery library has been loaded , i'm sure chrome console working "all" option enabled. here's code, i'll using ajax, need jquery send message console: html <head> <script src="../libraries/jquery-1.11.0.min.js"></script> <script src="../libraries/jquery.validate.js"></script> <script src="../libraries/validardatos.js"></script> <script src="../libraries/registro.js"></script> <script src="../libraries/bootstrap/js/bootstrap.min.js"></script> <script src="../libraries/ajaxcall.js"></script> <!-- rebellious doc--> </head> jquery: $(document).ready(function(){ console.log("hello world"); }); you can add jquery

c++ - Why does this C++11 lambda not behave as I expect? -

i've encountered situation challenges nascent understanding of c++ lambdas, , i've distilled down following: #include <iostream> void test() { int (*func)(); func = []()->int { std::cerr << "func()" << std::endl; return 0; }; int = 0; func = [i]()->int { std::cerr << "func(): i= " << << std::endl; return 0; }; } in first case, i'm assigning simple lambda function pointer, , seems work expect. i'm trying in second case provide lambda access value of i . understanding of [i]()->int { code } defines nameless function takes no arguments, returns int and, through magic of c++11 unicorns, knows current value of i . expect lambda should callable int(*)() . test.cpp: in function ‘void test()’: test.cpp:14:7: error: cannot convert ‘test()::__lambda1’ ‘int (*)()’ in assignment func = ^ it seem gc

php - $_GET variable not passing while using an htaccess file -

this question has answer here: .htaccess rewrite pass query strings through 2 answers i having bit of trouble not being able pass variable when i'm using htaccess file. i have rewrite rule looks this: rewriterule user/([0-9]+) user.php?uid=$1&user and have small script looks this: <?php if(isset($_get['section'])){ /*do stuff here*/ } ?> //this doesn't run the problem i'm having if go example: www.example.com/user/2?section=info the 'section' part of url won't passed in. in order parse query string in rewritten url, must pass [qsa] (query string append) flag it, so: rewriterule user/([0-9]+) user.php?uid=$1&user [qsa]

python - Disconnecting from Interactive Brokers with ibpy -

here pretty standard piece of code use request data interactive brokers api through python: from ib.ext.contract import contract ib.opt import ibconnection, message import time def watcher(msg): print msg con = ibconnection() con.registerall(watcher) con.connect() contract = contract() contract.m_symbol = "eur" contract.m_exchange = "idealpro" contract.m_currency = "usd" contract.m_sectype = "cash" con.reqmktdata(1, contract, '', false) time.sleep(5) con.disconnect() print "disconnected" time.sleep(60) i expect connection closed after con.disconnect() , keeps getting new data (messages print updated bid, ask etc). why doesn't disconnect() seem , how can close connection? use cancelmktdata() . after calling method, market data specified id stop flowing.

Nginx: URL Redirect and regex -

i trying clean url blog's (movable type) search script using rewrite in nginx. clean search url: (xxx= tag name ex. apple) when access url 404 not found. http://cgi.blogurl.com/content/brand/apple/ regular search url script path: http://cgi.blogurl.com/mt/mt-search.cgi?includeblogs=1&tag=apple&limit=20 here have far: server { listen 80; server_name cgi.blogurl.com; if ($host = "cgi.blogurl.com") { rewrite ^/([^/]*)/$ /mt/mt-search.cgi?blog_id=1&tag=$1&limit=10 break; } } rewrite ^/?content/brand/([^/]+)/?$ /mt/mt-search.cgi?blog_id=1&tag=$1&limit=10 break;

java - ACM Interactors Freeze -

i'm trying make simple program swing , acm interactors. taken directly class handout, not function on computer. when run it, functions fine half second, briefly flashes, reloads, , button , text-field functionality lost. here's code: import acm.program.*; import java.awt.event.*; import javax.swing.*; public class textfieldexample extends consoleprogram { public void init() { namefield = new jtextfield(15); add(new jlabel("name: "), south); add(namefield, south); namefield.addactionlistener(this); } public void actionperformed(actionevent e) { if (e.getsource() == namefield) { println("hello, " + namefield.gettext()); } } private jtextfield namefield; } if helps, i'm using java se 1.6 eclipse helios service release 2 on mid-2010 mac pro running mac osx 10.8.4 as workaround, in addition using java 1.5 , add field north . also, may want extend graphicsprogram . modified sscce: import acm.program.*;

.htaccess redirect all other pages after manual 301's -

so have whole load of 301 redirect's in out htaccess because migrated new site , lot of content in different location now. need add catch rest of url's aren't manually specified , point them our homepage. you can use redirect rule as last rule (after of other rewrite rules) : rewritecond %{request_filename} !-f rewriterule . / [l,r=302]

javascript - associating an array of photos with a user on parse.com -

Image
i'm trying upload several user photos parse.com , associate them user object. i'm using javascript sdk https://www.parse.com/docs/js_guide#objects-types i'm able save photo file object. when try build array column in user object/table sdk errors out. i error json.stringify cannot serialize cyclic structures. upon saving user object. profilecontroller.js // uploads photo rest api given local file_uri $scope.addphoto = function() { var file = new parse.file("profile-image.jpeg", { base64: $scope.imagedata }); file.save().then(function(res) { console.log('success', res); var array = ['foo', file]; $scope.user.set('photos', array); $scope.user.save(); }, function(error) { console.log('error', error); }); }; this error arises when object being serialized holds references itself. question - there way associate user image files user object on parse.com? ideally array column because know there ne

c# - HttpRequest POST to RESTful web service - Salesforce Apex Callout -

i have created restful web service (c#, wcf) implements following interface: public interface itestservice { [operationcontract] [webinvoke(method = "post", responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.bare, uritemplate = "?s={astr}")] string test(string astr); } where test() method returns whatever given (or default "test" string) - and timestamps when method called . the service publicly available when enter url in browser: http://xx.xxx.xxx.xx:41000/testservice/web/ it returns json "test" string (or whatever might have been entered ?s=... @ end). i want salesforce post data web service. my apex class looks - gets triggered when object gets inserted in salesforce: public class webservicecallout { @future (callout=true) public static void sendnotification(string name) { httprequest req = new httprequest(); httpresponse res = new httpre

c# - Geckofx get xpath from geckoelement -

how can xpath geckoelement geckofx? private void webbrowser_domclick(object sender, domeventargs e) { geckoelement clickedelement = e.target.casttogeckoelement(); } how clickedelement xpath? public static string getsmallxpath(this geckonode node) { if (node.nodetype == nodetype.attribute) { return string.format("{0}/@{1}", getsmallxpath(((geckoattribute)node).ownerdocument), node.localname); } if (node.parentnode == null) { return ""; } string elementid = ((geckohtmlelement) node).id; if (!string.isnullorempty(elementid)) { return string.format("//*[@id=\"{0}\"]", elementid); } int indexinparent = 1; geckonode siblingnode = node.previoussibling; while (siblingnode != null) { if (siblingnode.localname == node.localname) {

php - Zend Framework 2 project crashing on heroku -

i have used tutorial guideline setting zf2 project on heroku. app deploys on heroku dyno crashes after , not load project. from logs, can see unable open web-boot.sh file in heroku folder in root directory. following log trace 2014-08-18t06:10:39.793559+00:00 heroku[web.1]: starting process command `sh www/heroku/web-boot.sh` 2014-08-18t06:10:40.635178+00:00 app[web.1]: sh: can't open www/heroku/web-boot.sh 2014-08-18t06:10:41.380597+00:00 heroku[web.1]: state changed starting crashed 2014-08-18t06:10:41.380597+00:00 heroku[web.1]: state changed crashed starting 2014-08-18t06:10:41.368316+00:00 heroku[web.1]: process exited status 2 2014-08-18t06:10:48.431308+00:00 app[web.1]: sh: can't open www/heroku/web-boot.sh 2014-08-18t06:10:47.975671+00:00 heroku[web.1]: starting process command `sh www/heroku/web-boot.sh` 2014-08-18t06:10:49.122386+00:00 heroku[web.1]: process exited status 2 2014-08-18t06:10:49.133922+00:00 heroku[web.1]: state changed starting crashed 2014-

php - Getter & Setter also for in class usage? -

it bad way of programming, when access private/protected class members directly in class via getter/setter methods? alternative #1 <?php class { private $myvariable; public function getmyvariable() { return $this->myvariable; } public function dosomething() { $variable = $this->getmyvariable(); } } ?> alternative #2 <?php class { private $myvariable; public function dosomething() { $variable = $this->myvariable; } } ?> which way prefer? think first solution more readable in constrast second one. please let me hear opinions. thanks in advance. since determined not duplicate, copy points this response relevant case: encapsulation of behavior associated getting or setting property - allows additional functionality (like validation) added more later. controlling lifetime , memory management (disposal) semantics of property - particularly important in non-managed memory environme

mysql - joining two tables, select values from two with second table having no records -

i have 2 tables fetch values both tables, situation first table contains records second table may or maynot. here tables tab1 id | rank 1 | tl 2 | pl 3 | mg tab2 num | id | swiped_on 1 | 1 | 20-4-14 2 | 1 | 21-4-14 3 | 3 | 25-4-14 the result want is,(only 1 record second table) id | rank | swiped_on 1 | tl | 21-4-14 2 | pl | ------- 3 | mg | 25-4-14 please help you can use left join subselect table tab2 select t.*,t1.swiped_on tab1 t left join (select id , max(swiped_on) swiped_on tab2 group id ) t1 on(t.id = t1.id) fiddle demo or max of swiped_on tab2 select t.*,max(t1.swiped_on) swiped_on tab1 t left join tab2 t1 on(t.id = t1.id) group t.id fiddle demo

How can I change a database for accounts by DDP on meteor? -

i have meteor app "a" using accounts-base, accounts-ui, accounts-twitter, , accounts-weibo. i decided make meteor app "b", same above mobile devices. are there ways change database accounts packages use on b, a's? it may possible, though not absolutely sure. may work: var connection = ddp.connect("http://other_server"); meteor.users = new meteor.collection("users", { connection: connection }); if 'collection defined error' may have fork accounts-base , use in place of used meteor.users & should fine. what pretends ddp client other server, allowing users app b use users collection app a , yet have separate database itself. the other option share same mongo_url other app, , wouldn't have worry modifying accounts-base package (if have to)

asp.net mvc - Can I limit page number using MVC routing? -

my urls this: /category/page-# /tag/product/page-# ...... can use mvc routing limit page number? want someting this: routes.maproute( name: "limitpaging", url: "*/page-{pagenumber}", defaults: new { controller = "error", action = "p404", }, new { pagenumber = @"\d+" }, new { pagenumber > 200 } ); thanks your create custom route constraint (a class implements irouteconstraint ) public class lessthanpage : irouteconstraint { private int _maxpage; public lessthanpage(int maxpage) { _maxpage = maxpage; } public bool match(httpcontextbase httpcontext, route route, string parametername, routevaluedictionary values, routedirection routedirection) { return convert.toint32(values[parametername].tostring()) <= _maxpage; } } routes.maproute( name: "limitpaging", url: "*/page-{pagenumber}", defaults: new { controller = "error"

Facebook friends ranking API -

dear facebook engineer , developers, i found script here opens ordered list of friends based on contacted or viewed. functionally needed next facebook app. my question is: in github link, said fb engineers keep on changing api. api formally supported or supposed secret? if formally supported, can shows me find api doc? ps: nice if api formally supported fb, because can open wide range of possibilities in application serve users better. thanks. https://developers.facebook.com/docs/apps/changelog with v2.0+, not possible list of friends anymore. can friends authorized app too. that script not seem use api though, imho scraping info. , scraping not allowed on facebook. using integrated typeahead feature, work while user logged in on facebook, , think works while facebook opened. highly doubt can integrate in own app, if allowed. edit: think safe use though, can try script check out how works. don´t see malicious in it, it´s known script anyway. can try putting

bash - mongodb export and remove docs -

i run unix cron every day does: export docs on 3 month old document remove same docs collections. for export part use: mongoexport --db mydb --collection mycollection\ --query "`./test2.sh`" --out ./test2.json and " ./test2.sh " file contains: #!/bin/bash d=`date --date="-3 month" -u +"%y-%m-%dt%h:%m:%sz"` echo '{ "timecreated": { "$lte": { "$date": "'$d'" } } }' for remove part can do: mongo mydb /home/dev/removedocs.js removedocs.js: var d = new date(); d.setmonth(d.getmonth()-3); db.gamehistory.remove({ timecreated: { $lte: d} }); how can synchronize 2 commends? want run remove commend after export finished. can merge 2 same cron? yes, can. the easiest way merge both commands single one-liner: mongoexport --db mydb --collection mycollection\ --query "`./test2.sh`" --out ./test2.json && mongo mydb /home/dev/removedocs.js but rec

ios - How do I urlencode this NSString that contains a JSON inside it? -

i have following json string should sent backend { id = "mu_200255802"; keywords = ( talk, games, meetup, time, meet, "time game" ); } so before json have java servlet url like http://....net/servletname? how should urlencode json string , url because after trying several options, keep getting bad url error in delegate method. right way it/ i tried encoding using nsstring *urlstringencoded = [[nsstring stringwithstring:urlstring] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; and used other encoding formats too. use create json string nserror *error; nsdata *jsondata = [nsjsonserialization datawithjsonobject:@"your object" options:nsjsonwritingprettyprinted error:&error]; nsstring *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding];

selenium ide - While recording the script, scripts records the command like "click id=ui-id-25" -

i recording site of online ticket booking , while recording script, scripts records command "click id=ui-id-25". once finish recording script , click on play run current test case. error message 'element id=ui-id-25 not found'. so please let me know what's meaning of command 'click id=ui-id-25' , why recorded, though while running script error message. the meaning of command the command click id=someid tells selenium simulate click on element on page has id = "someid" . if there no element id on page @ time of execution of command; have error telling element ... not found ! . why it's recorded selenium ide records actions in page. clicking element of page action it's recorded. why error this because selenium ide doesn't record "waiting time". if, while recording, action 1 , wait element shown (even 0.5 second) , click on element. selenium, 2 actions : doing action 1 clicking element and whe

android - listview inside a dialog window manager bad token exception -

i working on app clicking image, dialog has open listview inside it. image in listview onclicklistener in getview method of adapter. when click on image, app stops giving me windowmanagerbadtokenexception on dialog.show() line. this code : public class homelistadapter extends arrayadapter<homeitem> { public context context; public arraylist<homeitem> homeitemlist; //arraylist<string> phone; public homelistadapter(context context, int resource, arraylist<homeitem> homeitemlst) { super(context, resource, homeitemlst); this.context = context; this.homeitemlist = homeitemlst; } @override public int getcount() { if (homeitemlist != null) return homeitemlist.size(); return 0; } @override public homeitem getitem(int position) { return homeitemlist.get(position); } @override public view getview(final int position, view convertview, viewgroup pa

byte - Convert "AA" to 0xaa in arduino -

i need convert string :"aa99bb67" char[]={0xaa,0x99,0xbb,0x67}.how can that? strtoul() give 32-bit value. can use variety of methods turn array of characters. example, can use right shift move appropriate byte of 32-bit value low byte , assign element of character array.

php - Error when using dompdf library withh codeigniter -

i tried export pdf file using dompdf library, when call generatetitplepage() method got error : undefined variable number mycode: public function generatetitlepage() { $uid = (int) $this->uri->segment(3, 0); $this->load->database(); $query = $this->db->query("select * dosars id_dosar = $uid"); if ($query->num_rows() > 0) { foreach ($query->result() $row) { $number = $row['number']; $name = $row['name']; $surname = $row['surname']; $village = $row['village']; } } $html = $number; $this->load->library('dompdf_gen'); $this->dompdf->load_html($html); $this->dompdf->render(); $this->dompdf->stream("welcome.pdf"); } help me please guys!!!!!!!!!!!!!!!exist solution????????logic should work

mysql - Pagination with lot of records avoid limit offset -

for example, has big mysql table (10kk records). table struct: create table `contents` ( `id` int(10) unsigned not null auto_increment, /* fields hidden */ `update_time` int(10) unsigned not null default '0', /* index */ primary key (`id`) ) engine=innodb default charset=utf8; update_time may changed current unix timestamp time. select query: select ... contents ... order update_time desc [limit ...]; how make pagination, avoid limit offset? limit offset not useful query, because it's reading unneeded rows. example, select ... contents limit 9000000, 100 read ~9000100 rows.

javascript - CasperJS bind issue -

i'm trying reach instagram page, no luck. keep getting error , blank screenshot. error text: typeerror: 'undefined' not function (evaluating 'a.createdescriptor.bind(null,t)') casperjs --version 1.1.0-beta3. basically use following code: var casper = require('casper').create({ verbose: true, loglevel: 'debug', pagesettings: { useragent: 'mozilla/5.0 (macintosh; intel mac os x 10_7_5) applewebkit/537.4 (khtml, gecko) chrome/22.0.1229.94 safari/537.4' }, loadplugins: true }); casper.on( 'page.error', function (msg, trace) { this.echo( 'error: ' + msg, 'error' ); }); casper.start('http://instagram.com/hello', function() { casper.wait(3000, function() { this.capture('screen.png'); }); }); casper.run(function() { this.exit(); }); the shim below isn't needed anymore if phantomjs 2 used. sadly casperjs 1.1-beta3 doesn't sup

delphi - NativeXML - Create processing instructions (xml-stylesheet) -

i know how 'classic' xml object begin pinode := xmldocument1.domdocument.createprocessinginstruction('xml-stylesheet', 'type="text/xsl" href="cda2.xsl"'); xmldocument1.domdocument.insertbefore(pinode, xmldocument1.domdocument.childnodes[1]); end; but have project uses nativexml ; , don't want mix code ; want use nativexml complete task. so ... question : there function/method/workaround nativexml. thank you!

ios - Resizable selection area on realtime video -

i want develop ios app grab specific text paper using resizable selection area on real time video. click here see link of app have similar feature. can please tell me api or code should implement in order add similar features in ios platform. highly appreciate valuable resource links or project links or code sample.

How to convert from binary to bytes to hex in Python 3? -

i'm trying write program converts 2 hex strings bytes, , bytes binary. once in binary, want perform xor transposition on them. having been accomplished, want convert binary strings bytes, , again hex. know answer should be, it's question of getting b. the code have far follows: input1 = "1c0111001f010100061a024b53535009181c" input2 = "686974207468652062756c6c277320657965" target = "746865206b696420646f6e277420706c6179" d = conversions.hexconvert(input1) e = conversions.hexconvert(input2) print(d) print(e) f = bitstring.bitarray(d) g = bitstring.bitarray(e) xor1 = f.bin xor2 = g.bin print("xor1 is", xor1) print("xor2 is", xor2) xor1, xor2 = xor2, xor1 print("xor1 now:", xor1) the function "hexconvert" comprised of following code: import codecs def hexconvert(input): output = codecs.decode(input, 'hex') return(output) my code spitting out following: b'\x1c\x01\x11\x0

flex - Save data back to xml file using datagrid in flash builder -

i have xml file has employee details have registered company. populating xml using local server. have login page , have registration page. have populated xml data datagrid , can not update or add new employee through text input field. kindly me required process followed update xml file in hard drive. <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:registration="services.registration.*" creationcomplete="employeeservice.send()" currentstate="login" minwidth.registration="955" minheight.registration="600"> <s:layout> <s:basiclayout/> </s:layout> <fx:style source="assgpart2.css"/> <s:states> <s:st

jquery - How to stop Tweenmax animation while animating -

i have tried stop animation before complete animation in tween-max. div top '0px' animating top '90px' in 3 seconds.if click on button want stop it.how ? tweenmax.to("div",3, { top: '90px', }); <div id="stop">stop</div> you can use kill() remove tween. js: to remove tween. var tween:tweenmax = tweenmax.to("div",3, { top: '90px' }); //then later... tween.kill(); source

html - how to enlarge the size of an image fetched from database using only php -

i want know there inbuilt function in php through can display image greater size stored in database(i.e. greater original size). i know can done using html/css properties height , width want done through php only. i tried imagecreatefromjpeg($filename); takes file or directory name in place of $filename , image in database. here part of code: while( $result=mysqli_fetch_array($runquery)) { echo'<img src="data:image/jpeg;base64,'base64_encode($result['image']).'"/>'; } load image imagecreatefromstring . resize imagecopyresized . also suggest save paths image in database.

objective c - PHP flattening JSON array of objects? -

i'm using afnetworking post json ios app. seems working fine, json i'm sending has following format: { "user":{ "firstname":"joe", "lastname":"blogs", "contact":{ "email":"joe@blogs.com", "phone":"0800900800" }, "list":[ { "name":"item1", "code":"itm1", "category":0 }, { "name":"item2", "code":"itm2", "category":3 }, { "name":"item3", "code":"itm3", "category":2 } ] } } i parse contents of json in mysql table. i'm able r

c# - Stack constructor - What to put as initial capacity? -

one of constructors shown on msdn , takes int32 parameter representing initial capacity. there remark on above documentation page states following: if count less capacity of stack, push o(1) operation. if capacity needs increased accommodate new element, push becomes o(n) operation, n count. pop o(1) operation. i'm in situation don't know how initial capacity give stack. better overestimate think need ? because surely low initial capacity make performance suffer? what drawback in passing in high initial capacity in terms of performance? internally, storage array inside stack<t> grows exponentially , implies amortized o(1) cost add element . so, if don't know correct initial capacity, don't worry , use default constructor , performance anyway.