Posts

Showing posts from May, 2014

What is the Infinity property used for in Javascript? -

why infinity property used command (rather result) for example, code below works, result isn't expected. alert(isodd(infinity)); function isodd(num) { return num%2==1; } infinity property of global object holds numeric value representing mathematical concept of infinity . don't know normal definition called "command." with regard edit, should return false (i ran confirm suspicion, , did on browser). correct, infinity not considered odd number.

could not find text file, java file I/O error -

not sure why won't read txt file saved in same directory. compiled fine when enter java blindfoldsaside cmd ln, says cannot find or load main class blindfoldsaside. case correct far can see , in right file path, i'm not sure went wrong! package blindfoldsaside; import java.io.bufferedreader; import java.io.fileinputstream; import java.io.filereader; import java.io.ioexception; import java.util.scanner; public class blindfoldsaside { public static void main (string[] args) { scanner scannerin = null; fileinputstream in = null; bufferedreader inputstream = null; int filechar; //character's int equivalent string fileline; try { // fileinputstream calls txt file in = new fileinputstream("blindfoldsaside.txt"); system.out.println("these lyrics tell story of woman, named kezia, is" + " \nbeing put death after being forced prostitution. song prison...

winforms - Toggle the picture of picture box with picture box on_click c# -

i have 1 image in picture box using resource want change image when click icon.png should changed icon1.png within picturebox when click again picture box should changed icon.png private void picturebox10_click(object sender, eventargs e) { if (picturebox10.imagelocation != @"icon1.png") { var image = image.fromfile(@"icon1.png"); picturebox10.image = image; } if (picturebox10.imagelocation == @"icon1.png") { var image = image.fromfile(@"icon.png"); picturebox10.image = image; } } but not working please me out of this. you're getting null image location it's not set when you're assigning picture image property. there few ways fix this: change assignment assign using imagelocation picturebox10.imagelocation = @"icon1.png"; change check see if image property equal new image picturebox10.image == im...

Dictionary vs. hashtable -

can explain difference between dictionaries , hashtables? in java, i've read dictionaries superset of hashtables, thought other way around. other languages seem treat 2 same. when should 1 used on other, , what's difference? the oxford dictionary of computing defines dictionary as... any data structure representing set of elements can support insertion , deletion of elements test membership. as such, dictionaries abstract idea can reasonably efficiently implemented e.g. binary trees or hash tables, tries, or direct array indexing if keys numeric , not sparse. said, python uses closed-hashing hash table dict implementation, , c# seems use kind of hash table (hence need separate sorteddictionary type). a hash table more specific , concrete data structures: there several implementations options ( closed vs. open hashing being perhaps fundamental), they're characterised o(1) amortised insertion, lookup , deletion, , there's no excuse begin-...

how to write elasticsearch script_score in java api -

i find function in elasticsearch like get /_search { "function_score": { "functions": [ { ...location clause... }, { ...price clause... }, { "script_score": { "params": { "threshold": 80, "discount": 0.1, "target": 10 }, "script": "price = doc['price'].value; margin = doc['margin'].value; if (price < threshold) { return price * margin / target }; return price * (1 - discount) * margin / target;" } } ] } } i use scorefunctionbuilder achive "location caluse" , "price caluse" ,but not know how write "script_score" , "script" java api the es version in project 2.2.0 , use java api achieve function but can not find api scriptscorefunctionbuilder. scriptfunction(string script, map<string...

eclipse - selenium find element in a while loop in java -

so, have selenium webdriver command condition while loop shown here: while (driver.findelement(by.cssselector("a[action='cancel']")).isdisplayed() == true){ driver.navigate().refresh(); timeunit.seconds.sleep(5); driver.findelement(by.id("479510558845313")).sendkeys(instagramaievx.spamusernameinput); driver.findelement(by.id("263795143794707")).sendkeys(instagramaievx.spamcommentinput); driver.findelement(by.id("u_0_4")).sendkeys(x); driver.findelement(by.id("u_0_5")).click(); } timeunit.seconds.sleep(2); driver.findelement(by.xpath("//a[contains(text(),'okay')]")).click(); killfirefox(); so, problem when condition false, not skip while loop , go what's below it. tries : driver.findelement(by.cssselector("a[action='cancel']")) makes program fail. how make skip wh...

ANDROID - Using CursorLoader to get audios causes duplication of audios -

i building activity want populate audios using loader. public class mainactivity extends baseactivity implements loadermanager.loadercallbacks<cursor> { private static final int internal_cursor_id = 0; private static final int external_cursor_id = 1; private arraylist<audio> audios = new arraylist<>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initloader(); } private void initloader() { try { getsupportloadermanager().initloader(internal_cursor_id, null, this); getsupportloadermanager().initloader(external_cursor_id, null, this); } catch (securityexception e) { } catch (illegalargumentexception e) { } } private static final string[] internal_columns = new string[]{ mediastore.audio.media._id, mediastore.audio.media.album...

asp.net - how to check selected item in Check Box List (generated from code) -

i have have asp.net / vb application need check on selected item in check box list checkbox dynamically code behind <asp:panel id="panel1" runat="server"> <asp:button id="button1" runat="server" text="save" /> <asp:label id="lbl_selected_items" runat="server" text=""></asp:label> </asp:panel> code behind page load dim checkboxlist new checkboxlist pagerview.controls.add(checkboxlist) ...est button1 click event protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click dim checkboxlist1 checkboxlist = ctype(me.findcontrol("checkboxlist"), checkboxlist) dim scheckedvalue string = "" each oitem listitem in checkboxlist1.items if oitem.selected if scheckedvalue = "" scheckedvalue = ("selected value : " + oitem.value & " selec...

php - Get last inserted id of any table in mysql -

i'm importing .sql file via php. .sql file contains multiple tables , want last inserted id of particular table. so, how last inserted id of table table name? any idea how id? please don't suggest, id select query max id. as long auto_increment defined, last inserted auto increment id can retrieved information_schema.tables : select if(auto_increment = 1, 'no row has been inserted', auto_increment - @@auto_increment_increment) lastinsertedid information_schema.tables table_schema = 'dbname' , table_name = 'tablename';

If I Fork a process in ruby, do I need to reconnect to Mysql DB? -

i'm using following environment. rails 3.1 unicorn mysql i have fork process wich generate invoces. people told me use activerecord::base.connection.reconnect! because drivers lost connection fork... looked information i'm more confused before... here comes doubts: 1 what's difference between using activerecord::base.connection.reconnect! and ::activerecord::base.clear_all_connections! before forking , ::activerecord::base.establish_connection as shown here? mysql, using fork in ruby 2 should always? if answer yes there place put "fork configuration"? 3 what's happen connection when forked process ends? should close it? or close automatically? , what's append father's process connection? 4 needed database connections? i have read somewhere postgres db... thank you no, point of view dont have reconnect.. have connect if want access different database, far know rails handles reconnect own mysql. ...

checkbox - Rails check_box data not saving -

i have form check_box method, , when submit form, doesn't save user.(i check using user.all in console) it's separate form sign form, , dont know if necessary, im using devise. edit heres console : parameters: {"utf8"=>"✓", "authenticity_token"=>"lpplw/awlhpdnt4xz7+vuafr2befwnapvdn3w4sroug6jpusk1kg9pv3+cepey2qw50aivhmu/hnkdknwk1l0q==", "user"=>{"html5"=>"1", "css3"=>"1", "ruby"=>"1", "python"=>"1", "javscript"=>"0", "jquery"=>"0", "php"=>"0"}, "commit"=>"submit"} user load (0.1ms) select "users".* "users" "users"."id" = ? order "users"."id" asc limit 1 [["id", 1]] rendered dashboard/index.html.erb within layouts/application (5.1ms) completed 200 ok in ...

java - What is it called when a subclass changes the implementation of a superclass method? -

i search on own, don't know look. there annotation this? overriding. , @override annotation, link indicates method declaration intended override method declaration in supertype.

node.js - How to Validate Mongoose Schema With a Complex Object in Array -

i building schema has complex object in array: foo:{ bar:[{ itema:string, itemb:string }] } i want add validation object in array check array size (i want limit size of array 10). how structure schema validate sort of object in array? you can through validate option in schema below var fooschema = new schema({ foo:{ bar: { type: [{ itema:string, itemb:string }], validate: [arrlimit, '{path} exceeds limit 10'] } } }); function arrlimit(arr) { return arr && arr.length <= 10; }; if add more 10 items bar array like var f = foo({}); (var = 0; < 12; ++i) f.foo.bar.push({itema: 'a', itemb: 'b'}); f.save(function(err) { if (err) console.log(err); else console.log('save foo successfully....'); }) error come up { [validationerror: foo validation failed] message: 'foo vali...

indentation - Adobe-Brackets disable auto-indent and auto-close tags -

i have issues adobe brackets out there after trying change preferences solutions out there. issue: opened head tag. after typing code, on last line, begin close head tag , auto completes tag. in addition, auto-indents closing tag. how disable both of these? have tried changing preferences smartindent, whenclosing, whenopening 'false' no avail. or perhaps need idiot-proof explanation of how it. update: auto-indent of tag seem follow previous written line of code. prevent this. thanks in advance. the brackets wiki preferences page details closetags option, which, disable particular behavior you're experiencing, should have whenclosing option disabled, @ least. add preferences file: "closetags": { "whenclosing": false } additionally, disable tag autoclosing when typing opening tag, disable whenopening , well: "whenopening": false

python - Kivy understand self.pos and self.size -

whenever try span canvas across layout, have this <floatlayout>: canvas: color: rgba: 54 / 255, 60 / 255, 72 / 255, 1 rectangle: pos: self.pos size: self.size i have been playing around , fail understand self.pos referring to? reading documentation seems points current widget should rectangle. when enter debug mode, notice default value of self.size (100, 100). rectangle not widget, it's canvas instruction, widget representation (a set of canvas instructions) + behavior (various methods 'on_touch_down'). in kv, self designate current widget, here, floatlayout. widget's default size indeed '(100, 100)' it's default any.

php - Authorization adapter &quot;actions&quot; was not found. CakePHP -

i use cakephp auth componenet in web site. code works fine in windows after uploading linux online host, give message authorization adapter "actions" not found. cakephp any idea regarding problem ? <?php app::uses('appcontroller', 'controller'); class appcontroller extends controller { public $mobile; public $components = array( 'acl', 'auth' => array( 'authorize' => array( 'actions' => array('actionpath' => 'controllers/'), ), ), 'session', 'requesthandler', ); public $helpers = array('html', 'form', 'session', 'js' => array('jquery')); public function beforefilter() { parent::beforefilter(); // print_r($this->request); die; if ($this->...

arangodb - Can arangosh support shebang with --javascript.execute -

arangosh seems not having shebangs in javascript files loaded --javascript.execute i'm making sysadmin tools our arangodb - tools guy root password use when stuff breaks! tools wont ask permission, bypass arangodb's permission restrictions. use unix socket that. so far have made /opt/arango-tools/bin/arangojs with: #!/bin/bash soc=/var/lib/arangodb/unrestricted-endpoint if [ -r $soc ] && [ -w $soc ] /usr/bin/arangosh --server.endpoint unix://$soc --javascript.execute "$@" else echo needs r/w $soc, consider running sudo exit 1 fi and simple helper tool /opt/arango-tools/bin/list-users.js with: #!/opt/arango-tools/bin/arangojs var users = require("org/arangodb/users"); db._listdatabases().foreach(function(db_name) { console.log(db_name); db._usedatabase(db_name); users.all().foreach(function(row) { console.log(" " + row.user + (row.active ? ' (active)':' (disabled)')); }); }); but ...

html5 - How to check if the flash file stopped with javascript -

i using <embed> tag display flash file .swf, want check if file have stopped loading of js you can check : if (!movie.isplaying()) alert("movie stopped");

multithreading - WPF starting up interfaces without freezing the GUI -

i know there bunch of threads initializing stuff in different thread dont need freeze ui. in case initialization involves creating lot of plots (polylines in canvas) seems need freeze ui. it enough hide frame things being initialized (i let "loading.." message in below) , freeze ui (couple of seconds) , show again frame. this have far. not working... freezes ui before hiding nothing , unfreezes after loading initializes frame. otherwise thing works charm. void historics_showexperimentresults(object sender, eventargs e) { aeppage = new aeppage(); resultspage = new aepresultset(); // try hide frame. below there "loading..." nice text. // not sure if it's best way works if dont show @ end paradigmframe.dispatcher.invoke((action)delegate { paradigmframe.content = null; paradigmframe.updatelayout(); }); // initialization needs have gui thread //because draw...

asp.net web api - Pushing an item into array in javascript -

i got problem javascript. specificly, have table like <table class="table"> <tr> <th> <label>select</label> </th> <th> @html.displaynamefor(model => model.firstname) </th> <th> @html.displaynamefor(model => model.middle) </th> <th> @html.displaynamefor(model => model.lastname) </th> <th> @html.displaynamefor(model => model.dob) </th> <th> @html.displaynamefor(model => model.gender) </th> <th> @html.displaynamefor(model => model.startdate) </th> <th></th> </tr> @foreach (var item in model) { <tr id="@html.displayfor(modelitem => item.employeeid)" ondblclick="doubleclickonrow(this)"> ...

Decoding A Json String in php -

this question has answer here: how extract data json php? 2 answers i want know how can acess decoded json , code <?php $jsonobject = $_get["userdetails"]; ?> jsonobject = {\"email\":\"joissumanh@gmail.com\"} how can decode above json , acess it. looking forward indepth answer. thankyou you can access object property using -> <?php $jsonobject = json_decode($_get["userdetails"]); echo $jsonobject->email; // print joissumanh@gmail.com ?>

node.js - Jade to Dust Parser? -

i wrote using jade template nodejs. when talking manager.. found use dust within company. required switch on dust. while following dry principle.. don't want manually. is there translator/parser parse existing jade template dust? searched online didn't found. additionally, if there's no such template, go , implement 1 myself? took compiler course before , thinking not-to-hard implement. never tried... , don't understand dust template yet. how think of difficulty of doing 1 parser myself?

ios - ViewController objects invalid when performFetchWithCompletionHandler called -

i received crash report tester main user object created masterviewcontroller (apparently) nil or invalid when os called performfetchwithcompletionhandler. know object initialized when app went background because don't request background fetch notifications unless i'm in state requires user object valid. here snippet of create of masterviewcontroller: class masterviewcontroller: uitableviewcontroller { static var services = [service]() static var user:user! . . . override func viewdidload() { super.viewdidload() // create model objects masterviewcontroller.user = user() . . . } and here fetch call using user object: func application(application: uiapplication, performfetchwithcompletionhandler completionhandler: (uibackgroundfetchresult) -> void) { print("background notification: in performfetchwithcompletionhandler") if masterviewcontroller.user.getproviderstate() == providerstate.offline || !userapimanager.sha...

java - JPQL (Eclipse JPA procider) cannot call method on int -

so have following jpql in netbean jpql tool. select e.idetu, e.nometu, e.prenometu,e.ddnetu etudiant e,inscrireclasse i, niveau n i.idniveau = n.idniveau , n.nomniveau='master 1' when run dont know why there bug. below jpa log (it cannot call method on int...no idea means) if run without i.idniveau = n.idniveau works perfectly javax.persistence.persistenceexception: exception [eclipselink-4002] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.databaseexception internal exception: com.microsoft.sqlserver.jdbc.sqlserverexception: cannot call methods on int. error code: 258 call: select t0.id_etu, t0.nom_etu, t0.prenom_etu, t0.ddn_etu gestion_des_notes.dbo.etudiant t0, gestion_des_notes.dbo.niveau t2, gestion_des_notes.dbo.inscrireclasse t1 ((t1.id_niveau = t2.id_niveau.t2.id_niveau) , (t2.nom_niveau = ?)) bind => [1 parameter bound] query: reportquery(referenceclass=etudiant sql="select t0.id_etu, ...

operating system - Reading memory in memory-protected OS -

modern operating systems , cpu hardware provide memory protection prevent processes accessing memory other allocated process. given this, how 1 write utility windows' resource manager reports how memory free, in use, reserved, etc.; or basic memory dump utility , like? way on such systems through making such program part of operating system kernel privileges? there operating system apis can allow access process' memory. if use these, memory-reading program still needs privileges. going through os way find out contents of memory , cpu registers? is situation similar disk monitoring programs? memory bunch of individual labeled memory locations, either 1 or 0, high or low, on or off. these bits. takes amount of current use these bits, turning them on or off, maybe possible read how current memory using, find minimums , maximums set benchmarks, , see memory usage how current varies. it quite task software. on kernel level or upstream of that. with disk mon...

mysql - Order column by the last letter in the records -

i have table named seat contains following records : +----+------+ | id | seat | +----+------+ | 1 | 1a | +----+------+ | 2 | 1b | +----+------+ | 3 | 2a | +----+------+ | 4 | 2b | +----+------+ | 5 | 3a | +----+------+ | 6 | 3b | +----+------+ | 7 | 4a | +----+------+ | 8 | 4b | +----+------+ | 9 | 10a | +----+------+ | 10 | 10b | +----+------+ | 11 | 11a | +----+------+ | 12 | 11b | +----+------+ | 13 | 12a | +----+------+ | 14 | 12b | +----+------+ i want order result based on last character of second column seat table shows : +----+------+ | id | seat | +----+------+ | 1 | 1a | +----+------+ | 3 | 2a | +----+------+ | 5 | 3a | +----+------+ | 7 | 4a | +----+------+ | 9 | 10a | +----+------+ | 11 | 11a | +----+------+ | 13 | 12a | +----+------+ | 2 | 1b | +----+------+ | 4 | 2b | +----+------+ | 6 | 3b | +----+------+ | 8 | 4b | +----+------+ | 10 | 10b | +--...

asp.net mvc 5 - how to create a folder with user name or email? -

i've tried make folder whenever registered system don't know how create name of user name or user email help? this should you're looking for string directorypath = server.mappath(string.format("~/{0}/", txtfoldername.text.trim())); if (!directory.exists(directorypath)) { directory.createdirectory(directorypath); }

pointers - Java Object assignment when passing to a method -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 74 answers i have following class test{ public inner x; public static void main(string[] args){ test t = new test(); t.bar(t.x); } public test(){ x = new inner(); system.out.println("x = "+x.val); } public void bar(inner a){ x.val = 2; system.out.println("a = "+a.val); = new inner(5); system.out.println("a = "+a.val); system.out.println("x = "+this.x.val); } class inner{ public int val; public inner(){val=0;} public inner(int i){val=i;} } } i concerned why program tells me class's inner object , passed-in object same, when change passed object new one, not same. thought java passed pointers, , changing poi...

python - Place the data with respect to its variable (column) -

customerid cs_cookie cs_referer cs_host sc_status sc_substatus sc_win32_status sc_bytes cs_bytes 1 kommarajula http rewardcenter 200 0 0 3189 2767 62 2 kommarajula http rewardcenter 200 0 0 61828 2767 156 2 kommarajula http rewardcenter 200 0 0 3445 2750 62 3 kommarajula http rewardcenter 200 0 0 19738 2782 78 4 kommarajula http rewardcenter 200 0 0 19738 2781 78 5 kommarajula v1:1 rewardcenter 200 0 0 51396 2253 374 6 kommarajula v1:1 rewardcenter 200 0 0 2357 2201 124 7 kommarajula v1:1 rewardcenter 200 0 ...

ipc - Using the open function in named pipes -

i have 2 process. 1 first read write. other 1 first write read. , want implement using 2 pipes. here implementations /***read before write*****/ #include <fcntl.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> #define max_buf 1024 int main() { int fd,fd1; char buf[max_buf]; char * myfifo = "/home/aditya/desktop/myfifo"; char * mynewfifo = "/home/aditya/desktop/mynewfifo"; mkfifo(mynewfifo, 0666); printf("read before writing\n"); printf("before opening\n"); fd = open(myfifo, o_rdonly); fd1 = open(mynewfifo, o_wronly); printf("after opening\n"); read(fd, buf, max_buf); printf("received: %s\n", buf); close(fd); printf("reader writing\n"); write(fd1, "hi", sizeof("hi")); close(fd1); unlink(mynewfifo); return 0; } /**** wriiting after reading ******/ #include <fcntl.h> #include <stdio.h> #in...

tiles - org.xml.sax.SAXParseException: Attribute "controllerClass" must be declared for element type "definition" -

while starting 8.5 server publishing application, i'm getting below error: [3/17/16 14:29:50:216 ist] 0000004c digester e org.apache.commons.digester.digester error parse error @ line 99 column 169: attribute "controllerclass" must declared element type "definition". org.xml.sax.saxparseexception: attribute "controllerclass" must declared element type "definition". @ org.apache.xerces.util.errorhandlerwrapper.createsaxparseexception(unknown source) @ org.apache.xerces.util.errorhandlerwrapper.error(unknown source) @ org.apache.xerces.impl.xmlerrorreporter.reporterror(unknown source) @ org.apache.xerces.impl.xmlerrorreporter.reporterror(unknown source) @ org.apache.xerces.impl.dtd.xmldtdvalidator.adddtddefaultattrsandvalidate(unknown source) @ org.apache.xerces.impl.dtd.xmldtdvalidator.handlestartelement(unknown source) @ org.apache.xerces.impl.dtd.xmldtdvalidator.startele...

Unknown error executing command (empty document returned), when executing aggregate in mongodb using php -

i want group in mongodb: code below: $m = new mongoclient("localhost"); $c = $m->selectdb("grl_db")->selectcollection("user_tbl"); $data = array ( 'title' => 'this title', 'author' => 'bob', 'posted' => new mongodate, 'pageviews' => 5, 'tags' => array ( 'fun', 'good', 'fun' ), 'comments' => array ( array ( 'author' => 'joe', 'text' => 'this cool', ), array ( 'author' => 'sam', 'text' => 'this bad', ), ), 'other' =>array ( 'foo' => 5, ), ); $d = $c->insert($data, array("w" => 1)); $ops = array( array( '$project' => array( "author" => 1, "tags" => 1, )...

Equal height for parallel list items using CSS -

i have situation click here according text length, buttons height changes. when want parallel button height made equal of first 1 (not of buttons of parallel button). i approach in 1 of 2 ways - either using jquery ( fiddle - notice need wrap each button pair in own ul - if don't jquery more complicated) or cheating , dropping in background image gives effect of you're after - done, again, wrapping each button pair in own ul , dropping in background image containing vertical lines wrap them - 'cap off' each column adding starting , finishing li elements graphical end caps. i understand want go css only, can't think of way done. there may involving careful balancing of max-height, min-height, , height... can't think of how work @ moment.

GET and POST request through curl -

is possible send , post request using curl through linux terminal? essentially, i'm trying understand these guys doing in tutorial don't understand how add additional parameters tutorial's example. for instance, in tutorial ( http://valeriobasile.github.io/candcapi/ ), use example of: curl -d 'every man loves woman' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=fol' it works want graphical representation of this. mention in example here . "an entry point generate png image... $candcapt/drg "the url accepts same parameter pipeline." so tried send doesn't png file: curl -d 'every man loves woman&pipeline' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=drs&roles=verbnet' this breaks system. curl -d 'every man loves woman' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=drs&roles=verbnet%20%@...

What is the correct way to install Perl Catalyst to Debian -

i restarting use catalyst framework, running on debian jessie (currently 8.3.) have followed recommendation debian using install apt-get install: http://wiki.catalystframework.org/wiki/installingcatalyst but got catalyst version 5.90075. there lot of changes using unicode in later versions, want latest - 5.90103. have tried install command: cpan catalyst::runtime catalyst::devel catalyst updated, there errors when running catalyst server (errors update , listed @ end of question). i searching whether source.list apt has correct links - have not found link latest debian version. or not possible in current stable debian version , should go unstable debian version able use latest catalyst? errors when running catalyst: caught exception in myapp::controller::login->index "can\'t locate object method "has_args_constraints" via package "catalyst::action" @ /usr/local/share/perl/5.20.2/catalyst.pm line 1632." after comment lines met...

uinavigationcontroller - Embedding a navigation controller in a container - Objective C -

how embed navigation controller in container view? when place container first shows viewcontroller embed container, want change viewcontroller navigation view , set rootviewcontroller , other views basically add viewcontroller uinavigationcontroller , set uinavigationcontroller rootviewcontroller. hope helps: viewcontroller *vc = [[viewcontroller alloc] init]; uinavigationcontroller *nvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:vc]; self.window.rootviewcontroller = nvc;

python - Functional start and stop button in a GUI using pyqt or pyside for real time data acquisition using pyqtgraph -

i implementing program using scrollingplots example provided pyqtgraph here https://github.com/skycaptain/gazetrack/blob/master/gui/pyqtgraph/examples/scrollingplots.py import pyqtgraph pg pyqtgraph.qt import qtcore, qtgui import numpy np win = pg.graphicswindow() win.setwindowtitle('pyqtgraph example: scrolling plots') win.nextrow() p3 = win.addplot() p4 = win.addplot() # use automatic downsampling , clipping reduce drawing load p3.setdownsampling(mode='peak') p4.setdownsampling(mode='peak') p3.setcliptoview(true) p4.setcliptoview(true) p3.setrange(xrange=[-100, 0]) p3.setlimits(xmax=0) curve3 = p3.plot() curve4 = p4.plot() data3 = np.empty(100) ptr3 = 0 def update2(): global data3, ptr3 data3[ptr3] = np.random.normal() ptr3 += 1 if ptr3 >= data3.shape[0]: tmp = data3 data3 = np.empty(data3.shape[0] * 2) data3[:tmp.shape[0]] = tmp curve3.setdata(data3[:ptr3]) curve3.setpos(-ptr3, 0) curve4.setdata(...

ldap - Create Root domain in OpenLDAP through command line -

i trying create second root domain in openldap. want accomplish through command line. understand have edit slapd.conf file , add following second domain: database bdb suffix "dc=newdomain,dc=com" rootdn "cn=manager,dc=mydomain,dc=com" rootpw secret directory <path_to_preexisting_directory> after this, restarted server, domain doesn't seem added neither can connect nor can execute commands such ldapadd, ldapsearch etc. what can create domain? according openldap quick start guide #8 don't have change ldap.conf, have create auxilliary .ldif-file , perform ldapadd upon it: #example .ldif-file domain example.com dn: olcdatabase=bdb,cn=config objectclass: olcdatabaseconfig objectclass: olcmdbconfig olcdatabase: bdb olcdbmaxsize: 1073741824 olcsuffix: dc=example,dc=com olcrootdn: cn=manager,dc=example,dc=com olcrootpw: secret olcdbdirectory: /usr/local/var/openldap-data olcdbindex: objectclass eq call it, exampl...

PHP how to get the second number present in a string -

second number present in string. maybe have better ideas mine. from example: 1 pln = 0.07 gold i "0.07" string. obtain web scraping returns me string. the problem have following. "second number in string" might ".", without it, might composed 1 number ex. "1", or 2 "12", might have decimals ex. "1.2", position may change, because currency have "1 pln", "1 usd" others have "1 tw". so can't work on position, can't extract numbers (i have "1" @ beginning of string), can't extract int cause have decimals... so constant of string - think (but if have better ideas pls suggest me) - need second number find in string. how it? sorry if wasn't enough clear. try this: <?php $string = '1 pln = 0.07 gold'; $pattern = '/\d+\.\d+/'; $matches = array(); $r = preg_match($pattern, $string, $matches); var_dump($matches); //$matches array re...

javascript - Undeclared variable receiving a function in a Angular service -

i'm getting started angular js , i'm working on tutorial found on internet : http://www.sitepoint.com/user-authenication-mean-stack/ in service there 3 undeclared variables receiving function , don't understand syntax despite researches. code : register = function(user) { return $http.post('/api/register', user).success(function(data){ savetoken(data.token); }); }; the code whole service: (function () { angular .module('meanapp') // service qui dépend de ce module ? .service('authentication', authentication); // $inject : allow minifiers rename function parameters , still able inject right services, function needs annotated $inject property. $inject property array of service names inject. // https://docs.angularjs.org/guide/di authentication.$inject = ['$http', '$window']; function authentication ($http, $window) { var savetoken = function (token) { $window.localstorage['mean...

javascript - Chrome - Offline Pages -

i'm taking course online has terrible gui setup. sifting through material, online, incredibly slow , annoying. what want create directory saved , pre-loaded. remember used able in older browsers, option called 'save offline viewing' can't find such option in chrome. how can pre-loaded access of course content, own organization structure, using chrome (or other method). each 'page' contains images, video text. the player seems coming chrome, , there 'save video option'; extension mp4. i'm not fantastic html or javascript, way set unbearable i'm open more complex solution if need be. comment more information. settings -> "more tools" -> save page as

python - Load static files for all templates in django -

is there way in django not need {% load static %} @ top of every template? this question indicates can factor out common load tags settings, doesn't give particulars need in case. as of django 1.9, can add following template settings: 'builtins': ['django.contrib.staticfiles.templatetags.staticfiles'] for example, whole template setting might this: templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [], 'app_dirs': true, 'options': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'builtins': [ 'django....

Connecting to remote mysql works in terminal, not via PHP PDO script -

i facing weird problem here have server app files stored , b server database tried connect via command prompt server b using command mysql -h xx.xx.xx.xx -u root -p password - , worked now tried create php script in server connect server b command $this->db=new pdo('mysql:host=xx.xx.xx.xx;dbname=databasename','root','password'); connection failed: sqlstate[hy000] [2003] can't connect mysql server on 'xx.xx.xx.xx' (13) fatal error: uncaught exception 'exception' message 'sqlstate[hy000] [2003] can't connect mysql server on 'xx.xx.xx.xx' (13)' unable find solution on this. can on this? thank you i got working running command in database server :) setsebool httpd_can_network_connect_db=1 thanks replies yycdev

Android point direction with 2 locations -

i'm coding application on android , need point direction, explaination, have position fixed , position of smartphone (the 2 in longitude latitude) , want point arrow direction between two. searched hell, have compass works , tried change pointing direction changing north direction getrotationmatrix stuff after loosing brain trying don't know xd yeah need ideas , hints. here's code in case (i past onsensorchanged func rest basic initialisations) @override public void onsensorchanged(sensorevent event) { if (event.sensor == maccelerometer) { system.arraycopy(event.values, 0, mlastaccelerometer, 0, event.values.length); mlastaccelerometerset = true; } else if (event.sensor == mmagnetometer) { system.arraycopy(event.values, 0, mlastmagnetometer, 0, event.values.length); mlastmagnetometerset = true; } if (mlastaccelerometerset && mlastmagnetometerset) { sensormanager.getrotationmatrix(mr, null, mlastacceler...