Posts

Showing posts from April, 2012

php - Pulling random numbers from an array -

i'm working on "card game" in cards randomly dealt 4 suites 4 players. created 2 separate arrays, 1 13 cards, , 1 4 suites. below code have 1 player. arrays: <?php $suite=array("clubs", "diamonds", "hearts", "spades"); $random_suite=array_rand($suite, 4); ?> <?php $card=array("ace", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "jack", "queen", "king"); $random_card=array_rand($card,5); ?> if statements (don't believe problem exists here): <?php if (!is_numeric($_get['players'])) { echo "you did not enter value number of players; click 'return' button , enter number."; } elseif ($_get['players'] < 1) { echo "you entered number less 1 minimum allowed; click 'return' button enter number."; } elseif

python - Create a square with sides at any angle -

i trying create rotating turret. turret rotates correctly problem when make turret shoot space bar bullet isn't same size or shape @ every angle. tried using angle turret facing trig calculations , find 2 corner points needed create bullet (which circle). nothing have tried work. here code: barrel = [260,210,270,210,270,170,260,170] def rotatebarrel(): global angle anglechange = 2 mountcenterx = 265 mountcentery = 215 #rotate barrel cycle = 1 while cycle < len(barrel): x = barrel[cycle-1]-mountcenterx y = barrel[cycle]-mountcentery barrel[cycle-1] = (x*math.cos(anglechange*math.pi/180)-y*math.sin(anglechange*math.pi/180))+mountcenterx barrel[cycle] = (x*math.sin(anglechange*math.pi/180)+y*math.cos(anglechange*math.pi/180))+mountcentery cycle += 2 angle += anglechange if angle == 360: angle = 0 canvas.coords(barrel,barrel) self.after(1,rotatebarrel) def spinningshoot(event): global ang

mysql - Anonymous transactions get made even with GTID_MODE=ON -

i'm using mysql 5.7 gtid master-master replication , i'm experiencing strange error. randomly 1 of masters stop replicating with: "cannot replicate anonymous transaction when @@global.gtid_mode = on" when check there indeed anonymous entry in binlog, isn't clear how got there since other master has gtid_mode=on , should not allow anonymous transactions execute or make way in binlog. enforce_gtid_consistency on queries result in anonymous transaction should failing. it's ever single query/transaction. previous , next queries in binlog have gtid's. i ran same issue. first time saw when upgraded mysql 5.7.12. i don't have workaround/fix yet either. version of mysql on?

javascript - After add transform scale, I can't set the section to center -

if don't use javascript listen event of resize. method center div? the css structure contain 3 state. normal , under 900px, under 550px. when width on 550px. can set section center. when screen under 550px. used scale reduce size , unable set center. i tried change position fixed/relative, left/ float/transform-origin/translatex/use vw/margin/padding... must use javascript listen window resize , change left property css of section? my website on http://php-kkhchan.rhcloud.com css: @media screen , (max-width: 900px) { .box { width: 520px; height: 650px; } #tabs { width:520px ; height: 650px; position: static; margin: 0 auto; padding-top: 1em; } } @media screen , (max-width: 550px) { #tabs, .box { transform: scale(0.6,0.6); left: -14%; position: relative; } } html: <section id="tabs"> <article class="c_tab box" id="tab0&

iOS share sheet scale modification -

i'm writing app on ios 9.3. however, app's share sheet screen bigger other app's share sheet screen. there way modify share sheet screen iphone original icons size? following code: - (ibaction)onsharebuttonclick:(uibutton *)sender { nsstring *string = @"upload chart"; uiimage *uploadimage = [self.selectedcontroller performselector:@selector(getuploadimage)]; uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc] initwithactivityitems:@[string, uploadimage] applicationactivities:nil]; [self presentviewcontroller:activityvc animated:yes completion:nil];} as comment below, found getuploadimage getting part of screen. if modify code follow, share sheet "more more" instead. however, size of share icon same origin. uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc] initwithactivityitems:activityvc applicationactivities:nil]; because activityvc empty.

c++ - Finding where a handle is open to -

i'm messing around handles / hooks, , have question. right now, have dll inject process i'm playing with. dll hooks closehandle() function. when closehandle called, following: int winapi detourclosehandle(handle hobject) { outputdebugstringa("close hadnle"); char name[max_path]; getfinalpathnamebyhandle(hobject, name, max_path, file_name_normalized); outputdebugstringa(name); return oclosehandle(hobject); } my goal in figure out handle open to, , if handle open process, use handle read processes memory. gets printed out when closehandle called paths random files application reads, noticed random ascii characters being printed @ times, "name" of handle opened to. this can seen here. sometimes notice paths .exe files. not unusual, application i'm injecting read / @ binary files. question is, when see "name" returned getfinalpathnamebyhandle path exe file, how know if handle opened binary file itself, or if handle fi

Is there a JAVA API for extract MP4 Metadata -

i want specific asking. not asking modified mp4 files, extract metadata such width , height , bitrate , encoding , not in mp3 tags. i have tested xuggle works, need have library not use jni or native code. i looked mp4parser, , apache tika, , both not extract metadata, tag info or alter file. is there such java lib? i found looking using mp4parser here simple lines of code wanted using mp4parser filechannel fc = new fileinputstream("content/video_720p_madagascar-3.mp4").getchannel(); isofile isofile = new isofile(fc); moviebox moov = isofile.getmoviebox(); for(box b : moov.getboxes()) { system.out.println(b); } b contains info needed, have parse b want.

Node.JS Error in FreeBSD -

i develop node.js in ubuntu , deploy server running freebsd. when run npm start, got error error: shared object "libpthread.so.0" not found, required "bcrypt_lib.node" @ error (native) @ object.module._extensions..node (module.js:440:18) @ module.load (module.js:357:32) @ function.module._load (module.js:314:12) @ module.require (module.js:367:17) @ require (internal/module.js:16:19) i couldn't find solution. how fix it? the best way node.js on freebsd install (and npm ) packages. to install package, run pkg install www/node www/npm . install node , npm , prequisites. @ moment give node version 5.10 , npm 3.8.6.

c# Finding similar values in the database -

i created access database , connected c# code. in database, have 2 columns (ip , port). question how find same ip connects different value of port column. other words, want search if same ip connects many different ports. idea?!! thank you select ip tablename group ip having count(distinct port) > 1;

fortran90 - What does `A(::2,3) = -1.0` do in Fortran? -

i have matrix a declared real :: a(7,8) , intialised entries 0.0 . the following command not provide compiling errors. a(::2,3) = -1.0 i realise columns affected column 3. rows? ::2 mean rows 1 , 2 ? or else? i printed out matrix, couldn't understand pattern produced. here (for completeness): do, i=1,7 write(*, "(f5.2)") ( a(i,j), j=1,8 ) enddo 0.00 = 1 0.00 -1.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 3 0.00 -1.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 5 0.00 -1.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ---- 0.00 = 7 0.00 -1.00 0.00 0.00 0.00 0.00 0.00 looking @ now, looks starts @ i=1 , adds 2 i until reaches bounds of matrix. correct? does mean ::2 equivalent 1:7:2 ("from 1 7 step of 2)? looking @ documentation , see: print array-expressio

Why does creating objects with constructor execute object's method in javascript? -

suppose want have 3 objects of type room . 3 objects bedroom , livingroom , bathroom . room has 2 properties length , breadth , , 1 method myfunc . use constructor method create 3 required objects as: function room(len, bred, myfunc) { this.len = 5; this.bred = 8; this.myfunc = alert(); } var bedroom = new room(); var livingroom = new room(); var bathroom = new room(); the problem when run script myfunc gets executed 3 times displaying alert. thought since new keyword converts function object must not execute object's method -- typeof new room returns "object" . my question is: if statement new room(); converts copy of room() function object isn't equvalent object creation literal notation? if yes shouldn't var bedroom = new room(); assign properties of room object bedroom object? why execute objects method? how create objects without executing methods? alert function , alert() executes i

javascript - Countdown not working in some cases -

i'm using countdown script home page. loads @ first visit only. surf other web pages , come home page, it's not loading. i'm using meteor , react. componentdidmount () { $(window).load(() => { $('#clock').countdown('2016/9/9', function (event) { var $this = $(this).html(event.strftime('' + '<span>%m</span> months ' + '<span>%w</span> weeks ' + '<span>%d</span> days ' + '<span>%h</span> hr ' + '<span>%m</span> min ' + '<span>%s</span> sec')); }); }); } what's wrong code? it's not idea mixing react , jquery dom manipulation. in fact, doesn't make sense call $(window).load inside of componentdidmount because componentdidmount ensures react component loaded dom. here example of simple countdown timer using purely "reactive" approach. copi

Elasticsearch:Per shard per node VS Multiple shards per node? -

most article tells me,per shard per node best practices,but,if server has more 1 hard disk,and es create new index every day,then usage of disk have great difference. so,if create multiple shards(the number equals disks number) of node,then usage of disk balance? edit : here es configuration: path.data: /data1/es1,/data2/es1,/data3/es1 here id df -h shows: /dev/sdb1 733g 291g 405g 42% /data1 /dev/sdc1 733g 244g 453g 35% /data2 /dev/sdd1 733g 116m 696g 1% /data3 you still go single shard per node , use multiple disks. elasticsearch has config variable called path.data array accepts multiple locations, if define more 1 location (one per disk example) use both disks , benefit increased iops.

Linked list of structures in c -

i attempting create linked list has data points structure having trouble creating node. typedef struct n_data{ char name[16]; int integer; } data; typedef struct node{ data * data; struct node *next; } node; typedef struct{ int num; node *head; }root; i have function make node returns node has data points data structure: node *makenode(data *d){ node *temp; temp = (node*)malloc(sizeof(node)); if(temp != null){ temp->data= d; temp->next = null; } return temp; } and main looks this: int main(){ data* newdata=(data*)malloc(sizeof(data)); strcpy(newdata->name,"hello"); newdata->integer=7; node * temp; temp = make_node(newdata); } i getting error warning: assignment makes pointer integer without cast [enabled default] i not sure doing wrong can me this? there error in code change line temp = make_node(newdata); temp = makenode(newdata);

Mongodb sort by sum of keys -

i have json document { { "_id" : objectid("5715c4bbac530eb3018b456a"), "content_id" : "5715c4bbac530eb3018b4569", "views" : numberlong(200), "likes" : numberlong(100), "comments" : numberlong(0) }, { "_id" : objectid("5715c4bbac530eb3018b4568"), "content_id" : "5715c4bbac530eb3018b4567", "views" : numberlong(300), "likes" : numberlong(200), "comments" : numberlong(0) }, { "_id" : objectid("5715c502ac530ee5018b4956"), "content_id" : "5715c502ac530ee5018b4955", "views" : numberlong(500), "likes" : numberlong(0), "comments" : numberlong(200) } } how can sort document order sum("views", "likes", "comments") something in mys

javascript - JSON Object many errors. Help out -

Image
i have made json object , getting many errors. new json kindly help. posting here screenshots. appreciated. [![var data\[\]= {"cars": "honda":\[ {"model":"figo" }, {"model":"city"} \], "audi": \[ {"model":"a6"}, {"model":"a8"} \] } data.cars\['honda'\]\[0\].model data.cars\['honda'\]\[1\].model data.cars\['audi'\]\[0\].model ata.cars\['audi'\]\[1\].model (var make in data.cars) { (var = 0; < data.cars\[make\].length; i++) { var model = data.cars\[make\]\[i\].model; alert(make + ', ' + model); } }][1]][1] using jsonformatter , validator site checking code. since mentioned i totally novice json i explain completely. there little bit of syntax errors in way doing this. doing loop inside java

maven - Performance of Spring boot project when makes it installed -

i made 2 programs. 1 client program sends udp packet udp server , other server program receives udp packet udp client. udp server made spring boot. problem there difference of performance between run in sts(spring tools suite) , run jar(maven installed). when run program in sts(run as->spring boot app), gets packets client. if client sent 3,000 packets, gets 3,000 packet. when run jar(maven install), gets little of packets 200-300. it's same code. i don't know why occurs. there way build spring boot app or need option? whole code large. upload connect, send, bind code. this client program public udpclient(string[] args) { connector = new niodatagramconnector(); connector.sethandler(this); connectfuture connfuture = connector.connect(new inetsocketaddress( args[0], 6001)); connfuture.awaituninterruptibly(); if(args[1] != null) { totalcount = integer.parseint(args[1]); } if(args[2] != null) { count = int

regex search in Visual Studio 2015 -

i have specific pattern want search in visual studio 2015. basically, want search lines contains await , missing configureawait @ end of statement. i have patterns works in regex-testers such regex101.com, can't these patterns work in visual studio search. (for example pattern (?s)^(.)*(await)((?!configureawait).)*(.)?(;) .) what doing wrong? edit - want find lines in project such as await dosomecoolthings(x, y); (i.e. missing configureawait(...) .) but don't want mach lines such as: await dosomecoolthings(x, y).configureawait(false); if order of await , configureawait not matter, can use (?=.*\bawait\b)(?!.*\bconfigureawait\b) otherwise, if consider configureawait should come after await , can use (?=.*\bawait\b(?!.*\bconfigureawait\b)) efficient solution (?=\bawait\b(?!.*\bconfigureawait\b))

user interface - not getting data from SQL to JTable in Java -

i'm trying data database. when program getting data resultset , doesn't seem getting , @ end data[][] null . when debugging, noticed result r currentrow -1 throughout while loop , isn't changing. don't know how fix this. appreciated! the code : //get information table public void view(string table, connection conn) { try { preparedstatement statement = conn.preparestatement("select * " + table + " name '%" + name + "%';"); resultset r = statement.executequery(); data = new string[rows][column]; int j = 0; resultsetmetadata info = (resultsetmetadata)r.getmetadata(); x = new string[column]; for(int = 0; < column; i++) x[i] = info.getcolumnname(i + 1); r.beforefirst(); while(r.next()) { for(int = 0; < column; i++) data[j][i] = r.getstring(x[i]); j++; } } catch(exception

Remove all characters after a comma with jQuery -

i remove characters after "," in string using jquery, targeting class of element. other solutions found using javascript, targeting string instead of class. my code is: <td class="priceinfo">€779,34&nbsp;</td> how remove characters after "," in text of td element? you can use jquery's text() method achieve this: $('.priceinfo').text(function(i, t) { return t.substr(0, t.lastindexof(',')); }); working example

c# - Why is the imageview returning null or not retrieving the selected photo from gallery? (Xamarin VS 2015 Android) -

this stressing me out day because cannot seem figure out why image isn't showing after select image gallery (of android phone). gives me full blank photo without actual image although tools (button, textview, etc.) below image move down. based code here selecting gallery image , in other threads still gives me null. here codes: androidmanifest.xml <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-permission android:name="android.permission.camera" android:required="false"/> main.axml <imageview p1:src="@android:drawable/ic_menu_gallery" p1:layout_

javascript - Pause youtube video when slide the next item -

i using bootstrap slider on page. need pause playing video when slider moves next one. tried using youtube callback doesnt seems working, may way of applying not right. here have used jquery(function ($) { $('div.carousel-inner div.active').attr('id', 'current'); }); function callplayer(frame_id, func, args='') { if (window.jquery && frame_id instanceof jquery) frame_id = frame_id.get(0).id; var iframe = document.getelementbyid(frame_id); if (iframe && iframe.tagname.touppercase() != 'iframe') { iframe = iframe.getelementsbytagname('iframe')[0]; } if (iframe) { iframe.contentwindow.postmessage(json.stringify({ "event": "command", "func": func, "args": args || [], "id": frame_id }), "*"); }

javascript - Bootstrap Active Pagination Class Error -

there strange thing pagination active class i want change active state on slide change, previous active position didn't change. how fix this?? here template thanks) code: <div class="container"> <div id="carousel" class="carousel slide" data-interval="false" data-ride="carousel"> <div class="carousel-inner" role="listbox"> <div class="item active"> <img class="img-responsive center-block" src="http://www.w3schools.com/bootstrap/img_chania.jpg"> </div> <div class="item"> <img class="img-responsive center-block" src="http://www.w3schools.com/bootstrap/img_flower.jpg"> </div> <div class="item"> <img class="img-responsive center-block" src="http://www.w3schools.com/bootstrap/img_chania2.jpg"&

php - Laravel not adding data to foreign key column value in the database -

i'm not getting error message this, laravel 5.1 not assign values foreign key column in orderdetails table. i've tried multiple different calls , can't figure out what's wrong. public function orderproduct(request $request){ //try , find current incomplete order. if find fails, create new order. $order; try{ $order = orderheader::where("userid","=", auth::user()->id) ->where('ordercompleted', '=', false)->firstorfail(); }catch(\illuminate\database\eloquent\modelnotfoundexception $e){ $order = new orderheader; //find user $id = auth::user()->id; $user = user::find($id); //associate user $order->user()->associate($user); //mark order incomplete $order->ordercompleted = false; $order->ordersshipped = false; $order->save();

elasticsearch - Comparing data in kibana -

i indexing user data each day , using kibana analyse it, far able visualize requirement. not able visualize following use case i want analyse total number of user,repeated number of users previous day , how many unique. i can visualize total number of user day , how compare today's data yesterday. any appreciated. in advance i hope understand requirement correctly, create vertical bar chart visualization kibana , change default 'count' 'unique count', select field unique count , add x-axis date histogram on timestamp field. this create bar chart , each bar contain unique count each time interval. if select 7 days timeframe , 1 day interval in x-axis date histogram, you'll see unique count per day.

performance - Is there most efficient way to code program for Avg Clustering Coeff -

calculation of average clustering coefficient of graph getting correct result takes huge time when graph dimension increases need alternative way takes less time execute. there way simplify code?? %// adjacency matrix n x n, %// d degree , n=100; d=10; rand('state',0) = zeros(n,n); kv=d*(d-1)/2; %% creating matrix %%% = 1:(d*n/2) j = floor(n*rand)+1; k = floor(n*rand)+1; while (j==k)||(a(j,k)==1) j = floor(n*rand)+1; k = floor(n*rand)+1; end a(j,k)=1; a(k,j)=1; end %% calculation of clustering coeff %% i=1:n j=find(a(i,:)); et=0; ii=1:(size(j,2))-1 jj=ii+1:size(j,2) et=et+a(j(ii),j(jj)); end end cv(i)=et/kv; end avg_clustering_coeff=sum(cv)/n; output got. avg_clustering_coeff = 0.1107 that calculation of clustering coeff part vectorized using nchoosek remove innermost 2 ne

java - XML parsing error Unexpected token position:TEXT @1:2? -

the error showing is unexpected token (position:text @1:2 in java.io.stringreader@41d569a8) i following tutorial androidhive but when using url ( http://example.com/ss.svc/apiabc?a=10&key=xxxxx&from=19&to=221&date=19-apr-2016 ) parse data showing me error like- 04-19 15:39:17.349: e/error:(29642): unexpected token (position:text @1:2 in java.io.stringreader@41d501a8) 04-19 15:39:17.349: d/androidruntime(29642): shutting down vm 04-19 15:39:17.349: w/dalvikvm(29642): threadid=1: thread exiting uncaught exception (group=0x41322438) 04-19 15:39:17.379: e/androidruntime(29642): fatal exception: main 04-19 15:39:17.379: e/androidruntime(29642): java.lang.runtimeexception: unable start activity componentinfo{com.example.androidhive/com.example.androidhive.customizedlistview}: java.lang.nullpointerexception 04-19 15:39:17.379: e/androidruntime(29642): @ android.app.activitythread.performlaunchactivity(activitythread.java:2114) 04-19 15:39:17.379: e/andro

python tornado websocket server send message to specific client -

is possible, if multiple socket clients connected tornado websocket server, send message specific one? don't know if there possibility of getting client's id , send message id. my client code is: from tornado.ioloop import ioloop, periodiccallback tornado import gen tornado.websocket import websocket_connect class client(object): def __init__(self, url, timeout): self.url = url self.timeout = timeout self.ioloop = ioloop.instance() self.ws = none self.connect() periodiccallback(self.keep_alive, 20000, io_loop=self.ioloop).start() self.ioloop.start() @gen.coroutine def connect(self): print "trying connect" try: self.ws = yield websocket_connect(self.url) except exception, e: print "connection error" else: print "connected" self.run() @gen.coroutine def run(self): while tr

javascript - Wrap arround an higher element -

i've list elements in there. if item has same high, items wrapping correctly. if single item has bigger high others, items wrapping @ bottom of higher element. here can see example: https://jsfiddle.net/qqouol6n/ here simple html list: <div id="flexbox-container"> <div class="small-container"></div> <div class="big-container"></div> <div class="small-container"></div> <div class="small-container"></div> <div class="small-container"></div> <div class="small-container"></div> </div> as can see, there 1 div, class represents higher items other ones. here css: #flexbox-container { width: 220px; background-color: lightgrey; display: flex; flex-wrap: wrap; flex-direction: row; padding: 10px; } .big-container { background-color: orange; width: 100px; height: 200px; margin-right: 10px; marg

spring mvc - AJAX mechanics when updating view parts -

i learning ajax atm , far best application of form validation. my conceptual question best way deal design issues when example need update page fragment. basic scenario: we have page 1 , page 2 both pages have same menu , footer. page 1 contains neatly formatted table content of statistics , page 2 contains messages. want implement ajax menu stays there on top when move page 1 page 2 , vice-versa. for instance have request handler returns json server. page 1 ajax request, our server returns table data, page 2 messages. the confusion how , store design information format page fragment of returning data correctly? common strategy - manually apply css on data on "succeed" event within ajax method? not introduce disjointness between client , server server applies formatting standard requests? , if content data returning ajax request demands dramatically different design in example gave you, means externalizing majority of html , css application javascript believe pr

AngularJS: Unit testing controller returns "TypeError: $scope.$watch is not a function" -

i want write simple test controller sets variable of scope id calls function triggers api call id on scope log result describe('the app', () => { beforeeach(angular.mock.module('mymodule')); var $controller; var eid = 123456; beforeeach(angular.mock.inject((_$controller_) => { $controller = _$controller_; })); describe('directive', () => { it('should load data api', () => { var scope = {}; var controller = $controller('mycontroller', { $scope: scope }); scope.entityid = eid; expect(scope.entityid).tobe(eid); controller.load(); // api call using scope.entityid, load data scope scope.$digest(); console.log("entities:", controller.entities); // data should loaded }); }); }); my controller uses "controller as" s

ios - OpenGL ES 2.0 textures for retina display? -

i have got glkview, try draw couple of cubes , create textures view , map them onto cubes. however, when start app on retina device, textures correctly sized terrible. have tried set contentscalefactor of glkview scale of main screen - no avail. have tried multiply the buffers dimensions scale, resulted in textures looked crisp, 1/4 of original size... without further ado, may present have done (without above indicated multiplication): glkview - (void)setupgl { uiscreen *mainscreen = [uiscreen mainscreen]; const cgfloat scale = mainscreen.scale; self.contentscalefactor = scale; self.layer.contentsscale = scale; glgenframebuffers(1, &defaultframebuffer); glbindframebuffer(gl_framebuffer, defaultframebuffer); glgenrenderbuffers(1, &depthbuffer); glbindrenderbuffer(gl_renderbuffer, depthbuffer); glrenderbufferstorage(gl_renderbuffer, gl_depth_component16, self.bounds.size.width, self.bounds.size.height); glframebufferrenderbuff

PHP pointers vs references -

in php, difference between using pointer such as: function foo( $var ) { $var = 3; } $a = 0; foo( &$a ); and reference: function foo( &$var ) { $var = 3; } $a = 0; foo( $a ); they both modify value of original variable, represented differently internally? in php, there no pointers, references. examples demonstrate pass reference the difference between code snippets in syntax, first syntax deprecated.

closures - how to terminate parent function execution in javascript? -

i need override behaviour of function, goes after calls other function. problem parent function library , dont want change it, solutions make flag or change of function not good. know got caller object in function can change, maybe can figure out smth it. heres example: function parent() { console.log("some need stuff"); some.handler.function.from.config.that.i.can.change(); console.log("need omit right till end"); } function child() { console.log("need somehow stop evaluation of " + child.caller + " function"); } as ruby programmer know there lambdas can terminate evaluation inner scope of closure. im not sure how javascript. you can't directly. (moreover .caller obsolete) you can use dirty trick: try{ parentfunction();//calls child }catch(e){ //done } function child(){ dowhatever(); throw new error("this propagate"); } fiddle this work assuming parent not catch exceptions when cal

Trouble with UTF-8 JSON file used in android -

i'm working on android project , use json intechange data server.. problem here when use json file utf-8 format, crash happens , app stops.. , when don't, works fine. need have files in utf-8 format have correct charecters. missing? thank in advanced. here service handler class: public class servicehandler { static string response = null; public final static int = 1; public final static int post = 2; public servicehandler() { } /** * making service call * @url - url make request * @method - http request method * */ public string makeservicecall(string url, int method) { return this.makeservicecall(url, method, null); } /** * making service call * @url - url make request * @method - http request method * @params - http request params * */ public string makeservicecall(string url, int method, list<namevaluepair> params) { try { // http client defaulthttpclient httpclient = new defaulthttpclient(); httpentity httpentity =

javascript - Highstock scrollbar issue with single point -

when 1 point plotted on graph date range scroll not working still if try scroll @ edge's changing position of point in graph. check fiddle here jsfiddle thanks selected range using rangeselector.selected not avaliable in chart because of data used. set min , max xaxis remove issue. example: http://jsfiddle.net/pxcsx/25/

html - how to show like chat box for the div/p tag top left/right corners -

Image
we developing chat application in application showing text in div want give css chat box direction div(top right/left border) below screen shot. i marked in red color in screen shot need do requirement screen shot .right { position: relative; background: white; text-align: right; padding: 10px 15px; border-radius: 6px; border: 1px solid #ccc; float: right; right: 20px; } .right::before { content: ''; position: absolute; visibility: visible; top: -1px; right: -10px; border: 10px solid transparent; border-top: 10px solid #ccc; } .right::after { content: ''; position: absolute; visibility: visible; top: 0px; right: -8px; border: 10px solid transparent; border-top: 10px solid white; clear: both; } div{ clear: right; } .right img { display: block; height: auto; max-width: 100%; } <div class="right"> <span>thanks</span> &l

javascript - unable to recognize field - not marked as ignorable error - JSON - Java object -

i getting below error when try post input field values controller/method , convert json java object. couldn't figure out error is. can 1 please me solve this? error: unrecognized field "userid" (class models.signupcred), not marked ignorable @ [source: n/a; line: -1, column: -1] (through reference chain: models.signupcred["userid"]) model: import org.codehaus.jackson.annotate.jsonignoreproperties; import com.google.code.morphia.annotations.id; @jsonignoreproperties public class signupcred { @id string userid; string firstname; string lastname; string langcode; string email; string password; string residentcountrycode; string contactprefemail; } javascript: $(document).ready(function () { $("#signup").click(function() { var user = new object(); user.userid = $('#userid').val(); user.firstname = $('#firstname').val(); user.lastname = $(

javascript - Is there way to check the file size in ejs? -

i have image located in folder while showing front end want check size if file size 0 want show media not found. if(filesize!=0) { <li class="message left appeared"><div class="text_wrapper"><div class="text"><img src="/public/images/abc.png" style="width:400px;"></div></div></li> } else { media not found }

dockerfile - Docker - What is proper way to rebuild and push updated image to docker cloud? -

waht i'm doing now: dockerfile: from python:3.5.1 env pythonunbuffered 1 run mkdir /www workdir /www add deps.txt /www/ run pip3 install -r deps.txt add . /www/ run chmod 0755 /www/docker-init.sh build command: docker build -t my-djnago-app:latest . tagging: docker tag my-djnago-app:latest lolorama/my-djnago-app-img:latest pushing: docker push lolorama/my-djnago-app-img:latest after these steps repository image haven't been updated. "layer exists" message. the push refers repository [docker.io/lolorama/my-django-app-img] fd5aa641b308: layer exists d9c60c6f98e8: layer exists d9d14867f6d7: layer exists 64ce166099ca: layer exists 73b670e35c69: layer exists 5f70bf18a086: layer exists 9ea142d097a5: layer exists 52f5845b1de0: layer exists e7fadb3ab9d4: layer exists cef72744de05: layer exists 591569fa6c34: layer exists 998608e2fcd4: layer exists c12ecfd4861d: layer exists what i'm doing wrong? i found problem, @lorenzvth7! i'v

java - setOnLongClickListener with registerForContextMenu -

i want actions before show context menu... is possible use both?? i tried: name.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { //some code here before show context menu registerforcontextmenu(name); return true; } }); but didn't work thanks edit: have for (final file dir : dirs) { tablerow row = new tablerow(this); final button name = new button(this); name.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { //dir global variable. saves clicked path dir = dir.getabsolutepath()+"/"; //registerforcontextmenu(name); return true; } }); row.addview(name); fileview.addview(row); } as can see want show context menu after save path of clicked item you can place these act