Posts

Showing posts from May, 2012

angularjs - direct printing from a phonegap tablet app -

angularjs - direct printing from a phonegap tablet app - i'm writing phonegap app android tablets: basically have 2 storage departments (say tyres , brakes). people in both departments have tablet app. app to-do-list app synced db; people should print selected items on paper receipt ( different people can print list , collect items in storage section without having carry tablet themselves). can't figure out way print; truth i'm not up-to-date printers technologies. here tried , suppose: -i tried phonegap plugins create utilize of google cloud print, work everytime confirmation page (print preview) appears, leaving app screen. -on server side, php, sounds silly (apparently) network printing via php, sending list tablet server via json , printer of right department -i have no experience bluetooth or wifi printers (sure there are, there api? out-of-stock mprinter?) any smarter way? angularjs cordova printing google-cloud-print

c++ - Can I increase the performance of this Python code? -

c++ - Can I increase the performance of this Python code? - i have written next simple loop in python. uses floating point additions , multiplications sum squares of integers 0 1.0e9 - 1. (this toy example, believe representative of code writing). a = 0.0 = 0.0 while < 1.0e9: += * += 1.0 print on machine, using 32-bit cpython 2.7.8, takes 400 seconds run. equivalent c++ code (below) runs in less 2 seconds , equivalent go code in less 3. double = 0.0; for(double = 0.0; < 1.0e9; += 1.0) { += * i; } std::cout << << std::endl; since code needs distributed end users may not have other cpython installed, unable utilize pypy or numpy speed python code. is there else can increment performance of python code, or arithmetic heavy work cpython 100 times slower c++ , go? you have few options: 1) utilize pypy. on programme goes 30x faster: $ time python sum.py 3.33333332833e+26 real 4m17.728s user 4m17.465s sys 0m0.107s $ tim

java - How to compare time with correct PDT? -

java - How to compare time with correct PDT? - i want compare time below, 2 result time values created calendar setting timezone "pst". when compare 2 times, result wrong. log time: tue oct 06 17:21:17 pdt 1970, while action time: mon oct 06 17:49:47 pdt 2014 code below: calendar calendar = calendar.getinstance(); dateformat df = new simpledateformat("mm-dd hh:mm:ss.sss"); df.settimezone(timezone.gettimezone("pst")); s = newline.substring(0, 17); calendar.settime(df.parse(s)); i not see compare in code snippet, can't comment on code. should read on stackoverflow, <how compare calendar's time java.sql.time object?>read this see lion (2nd response in thread), explains everything, or can read java docs. java calendar

c - Precise delays on Arduino using nop assembly? -

c - Precise delays on Arduino using nop assembly? - i'm looking create short pulse after rising border signal input. the hard part here command (to high resolution) timing of delay before pulse, , duration of pulse. can command stringing nops myself, hard coding delays, i'm not sure how arbitrary delay, same level of accuracy. after lot of headache chasing downwards timers, , realizing limited interupt routine entry/exit time, settling @ trying command delay via nops. i had assumed c switch statement wanted (after compiling, hoping become efficient , alter programme counter right spot), produces odd behavior... switch(delaytime){ case 10: __asm__ __volatile__("nop"); case 9: __asm__ __volatile__("nop"); case 8: __asm__ __volatile__("nop"); case 7: __asm__ __volatile__("nop"); case 6: __asm__ __volatile__("nop"); case 5: __asm__ __volatile__("

xml - Java xPath/DOM - When importing a node into a document, xPath query is unable to find new node (and sub node) -

xml - Java xPath/DOM - When importing a node into a document, xPath query is unable to find new node (and sub node) - i trying import node 'new' dom document , execute xpath queries on newly imported nodes. xml i'm working has no namespaces. have followed standard procedure create document, shown: document newdoc = null; documentbuilderfactory mill = documentbuilderfactory.newinstance(); seek { documentbuilder builder = factory.newdocumentbuilder(); newdoc = builder.newdocument(); } grab (parserconfigurationexception pce) { // parser specified options can't built pce.printstacktrace(); } and import nodes... // nodetoimport node prior xpath search (part of node set) node doctorunxpathon = newdoc.importnode(nodetoimport, true); later, when seek run xpath query such as xpathfactory xpathfactory = xpathfactory.newinstance(); xpath xpath = xpathfactory.newxpath(); if (doctor

php - create a tree structure from a set of parent-child relationships -

php - create a tree structure from a set of parent-child relationships - i have array of arrays holds parent-child relationships between nodes in graph. each of nested arrays of form array( 0 => parent_node_id, 1 => child_node_id ) so in array: 0 => array( 0 => 1 1 => 3 ) the 2 nodes 1 , 3, , there parent-child relationship between node 1 , node 3 (the outer array index 0 irrelevant). 1 => array( 0 => 3 1 => 5 ), represents parent-child relationship between node 3 , node 5 (the 1 irrelevant). here parent-child relationship array (note array index of outer array (0, 1, 2, 3, etc.) not represent anything): 0 => array( 0 => 1 1 => 3 ), 1 => array( 0 => 3 1 => 5 ), 2 => array( 0 => 3 1 => 7 ), 3 => array( 0 => 3 1 => 9 ), 4 => array( 0 => 1 1 => 10 ), 5 => array( 0 => 10 1 => 15 ) here pictorial representation of info construction

facebook opengraph - "The 'og:type' property is required, but not present." error, despite correct HTML -

facebook opengraph - "The 'og:type' property is required, but not present." error, despite correct HTML - this url (http://www.di.fm/tracks/878723/ebm) gives error on opengraph debugger: the 'og:type' property required, not present. despite proper meta tag set: <meta property="og:type" content="company"> what wrong? there no og:type "company", see specification: http://ogp.me/#types also create sure utilize http/https in og:image definition. if seek re-scrape url in debugger, next error: object @ url 'http://www.di.fm/tracks/878723/ebm' of type 'website' invalid because given value '//static.audioaddict.com/4/2/f/d/b/5/42fdb594090bfe550f483e0ee6971a9a.jpg' property 'og:image:url' not parsed type 'url'. ...and add together slash @ end of each og tag, see here: http://ogp.me/ facebook-opengraph opengraph

ASP.NET Web API Login History Implementation -

ASP.NET Web API Login History Implementation - i have searched have not found documentation outlining best way log each successful or failed effort access token , store date/time , ip of request. able within application? ok. it's odd there isn't involvement in answering question. after trial/error , debug tracing, found applicationoauthprovider , located in providers folder in typical asp.net web api template, contains following: public override async task grantresourceownercredentials(oauthgrantresourceownercredentialscontext context) { var usermanager = context.owincontext.getusermanager<applicationusermanager>(); applicationuser user = await usermanager.findasync(context.username, context.password); //log authentication effort here if (user == null) { context.seterror("invalid_grant", "the user name or password incorrect."); return; } cl

php - Call external function from within class that accesses private properties -

php - Call external function from within class that accesses private properties - i'm trying create code little drier doing follow in php: function accessor($obj, $property) { homecoming $obj->$property; } class someclass { private $variable; function variable() { homecoming accessor($this, 'variable'); } } $some = new someclass; echo $some->variable(); the above code throws error because external function can't access private variable. code simplified, farther coding create more useful. i'm not sure if possible sure nice! what want traits (php 5.4+)- practically pasted parent classes, can access private state: trait variablethingy { function accessor($property) { homecoming $this->$property; } } class test { utilize variablethingy; private $variable = 15; function variable() { homecoming $this->accessor("variable"); } } but no, it's not nice. it'

javascript - EntityAspect property still not avail after adding an expand clause to a BreezeJS query -

javascript - EntityAspect property still not avail after adding an expand clause to a BreezeJS query - this follow question ziad asked on 13 nov 2013. question in regard entityaspect property no longer available after adding expand clause in breezejs. appeared functionality worked in v1.4.3, after upgrading v1.4.5 ef6 , webapi2, functionality no longer available. have breeze client of v1.5, ef 6.1.1 , webapi 2.2 , functionality still has not been restored. questions are: functionality ever restored and, if not, there workaround available. unless can find way overcome issue, have major breeze, knockout, durandal based application dead in water. i have stolen ziad illustration code. hope not mind because illustrates problem. code works fine: var query = breeze.entityquery.from("products").take(1); the entityaspect property row available. however, when added expand clause: var query = breeze.entityquery.from("products").expand("orders&qu

c - Difference between clock_t and time_t or time(NULL) and clock() -

c - Difference between clock_t and time_t or time(NULL) and clock() - i write c programme print integer value on every 1 sec exercise,this programme print integer after wait 1 sec before printing next integer programme take 5 seconds finish execution.i using clock_t , time() timer , works when utilize clock_t , clock timer doesn't work. as know time_t , time() absolute time , using seconds elapsed since 1970.while clock_t , clock() utilize time since programme run. this first code using time_t , time(null) #include <stdio.h> #include <time.h> int main (void) { int i; int sec=1; time_t start,end; start=time(null); for(i=1;i<=5;i++){ time_t wait=sec+time(null); while(time(null) < wait) {} printf("%d\n",i); } end=time(null); printf("program take %d second\n",(unsigned int)difftime(end,start)); homecoming 0; } and result when programme run: 1 2 3 4 5 programme take 5 sec

Displaying HeatMap in DataGridView from List<List> in C# -

Displaying HeatMap in DataGridView from List<List<T>> in C# - i've got info in list of list of touples. task create heatmap that. beingness newbie in c#, i've searched net , found way of solving task painting elements in datagridview, don't understand, how it. so,i've got list of touples: using spikedatapacket = list<tuple<double, double>>; this way load info within grid: public heatform(list<spikedatapacket> list) { spikelist = list; initializecomponent(); var bindstim = new bindinglist<spikedatapacket>(spikelist); var stimsource = new bindingsource(bindstim, null); heatmap.datasource = stimsource; } but displays table "capacity" , "count" within datagridview, not data. also, i've found way count color, don't know, how apply it: private color heatmapcolor(double value, double min, double max) { color firstcolour = color.royalblue; color secondcolour = color.lights

Cordova InAppBrowser opens double window on Android -

Cordova InAppBrowser opens double window on Android - i have developed app in cordova 3.6 latest version of inappbrowser. run on android device (4.1.2 , others) when user taps link open inappbrowser, double window seems open up. sec of these windows doesn't close. to check if had done in app, created default cordova hello world app , added standard window.open code link this <a href="#" onclick="window.open('http://www.google.com','_blank')">open window</a> and basic testing on device revealed same thing happening - fast or double tapping made double window open up, 1 of uncloseable. either <300ms double tap, or double taps browser slow launch. this doesn't appear happen on ios. any help gratefully appreciated. update part of problem on main app functions declared in wrong place (onpagecreate) beingness fired multiple times. set here in case similar... however on hello world app problem still happens.

database - Move field through different groups in Crystal Report -

database - Move field through different groups in Crystal Report - i have question concerning crystal reports. imagine have crystal study form 2 groups: grouping header & grouping footer. assuming different fields found on 2 groups connected same database. can moves fields through different groups not impact info or connection database. because have tried redesign study on crystal report, unfortunately when move field different grouping did not values database. have seek insert new field & link database. not work. can help me please. thanks p.s: beginner in crystal report. your requirement has nil database connection... database connection exists in report.... now coming requirement though have 1 grouping , grouping has grouping header , footer... info displayed different because grouping header show first record grouping , in grouping footer have lastly record grouping. hope explanation clear. if not looking allow me know... or explai

Scala type erasure for pattern matching -

Scala type erasure for pattern matching - i have been searching forum , google answers type erasure issues scala. however, cannot find answers question. i struggling pattern matching on objects match type parameter of paramclass. need pattern match on type of incoming objects bar method. have seen solutions such as bar[x](a : x)(implicit m : manifest[x]) which solve problem, cannot utilize bar method overridden method. (actually receive partial function in akka actor framework). code given below , should self explanatory: class paramclass[a : manifest] { def bar(x : any) = x match { case a: => println("found a: " + a) case _ => println("no match: " + x) } } object erasureissue { def main(args: array[string]) { val clz = new paramclass[int] clz.bar("faf") clz.bar(2.3) clz.bar(12) // should match, not } } erasureissue.main(null) any help on solving issue appreciated. i'm using scala 2.9.1,

firefox - Weird error in FF addon sdk 1.17 when running -

firefox - Weird error in FF addon sdk 1.17 when running - when run add-on (developed sdk 1.17) weird error: ###!!! [child][dispatchasyncmessage] error: route error: message sent unknown actor id otherwise add-on works should. updated ff 33.0.2 , moved sdk 1.16 sdk 1.17 , when error started happen. any help or clarification appreciated! i think firefox error, , not related add-on or add-on sdk. you can ignore it. firefox firefox-addon firefox-addon-sdk

java - How can I parse a string for a set? -

java - How can I parse a string for a set? - i writing method supposed take input string of format "s1:{1,2,3,4}" , set set . set class have developed myself, , follows: public class set<e> implements iterable<e> { private static final int default_capacity = 20; private string name; private e[] thedata; private int size = 0; private int capacity = 0; public set(){ capacity = default_capacity; thedata = (e[]) new object[capacity]; }//end constructor public set(string name){ capacity = default_capacity; thedata = (e[]) new object[capacity]; this.name = name; }//end constructor public string getname(){ homecoming name; }//end getname public void setname(string name){ this.name = name; }//end setname //adds object set public void add(object e) { if (size == capacity) { reallocate(); }//end if thedata

google maps api 3 - Auto display info windows on markers from directionsRenderer -

google maps api 3 - Auto display info windows on markers from directionsRenderer - the directionsrenderer creates marker @ origin , end destination. right have click marker display info window. how automatically display info window? process of creating 2 markers abstracted directionsrenderer i'm not sure how find 2 markers. 1) utilize suppressmarkers parameter of directionsrenderer directionsdisplay = new google.maps.directionsrenderer({ suppressmarkers: true }); 2) add together own markers on start (and/or end) point(s) jsfiddle demo 3) phone call open() method of infowindow forcefulness open https://developers.google.com/maps/documentation/javascript/reference?#infowindow hope helps. google-maps-api-3

java - JAXB - Composite pattern and @XmlValue -

java - JAXB - Composite pattern and @XmlValue - following jaxb , composite pattern, managed map: <precondition> <or> <and> <just><query>foo</query></just> <just><query>bar</query></just> </and> <just><query>baz</query></just> </or> </precondition> but i'd map: <precondition> <or> <and> <query>foo</query> <query>bar</query> </and> <query>baz</query> </or> </precondition> my jaxb class hierarchy follows: @xmlrootelement @xmlseealso({simplepreconditionquery.class, compoundandpreconditionquery.class, compoundorpreconditionquery.class}) public abstract class preconditionquery { // jaxb not deal interfaces default >:( } with several kinds of queries: @xmlseealso(precon

php - Phalcon "use Vendor\Package" pass to view -

php - Phalcon "use Vendor\Package" pass to view - i'm website developer using laravel main framework work. using phalcon projects may benefit it, having problem getting head around thing. i know know how add together utilize vendor\package controller gets passed on view? currently, documentation shows 'use' case beingness added view don't want have views tidy , believe should done in controller. i've tried... <?php utilize phalcon\tag; class indexcontroller extends controllerbase { public function indexaction() { } } and in view added... <h2>sign using form below</h2> <?php echo tag::form("signup/register"); ?> <p> <label for="name">name</label> <?php echo tag::textfield("name") ?> </p> <p> <label for="username">username</label> <?php echo tag::textfield("username") ?> <

xcode - How can I FORCE subversion to check in and commit a file? -

xcode - How can I FORCE subversion to check in and commit a file? - i have checked out project in xcode svn repository. else changed 2 of files had checked out, , caused them updated (they should not have) on svn, 2 of files out of date. cannot update 2 files machine fear of loosing changes. when seek , commit changes (about 60 files), checks in, except error 2 of files cannot checked in. project file itself, , 1 .mm file. xcode & svn insist must update 2 files before check them in. ok, on .mm file, have rolled changes re-create of file already. forcefulness check in. can re-create contents, update, , paste re-create file. should work .mm file since think updated. but project file? there way forcefulness check in? if not, how 1 merge project file? happy overwrite project file @ time. thanks in advance easy: copy project file new location do svn revert path/to/project/file in working copy do update in working re-create svn up commit uncommitted chan

xilinx - VHDL - unconnected components in top module -

xilinx - VHDL - unconnected components in top module - i working on project , i'm failing connect components in top module. can't see i'm doing wrong. suggestions highly appreciated. besides not beingness able see components in rtl schematic, warnings: warning:xst:1290 - hierarchical block <u0> unconnected in block <top>. removed design. warning:xst:1290 - hierarchical block <u1> unconnected in block <top>. removed design. warning:xst:2677 - node <u1/calc_deb> of sequential type unconnected in block <top>. warning:xst:2677 - node <u1/flipflops_1> of sequential type unconnected in block <top>. warning:xst:2677 - node <u1/flipflops_0> of sequential type unconnected in block <top>. so here implementation of top module: library ieee; utilize ieee.std_logic_1164.all; utilize ieee.std_logic_arith.all; utilize ieee.std_logic_unsigned.all; entity top port( calc: in std_logic; op: in std

Neo4j server plugin basic questions -

Neo4j server plugin basic questions - i using neo4j v2.1.5 , creating server plugin. how create unique node i.e. guarantee uniqueness of property? is there hook in plugin lifecycle, constraints , indexes can created? returning node returns finish database. how can homecoming node or pojo list json? there working examples or explanation of representation available? i using java api , not cypher. how create unique node i.e. guarantee uniqueness of property? you can create unique constraint on (label, property) pair ensure uniqueness of property. e.g. create unique constraint on :person(name) would ensure can't have 2 people nodes same name. if want java api you'd like this: try ( transaction tx = graphdb.begintx() ) { graphdb.schema() .constraintfor( dynamiclabel.label( "person" ) ) .assertpropertyisunique( "name" ) .create(); tx.success(); } is there hook in plugin lifecycle, constrain

java - Set a new JFileChooser FileFilter and reset previous ones -

java - Set a new JFileChooser FileFilter and reset previous ones - i want file filter 2 options, 1 show files , other show specific extension. the specific extension should 1 selected default. i'm using same jfilechooser twice, first time show .fas files, , sec show .xls files. right i'm using code, reasons not overwrite previous file extensions. many answers here on have similar code , same problem, if recycle jfilechooser. first portion, works filechooser.setfilefilter(new javax.swing.filechooser.filefilter() { @override public boolean accept(file file) { homecoming file.isdirectory() || file.getabsolutepath().endswith(".fas"); } @override public string getdescription() { homecoming "fasta"; } }); // more modern api, same result // filechooser.setfilefilter(new filenameextensionfilter("file fasta", "fas")); second portion. used in sec "opening" of same jfilechoo

html5 - What does the WHATWG working standard mean by the note "At the time of writing, no such rules actually exist"? -

html5 - What does the WHATWG working standard mean by the note "At the time of writing, no such rules actually exist"? - reading whatwg living standard found note in 13.2 parsing xhtml documents. an xml parser, purposes of specification, build follows rules given in xml specification map string of bytes or characters document object. note: @ time of writing, no such rules exist. and word document links html dom document (the thing has title , collection of forms , etc.) it appears exclusively undermine purpose of definition above it, , thereby of section 13.2 depends on definition. there more subtle way of interpreting it? (to avoid beingness open-ended philosophical question, interested in known whatwg author's opinions, e.g. quotes (and links to) supporting blog posts great.) ian hickson, author/editor of said living standard has said "i’m proud of html parser specification" it's state machine converting text/html

sql - DateAdd Syndrome -

sql - DateAdd Syndrome - i used ton of keywords search info on nil popped every time nail enter, that's little surprising me. my question this: i have functions in query homecoming me specific area of time in month of gross sales week. looks this: declare @startdate datetime, @enddate datetime set @startdate= **dateadd(wk, datediff(wk, 6, getdate()), 6)** set @enddate= **dateadd(wk, datediff(wk, 6, getdate()), 12)** exec dbo.lvs_salessummaryrpt @enddate =@enddate, @startdate = @startdate and have 1 entire month well: declare @startdate datetime, @enddate datetime set @startdate=**convert(varchar(25),dateadd(dd,-(day(getdate())-1),getdate()),101)** set @enddate=**dateadd(s,-1,dateadd(mm, datediff(m,0,getdate())+1,0))** exec dbo.lvs_salessummaryrpt @enddate =@enddate, @startdate = @startdate now areas i've bolded, i've copied , pasted select in new dataset in ssrs, new datasets can apply look =first(fields!begofweek.value, "weekds")

objective c - NSBItmapImageRep RGB To PNG -

objective c - NSBItmapImageRep RGB To PNG - i have bgra image encoded png (or compressed format compared raw bitmap). is there way 60 times sec little amount of cpu? right now, have tried using nsbitmapimagerep representationofimagerepsinarray, ends taking ton of cpu. objective-c osx png nsimage libpng

mysql - doesn't partition pruning work if I have range size larger than number of partitions? -

mysql - doesn't partition pruning work if I have range size larger than number of partitions? - i've 15 1000000 of rows in table , info comes on every 4 sec basis. so, have decided create partitions on each day follows alter table vehicle_gps partition range(unix_timestamp(gps_time)) ( partition p01 values less (unix_timestamp('2014-01-01 00:00:00')), . . . partition p365 values less (unix_timestamp('2015-01-01 00:00:00'))); i had create 365 partitions shown. each partitioned day contains info around 100 one thousand rows. , if want fetch info giving query select gps_time vehicle_gps gps_time between '2014-05-01 00:00:00' , '2014-05-06 00:00:00'; i found partitioning pruning not happening. mysql manual says if values in between range larger number of partitions, pruning won't happen. if need of creating partitions tables cont

How to merge multiple app.config files on runtime in .net? -

How to merge multiple app.config files on runtime in .net? - with web apps, multiple web.config files merged based on directory hierarchy. there way define custom hierarchy regular windows apps? functionality config file merging exists, don't see why shouldn't possible. currently hierarchy user.config -> roaming.config -> app.config -> machine.config . , there huge restrictions on can go user.config , roaming.config. i able have next hierarchy: additional2.config -> additional1config -> app.config -> machine.config , or many config files want, resulting in single configuration object can read from. otherwise, have search each additional config manually. configsource not plenty me, because additional configuration files contains new config sections. .net app-config

xcode - How to add seperate iPad and iPhone images in spritebuilder- Cocos2d 3.2 -

xcode - How to add seperate iPad and iPhone images in spritebuilder- Cocos2d 3.2 - i love spritebuilder takes retina ipad image , automatically makes scaled downwards iphone images. i create 1 image (ipad retina), , spritebuilder makes iphone ones automatically: but buttons/sprites, wanted create both ipad , iphone images myself. how add together custom iphone , ipad versions image can used in spritebuilder ui? eg. utilize 1 image ipad (retina), utilize 1 iphone. also, how add together external spritesheet spritebuilder xcode project? (adding -hd or -ipadhd suffix no longer works, chooses 1 no suffix) -i heard has 'resources-phone'? if select image in sb can see preview image in top half of file view. below image 4 smaller buttons labelled auto, 1 each platform (phone, phonehd, tablet, tablethd). for instance, select ipad image, drag , drop image image's phone , phonehd auto buttons. way override original image when app run on phone or phonehd

node.js - PassportJS req.user undefined when authentification from an android app -

node.js - PassportJS req.user undefined when authentification from an android app - i'm developing api in nodejs, authentification part i'm using passportjs. i'm using tutorial: http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local in browser, it's ok user when seek android app, req.user undefined. app.post('/login', passport.authenticate('local-login', { successredirect: '/loginsuccess', failureredirect: '/loginfailure', failureflash : true // allow flash messages })); app.get('/loginfailure', function(req, res, next) { res.setheader('content-type', 'application/json'); res.json({user: req.user, message: req.flash('loginmessage')[0]}); }); app.get('/loginsuccess', function(req, res, next) { console.log(req.user); res.setheader('content-type', 'application/json'); res.json({user: req.user, message: "test"

c# - Please Tell me why does this code generates output 'Base Class'. Although Object is of Derived2 type and reference variable is also of same type -

c# - Please Tell me why does this code generates output 'Base Class'. Although Object is of Derived2 type and reference variable is also of same type - namespace indiabixconsoleapplication { class baseclass { public void fun() { console.write("base class" + " "); } } class derived1: baseclass { new void fun() { console.write("derived1 class" + " "); } } class derived2: derived1 { new void fun() { console.write("derived2 class" + " "); } } class programme { public static void main(string[ ] args) { derived2 d = new derived2(); d.fun(); } } } because derived methods not public , selection external class ( program ) has public baseclass.fun() method. if create derived2.fun() public giv

javascript - while vs setInterval -

javascript - while vs setInterval - i have next array monitor widgets initiated app i'm working on: widgets = [{ selector: ".table", init: function() {...} }, { selector: ".anothertable", init: function() {...} }] each init function invoking plugin. when plugin has finished tasks pushes selector (e.g ".table") array called "readywidgets" now question this: how can tell 1 time selectors nested under primary widgets array nowadays in readywidgets array? i'm kind of having blackout, although have solution, think there improve 1 i'm missing. this came with: init: function() { // hold each widget selector // , later in readywidgets array var widgetspending = [] // initialize each widget in widgets array // (only if selector matches @ to the lowest degree 1 element) this.widgets.foreach(function(widget) { $(widget.selector).length && widgetspending.push(widget.selector)

php - Creating attribute in domdocument -

php - Creating attribute in domdocument - i have create type of xml :- <?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://www.example.com/</loc> <lastmod>2005-01-01</lastmod> <changefreq>monthly</changefreq> <priority>0.8</priority> </url> <url> <loc>http://www.example.com/catalog?item=12&amp;desc=vacation_hawaii</loc> <changefreq>weekly</changefreq> </url> </urlset> for have written code, $dom = new domdocument('1.0', 'utf-8'); $dom->formatoutput = true; $rootelement = $dom->createelementns('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'); $sxe = simplexml_import_dom( $dom ); $urlmain = $sxe->addchild("url"); $loc = $

ruby - Reference a variable in a test script -

ruby - Reference a variable in a test script - i have created deck class , have defined 1 of functions insert card @ origin of array. everytime seek test in test script receive `add_to_bottom': wrong number of arguments (1 0) (argumenterror). can please help me know close figuring out. deck class def add_to_bottom @cards.insert(0, c) end test script d = deck.new c = card.new(7, "s") d.add_to_bottom(c) print d, "\n" add_to_bottom has c in method body, neither method nor variable. if meant argument passed, need write def add_to_bottom(c) . if that, resolve error. ruby

json - Android Retrofit Get child object of child object -

json - Android Retrofit Get child object of child object - i'm trying kid object data kid object of children if kid object of data . i know sound confusing, here total json object: full json here code: import java.util.list; import retrofit.restadapter; import retrofit.http.get; import retrofit.http.path; public class githubclient { private static final string api_url = "http://www.reddit.com/r/pcmasterrace/"; static class info { string kind; list<children> children; } static class children { info data; } interface reddit { @get("/hot.json?limit=1") list<data> data(); } public static void main() { // create simple rest adapter points github api endpoint. restadapter restadapter = new restadapter.builder() .setendpoint(api_url) .build(); // create instance of our github api interface. reddi

ios - How can I redirect pan gesture events to parent views? -

ios - How can I redirect pan gesture events to parent views? - i have uiscrollview within sliding uiview . sliding uiview should able reach top of navigation bar, , if user still dragging finger, uiscrollview within should start slide upwards well. likewise, if slide uiscrollview downwards , reach top of content, sliding uiview should start slide down. i can't behavior work way want to. using xamarin.ios library, can translate objective-c c# if can point me in right direction this. thanks! you able custom delegate , utilize of scrollviewdidscroll: method. in method check see if have reached bounds of uiscrollview... if have pass whatever variables need to delegate (which uiview) , uiview handle info in way want. example: uiview.m [self.myscrollview setscrolldelegate:self]; scrollview.h @protocol scrollviewdelegate : <nsobject> @optional - (void)scrollviewdidscrolltoend:(needed parameters here); @end scrollview.m - (void)scroll

c++ - How to assign a variable a new object -

c++ - How to assign a variable a new object - let's have line of code this: myclass obj(1, 2, "hello"); and @ point in future want assign obj new value, i.e. obj(3, 4, "bye") . how this? i mean in java this: myclass obj = new myclass(1, 2, "hello"); obj = new myclass(3, 4, "bye"); in c++ have tried this: myclass obj(1, 2, "hello"); obj(3, 4, "bye"); but didn't work, have tried this: myclass obj(1, 2, "hello"); obj = myclass(3, 4, "bye"); and did work, not sure if preferred way accomplish this. please suggest me clean way assign variable new object , tell me if there additional effort needed manage memory after such assignment. please maintain in mind have started learning c++ 2 days ago, know oop concepts know how many fingers hands have. the code in c++ similar java code myclass obj = new myclass(1, 2, "hello"); obj = new myclass(3, 4, "

magento - 1.9 - Unable to login to admin panel -

magento - 1.9 - Unable to login to admin panel - i new in magento. have installed magento on localhost. after installing have tried login admin, can't able login. have tried in different browsers, browsers redirecting login page itself. have tried solution given in this question. producing error. please 1 help me solve issue. do not edit files. first, verify cookie domain right in magento configuration in system > configuration > web this should match url using access local store. otherwise here alternate method supports multiple local stores. in suggestion 1: adding local domain in local hosts file 2: updating apache configuration (if using mamp/xammp) 3: setting domain in magento configuration base of operations url , cookie domain. this method uses new local domain url (http://local.domain.com/) , consistant resolved domain / login issues i've had. mac: open terminal (command + spacebar, type "terminal" , nail enter) ty

PHP What is wrong with recursive function? -

PHP What is wrong with recursive function? - i did function showing today date or next workday date, if weekend. function works great, homecoming wrong. $today = todaydate('2014-10-18'); // saturday function todaydate($date) { if(date('n', strtotime($date)) >= 6) { echo 'if - ' . $date . '<br/>'; $date = date('y-m-d', strtotime('+1 day', strtotime($date))); todaydate($date); } else { echo 'else - ' . $date . '<br/>'; } homecoming $date; } echo '<br/><br/>today: ' . $today . '<br/><br/>'; this function echoes following: if - 2014-10-18 if - 2014-10-19 else - 2014-10-20 but echo of $today (last row in code) is today: 2014-10-19 so, wrong? lastly $date in function "2014-10-20" , value returning $today, $today shows different valu

audio - iOS8 & xcode6 no longer plays sound -

audio - iOS8 & xcode6 no longer plays sound - i'm having problem appeared after big update ios 8 , xcode6. when seek play sound audiotoolbox nil comes out speakers. using simulator. i have 2 variants of function plays sound. -(void)playsound:(nsstring *)filename { systemsoundid soundeffet = [self soundeffect]; nsurl *soundurl = [[nsbundle mainbundle] urlforresource:filename withextension:@"mp3"]; nsstring *urlstring = [soundurl absolutestring]; if ([[nsfilemanager defaultmanager] fileexistsatpath:urlstring]) { audioservicescreatesystemsoundid((__bridge cfurlref)soundurl, &soundeffet); audioservicesplaysystemsound(soundeffet); } else { nslog(@"error, file not found: %@", filename); } } this fails file exists @ path check. -(void)playsound:(nsstring *)filename { systemsoundid soundeffet = [self soundeffect]; nsstring *path = [[nsbundle mainbundle] pathforresource:filename ofty