Posts

Showing posts from January, 2013

Object I/O Stream java android -

i want print object file when app onstop , read @ oncreate. when close app , reopen object not there. objects acts ok while navigating trough app, problem on restart. the object instance ("tl") of tlist class - extends arraylist read: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); fileinputstream fis; try { fis = openfileinput("data_t"); objectinputstream ois = new objectinputstream(fis); tl = (tlist)ois.readobject(); ois.close(); } catch (filenotfoundexception e) { e.printstacktrace(); }catch(ioexception e){ e.printstacktrace(); } catch (classnotfoundexception e) { e.printstacktrace(); } write: @override protected void onstop() { super.onstop(); fileoutputstream fos; try { fos = openfileoutput("data_t", context.mode_private); o

Simple Error handling in Excel VBA -

i need simple error handling code small macro, have search web have nothing simple, seems complicated. i down load sales reports in .txt form on weekly basis, run separate macro stuff , add master page. not every week sales reports download there may not have been sales particular region. i need simple error handler if not find report, moves next sub. any appreciated sub mxm_pos() workbooks.opentext filename:="c:\users\903270\documents\excel\mxmpos*.txt" ‘run macro code run ("dlk_pos") end sub here simple basic structure can expand on needed: sub mxm_pos() on error goto errhandler ' code here exitsub: ' shutdown code here exit sub errhandler: if err.number <> 0 dim mbr vbmsgboxresult mbr = msgbox( _ "error #" & err.number & ": " & err.description & vbnewline & _ "would continue?", vbexclamation or vbyes

CSS only lightbox- Click to close & zoom -

i'm trying create versitile (for mobile, desktops , tablets) lightbox pop-up. i'm inputting through gravityforms, link can html. this code works- it's little messy. has gallery, , text, i've achieved already. i'm using wordpress 4.0 if there's better plugin solution i'm open it. a nice transition when opening resize fit mobile/smaller screens click background close there multiple galleries on 1 page . my code far #gallery .item { overflow: hidden; } #gallery .item img { height: 100%; align-self: center; } .lightbox { /** hide lightbox */ display: none; /** apply basic lightbox styling */ position: fixed; z-index: 9999; width: 100%; height: 100%; top: 0; left: 0; color:#333333; } .lightbox:target { /** show lightbox when target */ display: block; outline: none; } .lightbox .box { width: -webkit-min-content; width: -moz-min-content; width: mi

typeerror - Why do I keep getting: 'int' object is not callable in Python? -

x = 4 y = 5 = 3(x + y) print(a) i keep trying solve that. i've tried this. x = input("enter value x:") enter value x:4 y = input("enter value y:") enter value y:5 a = 3 x + y what doing wrong? i suspect want 3(x + y) acted upon in algebra, multiply result of x + y 3. need use multiplication operator * : a = 3 * (x + y) python take parentheses after token function call per f(x + y) , , since 3 not function, told not "callable" (meaning function, or can treat function).

ruby on rails - undefined local variable or method <object> for #<Class:0x55ebe50> -

i have problems polymorphic in rails. i have files: class createexecutions < activerecord::migration def change create_table :executions |t| t.integer :player_space_id t.integer :what_id t.references :what, polymorphic: true t.integer :qty t.integer :level t.datetime :when_ready t.timestamps end end end class execution < activerecord::base belongs_to :what, :polymorphic => true end class element < activerecord::base belongs_to :game_space has_many :levels has_many :player_elements has_many :executions, :as => end class playerspace < activerecord::base belongs_to :game_space belongs_to :user has_many :executions, as: :what end and when run controller has element, have error: nameerror in playerspacescontroller#show undefined local variable or method `what' # may me you have slight typo in element class: change this: class element < act

html - Is there anything I can do to force an element onto the second column? -

Image
as seen in picture above, have textarea, notes, , preview of current note. want do, force preview note onto second column, placeholder note located. cannot think of way current implementation, using css columns. .notes { // .notes container notes column-gap: 12px; column-fill: balance; column-count: 5; } my html looks following <div class="notes"> <div class="editor">...</div> <div class="previewnote">...</div> <div class="note">...</div> <div class="note">...</div> ... </div> i intentionally left out unrelated parts of css , html personally use normal css , float elements. div.notes div { width:50%; padding:0; margin:0; float:left; } and manually set ones want on right using float:right; div.notes .previewnote { float:right; } sections display based first on whether floated right or left, , based on in html f

Search for a table in multiple schema or databases -

i have few database names, , each database has many schema, 1. how can search table among database names, or among schema...any gui or commands ? what rdbms ? if oracle try this: "schemaname.tablename" if mssql try "schemaname.databasename.tablename"

r - Transform data by-group -

Image
i want know if possible apply ggplot2 transformations (of data) after grouping has been performed. example: here qqplot of iris species: ggplot(iris, aes(sample=sepal.width, col=species)) + stat_qq() + ggtitle('qqnorm of sepal width') i want transform sepal.width s (x - mean(x))/sd(x) : normalize = function (x) (x - mean(x))/sd(x) ggplot(iris, aes(sample=normalize(sepal.width), col=species)) + stat_qq() + ggtitle('qqnorm of sepal width, normalized globally') note has used global mean/sd in normalizing, not per-group mean/sd (same happens if write aes(sample=(sepal.width - mean(sepal.width))/sd(sepal.width)) rather hiding away in normalize . question : there way apply normalize within each group (species)? i can ddply , wondered if there elegant way apply affine transformation data in ggplot call, transformation parameters per-group. ggplot(ddply(iris, .(species), mutate, y=normalize(sepal.width)), aes(sample=y

How can I set limits on how many characters can be inputted? (Java) -

do{ out.println("\n---------------------------------"); out.println("---------------------------------"); out.print("please type acces card number: "); try{ card = input.nextint(); if(card.length != 10){ out.println("the number typed incorrect"); out.println("the number must 10 numbers long"); continue; } } catch(inputmismatchexception ex){ } }while(true); im trying make card 10 characters long. (1234567890), , if user inputs (123) or (123456789098723) error message should appear. card.length doesnt seem work. just change int string string card = input.next(); if(card.length() != 10){ //do } you can convert int later int value = integer.parseint(card);

unity3d - Weird position bug in Unity 4.6 for prefab gameobject as child of Canvas -

i putting prefab (basically image) onto canvas @ "0,0,0" in script (for debug sake). when press play in editor, carried out gameobject end @ "-3.051758e-05,-280,0" i.e. way off 0,0,0. cause this? the canvas child of root canvas , set max out size in order big parent. using unity 4.6. update: not 100% sure yet when setting position using somegameobject.localposition = somevector positioning seems work. transform.localposition sets position relative parents position whereas transform.position sets position in worldspace. if take @ canvas in scene view see bottom left corner of canvas @ 0, 0, 0 in worldspace, 0, 0, 0 of canvas in center. since have instantiate gameobject first , make child afterwards, it's position in worldspace 0, 0, 0 , it's position in inspector position relative parents position , therefor not 0, 0, 0 since canvas doesn't sit 0, 0, 0 . setting child localposition after instantiating position way want relative

c# - FieldInfo returning null on Component -

this question has answer here: addeventhandler using reflection 3 answers i'm trying list of events of bindingsource , returning null code: // bs bindingsource propertyinfo propertyinfo = bs.gettype() .getproperty("events", bindingflags.nonpublic | bindingflags.static | bindingflags.instance | bindingflags.flattenhierarchy); eventhandlerlist eventhandlerlist = propertyinfo .getvalue(bs, new object[] { }) eventhandlerlist; // following line returns null fieldinfo fieldinfo = typeof(bindingsource) .getfield("addingnew", bindingflags.instance | bindingflags.flattenhierarchy | bindingflags.instance | bindingflags.public | bindingflags.nonpublic); i put possible bindingflags error persists. doing wrong? found better answer duplicate addeventhandler using reflection - use type.getevent . addingnew

osx - .app is no longer openable on OS X after copy with python -

i have python application supposed copy .app on os x new place, run it. sha1 checksum on file before , after copy ensure copy without error, , checksum checks out. can think of reason why be? did ensure file permissions open chmod 777 on copied .app, doesn't fix it. this core of copy function in python. pulled somewhere else edited: def copy_directory_recursive(self, srcpath, dstpath): dirandfilelist = os.listdir(srcpath) dirlist = [] filelist = [] in dirandfilelist: if os.path.isdir(os.path.join(srcpath, i)): dirlist.append(i) elif os.path.isfile(os.path.join(srcpath, i)): filelist.append(i) dirlist.sort() filelist.sort() directory in dirlist: # if qitem.hascancelled(): #if user has cancelled copy, quit # break os.mkdir(os.path.join(dstpath, directory)) newsrc = os.path.join(srcpath, directory) newdst = os.path.join(dstpath, directory) # call move newl

javascript - Highcharts PDF download with more categories -

i have 50 charts comprised of basic column , basic bar charts. user can download required charts pdf conditions. @ time time of downloading these charts pdf have common method call executed report types. consider categories on each type of charts generate customized pdf size customizing options sourcewidth , sourcehight. 1 potential problem face when there huge number of categories on axis. assume, have basic bar graph more categories on axis , want see of them on downloaded chart(assume in 1000 categories). can increase soucehight value , required chart case. but, have basic column charts have categories on opponent axis basic bar chart. let assume, have datetimehour values on axis period of 2 years , have bars located @ particular hour on these 2 years span and, have 20000 categories on axis(because of datetimehour) on downloaded chart @ least want see bars on downlaoded chart instead of datehours on axis , more in case increase soursewidth accommodate more values in downloaded p

events - Find when Javascript is paused (hard to summarize) -

this question has answer here: start calling js function when pc wakeup sleep mode 1 answer can desktop browsers detect when computer resumes sleep? 3 answers i'm making little game out of javascript, , i'm little stuck. game 1 of virtual pets, have feed , stuff pet. now, have hunger system made every 3 seconds pet gets little more hungry. thing is, when close laptop, javascript isn't running. i'm doing getting date of last save , getting difference of current date when open laptop. however, have no way of triggering above. need event recognizes when page comes next time. if still don't understand i'm trying say, here's example: open page , close laptop. javascript has stopped. 30 minutes later, open , alert how long i've been gone. event can

Get element by cssSelector in Selenium (Java) -

<html> <body> <div id="login-box" class="form-box"> <form id="frmlogin" class="form" name="frmlogin" method="post"> <div class="body"> <div class="form-group"> <input id="email" class="form-control" type="text" maxlength="50" value="dfsf@gmail.com" placeholder="email" name="email"> <span class="red">please provide valid email address</span> </div> <div class="form-group"> <input class="form-control" type="password" maxlength="15" placeholder="password" name="password"> <span class="r

java - Operand Missing Variable -

int curfreeframe = frametableentry numfreeframes(); the error states "error ';' expected". everything initialized correctly in methods. if mean invoke static method, should : int curfreeframe = frametableentry.numfreeframes(); this assumes numfreeframes static method in frametableentry class (which assumption based entirely on naming conventions used).

r - Group function by two variables on data.table -

my data looks this students<-data.table(studid=c(1:6) ,faculty= c("it","science", "law","it","it","it"), sex=c("male","male","male","female","female","male"), wam=c(65,35,98,55,20,80)) studid faculty sex ave_mark (wam) 1 male 65 2 science male 35 3 law male 98 4 female 55 5 female 20 6 male 80 i have used following code calculate averages degrees[, mean(wam, na.rm=t),by=faculty][order(-v1)] so headings are faculty vi 65 law 50 etc any advice on how appreciated. i break sex also faculty vi vi male female 65 11 law 50 11 you try dcast.data.table(students, faculty~sex, fun.aggregate=mean, na.rm=true, value.var=&#

ios - Can we set different flowlayout in different sections within a UICollectionView? -

here picture explanation http://childhoodgamedev.qiniudn.com/xincheng_demo.png question description in section 0, flowlayout common, grid, in section 1, flowlayout circular (they in uicollectionview). the target with users' scrolling, first part grid flowlayout, second part custom , more complex flowlayout. can implement this? if not, 1 ideas? thanks. it looks childhoodandy solved problem, future readers candidate uipageviewcontroller using uipageviewcontrollertransitionstylescroll . each page own uicollectionviewcontroller whatever custom layout needed.

android - rotate string from back to front each character -

please help, i have string 7865, how rotate string 5687. whether using loop or call method lastindexof ? thanks help. use stringbuffer reverse string. string string="5678"; string reverse = new stringbuffer(string). reverse().tostring(); system.out.println("\nstring before reverse: "+string); system.out.println("string after reverse: "+reverse);

javascript - Disable\Enable Bootbox button with KO -

i'm using bootbox confirm dialog custom message template bound ko observables. wish compute obsrvables content , enable "ok" confirm button when computed returns true. at moment have js: self.name = ko.obsevable(): var messagetemplate = $("#add-template").html(); ko.applybindings(self, messagetemplate); bootbox.confirm({ title: "add new", message: messagetemplate, callback: function (value) { // } } } and html: <div id="add-template" style="display:none"> <form role="form"> <div class="row"> <div class="col-xs-8"> <div class="form-group"> <input data-bind='value: name, valueupdate: "afterkeydown"' placeholder="name"> </div

Shiro.ini file configuration but in Java class? -

i want know if possible configure shiro without shiro.ini file, mean, instead of using ini file, if need make shiro config hardcoded in java class? yes possible. documentation says how it: http://shiro.apache.org/configuration.html#configuration-programmaticconfiguration

why does db.collection.findOne() return less information than db.collection.find[1] in mongodb -

why db.collection.findone() return less information db.collection.find[1] in mongodb i think return 1 document in mongodb, when run commands there info missing using findone method you should use db.collection.find()[1] if using db.collection.find (without parentheses) return what function doing sample output db.collection.find (without parentheses). function (query, fields, limit, skip, batchsize, options) { var cursor = new dbquery(this._mongo, this._db, this, this._fullname, this._massageobject(query), fields, limit, skip, batchsize, options || this.getqueryoptions()); var connobj = this.getmongo(); var readprefmode = connobj.getreadprefmode(); if (readprefmode != null) { cursor.readpref(readprefmode, connobj.getreadpreftagset()); } return cursor; }

javascript - How open youtube video manually with fancybox -

i building angularjs webapp , want open youtube video calling method of constructor. achieve that; want reproduce same behavior as $(document).ready(function() { $('.fancybox-media') .attr('rel', 'media-gallery') .fancybox({ openeffect : 'fade', closeeffect : 'fade', padding: 0, helpers : { media : {}, buttons : {} } }); }); but using manual way, $.fancybox.open([ ... ]) . can guide me on how it? $.fancybox.open({ content: '<iframe width="xxx" height="xxx" src="//www.youtube.com/embed/xxxxxxxx" frameborder="0" allowfullscreen></iframe>' });

go - cannot use temp (type interface {}) as type []string in argument to equalStringArray: need type assertion -

i'm trying pass string array method. although passes assertion, i'm getting error cannot use temp (type interface {}) type []string in argument equalstringarray: need type assertion code: if str, ok := temp.([]string); ok { if !equalstringarray(temp, someotherstringarray) { // } else { // else } } i've tried checking type reflect.typeof(temp) , that's printing []string you need use str, not temp see: https://play.golang.org/p/t9aur98ks6 package main func equalstringarray(a, b []string) bool { if len(a) != len(b) { return false } := 0; < len(a); i++ { if a[i] != b[i] { return false } } return true } func main() { someotherstringarray := []string{"a", "b"} var temp interface{} temp = []string{"a", "b"} if strarray, ok := temp.([]string); ok { if !equalstringarray(strarray, someotherstringarray) {

java - Recreate a binary matrix with least "XOR" operations -

this highschool-degree coding contest question while back. basic idea recreate painting of black , white rectangular xor operations, or that's called it. the problem let assume have painting trying recreate (represented binary matrix, 0 being black , 1 being white): 1 0 0 1 1 1 1 0 1 one way of recreating painting following operations: (0, 0) (2, 2) (1, 0) (2, 0) (1, 2) (1, 2) the operations in form of (xstart, ystart) (xend, yend) thus above operations following, if start all-black canvas: beginning: 0 0 0 0 0 0 0 0 0 after (0, 0) (2, 2) : 1 1 1 1 1 1 1 1 1 after (1, 0) (2, 0) : 1 0 0 1 1 1 1 1 1 after (1, 2) (1, 2) : 1 0 0 1 1 1 1 0 1 technicalities assignment: winner has least operations. one operation should in form of (xstart, ystart) (xend, yend) . there no time or space restraints. in assignment, painting trying recreate 200x200 in size, , generated 2000 random xor operations. my own i

excel vba - Set conditional formatting expression using VBA variables? -

i trying add conditional formatting range vba using following statement: r.formatconditions.add type:=xlexpression, formula1:="=and($ayq4<=d$3;$ayr4>=d$3)" now problem instead of having ayq, 4, d, 3 , ayr have following vba variables: ldatesandheadersrow = 3 first row of range r = 4 first column of range r = d lstartdatecol = column number of ayq lenddatecol = column number of ayr is there way me use vba variables instead of normal cell references in following expression formula1:="=and($ayq4<=d$3;$ayr4>=d$3)" ? no, cannot. variables exists in context of macro defined into, once copied in cell become strings.

java - Open source FTP client which is Block mode enabled -

i have send data legacy ftp server "mode block" , "struct record" or "mode b" , "sturct r" mandatory. is there open source ftp client on linux or programming library "mode block" , "struct record" functions enabled? (preferably ftp client on linux). looking @ javadoc apache commons ftp library, looks though constants exist functionality. http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/ftp.html http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/ftp.html#block_transfer_mode http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/ftp.html#record_structure

c++ - Do we need to consider encoding (UTF-8) while constructing a string from char* buffer -

i working on http client module receives information server in character buffer , utf-8 encoded. wanted create std::string object character buffer. can create string object directly passing character buffer ? std::string receivedstring(receievedbuffer,bufferlength); here receievedbuffer char[] array contains data received tcp/ip connection , bufferlength contains number of bytes received. confused term utf-8 , understood unicode encoding , need take steps before conversion. std::string receivedstring(receievedbuffer,bufferlength); it not conversion, copies receievedbuffer receivedstring . if receievedbuffer utf-8 encoded the exact same bytes stored receivedstring . std::string storage format , not reflect encoding of data stored in it.

c# - Accesing node from DevExpress.XtraTreeList.TreeList -

how access nodes devexpress.xtratreelist.treelist, tree having multiple nodes , multiple branches. finding position of node evoke click action or event. in application single tree data structure using. tried following lines of code achieve same. new uft testing tools. can me out? swfwindow("softwarename 5.0.209.32468").swfobject("navbarcontrol1") swfwindow("softwarename 5.0.209.32468").swflistview("navbarcontrol1").object swfwindow("softwarename 5.0.209.32468").swfobject("navbarcontrol1").object.controls platform: windows application. don't know how use those.

mysql - join two table folder and image -

album ------------------ aid | aname | ------------------ 1 | album1 | 2 | album2 | 3 | album3 | 4 | album4 | ------------------ image --------------------------------------- iid | title | albumid | imgurl --------------------------------------- 1 | img1 | 3 | image3.jpg 2 | img2 | 1 | image1.jpg 3 | img3 | 2 | image4.jpg 4 | img4 | 0 | image5.jpg --------------------------------------- i have 2 tables album , image. in image table albumid= 0 means image not belong folder. need imageurl folder names , count of images inside folder below table in mysql. example: ---------------------------------------------------------------- id=aid+iid | name= aname +title | imgurl | countimg ---------------------------------------------------------------- 1 | album1 | null | 1 2 | album2 | nul

recursion - Why does this Prolog code not run? -

i have written following code replace occurrences of given element in list, specified value. here's code: substitute(x, y, [], []). substitute(x, y, [x|t], [y|r]) :- substitute(x, y, t, r). substitute(x, y, [h|t], [h|r]) :- h\= x, substitute(x, y, t, r). i trying call in gnu prolog: substitute(2, 3, [2, 2, 2], []). which results in: no what wrong here? don't see wrong. comparing head of given list see if matches x. if matches, replace in output list y , recurse on tail. in second case, if head doesn't match x, recurse on tail , check if element of tail same x , recursion replaces per 2nd definition. @ end of tail, when empty list encountered, recursion moves base case , terminates. not sure, why not able run code. please.

e.preventDefault() prevents the kendo 'read' event but does not work for 'create' on update keypress in kendo popup editor -

transport: { parametermap: function (data, operation) { if (operation !== "read") { return json.stringify(data); } else { return (data); } }, read: { url: function () { return moduleserviceroot; }, type: "get", datatype: "json", async: true }, create: { url: function (rec) { return moduleserviceroot; }, type: "post", contenttype: 'application/json; charset=utf-8', datatype: "json", async: true }, complete: function (e) { $("#grid").data("kendogrid").datasource.read(); async: true

Hide Installed app icon in android -

i have scenario in have hide few installed apps icon did try best didn't problem think following code work root devices only. componentname componenttodisable = new componentname("com.androidbird.lmkt", "com.androidbird.lmkt.splashscreen"); getpackagemanager().setcomponentenabledsetting( componenttodisable, packagemanager.component_enabled_state_disabled, packagemanager.dont_kill_app); logcat: fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.androidbird.lmkt/com.androidbird.lmkt.splashscreen}: java.lang.securityexception: permission denial: attempt change component state pid=18338, uid=10165, package uid=10140 @ android.app.activitythread.performlaunchactivity(activitythread.java:2325) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2377) @ android.app.activitythread.access$600(activ

c++ - makefile for openGL cannot find -lSOIL -

i have couple hours experience glsl (opengl shading language) , i`ve found sample code, when tried run using makefile got following error : /usr/bin/ld: error: cannot find -lsoil /tmp/ccbamtaw.o:glinit.cpp:function inittextures(): error: undefined reference 'soil_load_image' /tmp/ccbamtaw.o:glinit.cpp:function inittextures(): error: undefined reference 'soil_load_image' /tmp/ccbamtaw.o:glinit.cpp:function inittextures(): error: undefined reference 'soil_load_ogl_single_cubemap' /tmp/ccbamtaw.o:glinit.cpp:function inittextures(): error: undefined reference 'result_string_pointer' collect2: ld returned 1 exit status make: *** [all] error 1 and here makefile : lib=-llib inc=-iinc src=sample.cpp glinit.cpp glentry.cpp utils.cpp dirs=lib/ inc/ res/ all: g++ $(src) $(lib) $(inc) -o sample -lgl -lglu -lglut -lsoil -lpthread dist: @tar -czvf sample.tar.gz $(dirs) $(src) makefile --exclude "*~" is there can tell me wrong makefile

java - Android Studio Gradle CreateProcess error=2 -

i m new in android studio. m using android studio 1.0 rc 2 build #ai-135.1611497 , jdk: 1.8.0_25. trying import project, , getting error. allready tried delete .gradle.. gradle setted use default gradle wrapper. idea solve it? 2014-12-02 10:52:19,643 [3351320] info - s.plugins.gradle.gradlemanager - instructing gradle use java c:\program files\java\jdk1.8.0_25\ 2014-12-02 10:52:19,647 [3351324] info - s.plugins.gradle.gradlemanager - instructing gradle use java c:\program files\java\jdk1.8.0_25\ 2014-12-02 10:52:19,649 [3351326] info - ls.idea.gradle.util.gradleutil - looking embedded maven repo @ 'c:\users\tomas\android-studio\gradle\m2repository' 2014-12-02 10:52:19,652 [3351329] info - .project.gradleexecutionhelper - passing command-line args gradle tooling api: [-pandroid.injected.build.model.only=true, -pandroid.injected.invoked.from.ide=true, --init-script, c:\users\tomas\appdata\local\temp\aslocalrepo4461828038903261980.gradle] 2014-12-02 10:52:21,77

Can't Install socket.io in Laravel Vagrant Homestead -

problem can't install socket.io in laravel vagrant homestead. bellow error thrown. command npm install socket.io error > ws@0.5.0 install /home/vagrant/code/dota2/nodejs/node_modules/socket.io/node_m odules/engine.io/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0) make: entering directory `/home/vagrant/code/dota2/nodejs/node_modules/socket.io /node_modules/engine.io/node_modules/ws/build' cxx(target) release/obj.target/bufferutil/src/bufferutil.o solink_module(target) release/obj.target/bufferutil.node solink_module(target) release/obj.target/bufferutil.node: finished copy release/bufferutil.node cxx(target) release/obj.target/validation/src/validation.o solink_module(target) release/obj.target/validation.node solink_module(target) release/obj.target/validation.node: finished copy release/validation.node make: leaving directory `/home/vagrant/code/dota2/node

android - Null Pointer exception passing data from activity to Fragment -

i have url value in mainactivity page , need pass url value activity fragment. when click button i'm getting null exception on line of string url=getarguments().getstring("btn_url"); activity: fragment fragment=new about(); if (fragment != null) { fragmenttransaction transaction = getfragmentmanager().begintransaction(); transaction.replace(r.id.frame_container, fragment, "tag_fragment"); transaction.addtobackstack(null); transaction.commit(); bundle bundle=new bundle(); bundle.putstring("btn_url", url); fragobj=new about(); fragobj.setarguments(bundle); } fragment: string url=getarguments().getstring("btn_url"); you need commit after set fragments arguments. change code this: about fragobj=new about(); bundle bundle=new bundle(); bundle.putstring("btn_url", url); fragobj.setarguments(bundle); getfragm

parsing - Making Attoparsec based parser more efficient -

i wrote simple text stl (standard tessellation library) parser using attoparsec. stl contains collection of facets. each facet contains normal, , vertices of triangle. typical stl file can large (~100 mb or more). stl file format is solid facet normal nx ny nz outer loop vertex x1 y1 z1 vertex x2 y2 z2 vertex x3 y3 z3 endfacet endsolid the parser code here. full implementation can found @ stlreader -- | point represents vertex of triangle data point = point !a !a !a deriving show -- | vector given class data vector = vector !a !a !a deriving show -- | parse coordinate triplet. coordinates :: (fractional a) => text -> (a -> -> -> b) -> parser b coordinates s f = skipspace string s !x <- coordinate !y <- coordinate !z <- coordinate return $! f x y z coordinate = skipwhile ishorizontalspace *> fmap realtofrac double {-# inline coordinates #-} type rawfacet = (vector a, point a, point a, point a) --

javascript - How to 'add watch' in Chrome developer tools? -

i can't seem find way add watch expression selected javascript text in chrome developer tools, same way in firebug ctrl+w. there no way in chrome? can't right-click selection unselects it, , there no "add watch" context menu item. have type in every watch want add while debugging js? you can clicking ' add watch ' after right clicking you can select expression/variable , hit ctrl + shift + a

ios - Access file with file : // url -

i have created application can upload locally saved files in amazon server i app have used nsurlsessionuploadtask upload files , but in here @try { task = [[self backgroundurlsession] uploadtaskwithrequest:request2 fromfile:url]; [task resume]; } @catch (nsexception *exception) { nslog(@"exception %@",exception); } i recieve , not valid url file://url exception , checked file url , /var/mobile/containers/data/application/7494df09-866a-4088-ac73-710a21a6569a/documents/xxxx/1417516256_event_138_footage_1209_cam_001.mp4 how can change url in file:// type, , meaning of file:// located

c# - Rx produce and consume on different threads -

i have tried simplify issue sample code here. have producer thread pumping in data , trying batch time delay between batches ui has time render it. result not expected, produce , consumer seems on same thread. i don't want batch buffer sleep on thread producing. tried subscribeon did not much. doing wrong here, how print different thread ids on producer , consumer thread. static void main(string[] args) { var stream = new replaysubject<int>(); task.factory.startnew(() => { int seed = 1; while (true) { console.writeline("thread {0} producing {1}", thread.currentthread.managedthreadid, seed); stream.onnext(seed); seed++; thread.sleep(timespan.frommilliseconds(500)); } }); stream.buffer(5).do(x => { console.writeline("thread {0} sleeping create time gap between batches", thread.currentthread.managedthr

ruby - Fastest way to find if an array contains any member of another array? -

i'm trying detect whether file, read in string, either: text (of type of single-byte encoding). a multi-byte encoding, or binary, etc. i have "blacklist" array of characters/bytes normally never occur in "text": bad_bytes = [0, 1, 2, 3, 4, 5, 6, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 127] and my_bytes = file.binread('some_file').bytes . i can think of: (my_bytes & bad_bytes).empty? , and my_bytes == (my_bytes - bad_bytes) both produce correct result, , intuition latter might little faster. or, maybe they're equivalent? both seem rather inefficient me, @ purpose. don't need find complete intersection, or remove each instance of second array first - finding one common element sufficient. am missing method exists this? there faster technique? if not, of above faster? or approaching wrong? also, bonus points: there math / computer science / fancy term i'm trying here?

html parser - Object moved this document may be found here php -

i'm redirecting web page url. works fine on localhost when host web server give me message says "object moved document may found here". don't know issue here code. foreach($html->find('a[class=btn btn-warning btn-block]') $element) $redic=$element->href; header("location: $redic"); please me should avoid error. thank you your path must not absolute! pathname starts root path , specifies directories between root path , specified directory or file.

javascript - Using jquery Ajax in Laravel 4 -

i newbie ajax jquery , trying understand code , trying implement it. let know want , doing. i have search box input "sku" , tables , information of particular sku. i have in routes.php route::get('bestsellers', array('as'=>'bestsellers', 'uses' =>'salesflatorderitemscontroller@index')); in controllers have class salesflatorderitemscontroller extends \basecontroller { $sku_query = input::get('sku'); if($sku_query){ $orders = salesflatorder::join('sales_flat_order_item i','sales_flat_order.entity_id','=','i.order_id') ->select((array(db::raw('date(i.created_at) days'), db::raw('sum(i.qty_ordered) qty_ordered'), db::raw('sum(i.row_total) row_total'),'i.item_id', 'i.name','i.sku'))) ->where('i.sku','=',$sku_query) ->gro

jquery - Unable to access JSON content after reading from a file -

i've spent hours , hours searching reading json file using js. closest tut found https://gist.github.com/zuch/6224600 . cells.json: { "cells": [ { "img": "img/singlestitch_thumb.jpg", "url": "http://www.google.com", "description": "an interactive 'kite' sketch based on favorite letter[requires java]", "smallwin": true }, { "img": "img/text3d_thumb2.jpg", "url": "http://www.yahoo.com", "description": "animated custom font design in 3d (featured on 'processing' site)[requires java]", "smallwin": true }, { "img": "img/jazzer_thumb.jpg", "url": "http://flickr.com", "description": "a 3d musician 'plays along' arbitrary audio tracks[req. javajsyn]", "s

PHP Date Formatting from MySQL Fatched Datetime -

this question has answer here: convert 1 date format in php 12 answers can please help? have searched many website (including stackoverflow) can't find exact answer. it may easy, need know. 2014-11-21 18:49:55 i need convert to 6:49 pm, 21th november, 2014 can me please? thanks in advance helping. this should work you: $date = "2014-11-21 18:49:55"; echo date('g:i a, ds f y', strtotime($date)); output: 6:49 pm, 21st november 2014

wordpress - enabling CORS on apache -

i trying enable cors not workign me. runnign centos 6.5 apache. aplication wordpress. have tried following. set header in template file set header in .htaccess http://enable-cors.org/server_apache.html header set access-control-allow-origin "*" restarted apache. still error: cross-origin request blocked: same origin policy disallows reading remote resource @ https://gateway.spectrumasa.com/dev/mcmap/test-geosml3.kmz. can fixed moving resource same domain or enabling cors. i trying create geoxml3 kml polygon tooltip on mouseover instead of click below code have on template. <!-- <script type="text/javascript" src="<?=get_site_url(); ?>/wp-content/themes/twentytwelve-child/js/geoxml3.js.1"></script> <script type="text/javascript" src="<?=get_site_url(); ?>/wp-content/themes/twentytwelve-child/js/projectedoverlay.js"></script>--> <script type="text/javascript"

c# - var not getting implicit value -

i came across code below: public void listcontrols(controlcollection controls, list<control> controlsfound) { foreach (var control in controls) { if (control iattributeaccessor) { controlsfound.add(control); //error (invalid argument add method) listcontrols(control.controls, controlsfound); } } } it gives error above: if change var in foreach control works. reason add method expecting control parameter. think var should have been implicitly replaced control , right? no, doesnt because controlcollection implements non-generic ienumerable not generic ienumerable<control> when enumerate without providing type, object

Environment variables in .git/config -

i have git repo created --serparate-git-dir option. use same repo form different working trees specifying --git-dir , --work-tree arguments. i have 2 working trees switch between added .git file in secondary work tree pointing repository directory. since repository's config file points primary working tree, still have specify explicitly, otherwise uses primary working tree. i tried setting value of worktree $pwd int .git/config file causes following error: fatal: not chdir '$pwd': no such file or directory is there way make worktree dynamic? edit 05-2016 @amynbe comments, git >= 2.5 has git-worktree https://git-scm.com/docs/git-worktree i have script on freenode passed around, i'm not sure of author know can share, used create different working copyes based on branches, think fit use case: #!/bin/sh usage () { echo "usage:" $@ exit 127 } die () { echo $@ exit 128 } if test $# -lt 2 || tes