Posts

Showing posts from April, 2014

android - "ImportError: Cannot import name spawnu" while building apk using kivy -

i building simple android app using kivy using below code: from kivy.app import app kivy.uix.label import label kivy.uix.scatter import scatter kivy.uix.floatlayout import floatlayout class tutorialapp(app): def build(self): f = floatlayout() s = scatter() l = label(text="hello!", font_size=150) f.add_widget(s) s.add_widget(l) return f if __name__ == "__main__": tutorialapp().run() i building code apk using buildozer. wrote buildozer android debug this gave following error: http://imgur.com/z9tjmhc how can rectify error. it seems python or kivy compiler unable import package named spawnu.spawnu part of pexpect package. try sudo pip install pexpect sudo pip install pexpect --upgrade worked me. luck!!

javascript - How to add a small description window when mouse cursor is over a element class? -

i tested method see if works, but... no, see: var classname = document.getelementsbyclassname('avatartestcx'); function myfunction() { document.write("test."); } for(var i=0;i<classname.length;i++){ classname[i].addeventlistener('mouseover', myfunction, false); } when mouse cursor element class, calls function write in document (it's test verify if possible small description window). it's not working... do have method example? if it's simple tooltip guess title attribute done. here example fiddle http://jsfiddle.net/542jwva8/1/ var classname = document.getelementsbyclassname('avatartestcx'); for(var i=0;i<classname.length;i++){ classname[i].setattribute("title", "small description \n line"); }

.htaccess - Redirect htaccess automatic -

initially had site /beta/ , , google me indexed pages, when 1 goes http: //miosito.ext/beta/blabla become automatically http: //miosito.ext/blabla i tried redirect /beta/^([a-za-z0-9_-]+)$ http://miosito.ext/^([a-za-z0-9_-]+)$ not work ... any idea how can do? try rewriterule "^beta\/(.+)" "http://miosito.ext/$1" [r,l] reference rewriting url: http://httpd.apache.org/docs/2.4/rewrite/remapping.html

c# - How to set TextBox to be resized when DataGridTemplateColumn size changes -

i tried stuff didn't work. maybe missed something. goal have fill horizontally column textedit , have autoresized when user change column size dragging. <datagrid> <datagrid.columns> <datagridtemplatecolumn width="200"> <datagridtemplatecolumn.headertemplate> <datatemplate> <textbox/> </datatemplate> </datagridtemplatecolumn.headertemplate> </datagridtemplatecolumn> </datagrid.columns> </datagrid> add header style datagrid . <datagridtemplatecolumn width="200"> <datagridtemplatecolumn.headerstyle> <style targettype="{x:type datagridcolumnheader}"> <setter property="horizontalcontentalignment" value="stretch"/> </style> </datagridtemplatecolumn.headerstyle>...

php - Calling a method of a mock object -

i testing service phpunit. i using setup() create mock objects of dependencies service accepts, this: public function setup() { $this->foomanagermock = $this->getfoomanagermock(); $this->barmanagermock = $this->getbarmanagermock(); $this->treemanagermock = $this->gettreemanagermock(); $this->loggermock = $this->getloggermock(); $this->myservice = new myservice($this->foomanagermock, $this->barmanagermock, $this->treemanagermock, $this->loggermock); } bundle\tests\service\mytest::testservicewithvaliddata /** * @dataprovider getservicevalidcasedata */ public function testservicewithvaliddata($case) { $this->asserttrue($this->myservice->serve($fooarray)); } it turns out entity manager in serve() function, having this: return $this->foomanager->find($fooid) !== null; in case $this->foomanager instance of mock_foomanager_4038382a , wh...

c# - Connecting choices to buttons -

i want make interactive story in windows form , connect choices buttons. have like... richtextbox1.text = "would to... 1. kill dragon? 2. run away? 3. talk dragon." if ( button choice ) {} if else ( button choice ) {} else ( button choice ) {} and have 3 buttons on form named 1, 2, 3. how can use these buttons make choices in program? try this: public form1() { initializecomponent(); button1.click += button_click; button2.click += button_click; button3.click += button_click; } and: private void button_click(object sender, eventargs e) { button btn = sender button; if (btn.name == "button1") { // here according to.. } else if (btn.name == "button2") { // here according to.. } .... }

ruby - Query always the same with Sunspot/Solr on rails -

i have problem sunspot. when solr request have same query. solr request (3.7ms) [ path=select parameters={fq: ["type:tag"], start: 0, rows: 30, q: "*:*"} ] no matter type in search field , it's same query here code : tag.rb class tag < activerecord::base belongs_to :pictogram searchable text :name end end searchs_controller.rb class searchscontroller < applicationcontroller def index if params[:search] pictograms = array.new @term = params[:query] search = tag.search fulltext @term end index = 0 search.results.each |t| if !pictograms.include? t.pictogram pictograms[index] = t.pictogram index = index + 1 end end @results = pictograms.group_by { |p| p.category } @search_mode = true end end end index...

html - When Div Expands my screen does not activate a scroll bar -

as can see, when div expands have no option scroll down , i'm wondering how go fixing this. here css <style> #cust_info { width: 300px; min-height:350px; margin: 0 auto; padding: 1em; background-color: #fff; border-radius: 25px; border: 2px solid #66ccff; padding: 20px; position: fixed; top: 100px; left: 40px; font-family: arial; } .more { display: none; border-top: 1px solid #fff; border-bottom: 1px solid #fff; } a.showlink, a.hidelink { text-decoration: none; color: #36f; padding-left: 8px; background: transparent url(down.gif) no-repeat left; } a.hidelink { background: transparent url(up.gif) no-repeat left; } a.showlink:hover, a.hidelink:hover { border-bottom: 1px dotted #36f; } </style> i gave div min height expand without text leaving area, when div expands past screen lose of div. please remove position:fixed #cust_info id . removing automatically give scroll in page. for keeping l...

scala - How to do distributed Principal Components Analysis + Kmeans using Apache Spark? -

i need run principal components analysis , k-means clustering on large-ish dataset (around 10 gb) spread out on many files. want use apache spark since it's known fast , distributed. i know spark supports pca , pca + kmeans . however, haven't found example demonstrates how many files in distributed manner.

php - Symfony2 duplicates collection entities when form index is missing -

i using symfony 2 , form component manage relations. $builder->add('locations', 'collection', array( 'type' => new locationtype(), 'options' => array("em" => $this->em), "allow_add" => true, "by_reference" => false, "allow_delete" => true, "delete_empty" => true )); i use many 2 many relation fields, use many-to-one , one-to-many it works want. new entities can created. delete entities, provide ajax function removes item db , deletes corresponding html part of form. when have 2 entities in collection, delete first 1 , not reload form, form has 1 entity element left. 1 has index 1 , not 0. when submit form, have last entity duplicated. not want! the problem occurs when delete first location, when there "index gap". how can avoid this? there option? found solution. in thr pre_bind event this: $data["locations...

python 2.7 - Tweepy location on Twitter API filter always throws 406 error -

i'm using following code (from django management commands) listen twitter stream - i've used same code on seperate command track keywords - i've branched out use location, , (apparently rightly) wanted test out without disrupting existing analysis that's running. i've followed docs , have made sure box in long/lat format (in fact, i'm using example long/lat twitter docs now). looks broadly same as question here , , tried using version of code answer - same error. if switch using 'track=...', same code works, it's problem location filter. adding print debug inside streaming.py in tweepy can see what's happening, print out self.parameters self.url , self.headers _run , , get: {'track': 't,w,i,t,t,e,r', 'delimited': 'length', 'locations': '-121.7500,36.8000,-122.7500,37.8000'} /1.1/statuses/filter.json?delimited=length , {'content-type': 'application/x-www-form-urlencod...

Mysql Procedure not working in mysql -

i have tried following procedure both ways.but through error. here need thecount of particular question categories.table 'questions' create procedure questioncountjava() begin select count(*) javaquestioncount questions category='java' end ***************other tried way******************** delimiter // create procedure questioncountjava() begin select count(*) javaquestioncount questions category='java' end // delimiter;

ios - Does Parse.com support prompting Users to agree to terms & privacy policy agreements -

i'm using pfsignupviewcontroller , pfloginviewcontroller prompt users create accounts , login. how can prompt users agree "disclaimers": app's terms & conditions , privacy policy? haven't found example on parse.com parse doesn't offer direct support, both login , signup views controllers offer ability add custom subviews views contain text or buttons , both offer number of delegate callbacks used trigger display. can display 'alert' when show login or signup view in first place.

passkit - PKPASS not opennig in Passbook -

i'm new passbook. created web application using php-pkpass library create passes passbook. used necessary licences. when submit create form, creates pass, pass doesn't work on passbook. if send email attachment, shows null. works fine on android. i'm on windows pc can't use iphone simulator view logs. here link pass created me - http://tanvir.tennisads.com/passbook/passes/pass-36252.pkpass can please me identify what's wrong pass? in advance. update: i've removed beacons , location part, having same issue. here generated json code. { "description": "kenedy store", "formatversion": 1, "organizationname": "kenedy store", "passtypeidentifier": "pass.com.retailness.testing.passbook", "serialnumber": "449925", "teamidentifier": "nbn8h8w46l", "coupon": { "primaryfields": [ { "key": ...

Facebook API posting with PHP <5.5 without CurlFile class -

i'm having trouble uploading file facebook php versions before 5.5 curlfile class not available. as understand, should use @filepath source , should work, reason returns exception occured, code: 353 message: (#353) must select video file upload. i've tried sending path using realpath() function, doesn't work. $response = (new facebookrequest( $session, 'post', '/me/videos', array( 'source' => '@'.realpath($url), 'description' => $description, 'title' => $title ) ))->execute()->getgraphobject(); does have solution this?

c# - Best way to remove duplicates from DataTable depending on column values -

i have dataset contains 1 table , i'm working datatable here. the code see below works, want have best , efficient way perform task because work data here. basically, data table should later in database, primary key - of course - must unique. the primary key of data work in column called computer name . each entry have date in column date . i wrote function searches duplicates in computer name column, , compare dates of these duplicates delete newest. the function wrote looks this: private void mergeduplicate(dataset importeddata) { dictionary<string, list<datarow>> systems = new dictionary<string, list<datarow>>(); dataset importeddatacopy = importeddata.copy(); importeddata.tables[0].clear(); foreach (datarow dr in importeddatacopy.tables[0].rows) { string systemname = dr["computer name"].tostring(); if (!systems.containskey(systemname)) { systems.add(systemname, new list...

linux - Calculate variance in bash -

i want compute variance of input txt file one: 1, 5 2, 5 3, 5 4, 10 and want output like: 1, 0 2, 0 3, 0 4, 4.6875 i've used line: awk '{c[nr]=$2; s=s+c[nr]; avg= s / nr; var=var+(($2 - avg)^2 / (nr )); print var }' inputfile > outputfile standard deviation formula described in http://www.mathsisfun.com/data/standard-deviation.html so need say: for in items sum += [(item - average)^2]/#items doing in sample input: 5 av=5/1=5 var=(5-5)/1=0 5 av=10/2=5 var=(5-5)^2+(5-5)^2/2=0 5 av=15/3=5 var=3*(5-5)^2/3=0 10 av=25/4=6.25 var=3*(5-6.25)^2+(10-6.25)^2/4=4.6875 so in awk can say: $ awk 'begin {fs=ofs=","} # set comma field input/output separator {a[nr]=$2 # store data in array sum+=a[nr] # keep track of sum av=sum/nr # calculate average far v=0 # reset counter variance (i=1;i<=nr;i++) # loop ...

mysql - Terminating a callback in nodejs -

i new nodejs. using mysql node module. how use it: var connection = mysql.createconnection({ host: 'localhost', user: 'root', password: '', database: 'sample' }); connection.connect(function (err) { if (!err) { console.log("database connected ... \n\n"); } else { console.log("error connecting database ... \n\n"); } }); var post = {personid: 1, name: 'prachi', city: 'blore'}; var query = connection.query('insert persons set ?', post, function(error, result) { if (error) { console.log(error.message); } else { console.log('success'); } }); console.log(query.sql); this node code works functionally. in, adds data table. doesn't terminate. mistake making? take closer @ official documentation, have close connection : var mysql = require('mysql'); var connection = mysql.createconnection({ host :...

Sorting after aggregation in Elasticsearch -

i have docs structure: { field1:string, field2: [ {subfield:number}, {subfield:number}...] } i want sort on result of sum of numbers in field2.subfields: get myindex/_search { "size":0, "aggs": { "a1": { "terms": { "field": "field1", "size":0 }, "aggs":{ "a2":{ "sum":{ "field":"field2.subfield" } } } } } } if obtain buckets not sorted, want buckets sorted "a2" value. how can this? thank you! you had it. need add order property a1 terms aggregations, this: get myindex/_search { "size":0, "aggs": { "a1": { "terms": { "field": "field1", "size":0, "order": {"a2": "desc"} <---...

ios - Need help adding data to a TableView -

my first view controller has tableview. on second view controller, user input data , click button. i want button add data table view, can not figure out how this. var textarray: nsmutablearray! = nsmutablearray() @iboutlet weak var tableview: uitableview! func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return self.textarray.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { return uitableviewcell() } @iboutlet weak var adddata: uibutton! @ibaction func adddata(sender: anyobject) { self.textarray.addobject(textfield.text) self.tableview.reloaddata() } it brings error reloaddata line of code. presumably code have quoted in second view controller. ibaction in view controller can't reload self.tableview because table in first view controller. to looking there literally dozens of approaches each pluses , minuses. maybe easiest implemen...

Can I get git fsck to show commit names? -

i have deleted commit, among many deleted commits, i'm trying restore. found out fsck --lost-found command. great! the problem have on hundred dangling commit statements little information. dangling commit 654857f5e8418c4031e1d8411579906c528da562 dangling commit 74499bd482d688c1416d5091b391d82a438855a9 dangling commit 124ed7cd4465434865577c82757732df62febb59 dangling commit 92573bf4595be6f80f22eba94548dbc88d8796fc dangling commit 125b0ffa3f0db71f23fda65d6adb2f9941748cc0 dangling commit ba5b1f8d6d920900abc88bd725d44ba86c8c772f dangling blob e760d751ae4e3dab9beed0996e683c0f291eb4cc if throw out commit name sha big help. is, have run git show on each one, one-by-one, find right commit. there easier way? this not answer solving git fsck, might work in situation. git reflog outputs list of past heads in repository. example, if switch branch master branch devel, produces reflog entry head of master branch. so if commit part of branch @ time, chances great can reco...

hide - jQuery toogle by ESC and clicking -

i have simple script $(".showhide").click(function (e) { e.stoppropagation(); jquery(this).children('.showhide').toggle(); }); i dont know how 1) hide .modal if esc presed 2) hide .modal if user click outside of .modal-inside https://jsfiddle.net/zkx9gt2u/1/ this should trick. $(".showhide").click(function (e) { e.stoppropagation(); $(".showhide").children('.showhide').toggle(); }); $(".modal-inside").click(function (e) { e.stoppropagation(); }); $(document).bind('keydown', function(e) { if (e.which == 27) { $(".showhide").children('.showhide').hide(); } }); edit i came across bootstrap modal got added in v3. want. starting point official site , here . e.g. if wish close modal using esc key, have this: var options = { "backdrop" : "static" } $('#id-of-modal').modal(options);

excel - Reference copied data to original cells -

i trying reference copied data, initial cell. sequence follows add newsheet on button click // sheetname load1, load2, etc input data new sheet click add new load. copy specific cells paste in summary sheet 6. link pasted values original worksheet cells??? my code sub new_load() dim integer dim ws worksheet dim sh worksheet dim x1, x2, x3, x4, x5, x6, x7, x8 variant ' motor loads dim y1, y2, y3, y4, y5 variant 'ups loads ' y5 (cell c14 white text) sheetname set ws = sheets("tech_form") ' set sh = sheets(sheets.count) ' last sheet in workbook application.screenupdating = 0 if range("d15") = "ups" fill_blanks 'fill blanks n/a y1 = range("d15").value y2 = range("e42").value y3 = range("h42").value y4 = range("e46").value y5 = range("c15").value sheets("summary").select range("c" & rows.count).end(xlup).offset(1).value = y1 range("...

ios - Programmatically added UITableView won't populate data -

i wish create uitableview , custom cell, , add them uiviewcontroller . if layout uitableview storyboard onto uiviewcontroller , everything works fine custom cell . but realized animation regarding height not smooth - table view disappears so decided create/destroy uitableview everytime wish animation, , add subview uiviewcontroller . but programmatically-added uitableview won't populate data. what doing wrong here? import uikit class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { var dataarr = [string]() // holds data uitableview var tv: uitableview! // notice it's not @outlet override func viewdidload() { super.viewdidload() dataarr = ["one", "two", "three"] // create , add uitableview drop down tv = uitableview() tv.delegate = self tv.datasource = self createtableview() } func createtableview() { let w = uiscreen.mainscreen().bounds.size.width t...

android - No success with retrieving from parse -

i'm trying read parseobject. have class on there , i'm trying messages there last message sent device. so if send 2 messages last 1 sent. can me? this code: parsequery<parseobject> query = parsequery.getquery("smstable"); query.whereequalto("deviceid", android_id); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> objects, com.parse.parseexception e) { if (e == null) { (parseobject smsobject : objects) { date time = (date) smsobject.get("date"); mymsg = (string) smsobject.get("message"); usrnum = (string) smsobject.get("phonenumber"); //happend = (boolean) smsobject.get("happend"); result = tim...

Adding a sequential letter to the end of a filename in Python -

i attempting write script name file user's username, date, unique identifier. objective network of users have file name generated them in standardized format in sequential order in shared database. able generate username , date, having trouble assigning identifier. thinking sequential ascii_lowercase, can not have duplicate. examples: user doug saves 3 file edits on june 1, files should saved doug060115a , doug060115b , doug060115c . user doug saves 1 more file edit on june 2, file should save doug060215a . so, unique identifier @ end of file name should start @ , if taken move on b, c, , forth. if username or date change unique identifier should start on @ a. you can use offset of ord , slicing def incrementname(s): return s[:-1] + chr(ord(s[-1]) + 1) >>> incrementname('doug060115b') 'doug060115c' not sure want once hit z (if anticipate case)

php - Mysql syntax error on LEFT JOIN query -

i trying execute left join query getting syntax error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'left join lr_users on lr_capped_members.user = lr_users.user_id wher' @ line 2 i have checked code errors (ie: missing commas, incorrect table names, etc), can not find fault. maybe have tunnel vision form working on code day appreciate assistance. please find below code. $member_qry = mysqli_query($con, "select lr_capped_members.user, lr_users.username left join lr_users on lr_capped_members.user = lr_users.user_id cap_week = '$week' ")or die(mysqli_error($con)); you forgot from part of query. you'll want write : $member_qry = mysqli_query($con, "select lr_capped_members.user, lr_users.username lr_capped_members left join lr_users on lr_capped_members.user = lr_users.user_id cap_week = '$week' ")or die(mysql...

Emacs web mode selection word delimiters include _ -

i'm unsure of how describe question, here goes: in emacs double-click select word, determines characters select -- called? (in terminal profile preference, called select-by-word characters , i'll use phrase.) without web-mode, example, if double click word title in image_title , highlights title -- is, underscore recognized select-by-word delimiter. once enabled web-mode, behavior of select-by-word changes, , underscore no longer word delimiter. in previous example, double-clicking highlights entire image_title . irritates me, commonly want select portions of underscore-delimited-identifier. (in general, i'd prefer mode not change default selection behavior.) what option change behavior of web-mode? edit add: in preferred mode, if double-click on _ character, select entire word including underscores. subtle precise control of selection behavior. @lawlist - suggestions! wasn't able follow functions through entirely, did lead me along correct pa...

osx - Permission denied when trying to make sublime text shortcut -

so started getting using terminal manage files etc, , trying setup sublime text shortcut using line of code: ln -s /applications/sublime\ text\ 2.app/contents/sharedsupport/bin/subl /usr/local/bin/sublime however, when try says permission denied , have no idea why. using mac running mac 10.10.2 . for sublime text 3: sudo ln -s "/applications/sublime text.app/contents/sharedsupport/bin/subl" /usr/local/bin/sublime

PHP - How to echo profile page after form submit -

i new @ php. creating staff management system client, , want create unique link , echo result after user submits new profile using form. in other words, on form submit, create unique page, , echo. i’ve been googgling around don’t think using right term. what looking url parameters. when submit form particular url sends form data via url parameters. depending on type of submit get or post can see data in url or not. to fetch data 1st page <form method='post' action='a.php'> <input type ='text' name='hi' /> </form> 2nd page <?php echo $_post['hi']; //this how access post , stored in key value pair //with key being name. $_get ?>

c# - Controls doesn't show if heavy process -

i use c# in winform. before heavy function, want show waiting form prevent user. form opens, controls in not drawn. in following code, waitingform little form, textbox , progressbar using (waitingform waitingform = new waintingform()) { waitingform.show(); heavyfunction(); } i see 2 white rectangles, controls should appear. why happens ? you can't show waiting form before heavy processing , expect ui remain responsive. thread you're clogging heavyfunction() same 1 responsible drawing forms, controls , maintaining ui. use backgroundworker or threadpool offload heavy processing thread. edit: also, please consider ron beyer's input regarding async/await

angularjs - How to refresh the form to its previous non data state once the data has been submitted -

i having form scenario user select 1 form multiple forms , starts fill it. after filling when he/she clicks on submit button data posted server , server after successful operation returns status ok showing user pop user confirmation. when user clicks on ok button on pop up, want show user, same form again fill. form need refreshed. how done angularjs. developing app in cordova ionic framework , has angularjs in it. my form div this: <form name="fieldform" method="post" ng-submit="submitformdata($event, htmlvalue)"> <div class="bootstrap" ng-bind-html="htmlvalue.html | unsafe"> ......form html....... </div> <div class="padding"> <button class="button button-block button-calm"> submit </button> </div> </form> my controller looks this: var formid = htm...

c - What happens if I sum negative values to a 16bit register constantly -

i stuck in project. finding average of multiple values. have ten values average. sum giving correct result time adding negative numbers , result negative numbers, when values average found has high magnitudes 16bit register in summmation stored gives positive value. going wrong in here. void smootharray() { val = 0; for(k=0;k<10;k++) { cc = array[k]; val += cc; } val /= 10; } in when array has many locations negative summation wrong positive. c language used. array unsigned short, while val short what happens if sum negative values 16bit register constantly you have undefined behavior. let's example int 16-bit , adding 2 int value int_min , -1 , invoke undefined behavior. in systems end positive value. use variable of wider type sum values, example declare val of type long guaranteed @ least 32-bit wide.

ios - SKStoreProductViewController not showing anything -

i'm trying present app store sheet inside app: https://gist.github.com/valeit/bf9b357d8ef470fc559c my viewcontroller conforms skstoreproductviewcontrollerdelegate. seems problem in "loadproductwithparameters" since i've tried calling presentviewcontroller outside completion block , presents , dismisses fine, it's empty (a white screen). i've tried passing dictionary both string or nsnumber nothing changes. idea? i know question crazy old, i'm having same problem. the part of gist looks off that, according docs, value skstoreproductparameteritunesitemidentifier should of type nsnumber have supplied string . try changing to vc.loadproductwithparameters([skstoreproductparameteritunesitemidentifier : nsnumber(value: 364709193)] and see if works.

sql - does this LEFT OUTER JOIN statement look correct? -

i' not getting error message seem getting 5 results no matter choose, leaves me beleive there wrong sql statement. i'm usint node.js tedious connect sql 2008 r2 database. previous statements worked, simple select statement posting date clause. know there spaces in column names not practice, there nothing can because thedatabase utilized navision. there no line breaks, did make appear more orderly guys. select ta.[amount], ta.[posting date], ta.[entry no_], ta.[document no_], tb.[salesperson code] [showtex belgie nv$g_l entry] ta left outer join [showtex belgie nv$sales invoice header] tb on ta.[document no_]=tb.[no_] ta.[posting date]>'05/01/2015' , ta.[document type]='2' , ta.[gen_ posting type]='2' strangely enough sql turns out not issu. conversion json.stringify json.parse. had tested before. perhaps negligent. anyways code looks this. when console.log(retval) data still looks correct...

regex - Replace text between two special characters -

i have character vector as: x<- "\t\t<taxon id=\"tot_f50\"/>" and y<- "tot_a01" and want replace tot_f50 text in y ("tot_a01"). do know how replace text between " , \ (i.e. "tot_f50) ? try sub('(?<=").*(?=")', y, x, perl=true) #[1] "\t\t<taxon id=\"tot_a01\"/>"

python - Duplicate a list in a Pandas Dataframe into a new row -

i have dataframe in pandas (associateid) has list of codes against index. goes this: indexbudgetcode associateid nexusapp_341800 ppc_fli_1111 nexusweb_120000 ooc_htl_1010 primweb_1900000 ppc_fli_9999,ppc_fli_1777 you can see in cases, there more 1 associateid in row - seperated comma, no spaces. from line of code, can them list: b = pd.dataframe(budgetdf.associateid.str.split(',').tolist(), index=budgetdf.budgetcode).stack() which looks this: associateid indexbudgetcode [ppc_fli_9999, ppc_fli_1777] primweb_1900000 but can't seem duplicate list create final dataframe: indexbudgetcode associateid nexusapp_341800 ppc_fli_1111 nexusweb_120000 ooc_htl_1010 primweb_1900000 ppc_fli_9999 primweb_1900000 ppc_fli_1777 can shed light on approach can use achieve this? thanks perhaps easiest way expand associateids separate rows use generator expression build rows: ((index, item) index, row in df['ass...

angularjs - Middleware between passport and angular -

first off, i'm new this. i'm writing sails application angular front end , using passport authentication. access session data front end after user has logged in. i've read multiple places data in user object in api/policies/passport.js can accessed in controller-served view, have no idea go inside controller. have far standard code inside api/policies/passport.js, assets/js/controllers.js, , assets/partials/partial1.html. don't have code show here. can show me example of this? follow tutorial implement passport.js authentication: https://www.bearfruit.org/2014/07/21/tutorial-easy-authentication-for-sails-js-apps/ after you've done can access season data in homepage this: <html> welcom back: <% if(typeof user.username != 'undefined'){ user.username }%> </html> in server side can access data this: index: function(req, res) { res.json(req.user); } attach controller view: in sails/views folder create new...

ascii - Why is backspace allowed in my jQuery whether I filter it out or not? -

i've got jquery: $(document).on("keypress", '[id*=float]', function (e) { //only allow 1..9 (48..57), '.' (46), , backspace (8) var k = e.which; if (k === 8 || k === 46) return; if (k < 48 || k > 57) { e.preventdefault(); } }); ...working on html: <input type="text" id="txtbxfloat"> </br> <input type="text" id="txtbxhopefloats"> </br> <input type="text" id="txtbxfloatingfreeasabird"> it can fiddled here it comments say/what want. however, this: $(document).on("keypress", '[id*=float]', function (e) { //only allow 1..9 (48..57), '.' (46), , backspace (8) var k = e.which; if (k === 46) return; if (k < 48 || k > 57) { e.preventdefault(); } }); iow, "8" (backspace) allowed in either case. why? guess it's not problem me @ moment, if wanted prevent backspace? if...

sql - joining two tables by value of one column and calculating -

thank interested in question. have in 1 table thing sifrez | sifkorisnikpk | status 1 | 1 | 'p' 2 | 1 | 'p' 3 | 1 | 'u' 4 | 2 | 'p' 5 | 2 | 'p' 6 | 2 | 'u' 7 | 2 | 'u' 8 | 3 | 'u' 9 | 3 | 'u' 10 | 3 | 'u' 11 | 3 | 'u' 12 | 4 | 'p' 13 | 4 | 'p' then created stored function count values of p , u search ratio between them find user id , return username create procedure sp_getbestusernames begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; -- insert statements procedure here select sifkorisnikpk, count (status) brojlosih #losarez rezervacija status = 'p' gro...

vba - Digital signature for Excel macro to get rid of macro security warnings -

Image
we developing macro used customer organizations. possible rid of macro security warning messages signing macro file digital signature? we have code signing certificate comodo when opened signed macro file in computer (an old mac) still gave warnings. because didn't right or because not possible rid of warning @ all. it still hinges on security settings on computer opening code. there option in there disable macros except digitally signed macros must selected signature matter. my current settings still prompt add-in.

using interval partitioning in mysql -

i'm trying learn mysql knowledge learn microsoft sql , oracle . i'm trying use interval partitioning on table i'm not seeing solution error i'm having. create table telmar_php.call_log ( log_id int not null, sender int, reciever varchar(30) not null, call_duration timestamp, call_start timestamp, call_end timestamp, primary key (log_id), foreign key(sender) references number_assigned(sender) ) partition range (call_duration) //this error line interval(numtodsinterval(1, 'hour')) (partition "2015-03-15 00:00:00" values less (to_date ('2015-03-16 00', 'yyyy-mm-dd hh24', 'nls_calendar=gregorian'))); that's code can't use interval partitioning in mysql? unlike oracle, mysql not support interval partitioning. have explicitly define each partition.

android - FileNotFoundException EACCES (Permission Denied) -

i'm getting exception file open permission denied when i'm trying open fileinputstream. file myfile = new file(environment.getexternalstoragedirectory() .getabsolutepath() + "/test/test.txt"); try { fileinputstream instream = new fileinputstream(myfile); // crash here's stacktrace: system.err﹕ java.io.filenotfoundexception: /storage/emulated/0/test/test.txt: open failed: eacces (permission denied) system.err﹕ @ libcore.io.iobridge.open(iobridge.java:456) system.err﹕ @ java.io.fileinputstream.<init>(fileinputstream.java:76) ... caused by: android.system.errnoexception: open failed: eacces (permission denied) @ libcore.io.posix.open(native method) @ libcore.io.blockguardos.open(blockguardos.java:186) @ libcore.io.iobridge.open(iobridge.java:442) and yes, have permissions in manifest: <uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="andro...

java - Why can't I reference net.sf.jasperreports.engine.DefaultJasperReportsContext from JSF? -

i grabbed old jsf (in netbeans) project needed update. noticed libraries missing, went , snagged current version of jasperreports (.jar) , commons/other support .jars necessary. ultimately, when try run project fails @ jaspersoft jrxmlloader.load(inputstream) call with: java.lang.noclassdeffounderror: not initialize class net.sf.jasperreports.engine.defaultjasperreportscontext @ net.sf.jasperreports.engine.jrruntimeexception.getmessage(jrruntimeexception.java:146) @ net.sf.jasperreports.engine.jrruntimeexception.getmessage(jrruntimeexception.java:138) @ java.lang.throwable.getlocalizedmessage(throwable.java:391) @ java.lang.throwable.tostring(throwable.java:480) @ java.lang.string.valueof(string.java:2982) @ java.lang.stringbuilder.append(stringbuilder.java:131) @ java.lang.throwable.printenclosedstacktrace(throwable.java:695) @ java.lang.throwable.printenclosedstacktrace(throwable.java:709) @ java.lang.throwable.printenclosedstacktrace(throwable.java:709) @ java.lang.throwabl...

java - PhantomJS load same page multiple times does not work, cannot clear cache -

i trying use phantomjs load testing website, facing problem, phantomjs loads website once, after not hit it, see there many discussion people asking feature load testing purpose looks not included in phnatomjs yet. did ran same problem? , best way overcome this? have got success using selenium webdriver phantomjsdriver doing same? thank you. i did calling driver.executephantomjs(javascript, "utf-8") clear memory cache. or can done below - driver.executephantomjs("var page = this; page.clearcookies(); page.clearmemorycache(); page.close(); return 'done';");

csv - How can i compare two columns in two different rows in python -

i want go through each line of csv file , compare see if first field of line 1 same first field of next line , on. if finds match ignore 2 lines contains same fields , keep lines there no match here example dataset (no_dup.txt) ac_gene_id m_gene_id ensgmog00000015632 ensorlg00000010573 ensgmog00000015632 ensorlg00000010585 ensgmog00000003747 ensorlg00000006947 ensgmog00000003748 ensorlg00000004636 basically want exclude line 1 , 2 since contains same fields (ensgmog00000015632) , keep lines 3 , 4 here code have tried couldn't finish it prev = none open("no_dup.txt", 'r') fh_in: line in fh_in: line = line.strip() if line.startswith("e"): line1 = line.split() print "initial gene =", line1[0] if prev not none or prev!= line1[0]: prev = line1[0] i think clean way of doing make map of each entry -> list of lines. entries = {} open('no_dup.tx...

python - How do I modify an existing vm template's only ethernet adapter's IP address with pyvmomi -

below code think should used modify network adapter ip of ethernet adapter windows vm while cloning vm template using pyvmomi , virtual center. doesn't work, vm clones network adapter not modified. seem finding examples assume there no adapters @ , creating new ones. use figuring out i'm doing wrong: def clone_vm( content, template, vm_name, si, ip, datacenter_name, vm_folder, datastore_name, cluster_name, resource_pool, power_on): """ clone vm template/vm, datacenter_name, vm_folder, datastore_name cluster_name, resource_pool, , power_on optional. """ # if none git first 1 datacenter = get_obj(content, [vim.datacenter], datacenter_name) if vm_folder: destfolder = get_obj(content, [vim.folder], vm_folder) else: destfolder = datacenter.vmfolder if datastore_name: datastore = get_obj(content, [vim.datastore], datastore_name) else: datastore = get_obj( content, [vim.datastore], template.datastore[0].info.name) # if no...

spring - OAuth & SAML integration or better approach -

could explain best approach scenario?: there 2 separate service providers: system server works rest api mobile application. system b website login handled simple , plain cookies. i have read lot , ive found used protocols in use right these kind of systems saml , oauth, oauth works specially give security api services , saml web applications (cookie based). ideally, being looked single log in, right handled system b through cookies in main domain. is there way use both saml , oauth? or way go? the answer depends on idp have. is idp saml based or got researching? saml , oauth don't play together. the ideal openid connect use openid connect token rest api token. involve using same idp authentication both.

javascript - Fibonacci sequence animation -

i attempting program fibonacci sequence animation on html5 canvas using javascript. i have calculated fibonacci numbers , able add squares grid layout. trouble having being able calculate offset automatically fit side side nicely. have pointers how can achieved. here javascript code: var canvas; var context; function init(){ canvas = document.getelementbyid('canvas'); context = canvas.getcontext('2d'); drawgrid(); drawlines(); } function drawgrid(){ context.strokestyle="lightgrey"; for(var = 0; < 600; i+=20){ context.beginpath(); context.moveto(i, 0); context.lineto(i, 600); context.stroke(); context.beginpath(); context.moveto(0, i); context.lineto(600, i); context.stroke(); } } function drawlines(){ context.strokestyle="blue"; var startleft = (canvas.width / 2) - 20; var starttop = (canvas.height / 2) - 20; var fir...

python - Assigning (or tieing in) function results back to original data in pandas -

i struggling extracting regression coefficients once complete function call np.polyfit (actual code below). able display of each coefficient unsure how extract them future use original data. df=pd.read_csv('2_skews.csv') here head() of data date expiry symbol strike vol 0 6/10/2015 1/19/2016 ibm 50 42.0 1 6/10/2015 1/19/2016 ibm 55 41.5 2 6/10/2015 1/19/2016 ibm 60 40.0 3 6/10/2015 1/19/2016 ibm 65 38.0 4 6/10/2015 1/19/2016 ibm 70 36.0 there many symbols many strikes across many days , many expiry dates well i have grouped data date, symbol , expiry , call regression function this: df_reg=df.groupby(['date','symbol','expiry']).apply(regress) i have function seems work (gives proper coefficients), don't seem able access them , tie them original data. def regress(df): y=df['vol'] x=df['strike'] z=p.polyfit(x,y,4) return (z) i calling...

javascript - Angular base64 video interpolation fail ($sce) -

i'm trying present base64 video using angular, fails interpolate due $sce provider not trusting source (which simple data url). error: [$interpolate:interr] can't interpolate: {{video}} error: [$sce:insecurl] blocked loading resource url not allowed $scedelegate policy. url: data:video/mp4;base64,aaaaggz0exbtcdqyaaaaaglzb21tcdqyaaavzm1vb3yaaabsbxzoz…+vxw5fexy+x3p3xv429xirw87evd0svwnuu3by8hw9zs6twxs5zcbmgmlcky+3csi4rac9ya== so far have tried: $scope.video = $sce.trustasresourceurl('base64-string-here'); this didn't worked , believe method still expecting valid link , not data url, therefore not right solution. second try: angular.module('myappwithscedisabledmyapp', []).config(function($sceprovider) { // disable sce. // not use in new projects. $sceprovider.enabled(false); }); this of course works , disables entire provider, hence making app vulnerable. i have yet came across valid solution this, i'm displaying base64 images without h...

node.js - How can i read a json file in gzip? -

there archive format gzip. there json files. need each file in turn , , written in other gzip. realized need use standard library createreadstream , zlib. well, following example https://nodejs.org/api/zlib.html#zlib_examples following process done single gzipped file: var unzip = zlib.createunzip(); var fs = require('fs'); var inp = fs.createreadstream('input.json.gz'); var out = fs.createwritestream('output.json'); inp.pipe(unzip).pipe(out); however if there multiple files within gzip, not sure how 1 go doing that. not find documentation , way found multiple files unzipped gzip file in node if tar'd first. process unzipping tar.gz in node can found here . following example, 1 this: var unzip = zlib.createunzip(); var fs = require('fs'); var tar = require('tar-fs'); var inp = fs.createreadstream('input.tar.gz'); var out = './output'; // output directory inp.pipe(unzip).pipe(tar.extract(out));