Posts

linux - How to wait till all services are up in parallel using bash? -

i have script starts 5 services on 4000-4004 ports. want script blocked till of them up. following works me. while ! nc -vz localhost 4000; sleep 1; done while ! nc -vz localhost 4001; sleep 1; done while ! nc -vz localhost 4002; sleep 1; done while ! nc -vz localhost 4003; sleep 1; done while ! nc -vz localhost 4004; sleep 1; done the problem above if 4002 still not up, keep on waiting while have no information 4003 & 4004. what run of these in parallel somehow , print out status of each port. , when of them up, continues after block else blocks , prints out ports , down. (optionally need add timeout well, should doable once how above.) thanks lot. edit: following worked great me: $ parallel --timeout 300 -j0 'while ! nc -vz localhost {}; sleep 10; done; echo {} open' ::: {4000..4004} 5001 || { echo "one or more serves failed start. exiting.."; exit 1; } note: make sure run following after installation. ref-link $ sudo rm /etc/parallel/con...

jquery - Pop-up not showing in IE (with magnific-popup) -

Image
i'm trying implement magnific popup on website. works on ie10, firefox end on ipad. reason images not showing in ie8 in popup mode. (i have not checked in ie9). shows white screen. issue? here link: http://www.fietseling.org/media/routes2013/index.html this code: magnific popup <!-- magnific popup core css file --> <link rel="stylesheet" href="http://www.fietseling.org/templates/nuni_fietseling/css/magnific-popup.css"> <!-- jquery 1.7.2+ or zepto.js 1.0+ --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <!-- magnific popup core js file --> <script type="text/javascript" src="http://www.fietseling.org/templates/nuni_fietseling/js/jquery.magnific-popup.js"></script> </head> <body> <div class="window-content"> <img src="fotos/routekaart2013fotos_gro...

ajax - jQuery Form Plugin posting array as string -

i using jquery form plugin ( http://malsup.com/jquery/form/ ) , trying post array php file processed, can't work intended. with regular jquery $.ajax code example: var = [1,2,3]; $.ajax({ url: "uploader.php", type: "post", data: ({ a: }) }); would output php variable $_post['a'] as array ( [0] => 1 [1] => 2 [2] => 3 ) with plugin output of $_post['a'] string equals "1,2,3". i want plugin act $.ajax does. would handy see code sets jquery form plugin, if you're doing drop-in replacement assume like: $('#myformid').ajaxform({ url: uploader.php, type: "post", data:({ a:a }) }); without checking i've assumed "data" gets merged form data jquery form plugin i'm guessing ajax form plugin calls tostring javascript method on a - give "1,2,3" to json string json.stringify(a). ie: $('#myformid...

database - MySQL multiple processes writing -

i trying build database used store results on tests. problem these tests run in parallel , separate processes , after each 1 of them finishes commit results database. know mysql designed handle such situations , engines innodb can achieve row level locking. if process access locked table or entry, process blocked , poll until table or entry unlocked or query cached , process can terminate ? when process try connect server when down, happen or me handle ? any highly appreciated. the number 2 you, when mysql_connect() or whatever use connect database throw exception. number 1 issue resolved @ mysql level, depending on process require locked table or row. results in temporary delay query access data in locked areas, can return out-of-time error, should other process lock table/row extended period of time. mutual lock possible, process locks row 1, , process b locks row 2, , wants data row 2 , b wants data row 1. named "deadlocking", , 1 of processes chosen d...

java - More elegant approach regarding the camera -

i'm using libgdx draw 2d scene. before drawing this: batch.setprojectionmatrix(camera.combined); as expected, (0,0) coordinates no longer in bottom left of screen, @ middle of screen. what more elegant solution position whole scene correctly: 1) translate/position camera accordingly show that's on screen. 2) draw while having in mind (0,0) @ middle now, so: batch.draw(background, -background.getregionwidth()/2, -background.getregionheight()/2); note i'm doing parallax scrolling , first option dispositions midground layer objects bit, expected. if there no solution problem, i'm leaning more towards second option. try keep objects in "world space" , keep translations "world space" screen in "camera" (the "camera" abstraction around matrices defined translate world space screen space). polluting object's locations information screen cause confusion , problems. specifically, in case, call camera.t...

iphone - pass NSMutableArray to another view giving null values -

i'm new ios development , want pass nsmutablearray 1 viewcontroller gives me null values firstviewcontroller.h @interface firstviewcontroller : uiviewcontroller @property (nonatomic, retain) nsmutablearray *colorarray; -(ibaction)btn:(id)sender; firstviewcontroller.m @implementation firstviewcontroller -(ibaction)btn:(id)sender { secondviewcontroller* secondviewcontroller = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil]; secondviewcontroller.animalarray = self.colorarray; nslog(@"%@",secondviewcontroller.animalarray); // here not null [self.navigationcontroller pushviewcontroller:secondviewcontroller animated:yes]; } secondviewcontroller.h @interface secondviewcontroller : uiviewcontroller @property (nonatomic, retain) nsmutablearray *animalarray; secondviewcontroller.m i used nslog(@"animalarray:%@",self.animalarray); in viewdidload check values gives me null is there i...

Object Data Encryption using javascript -

i have object following var caregiverdata = new object(); caregiverdata.firstname = 'abg'; caregiverdata.lastname = 'abg'; caregiverdata.address1 = 'abg'; caregiverdata.address2 = 'abg'; caregiverdata.city = 'abg'; caregiverdata.state = 'abg'; caregiverdata.zip = 'abg'; caregiverdata.phone = 'abg'; caregiverdata.email = 'abg'; caregiverdata.language = 'abg'; i want encrypt object data , send webservice using json.stringify(data) there want decrypt.. can encrypt entire object data using javascript?? can 1 please suggest me better way