Posts

Showing posts from May, 2013

javascript - Detecting when a long request has ended in NodeJS / Express -

javascript - Detecting when a long request has ended in NodeJS / Express - i'm dealing server-sent events, pseudo-code looks this: var listeners = []; app.get('/stream', function (req, res) { listeners.push({ req: req, res: res }); }); // ... happens notify(listeners); now works quite fine acutally, how know when client closes browser window don't run out of memory eventually? have manage client-side or there req.on('close', fn); can't find? thanks in advance. :) using request's close event should work fine: var listeners = []; app.get('/stream', function (req, res) { var listener = { req: req, res: res }; listeners.push(listener); req.on('close', function() { listeners.splice(listeners.indexof(listener), 1); }); }); javascript node.js express server-sent-events

Tkinter grid() alignment issue in python -

Tkinter grid() alignment issue in python - i have been working in python first time , trying these labels align in right columns , right row reason doesn't move downwards rows , columns not right either. help much appreciated! code: tkinter import * import sys #setup gui #create main window main = tk(); #create title of main window main.title = "waterizer 1.0"; #create default size of main window main.geometry("1024x768"); #lets fram stick info in plan on using mainapp = frame(main); #snap grid mainapp.grid(); #font main labels labelfont = ('times', 20, 'bold'); #label powerfulness powerlabel = label(mainapp, text="power status"); powerlabel.config(fg="red", bd="1"); powerlabel.config(font=labelfont); powerlabel.grid( row=0,column=20,columnspan=4, sticky = w); #label water waterlabel = label(mainapp, text=...

javascript - jQuery: Duplicating file input groups -

javascript - jQuery: Duplicating file input groups - i'm trying utilize jquery duplicate file input groups, when user selects file upload, automatially creates file upload field , description field. this works fine, except when alter file of file i've selected input for. when that, duplicates file input groups. any insight why going on? jsfiddle: http://jsfiddle.net/czlmbjd6/4/ html: <div id = "add-photos"> <input type="file"></input> <label>description:</label> <input type = "text"></input> </div> <div id = "additional-photos"> </div> js: $(document).ready(function(){ bindfileinputs(); }); function bindfileinputs(){ $("input:file").change(function (){ addphotofield(); }); } function addphotofield() { var id = 1; //standin now, dynamically update number later createphotofield(id)...

java - Why am I getting a Identifier expected error -

java - Why am I getting a Identifier expected error - import java.util.*; public class students { public static void main(string[] args){ scanner scan=new scanner(system.in); pupil s1=new student();//creates object of class aircraft pupil s2=new student(); //or //student s1,s2 //s1=new student(); //s2=new student(); string str; int i; //str=s1.getname(); } } class student{ //extends students{ string name; int 1; ?<identifier> expected? int 2; ?<identifier> expected? int 3; } } in lastly 3 lines identifier expected. why? pupil class supposed store name, , 3 test scores. in java, variables not allowed start numbers - 1 invalid variable name (though num1 valid). see the naming requirements. to prepare code, rename them int var1 , int var2 , int var3 . (though improve names improve - seek more descriptive) java identifier

Error sending an email CakePHP -

Error sending an email CakePHP - i "unknown email configuration 'gmail' " error , while trying send email using cakephp ,is because i'm sending localhost (xampp) ? if($this->user->save($this->request->data)){ $message='click on link below finish registration '; $confirmation_link='www.sitename.com/users/verify/t:'.$hash.'/n:'.$this->data['user']['username'].''; app::uses('cakeemail', 'network/email'); $email = new cakeemail('gmail'); $email->email->from = 'myemail@gmail.com'; $email->email->to=$this->data['user']['email']; $email->email->subject = 'confirm registration'; $email->email->smtpoptions = array( 'host' => 'ssl://smtp.gmail.com', 'port' => 465, 'username' => 'myemail@gmail.com',...

python - How to check if the signs of a Series conform to a given string of signs? -

python - How to check if the signs of a Series conform to a given string of signs? - for illustration have series below, ts = pd.series([-1,-2.4,5,6,7, -4, -8]) i know if there pythonic way check signs of ts against list of signs, such as, sign = '++++---' # returns false while sign = '--+++--' # returns true this solution requires numpy functions, since using pandas info series, not issue you. import pandas pd import numpy np values = pd.series([-1, -2.4, 5, 6, 7, -4, -8, 0]) sign_str = "--+++--0" sign_map = { "+" : 1, "0" : 0, "-" : -1 } expected_signs = list(map(sign_map.get, sign_str)) observed_signs = np.sign(values) np.all(expected_signs == observed_signs) python pandas series

html5 - Chrome on Android: createObjectURL containing image blob captured from camera is broken -

html5 - Chrome on Android: createObjectURL containing image blob captured from camera is broken - this worked me before, broken on few (but not all) android devices using chrome (v38 canary/beta broken). if input set capture camera, blob returned invalid (a broken image appears). if unset attribute , take gallery instead, image loads fine. works on phone, not on few tablets. does know if has changed in chrome? unfortunately, not sure if chrome on broken devices has been updated. html: <form action="" method="post" id="edit_form" enctype="multipart/form-data"> <input {$readonly} id="input" type="file" accept="image/*" capture="camera" /> <div class='fileinput-preview thumbnail' data-trigger="fileinput" style="min-height: 267px; width: 200px; border: 1px solid black;" id="photo_front"></div> javascript: $("#in...

dictionary - Combing two dictionaries with a key and an element in each key (python) -

dictionary - Combing two dictionaries with a key and an element in each key (python) - i have 2 dictionaries: let's maledict = {'jason':[(2014, 394),(2013, 350)...], 'stephanie':[(2014, 3), (2013, 21),..]....} femaledict = {'jason':[(2014, 56),(2013, 23)...], 'stephanie':[(2014, 335), (2013, 217),..]....} i attempting combine dictionaries thats completedict = {'jason':[(2014, 394, 56),(2013, 350, 23)...], 'stephanie':[(2014, 3, 335), (2013, 21, 217),..]....} i not while loops thought seek , utilize list comprehension. [basedict[x].append((i[0], i[1], j[1])) in maledict[x] j in femaledict[y] if x == y , i[0] == j[0]] i maintain getting unhashable error. i'm not @ list comprehensions either lol. help appreciated. python3 for loops king in python. while loops have place, objects in python can iterated on using for item in object: syntax. here's 1 way it: from collections import defaul...

Lazy pub/sub in zeromq, only get last message -

Lazy pub/sub in zeromq, only get last message - i'am trying implement lazy subscriber on zeromq illustration wuclient/wuserver. client way slower server, must lastly sent message server. so far way i've found that, connecting/disconnecting client, there of course of study unwanted cost @ each connection, around 3ms: server.cxx int main () { // prepare our context , publisher zmq::context_t context (1); zmq::socket_t publisher (context, zmq_pub); publisher.bind("tcp://*:5556"); int counter = 0; while (1) { counter++; // send message subscribers zmq::message_t message(20); snprintf ((char *) message.data(), 20 , "%d", counter); publisher.send(message); std::cout << counter << std::endl; usleep(100000); } homecoming 0; } client.cxx int main (int argc, char *argv[]) { zmq::context_t context (1); zmq::sock...

javascript - Backbone render Data from Mongodb without Model -

javascript - Backbone render Data from Mongodb without Model - i want render info mongodb in view, don't want create collection or model.. my thought add together render function of default view: var myvar = 'sup fresh our turn baby!'; var mytextarea = document.getelementbyid('myarea'); mytextarea.innerhtml += myvar; this work. my problem how data(wich in variable) server.js (nodejs) backbone view. which best way data? thanks javascript node.js mongodb backbone.js

xmpp - Does Strophe js connection object have a roster property or is it a pluggin that I need to download? -

xmpp - Does Strophe js connection object have a roster property or is it a pluggin that I need to download? - i have been next this example list of contacts using strophe. says roster undefined. guess is pluggin need? one? thanks you need roster plugin. can here: https://github.com/strophe/strophejs-plugins xmpp strophe

jquery - javascript: draw an image underground and save -

jquery - javascript: draw an image underground and save - i working on censiumjs, javascript map library. want create heatmap json info , render on map. currently thought draw heatmap on hidden canvas using heatmap javascript plugin, save canvas image file, , render image on map. however found cannot draw on hidden canvas. wondering how can draw image underground , save while loading map? thanks help! you can utilize offscreen rendering function main(){ // here create offscreen canvas var offscreencanvas = document.createelement('canvas'); offscreencanvas.width = 300px; offscreencanvas.height = 300px; var context = offscreencanvas.getcontext('2d'); // draw offscreen context context.fillrect(10,10,290,290); // ... } javascript jquery html5 canvas cesium

java - How to convert an ArrayList containing Integers to primitive int array? -

java - How to convert an ArrayList containing Integers to primitive int array? - i'm trying convert arraylist containing integer objects primitive int[] next piece of code, throwing compile time error. possible convert in java? list<integer> x = new arraylist<integer>(); int[] n = (int[])x.toarray(int[x.size()]); you can convert, don't think there's built in automatically: public static int[] convertintegers(list<integer> integers) { int[] ret = new int[integers.size()]; (int i=0; < ret.length; i++) { ret[i] = integers.get(i).intvalue(); } homecoming ret; } (note throw nullpointerexception if either integers or element within null .) edit: per comments, may want utilize list iterator avoid nasty costs lists such linkedlist : public static int[] convertintegers(list<integer> integers) { int[] ret = new int[integers.size()]; iterator<integer> iterator = integers.iterator(); ...

objective c - Collision detection between two sprites (without a physic body?) iOS -

objective c - Collision detection between two sprites (without a physic body?) iOS - i having problem getting collision detection work 2 objects. here current code: _firstposition = cgpointmake(self.frame.size.width * 0.817f, self.frame.size.height * .40f); _squirrelsprite = [skspritenode spritenodewithimagenamed:@"squirrel"]; _squirrelsprite.position = _firstposition; _atfirstposition = yes; [self addchild:_squirrelsprite]; skaction *wait = [skaction waitforduration:3.0]; skaction *createspriteblock = [skaction runblock:^{ skspritenode *lightnut = [skspritenode spritenodewithimagenamed:@"lightnut.png"]; bool heads = arc4random_uniform(100) < 50; lightnut.position = (heads)? cgpointmake(257,600) : cgpointmake(50,600); [self addchild: lightnut]; skaction *movenodeup = [skaction movebyx:0.0 y:-700.0 duration:1.3]; [lightnut runaction: movenodeup]; }]; skaction *waitth...

c# - create a web role for azure cLoud project -

c# - create a web role for azure cLoud project - i need create web role azure cloud project. role should expose rest api. , send requests other service. created project , trying add together web role. vs2013 proposes 2 options : web role asp.net or wcf. don`t know best needs. advise , why? i suggest web role, utilize web api create service. easy , lightway framework. wcf more info intensive operations, requires more setup , might find hard create communicate other services. what type of service going communicate with? c# azure visual-studio-2013 cloud azure-web-roles

python - How do i import imdb list files into postgresql database? -

python - How do i import imdb list files into postgresql database? - i doing school project utilizing imdb database (purely educational purposes) unfortunately cannot utilize imdbpy2sql.py scheme unix , doesn't seem have python built in. i also: cannot utilize root (apparently attempting run sudo command plenty 1 in trouble, learned hard way). have been unable outdated moviedb tools work. there 2gb storage limit on server 1500 file count limit. only need subset of tables (ie actors, actresses, directors, etc. though having info not huge problem). i have remote access server. my question (having taken account) easiest way import data? quite literally @ stand still this. any help appreciated. one alternative run imdbpy2sql.py on different machine, dump sql database , load server. i'm going assume database called "imdbdata". after that, run command: pg_dump imdbdata > imdbdata.pgdump then, re-create file onto server , run comma...

ios - applyImpulse on CCSprite not making realistic moves, need to speed up the sprite moves -

ios - applyImpulse on CCSprite not making realistic moves, need to speed up the sprite moves - i developing jump game, in when tapped on screen, need create player jump up. so, used next code. [_player.physicsbody applyimpulse: ccp(0, player.physicsbody.mass * 155)]; in touchbegan method. the code ccsprite *_player is _player = [ccsprite spritewithimagenamed: @"assets.atlas/player.png"]; [_player setposition: ccp(160.0f, 210.0f)]; _player.zorder = 99; _player.physicsbody = [ccphysicsbody bodywithrect:(cgrect){cgpointzero, _player.contentsize} cornerradius:0]; // 1 _player.physicsbody.collisiongroup = @"playergroup"; // 2 _player.physicsbody.collisiontype = @"player"; //[_physicsworld addchild:_player]; [_foreground addchild: _player]; this code explains player setup physics body , added _foreground view. issue applyimpulse method written in touchbegan. when makes player jump, player jumps slowly, want create faster, like, jumping hulk,...

ios - How can I get string values out of an ABPersonRef / ABPerson? -

ios - How can I get string values out of an ABPersonRef / ABPerson? - this question arose while using [pkpayment billingaddress] , listed type abrecordref (but more precise, of type abpersonref ). nsstring *streetaddress; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); streetaddress = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddressstreetkey); } nsstring *city; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); city = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddresscitykey); } nsstring *state; if (abmultivaluegetcount(addressmultivalueref) > 0) { cfdictionaryref dict = abmultivaluecopyvalueatindex(addressmultivalueref, 0); state = (__bridge nsstring *)cfdictionarygetvalue(dict, kabpersonaddressstatekey); } nsstring *zip; if (abmultivaluegetcou...

javascript - Refreshing a webpage is actualy redirecting to bing -

javascript - Refreshing a webpage is actualy redirecting to bing - i have script, in adding custom url browser button for used particular script <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.cookie.js"></script> <script type="text/javascript" src="js/native.history.js"></script> <script type="text/javascript" src="js/go.new.js"></script> <script> $(window).load(function() { settimeout(backtrap, 100); if (!($.cookie("clkd"))){ $.cookie("clkd", 1, { expires : 14 , path: '/'}); } setinterval(toggle_image, 1000); }); window.onpageshow = function (e) { if (e.persisted) { location.reload(); } }; window.onpopstate = function(event) { if (document...

Error creating a list of key values pairs in R -

Error creating a list of key values pairs in R - i trying create list of paired values so: > prot_keys<-snp.ids_mrna > prot_vals<-seq.aa > mylist<-list() > mylist[[ prot_keys ]] <- prot_vals where: > dput(seq.aa) c("mysfntlrlylwetivffslaaskeaeaarsapkpmspsdfldklmgrtsgydarirpnfkgppvnvscnifinsfgsiaettmdyrvniflrqqwndprlayneypddsldldpsmldsiwkpdlffanekgahfheittdnkllrisrngnvlysiritltlacpmdlknfpmdvqtcimqlesfgytmndlifewqeqgavqvadgltlpqfilkeekdlryctkhyntgkftciearfhlerqmgyyliqmyipsllivilswisfwinmdaaparvglgittvltmttqssgsraslpkvsyvkaidiwmavcllfvfsalleyaavnfvsrqhkellrfrrkrrhhkspmlnlfqedeagegrfnfsaygmgpaclqakdgisvkgannsnttnpppapskspeemrklfiqrakkidkisrigfpmaflifnmfywiiykivrredvhnq", "mysfntlrlylwetivffslaaskeaeaarsapkpmspsdfldklmgrtsgydarirpnfkgppvnvscnifinsfgsiaettmdyrvniflrqqwndprlayneypddsldldpsmldsiwkpdlffanekgahfheittdnkllrisrngnvlysiritltlacpmdlknfpmdvqtcimqlesfgytmndlifewqeqgavqvadgltlpqfilkeekdlryctkhyntgkftciearfhlerqmgyyliqmyipsllivils...

Android Studio w/ app engine plugin error -

Android Studio w/ app engine plugin error - did error i've been banging head 3 days trying android studio app engine work (from android studio event log): plugin error problems found loading plugins: plugin "google app engine integration" not loaded: required plugin "com.intellij.javaee" not installed. disable google app engine integration open plugin manager i had same issue. deleting .androidstudiobeta folder in home directory , reinstalling android studio 0.8.9 resolved issues. android

c# - Bizarre behavior with custom attributes and GetCustomAttributes -

c# - Bizarre behavior with custom attributes and GetCustomAttributes - i've been fighting problem hours , not find related on (or google matter). here's problem: have custom attribute contains object array property. [system.attributeusage(system.attributetargets.property, allowmultiple = false)] public class property : system.attribute { public object[] parameters { get; set; } public jsonproperty(object[] prms = null) { parameters = prms; } } and utilize next code read properties: var customproperties = (property[])currentproperty.getcustomattributes(typeof(property), false); this works fine following: [property(parameters = new object[]{}] <...property...> however, if set null ([property(parameters = null]) , error: system.reflection.customattributeformatexception: 'parameters' property specified not found. which absurd, because property defined within custom attribute. don't it. so question is: g...

Weird issue when transitioning ImageView in Android 5.0 -

Weird issue when transitioning ImageView in Android 5.0 - i'm experiencing unusual issue / bug regarding imageview transitions between activities in android 5.0. i'm trying transition thumbnail image fragment a (in activity a ) header image of fragment b (in activity b ). works of time, messes ever slightly. here's image of looks when messes up: naturally, it's supposed fill entire area. both imageviews set scaletype.center_crop , can't imagine beingness issue. what's curious issue fixes upon scrolling in activity b (everything contained within subclassed scrollview changes imageview padding upon scrolling). the code launching activity b pretty simple: activityoptionscompat options = activityoptionscompat.makescenetransitionanimation( activity, thumbimageview, "cover"); // "cover" shared element name both imageviews activitycompat.startactivity(activity, intent, options.tobundle()); here's code observa...

IFNULL with IN statement with mysql -

IFNULL with IN statement with mysql - i newbie mysql....it may dump question....but have been trying 3 hours...here trying do.... select merchant_id, ifnull(count(subscribe_id),0) subscribe_table merchant_id null or merchant_id in(1000000000066,1000000000104,1000000000103,1000000000105) grouping merchant_id order find_in_set(merchant_id,'1000000000066,1000000000104,1000000000103,1000000000105'); and output is... +------------------+---------------------------------+ | merchant_id | ifnull(count(subscribe_id),0) | +------------------+---------------------------------+ | 1000000000066 | 2 | | 1000000000103 | 1 | +------------------+---------------------------------+ but expecting in next manner... +------------------+---------------------------------+ | merchant_id | ifnull(count(subscribe_id),0) | +------------------+---------------------------------+ | 10000000000...

How can I kill an unresponsive query in Valentina Studio (for PostgreSQL)? -

How can I kill an unresponsive query in Valentina Studio (for PostgreSQL)? - is there way kill slow or unresponsive query in valentina studio there in mysql workbench? postgresql

Reorganizing a 2d array in Java -

Reorganizing a 2d array in Java - the comment in code i'm trying do, alter array "12345, 12345, 12345 111,222,333,444,555" public void reorganize() { for(int y = 0; y < repeat; y++)//this loop reorganizes arrays. each array organized number location rather how inputted. ex: 12345, 12345, 12345 111,222,333,444,555 { for(int r = 0; y==4; r++) { newnumbers[r][y] = numbers[y][r]; } } i've been trying prepare , i've rewritten couple times never ends working right. first time posting on , hope guys can help me (: thank you i suggest start passing in numbers array , returning newnumbers array. basically, logic should rotate dimensions of input numbers array build newnumbers , re-create logic right (once prepare loop test conditions). public static int[][] reorganize(int[][] numbers) { int[][] newnumbers = new int[numbers[0].length][numbers.length]; (int y = 0; y ...

python - Position 5 subplots in Matplotlib -

python - Position 5 subplots in Matplotlib - i position 5 subplots such there 3 of top , 2 @ bottom next each other. current code gets close final result next (ignore grayness lines): import matplotlib.pyplot plt ax1 = plt.subplot(231) ax2 = plt.subplot(232) ax3 = plt.subplot(233) ax4 = plt.subplot(234) ax5 = plt.subplot(236) plt.show() you can utilize colspan when utilize suplot2grid instead of subplot. import matplotlib.pyplot plt ax1 = plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2) ax2 = plt.subplot2grid((2,6), (0,2), colspan=2) ax3 = plt.subplot2grid((2,6), (0,4), colspan=2) ax4 = plt.subplot2grid((2,6), (1,1), colspan=2) ax5 = plt.subplot2grid((2,6), (1,3), colspan=2) and every subplot needs 2 cols wide, subplots in sec row can shifted 1 column. python matplotlib

c# - While in backgroundworker won't continue -

c# - While in backgroundworker won't continue - i have button set bool false , shouldn't upload files anymore automatic. if set true again, should start upload own, doesn't. private void backgroundworker1_dowork(object sender, doworkeventargs e) { while (automaticupload) { //i here } } i set true using button click private void ontoolstripmenuitem_click(object sender, eventargs e) { automaticupload = true; } edit: i know have start backgroundworker ^^ or mean calling enableupload() 1 time again button click ? private void enableupload() { backgroundworker1.runworkerasync(); } c# while-loop backgroundworker

how can i set operators priority in vb.net -

how can i set operators priority in vb.net - dim equation string dim numbers() string dim operators new list(of string) dim result double dim rx new regex("(\+|\-|\*)+") dim matches matchcollection equation = textbox1.text numbers = equation.split(new string() {"+"c, "-"c, "*"c}, stringsplitoptions.none) matches = rx.matches(equation) dim m1 match each m1 in matches operators.add(m1.value) next result = cint(numbers(0)) dim integer = 1 numbers.getupperbound(0) select case operators(i - 1) case "*" result *= cdec(numbers(i)) case "+" result += cdec(numbers(i)) case "-" result -= cdec(numbers(i)) case " ^" result ^= cdec(numbers(i)) end select next messagebox.show(result) that's code, illustration "1+4+2*3" how can edit code start multiplication first , partition + , - . have idea? ...

java - MapReduce: How to get mapper to process multiple lines? -

java - MapReduce: How to get mapper to process multiple lines? - goal: i want able specify number of mappers used on input file equivalently, want specify number of line of file each mapper take simple example: for input file of 10 lines (of unequal length; illustration below), want there 2 mappers -- each mapper process 5 lines. this arbitrary illustration file of 10 lines. each line not have of same length or contain same number of words this have: (i have each mapper produces 1 "<map,1>" key-value pair ... summed in reducer) package org.myorg; import java.io.ioexception; import java.util.stringtokenizer; import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.intwritable; import org.apache.hadoop.io.text; import org.apache.hadoop.mapreduce.job; import org.apache.hadoop.mapreduce.mapper; import org.apache.hadoop.mapreduce.reducer; import org.apache.hadoop.mapreduce.lib.output.fileoutputformat; i...

objective c - When should we use 'int' on iOS App based on arm64 architecture? -

objective c - When should we use 'int' on iOS App based on arm64 architecture? - what advantage of using 'int' on arm64 architecture? since apple forces apps using arm64 on next february, , suggests using nsinteger, of value 8 bytes, size_t, time_t, etc. , also, apps face no memory issue. except adopting info or other apis using 'int', seems there little chance utilize 'int', right? more questions, using 'int' more efficient, saving more memory 'long' in arm64? i don't think need int consuming api's. you can utilize nsnumber property. @property (nonatomic, copy) nsnumber *number; you can integer value of nsnumber this: [number intvalue]; ios objective-c apple nsinteger arm64

android - HttpRequest for content-length in response header -

android - HttpRequest for content-length in response header - this httprequest google drive. when parse response header, content-length null. true when utilize getcontentlength() method (see below), , when print out response header.tostring -- value isn't there. i'm not familiar httprequests, have inquire content-length included in response? public static httpresponse getfile_contents(string downloadurl, drive drive) throws ioexception{ httprequest request = drive.getrequestfactory(). buildgetrequest(new genericurl(downloadurl)); httpresponse response = request.execute(); long length = response.getheaders().getcontentlength(); //length null... homecoming response; } android http-headers google-drive-sdk

matplotlib - Issue with inverting sparse matrix pylab -

matplotlib - Issue with inverting sparse matrix pylab - i seek following from scipy import * numpy import * import scipy s import numpy np import math import scipy.sparse l plot import graph3dsolution import numpy.linalg lin currentsol=s.sparse.linalg.inv(i-c)*a*lastsol im missing out code issue this traceback (most recent phone call last): file "explict1wave.py", line 62, in <module> currentsol=s.sparse.linalg.inv(i-c)*a*lastsol attributeerror: 'module' object has no attribute 'linalg' python 2.7.6 |anaconda 1.9.1 (x86_64)| (default, jan 10 2014, 11:23:15) [gcc 4.0.1 (apple inc. build 5493)] on darwin type "help", "copyright", "credits" or "license" more information. im>>> import scipy >>> scipy.__version__ '0.14.0' >>> i documentation , seems these libraries existed since .12 . dont know issue is, im sure simple im not seeing. >>> im...

ember.js, ember-cli: Outlets not nesting properly -

ember.js, ember-cli: Outlets not nesting properly - i'm having issue i'm unable nested outlets appear in ember cli app. view tree want follows: application (list of resources, of client_availability one) - client_availabilities.index (list of client_availabilities) -- client_availability (individual client_availability) this similar "application > posts.index > post" hierarchy in ember starter kit. desired behavior list of client_availabilities appear in "mainoutlet" when navigate client_availabilities.index, persist when bring individual client_availability in "suboutlet". easy, right? default behavior & why love ember. however, can't seem working. when explicitly target named suboutlet in client_availabilities.index , click on individual client_availability, nil shows in either outlet: scenario 1: render suboutlet within client_availabilities /app/template/application.hbs: {{link-to 'client availabilities...

crosstab - Is is possible to summarize data from 3 unlinked subreports using cross tab feature in crystal reports? -

crosstab - Is is possible to summarize data from 3 unlinked subreports using cross tab feature in crystal reports? - i using crystal reports 2013. have main study comprises of 3 subreports not linked. want know if can utilize cross tab feature summarize details subreports in main report. to more specific, 3 subreports new, open, , closed anomalies during test cycle: these reports have next fields: [issueid] [symptom] [priority] [date] in main study want summary show me count of issues priority closed, new , open after test cycle. so summary below: total closed(subreport1) new(subreport2) open(subreport3) a b c d crystal-reports crosstab

file - Is there a way to run a java program from within another java program? -

file - Is there a way to run a java program from within another java program? - ok, basically, wrote java programme creates new java classes within same folder current program. far, part works absolutely fine since it's creating new text files. know though, if there way run created classes within programme without terminating running programme created them. so, basically, want write programme creates, edits, , runs java programs. there method, function, api, helps this? also, i'm using eclipse this. what seek in case without using external apis, run cmd commands java. in case can compile created java files , run .jar file example, using terminal commands 1 time more.. for cmd commands through java can refer link: run cmd commands through java java file class io runnable

How to loop with time in Python -

How to loop with time in Python - so i'd compress info downwards minutes. thinking of using loop time? pull info every min range (aka 09:30:00-09:30:59) time between 09:30:00 , 04:00:00, utilize math, , save in pandas dataframe. have no clue how this, , no clue google time loop. #refrences time import * import urllib.request web import pandas pd import os fortoday = 'http://netfonds.no/quotes/tradedump.php?csv_format=csv&paper=' def pulltoday(exchange,stock): datetoday = strftime("%y-%m-%d", localtime()) filename=('data/'+exchange+'/'+stock+'/'+datetoday+'.txt') try: if not os.path.isdir(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) except oserror: print("something went wrong. review dir creation section") pagebuffer=web.urlopen(fortoday+stock+'.'+exchange) pagedata=pd.read_csv(pagebuffer,usecols=['time','pric...

php - How do you set the default currency programmatically in opencart? -

php - How do you set the default currency programmatically in opencart? - i know how country user accessing site based on ip address. want set currency automatically based on ip address. or module in opencart should change? according source code in system/library/currency.php can call: $this->currency->set('gbp'); anywhere in controller. called whenever user changes currency clicking on currency sign in header - can check in catalog/controller/module/currency.php : if (isset($this->request->post['currency_code'])) { $this->currency->set($this->request->post['currency_code']); // ... } unfortunately there no check whether trying set existing (defined, registered) currency code or not create sure using codes nowadays in db (i.e. created via administration). php opencart

security - Can GoogleJavaScriptRedirect snippet be used offensively? -

security - Can GoogleJavaScriptRedirect snippet be used offensively? - i ruinning little website , tried upload html file, containing next code, in place of image upload. content of file : <script>window.googlejavascriptredirect=1</script><meta name="referrer" content="origin"><script>var m={navigateto:function(b,a,d){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=d;a.location.replace("about:blank");}}else{a.location.replace(d);}}};m.navigateto(window.parent,window,"http://www.eshcc.eur.nl/informatie/medewerkers/"); </script><noscript><meta http-equiv="refresh" content="0;url='http://www.eshcc.eur.nl/informatie/medewerkers/'"></noscript> my question : code do? why seek load in place of image? unsafe server or users? note: happily serveur protected , file never served serveur security redirect gwt code-snippets client-side-...

Cordova and iOS: Playing an audio from an iframe hosted in cdvfile://localhost -

Cordova and iOS: Playing an audio from an iframe hosted in cdvfile://localhost - i have next issue: - in ios cordova application, downloaded html page , resources (css, audio, images) in cdvfile://localhost/persistent/myfolder/ - load cdvfile://localhost/persistent/myfolder/index.html in iframe. - page displayed (css , images) audios not beingness able load , play... popup "unsupported url" appears when trying execute audio... i found lot of articles/post regarding issue, none of them have particularity of playing audios iframe (i need utilize iframe, must in project)... any ideas? remember i'm not having access cordova's plugins within iframe :-/ ios cordova audio iframe plugins

ruby - Putting Faker Gem Values to a Hash -

ruby - Putting Faker Gem Values to a Hash - i'm writing automated tests using cucumber, capybara, webdriver, siteprism, , faker. new , need help. i have next steps.. given (/^i have created new active product$/) @page = adminproductcreationpage.new @page.should be_displayed @page.producttitle.set faker::name.title @page.product_sku.set faker::number.number(8) click @page.product_save @page.should have_growl text: 'save successful.' end when (/^i navigate product detail page) pending end (/^all info should match entered$/) pending end in config/env_config.rb have set empty hash... before # empty container sharing info between step definitions @verify = {} end now want hash value generated faker in "given" step can validate saved in "when" step. want come in value generated faker in script below search field. @page.producttitle.set faker::name.title how force values generated faker @verify has? ...

ios - Cannot retrieve transition state from cell when rearranging is enabled -

ios - Cannot retrieve transition state from cell when rearranging is enabled - i have uitableviewcontroller within navigation controller. i'm retrieving state of cells in class of uitableviewcell method - (void)willtransitiontostate:(uitableviewcellstatemask)state; which works fine, when enable rearranging table view with - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath; the state has values 0 , 2147483649 , 2147483650 & 2147483651 instead of 0 , 1 , 2 & 3 . is there way resolve issue or missing something? the supported states below: uitableviewcellstatedefaultmask (0), uitableviewcellstateshowingeditcontrolmask (1), uitableviewcellstateshowingdeleteconfirmationmask (2), , uitableviewcellstateshowingeditcontrolmask | uitableviewcellstateshowingdeleteconfirmationmask (3). so these states can confirmed using below code : below works of transition states , ...

java - can't rename all files in a folder -

java - can't rename all files in a folder - i have pictures in folder on sdcard these names: 000.jpg 001.jpg 002.jpg 003.jpg 004.jpg ... the sort of names of import , should this. want maintain sort after deleting photo. mean if deleted illustration 3rd photo, 4th photo should renamed 002, 5th 003 , on. i writed code purpose: // "myfiles" file array of directory listfiles. // "str1" folder name , checked existences before // "numb" pic number should delete. file pic = new file(environment.getexternalstoragedirectory() + "/albummaker/" + str1 + "/" + string.format("%03d", numb) + ".jpg"); pic.delete(); // myfiles (i mean after deleting). (int = numb; < myfiles.length; i++) { file f = new file(environment.getexternalstoragedirectory() + "/albummaker/" + str1 + "/"+myfiles[i].getname()); f.renameto(new file(environment.getexternalstoragedirectory() + ...

string - Concerning C++ input and output -

string - Concerning C++ input and output - i've designed programme can encrypt 26 english language letters. here's how i'm handling input. i'm reading text file , stores in string. ifstream l; string str1; char ch; l.open("tobecoded.txt"); while(il.get(ch)) str1.push_back(ch); however, it's inefficient, if want read different file, have alter name in codes create work. there dynamic way so? drag file or type address of file during run time? by way, have improve way read txt string? 1 'seems' slow. you can utilize istream getline instead http://www.cplusplus.com/reference/istream/istream/getline/ c++ string

ios - UIButton's title mysteriously disappears when sliding back too fast -

ios - UIButton's title mysteriously disappears when sliding back too fast - i have uibutton in main screen, of title should show playing or to-be-played music, if playlist empty, should show "music", clicking bring song selecting screen(when playlist empty) or play list screen(when playlist not empty), after selecting song , go playlist screen, , delete song , slide main screen, title of uibutton should show "music". here's problem: when sliding fast, "music" text show in split sec , disappears, when sliding slowly, "music" text stays. i've recorded unusual behavior in this 25-second video. here's related code: - (void)updatechoosemusicbutton { if(self.songqueue.count == 0) { [self.choosemusicbutton settitle:@"music" forstate:uicontrolstatenormal]; } } - (void)setchoosemusicbutton:(uibutton *)choosemusicbutton { _choosemusicbutton = choosemusicbutton; [_choosemusicbutton settitle...

HTML5 Canvas - Text ontop of rectangle -

HTML5 Canvas - Text ontop of rectangle - my code this for(var = 0; < data.data.length; i++) { context.beginpath(); context.fillstyle = '#d0d0d0'; context.rect(data.data[i].x, data.data[i].y, 200, 25); context.fill(); context.linewidth = 1; context.strokestyle = 'black'; context.stroke(); context.fillstyle = 'black'; context.font = 'bold 20px serif'; context.filltext("1212a", data.data[i].x, data.data[i].y + 20); } draws rectnagle stroke text beeing draw underneath rectangle tried changing order of code still underneath... there there doesn't seem wrong code. problem might result of caching. class="snippet-code-js lang-js prettyprint-override"> var canvas=document.getelementbyid("main"); var context=canvas.getcontext("2d"); var x = 80; var y = 50; context.beginpath(); context.fillstyl...

css3 - CSS transform:rotate3d animate with perspective -

css3 - CSS transform:rotate3d animate with perspective - i have wheel rotate while keeping perspective. code below allows me spin wheel, cant maintain angled perspective @keyframes mywheel { { transform:rotate(0deg); } { transform:rotate(360deg); } } angled perspective: @keyframes mywheel { { transform:rotate3d(0, 1, 0, 65deg); } { transform:rotate3d(0, 1, 0, 65deg); } } how can combine 2 , rotate img while keeping perspective? here my fiddle fixed worked: @keyframes mywheel { { transform:rotate3d(0, 1, 0, 65deg); rotate(0deg); } { transform:rotate3d(0, 1, 0, 65deg); rotate(-360deg);} } css3

php - Force greaterThan with numbers in Zend Mysql -

php - Force greaterThan with numbers in Zend Mysql - i'm using next code: $age=10; //user input $select ->columns(["id"=>"id"]) ->where->greaterthan("age",$age); echo $select->getsqlstring(); this gives me folowing result: select "program"."id" "id" "program" "age" > '10' however, utilize > ints, eg have resulting query select "program"."id" "id" "program" "age" > 10 how can accomplish using greaterthan predicate? i know can write ->where("age > $age"); that's not secure nor beautiful. looking @ the documentation, greaterthan has function header: public function greaterthan($left, $right, $lefttype = self::type_identifier, $righttype = self::type_value); though not documented, setting $righttype type of predicate::type_literal might expose literal ...

android - Send keywords and targeting info to AdMob for better ads -

android - Send keywords and targeting info to AdMob for better ads - on admob, when click on monetize > admob network report , select "targeting type" in drop-down selection (at bottom left of page), see 5 lines: - (unmatched advertisement requests) - (unknown) - contextual - interest-based - placement can explain me how such results possible in android app , no targeting info provided google (for me, contextual linked environnement of user in app like, text on webpage web-site visitor example...) actually improve ecpm providing keywords , -if useful- user (non-personal) info admob not yet. does anymone have thought how achieved , how admob can propose keyword-based advertising when not provide it? mystery me :-) thanks in advance answers! you can provide keywords admob ads can targeted. using addkeyword function when create request. this: adrequest.builder builder = new adrequest.builder() .addtestdevice("and id device") ...

shell - How to find a directory in Unix, whose ordinary files have the greatest line count together -

shell - How to find a directory in Unix, whose ordinary files have the greatest line count together - ok, clear, school assignment, , don't need entire code. problem this: utilize set subory = ("$subory:q" `sh -c "find '$cesta' -type f 2> /dev/null"`) to fill variable subory ordinary files in specified path. have foreach count lines of files in directory, that's not problem. problem is, when script tested, big directories utilize path. happens script doesn't finish, gives error message word long . word subory . real problem, because $cesta can element of long list of paths. tried, cannot solve problem. ideas? i'm bit lost. edit: clear, task assign each directory number, represents total line count of it's files, , pick directory greatest number. you need reorganize code. example: find "$cesta" -type f -execdir wc -l {} + this run wc on files found, without ever running afoul of command line-len...

linux - Raspbian Fix for Chrome "did not shut down properly" -

linux - Raspbian Fix for Chrome "did not shut down properly" - i need quick , dirty prepare chrome did not shutdown in linux. i'm running concerto digital signage in chrome in kiosk mode, if hard unplug system, or lose powerfulness have take mouse , keyboard out rid of bar. shell script or have fine. sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/default/preferences this may doable solution... testing now. linux shell google-chrome raspberry-pi raspbian

java nested for loops to get numbers triangle -

java nested for loops to get numbers triangle - this question has reply here: java - creating triangle numbers using nested for-loops [closed] 2 answers my output should in image 1, output looks in image 2. i not suppose print out ... there have print out same thing 32 64. int have far, got half of triangle correct. don't know how reverse though. k = 1; int j; int l = 1; for(int i=1; <= 8; i++){ for(j=8; j>i; j--){ system.out.print(" "); } for(j=1; j<=k; j=j*2){ system.out.print(j + " "); } (j = 1; j<k; j=j*2) { system.out.print(j + " "); } k = k * 2; system.out.println(); } } } your problem is, in 2nd loop, still go j=1 -> k . can k -> 1 loop reversed sequence. also java has printf method, ...

javascript - angularjs, bug in nested array with same value -

javascript - angularjs, bug in nested array with same value - i've tried lastly 2 days on little problem. i'm new on angularjs, , don't understand why not working. if there same value in array, nested ng-repeat doesn't work :( is can help me please ? index.html : <!doctype html> <html ng-app="testapp"> <head> <title></title> </head> <body ng-controller="testctrl"> <ul> <li ng-repeat="item in items"> {{item.ip}} <ul> <li ng-repeat="s in item.status">{{s}}</li> </ul> </li> </ul> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script src="app.js"></script> </body> </html> app.js (this working) var app = angular.module('testapp...

javascript - Accessing a Meteor Template Helper Function in Jasmine for Integration Testing -

javascript - Accessing a Meteor Template Helper Function in Jasmine for Integration Testing - i'm trying run jasmine client integration tests on meteor project. i'm using meteor 0.9.4 , , sanjo:jasmine bundle jasmine. i have written test looks like: describe("template.dashboard.tasks", function() { it("ela displays right assessment", function() { session.set("selected_subject", "math"); session.set('selected_grade', "1"); tasks = template.dashboard.tasks(); expect(true).tobe(true); }); }); i error before can end of test: cannot read property 'tasks' of undefined this means template.dashboard not exist within scope of test. template.dashboard.tasks() helper function works completely, , in js file within view folder. regular jasmine tests work expected, seek utilize 1 of own functions file, doesn't work. my question is: there need give ja...