Posts

Showing posts from February, 2014

casting - How can I convert float to integer in Java -

this question has answer here: how convert float int java 5 answers i need convert float number integer. can java automatically convert float number integers? if so, normal rounding rules apply (e.g. 3.4 gets converted 3, 3.6 gets converted 4)? you have in math library function round(float a) it's round float nearest whole number. int val = math.round(3.6); \\ val = 4 int val2 = math.round(3.4); \\ val2 = 3

Magento Layered navigation call to count() on undefined object -

i have encountered problem in layered navigation block, believe might bug. in block mage_catalog_block_navigation, method _rendercategorymenuitemhtml: // children // if flat data enabled use on frontend $flathelper = mage::helper('catalog/category_flat'); if ($flathelper->isavailable() && $flathelper->isbuilt(true) && !mage::app()->getstore()->isadmin()) { $children = (array)$category->getchildrennodes(); $childrencount = count($children); } else { $children = $category->getchildren(); $childrencount = $children->count(); } i have flat category index enabled , index rebuilt when scheduled (every minute). magento version 1.14.0.1 , error message: call member function count() on non-object based on if clause assuming happens when accesses page while index being rebuilt (isavailable). problem code in else block doesn't seem theoretically work, because $category->getc

php - What is the right way to group my methods inside a single model? -

i'm sorry title, maybe couldn't describe well. here's want: now if create model m.php , put inside models folder following code: class m extends ci_model { public function username() { print "john doe"; } public function password() { print "abc123"; } } now, can following in controller : $this->load->model("m"); $this->m->username(); // prints john doe $this->m->password(); // prints abc123 now need make in way on can call methds above following: $this->m->genralinfo->username(); // prints john doe $this->m->privacy->password(); // prints "abc123" how can achieve ? want in order group methods specific alltogether, helps me structure code better. **i aware possible create new model every group of methods i'd keep related user inside single model ** is possible using single model ? i think want this class m extends ci_model { public $genral

Using functions to remove decimal values for a column in a dataset using excel -

i using truncate function in excel remove decimal values. when remove original column truncated column deleted. how remove original column? i don't think there clever answer question, copying truncated values , pasting them new column using 'paste values'. then can safely remove original column or numbers in it.

crud - Getting metadata error while trying to save values to DB using Entity Framework -

i little new entity framework. i created sample applicaiton save values db table using entity framework. i have given below code snippet. [httppost] public actionresult employee(employeemodel model) { if (modelstate.isvalid) { // insert var _insert = new employeemodel { firstname = model.firstname, lastname = model.lastname, initial = model.initial, dob = model.dob, doj = model.doj, role = model.role, city = model.city, state = model.state, country = model.country }; db.employee_master.addobject(_insert); db.savechanges(); return view(); } i getting below compilation error in "db.employee_master.addobject(_insert);" line.

how to find one hop sender node in ns2 dsragent? -

i want find out node in neighborhood sent me packet receiving in recv function in dsragent . use following packet header don't have previous address. hdr_sr *srh = hdr_sr::access(packet); hdr_ip *iph = hdr_ip::access(packet); hdr_cmn *cmh = hdr_cmn::access(packet); the sending node shall modify 1 of header, otherwise telling impossible. since don't know application looks like, can't tell header appropriate modify.

javascript - Render components inside other components with react.js -

i'm having trouble figuring out how render react components, children inside other components on serverside. on client side in index.js file i'd like: react.render( <panel title="full time score"> <graph /> </panel>, document.getelementbyid('column-main') ); but on server side i'm not getting luck, possible this? or kind of anti-pattern , should start off 1 parent component. what i'm trying have reusable panel component (it includes button toggles visibility) can put content/components inside. on server, markup returned react.{rendertostring,rendertostaticmarkup} html output of component on first render. on client, components can re-render after componentdidmount lifecycle method has fired. make sure panel component renders children prop on first render.

java - Hibernate - one-to-one mapping not working -

i followed tutorial one-to-one mapping in hibernate end persistent class not known exception. the basic scenario is, have order reference customer , car. save order referenced entities database. order.java: public class order implements serializable { private static final long serialversionuid = 234543634; private string id; private car car; private customer customer; private date date; public string getid() { return id; } public void setid(string id) { this.id = id; } public car getcar() { return car; } public void setcar(car car) { this.car = car; } public customer getcustomer() { return customer; } public void setcustomer(customer customer) { this.customer = customer; } public date getdate() { return date; } public void setdate(date date) { this.date = date; } order.hbm.xml: <hibernate-mapping> <clas

geolocation - Restrict android application to specific region through code -

i've read can restrict access app when publishing on android market particular location. can restrict country but, want restrict access based on state or city live. and, app access expanded other cities or states in later updates. is there way can restrict users using app based on location. if there way explain in detail. you can user's current geo-point using "location manager" , there track user located at, there restrict user.

jquery - New message alert -

just stackoverflow , facebook tell of number of new messages you've got, please jquery tool use? have been playing around toastr appears toastr notification bigger , therefore not tool facebook , stackoverflow, , codeproject use notify users. please me out on name.

pcap - Wireshark filter for all connections -

so have 2 pcaps , need length of each connection in them , graph them against connection start times (so y axis duration , x axis time). need find connections did not end ack after fin-ack. new working pcaps unsure how this. assume wireshark easiest if tcpdump or other utility better fine well. can me filter? thanks

pointers - Linked List in c add to front -

so i'm confused. trying write c method allows me add new "node" front of linked list. have done before in c++ , no problem. getting frustrated because after writing code pretty sure right went , looked around , everywhere find tells me same thing ready doing...i'll provide code , step step addresses , values of variables. here code: the real function in question is: void addtobeginning(int value, struct node* root){ struct node* newnode; newnode = malloc( sizeof(struct node)); newnode->value = value; newnode->next = root; root = newnode; } but here complete code. removed things make more concise (things aren't necessary answer question getlength(...) , addtopos(...)) #include <stdio.h> #include <stdlib.h> struct node { int value; struct node* next; }; void printlinkedlist(struct node* root); void addtoend(int value, struct node* root); void addtobeginning(int value, struct node* root); void addtopo

symfony form entity update -

i'm trying create entity. my controller: $questionnaire = $em->getrepository('questionnairebundle:questionnaire')->findoneby(array('id' => $id)); $form = $this->createform(new questionnairetype(), $questionnaire); questionnairetype: public function buildform(formbuilderinterface $builder, array $options) { $builder->add('nom', 'text', array('label' => 'nom:')); $builder->add('nbrequestions', 'text', array('label' => 'nombre de questions:')); $builder->add('type', 'entity', array('class' => 'questionnairebundle:type', 'property' => 'type')); $builder->add('envoyer', 'submit', array('label' => 'enregistrer', 'attr' => array('class' => 'btn btn-success col-md-12'))); } the entity: questionnaire namespace questionnai

Best way to extend eclipse Java project wizard? -

i writing eclipse plug-in , need provide functionality let user create custom project basically plain old java project jar dependency , sample class in source folder. it should have custom nature (this tag project / change icon stands out visually). the user must able choose @ least name of project , location , , preferably java execution environment because must 8+. my understanding way create custom org.eclipse.ui.newwizards extension point. have considered following solutions : extending org.eclipse.jdt.internal.ui.wizards.javaprojectwizard , add jar, class , custom nature @ creation. problem class "not api" , should not extending it. create basic wizard project name , location (and maybe java environment combo box), and add java project settings myself (java nature, source , output locations...). preferred option, i'm wondering how simple ? if add java nature, guess associated preferences project appear automatically...? project doesn't have spe

authentication - Authenticating in MS Azure AD with returned SAML 2.0 artifact from another IdP -

our web app has enduser sso authentication 1 governmental identity provider. idp saml 2.0 based. web app calling web service registered in ms azure ad , require authentication kind of token. examples have seen far authenticating in azure ad based on jwt bearer tokens. is there way can use successful enduser (saml 2.0) returned token/artifact in web app authenticate against azure ad tenant can call azure ad web service? as far understand question, cannot achieve want! azure ad is identity provider itself. @ moment azure ad cannot federate identity provider (except internally live id). when create application in azure ad (register app), create trust between azure ad , application. , make application only trust azure ad . in picture there no place other saml-p identity provider. the way can achieve ask for, establish trust between saml provider , azure ad . , this, @ moment not supported azure ad. if web application calling web api via server side code (not clie

r - problems with user defined function -

i have trouble when running r code. contains few functions, problem happens when following function called: w <- function(p) { if (p == 1) pr <- 1 if (p == 0) pr <- 0 if (p != 0 && p != 1) pr <- exp(-(-log(p))^sigma) return(pr) } the problem occurs when argument of w function becomes 1. checked step step execution. found when have w(c1) in other function , c1 has value of 1, return of w function nan. confused because when write w(1), 1, when have w(c1), c1 computed 1 in other function, w function not work. in step step execution, when c1 becomes 1, first if condition not work, returns false, should opposite, since c1 equal 1. what can solution problem?

angularjs - Ionic / Angular JS - $scope issue : Cannot read property 'length' of undefined -

i can't use $scope in ionic, seems that's $scope not working. let's see simple example : app.js : angular.module('testapp', ['ionic','testctrl']) .run(function($ionicplatform) { $ionicplatform.ready(function() { if(window.cordova && window.cordova.plugins.keyboard) { cordova.plugins.keyboard.hidekeyboardaccessorybar(true); } if(window.statusbar) { statusbar.styledefault(); } }); }) .config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('login', { url: "/login", templateurl: "views/login.html", controller : "login" }); $urlrouterprovider.otherwise('/login'); }); login.js : angular.module('testctrl',[]) .controller('login', function($scope,$rootscope) { $scope.giveclass = function() { console.log($scope.email.length); } }); index.html : <!doctype html> &

javascript - How to read and write files with Appengine in Python? -

i'm new @ appengine , need help. the javascript want display generates graph. import webapp2 main_page_html1 = """\ <html> <body> <script> #my script comes here var graph = new graph(); graph.addnodes('a', 'b'); graph.addedges(['a', 'b']); #... </script> </body> </html> """ class mainpage(webapp2.requesthandler): def get(self): self.response.write(main_page_html1) app = webapp2.wsgiapplication([ ('/', mainpage), ], debug=true) my idea store main html in file , read if requesthandler called , modify when post new graph elements client. can't this, because appengine doesn't allow standard file operations. what easiest way make work? app engine lets read files fine, not write them. among many alternatives plain files can use if need read/write functionality, best 2 usually: (a) app engine data store, "files" of

How to make C# chart with two columns per one X value? -

i need chart: | _ | _ | | _ | | | _ | || | | | || | | || | |----|-------|------ 1 2 i've tried code below, second column overlaps first.but must second column next first column chart.series.clear(); chart.series.add("series 1"); chart.series.add("series 2"); (int = 0; < alphabet.length; i++) { datapoint dp = new datapoint(); dp.axislabel = alphabet[i].tostring(); dp.yvalues = new double[] { freq[i] }; chart.series[0].points.add(dp); dp.yvalues = new double[] { 100 }; chart.series[1].points.add(dp); } the columns not aligning because using same instance of datapoint. use new instance of datapoint second series , rendered besides each other. chart.series.clear(); chart.series.add("series 1"); chart.series.add("series 2"); (int = 0; < alphabet.length; i++)

html - Images not loading/ fly away buttons -

i made changes website , works , looks when open them in chrome, upload them on ipage server , @ them on actual site broken. http://jonathondull.com index page page looks how it's suppose too. i've exhausted of resources , person furious. have ideas causing this? if haven't already, wrap buttons inside container. make buttons width 25%, float them left , position container, haven't provided code i'll provide example you. should solve problem. inside container buttons are, create new div , call button container , wrap around buttons. <div id ="button_container"> //button tags go here </div> for css assign width , height button container , buttons including css have now. #button_container {width:25%; height:30px;} //example dimensions #button1, #button2, #button3, #button4 {width:25%; height:100%; float:left;} make sure container has margin above other content. can make container 100% width match width of it's

mysql - implementing my first PHP model -

i've written small restful php backend using slim framework ( http://www.slimframework.com/ ) interfaces mysql database, , right have 1 class doing db interactions , it's getting kinda big. it's time organize little more cleanly. so based on understand mvc, better way might implement model layer so: each logical entity in system implemented data class. i.e. user accounts: class called "account" getid(), getname(), getemail(), etc etc and corresponding factory objects, i.e. accountfactory owns db connection , creates account class manipulate elsewhere in business logic layer. the business logic layer still pretty simple, maybe class called myapplication instantiates factories , uses them respond restful api calls. business logic might be, example, matching 2 accounts based on geographical location. in case, testing on data in 2 separate account objects instead of raw data loaded database. but seems lot of refactoring time spent same thing. why wouldn

c - Vigenere Cipher Black Hawk Down -

i cannot figure out why thing doesn't scramble correctly. read other posts on cipher , far can tell i'm using exact same algorithm are... the areas commented out tests tried make sure passing through correctly. believe goes through correctly fails in algorithm. #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <stdlib.h> string get_message(void); string scramble(string key, string message); int main(int argc, string argv[]) { if(argc == 2) { string key; string message; key = argv[1]; //printf("key: %s<<",key); message = get_message(); scramble(key, message); } else { printf("please enter 2 arguments.\n"); return 1; } } string get_message(void) { string message = ""; { message = getstring(); } while(strlen(message) < 1); return message; } st

android - Send Bitmap using data URI scheme -

i'm trying approach problem: share image without write_external_storage? my idea encode png in data uri scheme . code: bytearrayoutputstream baos = new bytearrayoutputstream(); baos.write("data:image/png;base64,".getbytes()); base64outputstream base64 = new base64outputstream(baos, base64.no_wrap); boolean ok = bitmap.compress(bitmap.compressformat.png, 0, base64); base64.close(); if (ok) { uri uri = uri.parse(baos.tostring()); intent intent = new intent(intent.action_send); intent.settype("image/png"); intent.putextra(intent.extra_stream, uri); startactivity(intent); } the applications i've tried (e.g. gmail on android 4.4.4) cannot open image. create uri correctly? if so, prevents other applications reading image? do create uri correctly? i have no idea. if so, prevents other applications reading image? because have no idea data uri .

ruby - Rails send method to namespaced module -

i trying call method inside namespaced module. trying do, "undefined method" error. calling module method without send method working correctly. variable = send "namespace::#{type.capitalize}helper.#{type}_method".to_sym, params thanks help. (rails 4.1, ruby 2.1.1) variable = "namespace::#{type.capitalize}helper".constantize. send( "#{type}_method".to_sym, params ) (broken 2 lines, should still work because of trailing . .) send takes method name, not whole classname.method code. you're doing: namespace::somehelper.send( "sometype_method".to_sym, params)

python - If multiple Django apps define the same custom management command, which is used? -

the docs silent on questios. commands registered in order, later apps (in settings.installed_apps order) overriding previous commands (whether custom other apps or built-in django commands)? the answer yes, of current 1.7 release. see this line in django source see logic implemented: in order of apps per settings.installed_apps tuple, each app's management commands added dictionary of commands (which initialized django's built-in commands here ), single slot given command name, last 1 added sticks, overriding previous app's (or django's built-in) command same name; when executing command (code here ), django uses dictionary above decide command logic use. note haven't found documentation of this, should technically considered unofficial behavior.

javascript - Jquery mobile 1.4.5 set panel height possible? -

i making jqm project mobile only. i have 2 panels 1 set push other overlay. 1 in left corner , other top right corner. my question possible set right panel 100% width (which i've done) , set height 10-20% (40px-50px). can done without breaking functionality? can done in css? i'm able set width unable set height. thanks in advance!! customizing right or left panel need change 3 css classes set jqm. animation, panel, , inner part of panel content in. easier way create custom overlay box. demo https://jsfiddle.net/bz649m86/ html <div class="box"><a class="close">close</a></div> css .box { position:fixed; // fixed position used box top:0; // placed @ top of screen right:-100%; // minus position setting on right side of screen hidden view background-color: blue; width: 100%; //with width of whole screen, can width display: block; //displayed in block format z-index: 999999; // abo

c# - Use Sql View in EF 6.0 -

i have cashflowview: create view [dbo].[cashflowview] cte ( select row_number() on (order ratedate) id , sum(case when c.currencyname = 'br' t.amountmoney else 0 end) amountbyr , sum(case when c.currencyname = 'usd' t.amountmoney else 0 end) amountusd , cr.ratedate [date] transactions t inner join accounts on a.accountid = t.currentaccountid inner join currencies c on c.currencyid = a.currencyid right outer join currencyrates cr on cr.ratedate = t.executiondate group cr.ratedate ) select id , a.amountbyr , (select sum(b.amountbyr) cte b b.id<=a.id) balancebyr , a.amountusd , (select sum(b.amountusd) cte b b.id<=a.id) balanceusd , [date] cte then i've added entity: public class cashflowview { [key] public int id { get; set; } public decimal amountbyr { get; set; } public decimal balan

How to merge two array of objects in javascript -

how merge 2 array of objects in 1 array,the given array of objects below. var arr1=[{key:2000,value:100},{key:2001,value:200},{key:3000,value:300}] var arr2=[{key1:2000,value1:100},{key1:2001,value1:200},{key1:3000,value1:300}] expected output: [ { "key": 2000, "value": 100, "child": [ { "key1": 2000, "value1": 100 } ] }, { "key": 2001, "value": 200, "child": [ { "key1": 2001, "value1": 200 } ] }, { "key": 3000, "value": 300, "child": [ { "key1": 3000, "value1": 300 } ] } ] updated: other folks have mentioned, can loop through first array , assign corresponding element of second array child property of appropriate object in first array, or can use array.prototype.map for examp

c - Reading the program header contents of an ELF file -

how possible extract loadable program headers individually elf files? examining binary using readelf 1 can output similar to: $ readelf -l helloworld elf file type exec (executable file) entry point 0x400440 there 9 program headers, starting @ offset 64 program headers: type offset virtaddr physaddr filesiz memsiz flags align phdr 0x0000000000000040 0x0000000000400040 0x0000000000400040 0x00000000000001f8 0x00000000000001f8 r e 8 interp 0x0000000000000238 0x0000000000400238 0x0000000000400238 0x000000000000001c 0x000000000000001c r 1 [requesting program interpreter: /lib64/ld-linux-x86-64.so.2] load 0x0000000000000000 0x0000000000400000 0x0000000000400000 0x000000000000070c 0x000000000000070c r e 200000 load 0x0000000000000e10 0x0000000000600e10 0x0000000000600e10 0x0000

ms access - MS access2013 datasheet shows display values, but listbox only shows ID -

i have table named "customers", , table named "cases". these relate real estate transactions. on table "cases" have field "other party", lets enter new customer or pick existing 1 if have had person in our database different transaction. i have created form listbox can search case records via customer , other party fields (i show other info case not needing search info). in formview listbox shows customer name, shows id number other party. when go rowsource, buildevent, , see query in datasheet view, records display way want them -by name, not showing id numbers. why won't display correctly on listbox??? please help! have spent way many hours trying figure out :( first time using access , figuring out go. this sql query in listbox rowsource: select query3.customers.id, query3.[last name], query3.[first name], query3.[other party], query3.[property address], query3.[assigned to], query3.lawyer query3; and sql query3: parameter

Android TCP networking: AsyncTask vs. IntentService -

i’m building android app needs communicate server on tcp sockets. know networking should done off ui thread i’m not sure “threading approach” go with: intentservice or asynctask. read should use services if have run continually in background, , use asynctask one-off tasks find rather vague. application need communicate server on startup , when user clicks button, seem favour asynctask (since seems one-off task). benefit , downside of using asynctask on intentservice? i think shouldn't use async task, because async tasks runs in serial execution. slow down application if user go or press multiple times. can use thread handler or can use event bus library. or network task can use volly.

how to clear/empty string value in java -

i have started learning java. learning running simple udp server. program runs fine, if send packet "hello" client returns value hello. however, if send packet 1, value displayed 1ello. have tried clear string null , "" has not worked. how go doing this? import java.io.*; import java.net.*; class udpserver { public static void main(string args[]) throws exception { datagramsocket serversocket = new datagramsocket(9876); byte[] receivedata = new byte[1024]; byte[] senddata = new byte[1024]; while(true) { datagrampacket receivepacket = new datagrampacket(receivedata, receivedata.length); serversocket.receive(receivepacket); string sentence = new string( receivepacket.getdata()); system.out.println("received: " + sentence); inetaddress ipaddress = receivepacket.getaddress();

javascript - Lodash union of arrays of objects -

i'd use _.union function create union of 2 arrays of objects. union works arrays of primitives uses === examine if 2 values equal. i'd compare objects using key property: objects same key property regarded equal. there nice functional way achieve ideally using lodash? a non pure lodash way using array.concat function able pretty along uniq() : var objunion = function(array1, array2, matcher) { var concated = array1.concat(array2) return _.uniq(concated, false, matcher); } an alternative approach use flatten() , uniq() : var union = _.uniq(_.flatten([array1, array2]), matcherfn);

java - Heap allocation causes significant FPS drop after few restarts - LIBGDX -

Image
this how load textureatlases each time restart level uses different textureatlas: public void loadalltextures(){ if(atlas_main!=null) atlas_main.dispose(); if(atlas_secondary!=null) atlas_secondary.dispose(); assets.clear(); assets.load(main_atlasaback1_atlas, textureatlas.class); assets.load(main_atlasaback1_skin, skin.class); assets.finishloading(); if(!assets.isloaded(main_atlasaback1_atlas)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { atlas_main = assets.get(main_atlasaback1_atlas); } if(!assets.isloaded(main_atlasaback1_skin)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { skin_main = assets.get(main_atlasaback1_skin); } assets.load(main_atlas_sec_atlas, textureatlas.class); assets.finishloading(); if(!assets.isloaded(main_atlas_sec_atlas)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { atlas_secondary = ass

javascript - Wordpress jQuery: Selecting div's with no specific class or id -

i have spent way time on , need (days in fact). html follows: <div class="row"> <div class='five mobile-four columns'> <label class='right inline'> ciudad/estado </label> </div> </div> the code follows: (function ($) { $('div:contains("ciudad/estado")').css('display', 'none'); $("#field_2762").change(function () { if ($(this).val() == 'seleccione') { $("div:contains('ciudad/estado')").css('display', 'none'); } if ($(this).val() == 'puerto rico') { $("div:contains('ciudad/estado')").css('display', 'block'); } }); }); basically want select parent div common .row class can hide , show dependent on dropdown. far variations of code have tried (in thousands) have not worked. i new stacke

javascript - Jquery change function error checking form for input type=number -

i'm implementing timer, , trying figure out how error check input boxes in form random strings or characters aren't numbers. putting in character or string doesn't seem trigger change() function, , i'm guessing it's because have type="number" in html. i'm hesitant change type = "text" because spinner , down arrows come type="number" input boxes. is there easy way check 4 input boxes @ once instead of having "else" statement 4 boxes? i'm thinking there has elegant way this. i'm starting out javascript, appreciated. :) js: $(function(){ $("#sec").change(function(){ secs = parseint( $("#sec").val() || -1); mins = parseint( $("#min").val() || -1); hours = parseint( $("#hour").val() || -1); days = parseint( $("#day").val() || -1); console.log("secs " + secs); if($("#sec").val() >= 60

python - Does Tkinter come with File Dialogs by default? -

i've been reading tkdocs here , looking @ section windows , dialogs. 1 part provided various ways save, open , locate files on hard drive. from tkinter import filedialog dirname = filedialog.askdirectory() after trying 1 however, got following error: traceback (most recent call last): file "<pyshell#9>", line 1, in <module> a() file "<pyshell#8>", line 2, in tkinter import filedialog importerror: cannot import name filedialog the code provided in docs done python 3. i've modified import on tkinter (uppercase vs lowercase). my question is: are filedialogs in tkinter somewhere else, or need online, or not provided @ all? have python 2.7.6. you need import tkfiledialog tkinter package. refer this from tkinter import * tkfiledialog import *

javascript - Retrieve the parent of a clicked element -

i've got < table > - < tr > - < td > structure. each < td > includes < div > 3 < span > inside. need function, returns clicked < td > every time click either < td > or of elements (< div >, < span >#1, < span >#2, < span >#3). what tried setting z-index property < td > of higher value 1 < div > , < span > elements. thus, tried "hide" them behind < td >, didn't work. here's i've got now: http://jsbin.com/mocajahalu/2/edit?html,css,js,output please, help. try this... document.addeventlistener('click',function (e) { var parentel = null; if (e.target.tagname === "td") { // when user clicks on td parentel = e.target; } else if (e.target.parentelement.tagname === "td") { // when user clicks on of child element (the divs , spans) // if user clicks on child elements parentel = e.target.paren

parsing - Input data: java.lang.NumberFormatException: For input string: "2 " -

here data text file: 21/08/12#ese-6329#pv/5732#30 27/08/12#pea-4567#pv/5732#3@ 11/09/12#ese-5577#xk/8536#2 14/09/12#pnw-1235#hy/7195#2@ and code form main method: file orderdata = new file("purchaseorderdata.txt"); scanner datascan = new scanner(orderdata); while(datascan.hasnextline()) { string linedata = datascan.nextline(); scanner linescan = new scanner(linedata); linescan.usedelimiter("#"); string date = linescan.next(); // line 259 string id = linescan.next(); string code = linescan.next(); string quantityplus = linescan.next(); if(!quantityplus.contains("@")) management.addnewpurchaseorder(date, id, code, integer.parseint(quantityplus)); // line 267 else { quantityplus = quantityplus.replace("@", ""); management.addnewpurchaseorder(date, id, code, integer.parseint(quan

python - How to search and return position of a node in a linked list? -

new here sorry if don't ask in right way. have linked list , want search node it's data using ll.search(data), want return position node in can insert right after it. how that? this in python. def search(self,item): current = self.head found = false while current != none , not found: if current.get_data() == item: found = true else: current = current.get_next() return found here's code search function full ll implementation: from node import node class linked_list: def __init__(self): self.head = none def add(self, data): node = node(data) if(node != none): node.next = self.head self.head = node def append(self, data): node = node(data) if(node != none): if(self.head == none): self.head = node else: trav = self.head while(trav.next != none):#find last nod

html - Sit .SVG graphic next to menu text -

Image
basically i'm creating spry menu, can't seem 10x10px image sit next menu item. photoshop ex: without seeing code, impossible know how you're trying implement it. however, these types of icons it's easier use font-awesome. here jsfiddle of being easy implemented font-awesome. http://jsfiddle.net/jfgve/448/ <a class="navlink"> design <i class="fa fa-angle-down"></i> </a> @import 'http://fortawesome.github.io/font-awesome/assets/font-awesome/css/font-awesome.css'; .navlink { font-family: verdana; font-size: 40px; font-weight: 100; } .navlink { font-size: 30px; }

java - NullPointerException, can't get my textview from my layout -

edit: answered own question. my textview null , don't understand why. use personal fragment manager maybe it's problem. id correct because if add fragment on main activity , change text fragment oncreate method change text function works. not work have fragmenta added activity, click on button , count number of time click on it. wanna change textview of fragmentc " counter equal .." , textview null. suspect reason null it's not yet added activity. oncreateview not called. way can fix ? should call fragment.oncreateview in respond function ? my class textview: public class fragmentc extends fragment { textview textview; @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragmentc, container,false); //textview = (textview) view.findviewbyid(r.id.txtinfo2); return view; } @override public v

javascript - Keydown / Keyup gets called 7 times -

i'm building angularjs website game. here want use keyboard resume/pause , control game. code have add eventlistener following: $window.addeventlistener('keydown', function(e) { if ($scope.gamestate.playing) { (var control in controls) { if (controls.left.indexof(e.keycode) > -1) { gameengine.startleft(); } else if (controls.right.indexof(e.keycode) > -1) { gameengine.startright(); } else if (controls.powerjump.indexof(e.keycode) > -1) { gameengine.powerjump(); } else if (controls.pause.indexof(e.keycode) > -1) { $scope.pausegame(); } } } }); the content of function isn't important, problem gets called 7 times every time press key. same keyup . fast or slow press it. var gameapp = angular.module('gameapp', []); gameapp.controller('gamecontroller', function($scope, $timeout, $window) t

assembly - What does killed mean, as response to loading a program in Fedora linux? -

i have assembler program simple structure, text segment , bss segment. similar programs have been compiled me on decade. forth compiler , play tricks elf header. i'm used if mess elf header, can't start program , loader says "killed" before segfaults. but i've user of fedora version 6 linux, following: as -32 lina.s ld a.out -n -melf_i386 -o lina ./lina and message "killed" , 137 result of 'echo $?' clearly procedure uses official tools, such elf header should @ least valid. exact same procedure on other systems ubuntu or debian systems lead programs work normally. objdumps of resulting programs same @ least mapping of segments concerned. please give me indication of going on here, have no clue of how tackle problem. i'd stress no instruction executed, i.e. gdb refuses run it. so (gdb) run starting program: /home/gerard/desktop/lina-5.1/glina32 warning: cannot insert breakpoint -2. error accessing memory address 0x8048054: i

ios - Objective-C Conversion Errors -

i have project working on. project uses afnetworking 2.0 youtube gdata channel , load uitableview. there tutorial saw jared davidson showed me how so. great problem was in objective - c , project in swift . trying convert code swift have stumbled upon problem. i tried converting this, self.post = self.posts[@"data"][@"items"]; to in swift, self.post = self.posts["data"]["items"] nsmutabledictionary but error says... 'anyobject?' not have member named 'subscript' i have tried numerous ways fix still don't know how it. appreciated thanks ! accessing dictionary returns optional since key may not exist.. how compiler parses it: call posts . returns nsdictionary . call subscript on returned object, argument of "data." returns optional anyobject . call subscript on returned anyobject? , argument of 'data'. causes error, because need unwrap it. you need change to: s

VBA, MSXML2.XMLHTTP60 parse in head section -

i use webpage dim xhr msxml2.xmlhttp60 set xhr = new msxml2.xmlhttp60 on error resume next xhr .open "get", url, false .send if .readystate = 4 , .status = 200 set doc = new mshtml.htmldocument doc.body.innerhtml = .responsetext htmlrequesthttp = true else msgbox "internet error, please check:" & vbnewline & "ready state: " & .readystate & _ vbnewline & "http request status: " & .status htmlrequesthttp = false end if end but doc.getelementsbytagname("meta") misses tags head section. .response complete (i checked) how can access head elemnts? thanks, don't write document body. write document itself. set doc = new mshtml.htmldocument doc.write httpget(url) msgbox doc.getelementsbytagname("meta").length function httpget(url) new msxml2.xmlhttp60 .open "get", url, false on error re

Python -- attributes inexplicably changing with nothing in between changing them? -

i can't figure out how happening, here's relevant code in class: def flip_states(self, newvalue): ... self.currentstate = newvalue self.currenstatestr = genconfig.sensor_state_to_str[newvalue] self.update_field_in_db("currentstate", self.currentstate) self.update_field_in_db("currentstatestr", self.currenstatestr) wx.callafter(dispatcher.send, eventconfig.element_state_listener, orders=[self.gentype, self.currentstatestr, self.name, self.id]) simple enough, update_field_in_db calls gets newly reassigned version of self.currentstatestr, wx.callafter call gets old value of self.currentstatestr when put print of currentstatestr value received db call, correct , db updates expected -- put print in function right after db calls before wx.callafter, were. i thought maybe had how python assigned lists, can print attributes without list , still old ones. i've scoured db call make sure n

eclipse svn "The working copy needs to be upgraded" -

i've upgraded eclipse luna on laptop don't use much. i'm trying projects in sync svn server (hosted), running "the working copy needs upgraded" message. not have local svn client; use subversive in eclipse. i've upgraded plugins. what's next? some resources not updated. working copy needs upgraded svn: working copy @ '[my directory]' old (format 10) work client version '1.8.10 (r1615264)' (expects format 31). need upgrade working copy first. does help? svn upgrade working copy with command line client, have manually upgrade working copy format issuing command svn upgrade or: from eclipse, can select on project, right click->team->upgrade

amazon web services - zookeeper installation on multiple AWS EC2instances -

i new zookeeper , aws ec2. trying install zookeeper on 3 ec2 instances. as per zookeeper document , have installed zookeeper on 3 instances, created zoo.conf , add below configuration: ticktime=2000 initlimit=10 synclimit=5 datadir=/opt/zookeeper/data clientport=2181 server.1=localhost:2888:3888 server.2=<public ip of ec2 instance 2>:2889:3889 server.3=<public ip of ec2 instance 3>:2890:3890 also have created myid file on 3 instances /opt/zookeeper/data/myid per guideline.. i have couple of queries below: whenever starting zookeeper server on each instance, start in standalone mode.(as per logs) can above configuration gonna connect each other? port 2889:3889 & 2890:38900 - these port about. can need configure on ec2 machine or need give other port against it? is need create security group open these connection? not sure how in ec2 instance. how confirm 3 zookeeper has started , can communicate each other? the zookeeper configuration designe