Posts

Showing posts from May, 2010

javascript - google map multiple polyline -

i have google map sample multiple polygons. changed new google.maps.polygon function polyline as new google.maps.polyline({ paths: arr, strokecolor: '#ff0000', strokeopacity: 0.8, strokeweight: 2, fillcolor: '#ff0000', fillopacity: 0.35 }) but not drawing lines. fiddle here . how set object name infowindow content. tried with var infowindow = new google.maps.infowindow({ content: }); edited fiddle . a google.maps.polyline doesn't have paths property. change: new google.maps.polyline({ paths: arr, strokecolor: '#ff0000', strokeopacity: 0.8, strokeweight: 2, fillcolor: '#ff0000', fillopacity: 0.35 }) to: new google.maps.polyline({ path: arr, strokecolor: '#ff0000', s

Git an existing project -

i missing something. attempting use git existing project , our team working it. following did: ssh user@domain.com cd /directory/of/gitproject git init git add . git commit 'first commit' i thought bring local, exit ssh connection, local: git clone user@domain.com/directory/of/gitproject/.git mylocalgit when this, not appear git repository. .git not repository; directory contains is. want clone that directory, not .git . by way, when creating repository on server want pull/push to/from, should pass --bare git init . make first commit local machine, not on server.

python - Scrapy finishes crawl prematurely -

i've had crawler running months last few weeks it's been finishing prematurely after few crawled pages out of tens of thousands of pages should crawled. it's sitemapspider following sitemap_rules . class foositemapspider(sitemapspider): name = "foo" sitemap_urls = ["http://www.foo.se/sitemap.xml"] sitemap_rules = [ ('/bostad/', 'parse_house') ] all url's want crawl looks this: http://www.foo.se/bostad/address-1-259413 http://www.foo.se/bostad/address-2-275754 there aprox 50,000+ pages should crawled, instead spider stops crawling after 0 crawled pages , handful of pages crawled, without error. says: 2015-06-25 19:37:38 [scrapy] info: closing spider (finished) 2015-06-25 19:37:38 [scrapy] info: dumping scrapy stats: {'downloader/request_bytes': 106313, 'downloader/request_count': 310, 'downloader/request_method_count/get': 310, 'downloader/response_bytes': 2809

arrays - Get image width between given range with getElementbyClass javascript -

how can width of elements between given range jquery or javascript? let's have buch of images hidden want select ones big enough matter client. this code working on: var imglink = document.getelementsbyclassname("imglink") array imglk; (i=0;i<imglink.length;i++) { if(imglink[i].style.size >= "600px"){ imglk += imglink[i]; } } (i=0;i<imglk.length;i++) { if(imglk[i].style.display == "none"){ imglk[i].style.display = "block"; imglk[i].style.opacity = "1"; } }

c# - Sorting using a Repeater with pagination -

i have repeater , i'm using pagination. works, funny stuff sorting. first of all, if press sort button, pagination control shows twice. secondly, paginates based on default sort order. ideas might wrong? protected void btnsort_click(object sender, eventargs e) { show_data(); } public void show_data() { sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["pbrconnectionstring"].connectionstring); string srtorder = cbosortby.text; sqldataadapter adp = new sqldataadapter("select [acct_list].*, [acct_grp_list].acct_grp [acct_list] left join [acct_grp_list] on [acct_grp_list].acct_grp_pk = [acct_list].acct_grp_fk order " + srtorder + "", con); dataset ds = new dataset(); adp.fill(ds, "tacctlist"); //pagination code set number of records loads @ time. // done speed loading, since list gets long. pageddatasource pds = new

How to show a label after same second in a VB.NET -

i wondering how in vb.net. imagine have form has 4 labels hidden. want show them 1 after each other delay. example, when run app first show first label after 5 second show second 1 , after 5 second show other 1 , on. know should use timer , write code in tick don't know how. tell me timer code. can rest of that. assuming winforms? 1 way done... public class form1 private labelsenumerator ienumerator private sub form1_load(sender object, e eventargs) handles mybase.load dim labels() label = {label1, label2, label3, label4} each lbl label in labels lbl.hide() next labelsenumerator = labels.getenumerator timer1.interval = timespan.fromseconds(5).totalmilliseconds timer1.start() end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick if not isnothing(labelsenumerator) if labelsenumerator.movenext labelsenumerator.current.show()

Select a tab in Firefox from command line -

firefox lets open new urls command line. there way select existing tab command line, title or url? yes, there is: install mozrepl addon start it: tools -> mozrepl -> start use telnet connect running mozrepl instance: $ telnet 127.0.0.1 4242 you can use rlwrap enable readline -like keybindings inside telnet session: $ rlwrap telnet 127.0.0.1 4242 define function searching tab given url , switching it. 1 https://github.com/emacsmirror/cedet/blob/master/lisp/cedet/semantic/db-mozrepl.el pretty cool: function semanticselecttab(url) { var numtabs=gbrowser.browsers.length; for(i=0; i<numtabs-1; i++) { if(gbrowser.browsers[i].contentdocument.location.href.indexof(url)>=0) { gbrowser.tabcontainer.selectedindex=i; break; } } } run this: repl> semanticselecttab("https://stackoverflow.com/questions/31055148/select-a-tab-in-firefox-from-command-line")

python - Trying to produce different random numbers every time a loop is executed -

srate = [5,5,5] bots = 120 nqueue = 3 tsim = 100 exp = 2 ddistance = 1 lambda = 40 # 120/3 = 40 import random elist=[] avgsrate = 5 def initilization(avgsrate,lambda,exp): return float((lambda/(avgsrate**exp))*(1+(1/10)*(2*(np.random.seed(-28)) - 1))) in range(1,361): elist.append(initilization) i trying produce set of randomly generated numbers between 0 , 1, decimals initialization of simulation, spits out same values every time loop executed, when print elist list of same values. list has <function initialization @ "the number"> , me eliminate portion printed list have numbers. the issue np.random.seed(-28) seeding random generator [ documentation ] , not return random numbers , getting random number use - np.random.rand() . example - return float((lambda/(avgsrate**exp))*(1+(1/10)*(2*(np.random.rand()) - 1))) if want seed random generator, can call before calling for loop calls initilization function. the function after should -

angularjs - Angular - Jquery Sprite switch animation stops working when using ng-view -

i have sprite animation switches next sprite animation after animation has finished playing. i made switch using jquery, have been implementing angular's routing of jquery has stopped working. i looked , found might wrong order of scripts in html, when tried moving jquery above angularjs script did not solve issue. i looked further , found need change jquery angularjs directive. how go doing that?? every site has tried explaining how done, shows before , after code. not make sense me. can show me how done? //this original jquery code using. want make work using directive // $(document).ready(function(){ // $(".hero-unit.land-animation").one('webkitanimationend mozanimationend msanimationend oanimationend animationend', function(){ // $(this).addclass("land-animation2"); // }); // }); // attempted @ trying in angular. var app = angular.module('app', ['ui.boostrap', 'ngroute']);

asp.net mvc - Is there a way to have a RoutePrefix that starts with an optional parameter? -

i want reach bikes controller these url's: /bikes // (default path us) /ca/bikes // (path canada) one way of achieving using multiple route attributes per action: [route("bikes")] [route("{country}/bikes")] public actionresult index() to keep dry i'd prefer use routeprefix, multiple route prefixes not allowed: [routeprefix("bikes")] [routeprefix("{country}/bikes")] // <-- error: duplicate 'routeprefix' attribute public class bikescontroller : basecontroller [route("")] public actionresult index() i've tried using route prefix: [routeprefix("{country}/bikes")] public class bikescontroller : basecontroller result: /ca/bikes works, /bikes 404s. i've tried making country optional: [routeprefix("{country?}/bikes")] public class bikescontroller : basecontroller same result: /ca/bikes works, /bikes 404s. i've tried giving country default value: [

python - combine colormaps matplotlib -

this question has answer here: combining 2 matplotlib colormaps 1 answer i use matplotlib plot temperature data combustion simulations, temperature in flame ranging 3200k - 5500k , temperature outside of flame ranging 300k 1000k. want generate projection plots using 2 different colormaps, 1 within flame , 1 outside of it, show slight variations in both regions. don't see temperatures in intermediate region of 1000k - 3200k, waste resolution in colormap using 1 map entire 300k - 5500k range. tried using of diverging maps, still miss small variations @ high , low ends. does have suggestions how combine 2 colormaps one, using 1 of colormaps each temperature range? edit to make question more specific: want use matlplotlib's 'hot' colormap data points in 3200 - 5500 range , 'cool' data points in 300 - 1000 range. is there way source code th

linux - Why is the probe function in my kernel module not being called? -

while following, among others, tutorial ([ http://tali.admingilde.org/linux-docbook/writing_usb_driver.pdf][1] ) , reading chapters in linux device drivers book, cannot pr_debug statements in probe function show output in dmesg. here's code: #include <linux/module.h> /*included kernel modules*/ #include <linux/kernel.h> /*included kern_debug*/ #include <linux/init.h> /*included __init , __exit macros*/ #include <linux/usb.h> #include <linux/usb/input.h> #include <linux/hid.h> #define vendor_id 0x0930 #define device_id 0x6545 module_license("gpl"); module_author("dev"); module_description("eusb driver"); static struct usb_device_id eusb_table[] = { { usb_device(vendor_id, device_id) }, { } /* terminating entry */ }; module_device_table (usb, eusb_table); static int eusb_probe(struct usb_interface *interface, const struct usb_device_id *id) { pr_debug("usb probe func

android - Selecting photo from new Google Photos app has incorrect orientation -

i'm trying choose photo using intents on android. works , photos being retrieved photos app (camera, gallery, screenshots etc.. if selected new photos app); except ones backed online on google photos. photos taken in portrait retrieved in landscape when getting bitmap. have code orientation of photo can translate accordingly, orientation 0 when choosing online photo on new google photos app. ideas on how should orientation these photos 0 being returned? code below - thanks. starting intent intent = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(i, import_photo_result); intent result uri selectedimageuri = data.getdata(); imagebitmap = mediastore.images.media.getbitmap(this.getcontentresolver(), selectedimageuri); //fix rotation int orientation = -1; cursor cursor = mediastore.images.media.query(getcontentresolver(), selectedimageuri, new string[] { mediastore.images.imagecolumns.orientation }); t

excel - Unique List from Column and Related Columns using Advanced Filter -

i'm using code retrieve unique values column. sub finduniquevalues(sourcerange range, targetcell range) sourcerange.advancedfilter action:=xlfiltercopy, _ copytorange:=targetcell, unique:=true end sub it works in getting list of unique items, how modify code pulls related columns? thanks!

php - How to create the array with key and value every time? -

i want create array such $animal = array("a" => "horse","b" => "fish") . constraint condition create 1 element (key , value) in array 1 time,that say in first time create key "a" , value "horse" ,to make $animal = array("a" => "horse") , in second time create key "b" , value "fish",to make $animal = array("a" => "horse","b" => "fish") . i can create array("horse","fish") in 2 times, in first time make array array("horse") , in second time make array array("horse","fish") . <?php $animal = array(); $x2 = "horse"; $x4 = "fish"; $animal[] = $x2; $animal[] = $x4; print_r($animal); ?> how create array("a" => "horse","b" => "fish") in same w

html - Transform not working when parent's height is set in viewport units -

i'm having problems vertical centering. header has height of 100vh , , child element, site-info , has unspecified height. site-info element supposed vertically centered within header . i've tried standard transform:translatey solution, doesn't work. top:50% work, it's transform doesn't happen. can see firebug transform property attached site-info , nothing happens. i've tried using vertical-align: center on site-info no success, , using position:absolute solution header makes disappear completely. using position:absolute on site-info not either. html: <header> <div class="site-info"> <h1>title</h1> <p>some content</p> </div> </header> css: header{ background-position:top center; background-size:100%; background-size:cover; height:100vh; position:relative; text-align:center; color:white; overflow:hidden; } div.site-info{ position:relative; text-align:c

sql - C# Login Form Secure/Correct? -

i'm making final project c# (school) year , promised last time got on site make sure sql secure , make application secure. on login screen , tell me if proper , secure way? i start opening main mdicontainer via program.cs: private void form1_load(object sender, eventargs e) { fl.showdialog(); } then login form shows: string user = txtuser.text; string pw = txtpw.text; int correct = cldatabase.login(user, pw); if (correct == 1) { this.hide(); } else { messagebox.show("de gegevens die u heeft ingevult kloppen niet", "fout!"); //above means input not correct } and in cldatabase.login public static int login(string gebruikersnaami, string wachtwoordi) { int correct = 0; sqlconnection conn = new sqlconnection(clstam.connstr); conn.open(); using (sqlcommand strquer = new sqlcommand("select * gebruiker usernm=

javascript - Clear reactJs textarea after submit -

i have following form component in skylight dialog, after submit, if dialog reopened containing form, contains previous submitted value. can please tell me how stop , clear textarea value everytime dialog opened? here component: var addnoteform = react.createclass({ componentdidmount: function() { react.finddomnode(this.refs.notes).value = ""; }, handlesubmit: function (event) { event.preventdefault(); var notes = react.finddomnode(this.refs.notes).value; var details = { studentid: this.props.studentid, schoolid: this.props.schoolid, notes: notes }; this.props.onsubmit(details); }, render: function() { return ( <form classname="pure-form pure-form-aligned" onsubmit={this.handlesubmit}> <div classname="pure-control-group"> <label htmlfor="notes">note</label> <textarea ref="notes"

user interface - How to make javafx choiceBox fit column width -

Image
i have dialog window created dinamically. there have textfields , choiceboxes. text fields fits column widths , choiceboxes not. have @ pic: i need choicebox of same width textfield elements added in way: addingdialogpane.add(namelabel, 0, 1); addingdialogpane.add(name, 1, 1); addingdialogpane.add(extuidlabel, 0, 2); addingdialogpane.add(extuid, 1, 2); addingdialogpane.add(is_folder, 0, 3); addingdialogpane.add(parentlabel, 0, 4); addingdialogpane.add(parent, 1, 4); addingdialogpane.add(confirm, 1, 5); upd: i've tryed use parent.prefwidthproperty().add(name.getwidth()); no effect i've tryed parent.prefwidth(double); no effect set maxwidth property of to: extuid.setmaxwidth( double.positive_infinity );

timezoneoffset - AIX numeric time zone offset -

is there os command display numeric time zone offset in aix 7.1? other unix systems have "date +%z" command return (-0400 example). aix return abbreviation (edt example) instead. gnu's date installed in /usr/linux/bin on aix versions later 6.x. unless sysadmin had specific reason not install packages default, there. if not installed, ibm provides linux toolbox aix . after installed, quick alias date=/usr/linux/bin/date give gnu date default.

SQL Server How to array a comm separated field -

Image
this question has answer here: how split string can access item x? 36 answers split comma seprate value table in sql server 3 answers i'm need separate out table follows: i've heard may possible using cursor function? can please? select id, tag mytable

uiview - View background color and button image has the same code but different look (iOS) -

Image
i set background color uiview through storyboard, see brighter color in simulator. , different button image background same code , sketch same code. alpha set 1. can wrong? sometimes need set rgb natural state try using "generic rgb" in colour settings

c++ - Locking ostream output in macro -

i have code proprietary logger: #define log getstream() where getstream returns std::ostream. user do: log << "text"; i need thread safe avoid this: #define end unlock(); #define log lock(); getstream() << "text" << end; since user need add "end": log << "text" << end; any ideas? remark: handle carriage return using this . one way solve use function-style macros, incorporate locking/unlocking using c++ block , scoping: #define log(output) \ \ { \ lockingclass lock; \ getstream() << output; \ } while (0) the lockingclass (or whatever want name it) scoped lock, locks stream on construction, , unlocks in on destruction. could used e.g. log("hello variable " << variable); can't use expressions containing comma though, preprocessor interpret commas a

angularjs - In angular datatable how to change show records per page options -

in jquery data table can change records per page option by "alengthmenu": [[50, 100, 150, 200, -1], [50, 100, 150, 200, "all"]], anyone know how achieve in angular? i tried $scope.dtoptions = dtoptionsbuilder.newoptions().withoption('order', [1, 'asc']).withdisplaylength(250); and $scope.dtoptions = dtoptionsbuilder.newoptions().withoption('order', [1, 'asc']).withoption('lengthmenu', [[50, 100, 150, 200, -1], [50, 100, 150, 200, "all"]]) i want show 50, 100, 150, 200 i searched @ http://l-lin.github.io/angular-datatables/#/api couldn't found you close... use 'lengthmenu' option , 1 array: $scope.dtoptions = dtoptionsbuilder.newoptions().withoption('order', [1, 'asc']).withoption('lengthmenu', [50, 100, 150, 200])

android - Sort Date column which is in MM/dd/yyyy format in sqlite -

this question has answer here: ordering dates descending in sqlite 1 answer i want max date first following query not return correct data cursor mcursor = db.rawquery("select * " + eservice_ticket_sync_table + " " + eservice_send_status + " = ? , " + eservice_user_id + " = ? order date(" + eservice_creation_date + ") desc ", new string[] { send_status, user_id }); i had stored eservice_creation_date in format mm/dd/yyyy text. thanks in advance. correct usage of "order is": order column_name desc

jQuery addClass() to another class -

i find class (used multiple td) , add @ td class, class. the class every td $day-momento-$x ($day number of today, $x can 1, 2 or 3, because i've 3 columns). this javascript code var ora = new date(); oo = ora.gethours(); giorno = ora.getdate(); //console.log('oo: '+ oo + ', giorno: ' + giorno); if (oo >= 4 && oo < 12) { $('.'+giorno+'-giornata-1').addclass('online'); } else if (oo >= 12 && oo < 20) { $('.'+giorno+'-giornata-2').addclass('online'); } else if (oo >= 20 && oo < 4) { $('.'+giorno+'-giornata-3').addclass('online'); } php/html code at top i've connection db, , $i of ajax code $i = $_post['contatore_giorni']; $numerogiorno = date("j", strtotime("+".$i." days")); $contatore = 0; ($m_p_s = 1; $m_p_

c++ - Apply transformation to PolyData -

i want able apply tranformations polydata no matter how try it, doesn't work. here have "drawing" polydata in class call drawing.cpp: drawing.h vtksmartpointer<vtkplane> clipplane; vtksmartpointer<vtkimplicitplanerepresentation> planerep; vtksmartpointer<vtkactor> actorplanesource; vtksmartpointer<vtkactor> mainactor; vtksmartpointer<vtktransformpolydatafilter> transformfilter; vtksmartpointer<vtktransform> translation ; vtkcontextview* ctxview ; vtkrenderwindow* win ; vtkrenderer* ren ; vtkcamera* cam ; vtksmartpointer<vtkpolydata> inputpolydata; then read function called , starts rendering, here function in drawing.cpp: void drawing::read(){ std::string filename = bunny; // read data file vtksmartpointer<vtkxmlpolydatareader> reader =vtksmartpointer<vtkxmlpolydatareader>::new(); reader->setfilename(filename.c_str()); reader->update();

css - Google fonts not displaying on live site -

i did update code i'm working on website , reason google fonts have stopped working on site http://www.gezzamondo.co.uk/simple.html i don't want copy , paste code in there's quite lot. else having problem or there error somewhere why add text cv in style.css, remove it. cv@charset "utf-8"; /* css document */ body { font-family: 'roboto', sans-serif; margin:0; padding:0; font-weight:300; }

Android: Rotate two objects(circles) onTouch with animation -

basically want draw 2 circles (one red, 1 blue) , make them rotate rotate animation. trying days without success. tried move animation method gameview class didn't work there either. currently crashes on ontouch. here's code far: gamescreen public class gamescreen extends activity { private gameview mygameview; private drawthread drawthread ; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_game_screen); mygameview = (gameview) (findviewbyid(r.id.gameview1)); mygameview.setzorderontop(true); mygameview.getholder().setformat(pixelformat.translucent); } public boolean ontouchevent(motionevent e) { int eventaction = e.getaction(); switch (eventaction) { case motionevent.action_down: system.out.println("clicked"); mygameview.rotate(mygameview);

feature extraction - what is the meaning of intensity order in image processing? -

i'm reading article . article explains new feature descriptor such sift , surf , it's name mrogh . in part of article, there sentence: in our work, sample points segmented based on intensity orders , gradients pooled each segment. my question is: what meaning of intensity order , local intensity of point in image? thanks, edit: @yves daoust linked me here , answer. the explanation seems rest in quote paper: "specifically, first sort sample points in support region according intensities. divide them 𝑘 segments equally according orders. finally, gradient information of sample points in each segment pooled, , gradient orientation histograms in these 𝑘 segments concatenated form representation of support region."

backup - which file to back up in Cpanel account? -

please had issues party hosting website, when contacted party requested me transfer site folder "backup" in root of account can see if can deploy or not. files should put in folder said? please need answer ugrent login cpanel , create new backup of account files latest content new host. you can generate backup following steps. login cpanel >> backup >> download full website backup >> , click on "generate backup" above steps create backup file in root directory account. have provide them login details migrate site.

Can't customize django ckeditor toolbar -

Image
i installed django-ckeditor==4.4.8 on django1.6 but minimum of buttons in toolbar, tried change toolbar more options, specially able add pictures this get: and these settings: #ckeditor settings ckeditor_upload_path = "images/" ckeditor_image_backend = 'pillow' ckeditor_jquery_url = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' aws_querystring_auth = false ckeditor_configs = { 'default': { 'toolbar':'full', }, } btw wonder happen when add picture , delete link of picture text editor, picture doing deleted? try putting in settings file: ckeditor_configs = { 'default': { 'toolbar_full': [ ['styles', 'format', 'bold', 'italic', 'underline', 'strike', 'spellchecker', 'undo', 'redo'], ['link', 'unlink', 'anchor'], ['image', &

Loading data from one couchbase server to another -

i want import data local machine. there way it? thanks, michael cbtransfer tool friend one. added benefit, can give regular expressions subset of data in case care.

How do I input my link information in html5 from a swiffy created from a flash file? -

i'm creating banner ad in flash cs5 2 , converting html5 swiffy, have button click tag in flash, input link information click tag - in html, in flash or input somehwere else? i add something: for purpose of running flash/html5 thru adserver, url inside flash doesn't matter, have 1 inside flash , 1 on codeside; click use 1 on code side. so yuo have inside flash: on (release) { geturl("http://www.msn.com", "_blank"); } and, after conversion, related code be: "actions":[{"value":"http://www.msn.com","type":305},{"value":"_blank","type":305} now replace url this: "actions":[{"value":"http://www.google.com","type":305},{"value":"_blank","type":305} and banner go google instead of going msn. note added target _blank. cheers

cytoscape.js - multiple graphs in one instance -

i'm making view of switch cytoscape. switch has 40 ports, each port fits nice breadthfirst layout. http://i.stack.imgur.com/ddg2d.png but need around 40 same graphs in 1 page when i'm using breadthfirst multiple roots i'm getting mess this http://i.stack.imgur.com/nycnz.png so, can deal somehow? sorry, dont have 10 rep yet, cant paste images , more links explain more correctly. also english not native language. you can run different layouts on different parts of graph, if want keep elements in single instance: http://js.cytoscape.org/#collection/layout

OpenCV Gaussian Mixture Model of histogram -

given histogram want train gaussian mixture model: int calcgmmthreshold(cv::mat & hist, cv::mat & labels){ cv::mat samples(hist.rows,2, cv_32fc1); // building 2 dim samples // output variables cv::mat probs, log_likelihoods; // building 2 dimensional mat -->[value][#value] for(int = 0; i<hist.rows; i++) { samples.at<float>(i,0) = (float)i; samples.at<float>(i,1) = hist.at<float>(i); } assert(samples.cols == 2); assert(samples.rows == 256); ///set gmm //gmm object 3 gmms cv::em gmm(3); /*train gmms*/ gmm.train(samples, log_likelihoods, labels, probs); } when plot histogram labels me looks gmms separate absolute values , not 2 dimensional input. i have expected 3 gaussians means @ each peak of histogram. to compute gaussian mixture model use actual image data not histogram intended in code above.

javascript - Use data from Node.js function -

this question has answer here: how return response asynchronous call? 21 answers i learning work nodejs , came problem. getcurrentweather() asynchronous function loads instantly when start app, , writes data variables. when use variables outside function console.log() data, undefined results, because node doesn't wait until getcurrentweather() gets api data, executes code instantly while still doesn't have return. solved function renewcurrentweather() , added settimeout wait while getcurrentweather() gets data, , console.log() it. this method works me, problem if want use data more 1 time,i have use function wiht settimeout . looks me little buggy, because need use data in more complex situations. so question is, how make node.js execute console.log(temp, cond) then, when getcurrentweather() finished loading data api. in other words, want use vari

Bulk copy from SQL Server CE to SQL Server -

there sqlcebulkcopy library (for windows ce) allows fast copying sql server database sql server ce on mobile devices? is there windows ce library allows backward? mean copy sql server ce on mobile device sql server?

ios - Is it possible to release an App for iPad only in cordova? -

Image
we've created ipad-app in cordova(phonegap) , client want put in appstore. setup when clicked on submit-button in itunes connect, asked upload screenshots iphone too. app should ipad only. can define that? in itunesconnect under screenshot section need select ipad shown in image. , in xcode project deployment info set device ipad

python - Change a field value within an If statement in Odoo 8 -

i have been using odoo 8 ubuntu 14.04. have onchange function , under if statement in trying change field value not change . need assign null value or 0.0 field failed. python code below: def _proposed_total(self): print self.emp_propose_allowance self.emp_propose_total = self.emp_propose_basic + self.emp_propose_allowance cr=self._cr uid=self._uid ids=self._ids val=int(self.employee_name) if(val): cr.execute("select max_salary,min_salary hr_job id in (select job_id hr_employee id='"+str(val)+"')") res=cr.fetchall() data in res: max_sal=data[0] min_sal=data[1] if(self.emp_propose_total>max_sal): raise osv.except_osv('out of range','proposed total must in between "'+str(max_sal)+'" "'+str(min_sal)+'"') self.emp_propose_basic=0.0 self.emp_propose_allowance=

java - How to read same XML file more times using XMLStreamReader -

i read xml file in 3 phases , in each phase, interested in different elements, based on input parameters. what best approach read 1 xml file more times using xmlstreamreader? xmlinputfactory = xmlinputfactory.newinstance(); try { xmlstreamreader streamreader xmlinputfactory.createxmlstreamreader(inputstream); try { while (streamreader .hasnext()) { where inputstream fileinputstream instance at moment, either stream closed exception or streamreader.hasnext() false when start second phase reading. load file memory , use bytearrayinputstream file f = ...; int len = (int)f.length(); // careful: if life on 4 gigs won't work byte myxml[] = new byte[]; fileinputstream fis = new fileinputstream(f); int read = fis.read(f); // not guarenteed read bytes, in experience, reads bytes if (read != len) throw runtimeexcption("didn't read everything"); // can create many xmlstreamreaders want try { xmlstreamreader streamreader

sparkr - Unable to call sparkRSQL.init function -

i new spark , trying run example mentioned in sparkr page. effort, able install sparkr machine , able run basic wordcount example. however, when try run: library(sparkr) #works fine - loads package sc <- sparkr.init() #works fine sqlcontext <- sparkrsql.init(sc) #fails it says, there no package called ‘sparkrsql’. per documentation sparkrsql.init function in sparkr package. please let me know if missing here. thanks in advance. i have faced problem when trying test sparkr. there lack of documentation on part. problem "sparkrsql" , "sparkrhive" not included in master branch, have install sparkr package "sparkr-sql" branch using command: library(devtools) install_github("amplab-extras/sparkr-pkg", ref="sparkr-sql", subdir="pkg") there hint in amplab website dataframe introduced in spark 1.3; 1.3-compatible sparkr version can found in github repo sparkr-sql branch, includes preliminary r api work

android - Captured image was not set into imageview not working on samsung s3 Duos -

i simple application set image in imageview. the image captured camera. my code working fine in devices except samsung s3 duos android version 4.4.4 my code package com.example.imageviewdemo; import android.net.uri; import android.os.bundle; import android.provider.mediastore; import android.app.activity; import android.content.intent; import android.content.pm.activityinfo; import android.content.res.configuration; import android.graphics.bitmap; import android.graphics.matrix; import android.view.display; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.view.windowmanager; import android.widget.imageview; public class mainactivity extends activity { imageview myimage; final int camera_capture_photo = 1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //setrequestedorientation(acti

geodjango - Heroku Cedar-14 heroku-geo-buildpack GEOSException -

i updated heroku cedar bamboo cedar-14. had geodjango buildpack installed failing error: ogrexception: ogr failure. this buildpacks: cat .buildpacks https://github.com/dulaccc/heroku-buildpack-geodjango.git https://github.com/heroku/heroku-buildpack-python https://github.com/gregburek/heroku-buildpack-pgbouncer.git#v0.3.2 this runtime: cat runtime.txt python-2.7.8 is there buildpack geodjango workis on cedar-14? in advance managed solve issue doing this: changed .buildpack file this: https://github.com/dulaccc/heroku-buildpack-geodjango.git#1.1 https://github.com/gregburek/heroku-buildpack-pgbouncer.git#v0.3.2 i used here latest release of heroku-buildpack-geodjango checking release tags , specifying latest one. i ended using runtime.txt: python-2.7.9 i made sure had following enviroment varialbles pointing correct location is: heroku config:set gdal_data=.geodjango/gdal/share/gdal heroku config:set gdal_library_path=.geodjango/gdal/lib

Triplicates in R -

i have set of 80 samples, 2 variables, each measured triplicate: sample var1a var1b var1c var2a var2b var2c 1 -169.784 -155.414 -146.555 -175.295 -159.534 -132.511 2 -180.577 -180.792 -178.192 -177.294 -171.809 -166.147 3 -178.605 -184.183 -177.672 -167.321 -168.572 -165.335 and on. how apply functions mean, sd, se etc. each row var1 , var2? also, dataset contains nas. bothering such basic questions what expected result when there nas? apply(df[-1], 1, mean) (or whatever function) work, give na result row. if can replace na 0 df[is.na(df)] <- 0 first, , apply function in order results.

language agnostic - Algorithm to calculate combinations without duplicates -

i have following problem: calculate combination of 3 digits number consisting of 0-9, , no duplicate allowed. as far know, combinations don't care ordering, 123 equal 312 , number of possible combinations should ( 10 ) = 120 combinations ( 3 ) that said: know how calculate permutations (via backtracking) don't know how calculate combinations. any hint? finding comnbination done via backtracking. @ each step - "guess" if should or should not add current candidate element, , recurse on decision. (and repeat both "include" , "exclude" decisions). here jave code: public static int getcombinations(int[] arr, int maxsize) { return getcombinations(arr, maxsize, 0, new stack<integer>()); } private static int getcombinations(int[] arr, int maxsize, int i, stack<integer> currentsol) { if (maxsize == 0) { system.out.println(currentsol); return 1; } if (i >= arr.length) return

c# - Logout not redirecting to Login Page MVC -

i trying navigate login page(sso) facing challenges. i dont have login page/controller can navigate on logout need redirect third party page(sso) on logout. in view :(_layout.cshtml) <a href="@url.action("logout", "home")"> <i class="fa fa-sign-out"></i> <span data-i18n="log out">log out</span> </a> in homecontroller.cs public actionresult logout() { // delete user details cache. httpcontext.session.abandon(); return redirect(configurationmanager.appsettings["logouturl"]); } in web.config: <add key ="logouturl" value="https://ssointrad.dev.ipc.us.aexp.com/ssoi/request?request_type=un_logoffampsd;ssourl=https://wpdcldwa00123.abc.xxxx.com/gpatdev"/> now when click on logout redirects : https://wpdcldwa00123.abc.xxxx.com/gpatdev/home/logout how resolve issue ? thanks.

ruby on rails - RoR 4.x approach for managing transactions best practices -

first of - sorry perhaps stupid questions i'm beginner in ror world , need basic clarity on how database transactions work within models / controllers. come java world things done in way , when working ror naturally compare java web frameworks hence confusion if looks radically different :-) in 1 of controller actions, need modify , save multiple of models, let's say: order, invoice, payment. from understand, standard "save" method on each model executes in it's own transaction therefore if write: payment.save order.save invoice.save this create 3 independent db transactions , each model saved in it's own transactions - not want since i'd make sure either or none of these models saved. i found article: http://markdaggett.com/blog/2011/12/01/transactions-in-rails/ demonstrates how wrap multiple "saves" single transaction. it's old hope still valid (correct me if i'm wrong). one thing don't need manage these transaction

nginx - Wordpress theme not recognized -

in local, works. here use rocketeer deploy project. in server, here wp-content/themes directory ./ ../ foobar/ .gitignore index.php -> /var/www/foobar.example.com/shared/wp-content/themes/index.php twentyfifteen -> /var/www/foobar.example.com/shared/wp-content/themes/twentyfifteen/ in admin panel, see twentyfifteen , cannot see foobar . i'm using nginx here server { listen 80; server_name foobar.example.com; root /var/www/foobar.example.com/current; error_page 404 /index.php; location / { index index.php; try_files $uri $uri/ =404; } location ~ \.php$ { include fastcgi_params; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param script_filename $document_root$fastcgi_script_name; } location ~/\.ht { deny all; } } for wordpress recognized themes need add special header css this

c++ - naming convention when typedef standard collections -

i looking naming conventions typedef of lengthy collections definitions. have c++ code used auto away style murder, need make code compiling on non c++11 compiler. looking establish convention typedef of collections, can become quite lengthy for instance typedef std::map<enum myfirstenum,enum mysecondenum> map_enum2_by_enum1_t typedef map_enum2_by_enum1_t::value_type vtype_map_enum2_by_enum1_t typedef map_enum2_by_enum1_t::iterator map_iterator_enum2_by_enum1_t there many nuances ( iterator before t @ beginning, using type rather t, ditching prefix map , etc...) half of time select 1 nuance, half of time select other. @ end no typedef other. typedef std::map<enum myfirstenum,enum mysecondenum> map_enum2_by_enum1_t; if there's no "big picture" name better describes mapping, i'd suggest enum2_by_enum1 or enum1_to_enum2 : both imply associative container without map bit, bit hungarian taste, same flaws (e.