Posts

Showing posts from September, 2014

centos - How to get PHP to be able to read system environment variables -

i using php php-fpm on centos. trying follow http://12factor.net/ guidelines of having settings stored in environment variables. i have created file in /etc/profile.d sets environment variables want, , environment variables appear when tested in cli via bash i.e. running bash script: echo $some_server_setting shows correct output. i have set clear_env setting false , variables_order egpcs , however, variable have set not show in php either getenv('some_server_setting') or doing var_dump($_env) what other setting needs set allow php-fpm receive of server environment variables, , in particular set through shell script in /etc/profiles.d on centos? security reasons :-) see /etc/php5/fpm/pool.d/www.conf (debian location, may different on centos) ; clear environment in fpm workers ; prevents arbitrary environment variables reaching fpm worker processes ; clearing environment in workers before env vars specified in ; pool configuration added. ; setting ...

android - Selendroid does not open the URL when I use it with Selenium Grid -

selendroid not open url when use selenium grid.below steps followed 1) initated grid hub using selendroid grid plugin , selenium grid jar java -dfile.encoding=utf-8 -cp "selendroid-grid-plugin-0.15.0.jar;selenium- server-standalone-2.45.0.jar" org.openqa.grid.selenium.gridlauncher - capabilitymatcher io.selendroid.grid.selendroidcapabilitymatcher -role hub - host 192.168.1.30 -port 4444 2) opened avd in vm (i.e. node) 3)initated selendroid node using below command java -jar selendroid-standalone-0.15.0-with-dependencies.jar -port 5556 -hub http://192.168.1.30:4444/grid/register -proxy io.selendroid.grid.selendroidsessionproxy -host 192.168.1.8 hub ip : 192.168.1.30 node ip: 192.168.1.8 4) navigate http:// 192.168.1.30:4444/grid/console – able view node added 5) ran below script on hub machine. selendroid web view opening unable open url package io.selendroid.demo.mobileweb; import java.net.url; import io.appium.java_client.android.androiddriver;...

c# - I need to get the value of a drop down list in an asp gridview when updating the row -

everything should work, can't figure out why can't value ddl. know code not clean. protected void gridproduse_rowediting(object sender, gridviewediteventargs e) { gridproduse.editindex = e.neweditindex; gridproduse.databind(); using (var context = new satcontext()) { var query = t in context.tipuriproduse select t.denumire; dropdownlist list = new dropdownlist(); list.datasource = query.tolist(); list.databind(); list.id = "ddltipprodus"; list.height = 27; dropdownlist listmoneda = new dropdownlist(); listmoneda.id = "ddlmoneda"; listmoneda.items.add("ron"); listmoneda.items.add("eur"); listmoneda.items.add("usd"); listmoneda.height = 27; gridproduse.rows[e.neweditindex].cells[7].controls.add(list); ...

ordering non-decreasing functions then adding them in R -

need basic r function: firstly order non-decreasing sequence 4 different sequences , order 4 sequences one. im totally green in programing please make simplest way possible. edit1: puting input data required a={3,2,1,2} b={6,7,5,8} c={12,11,9,10} d={65,43,76,13} i first order each sequence, so a={1,2,2,3} b={5,6,7,8} c={9,10,11,12} d={13,43,65,76} and merge it abcd={1,2,2,4,5,6,7,8,9,10,11,12,13,43,65,76} if want function takes vectors a, b, c, , d , input , outputs sorted version of them, can try: sortall <- function(a, b, c, d) sort(c(a, b, c, d)) and can run like: a <- c(1,2,2,3) b <- c(5,6,7,8) c <- c(9,10,11,12) d <- c(13,43,65,76) sortall(a, b, c, d) # [1] 1 2 2 3 5 6 7 8 9 10 11 12 13 43 65 76 if wanted write function combined , sorted number of inputs, try: sortall <- function(...) sort(unlist(list(...))) sortall(a, b, c, d) # [1] 1 2 2 3 5 6 7 8 9 10 11 12 13 43 65 76 sortall(a) # [1] 1 2 2 3

iterator - Iterate over pairs of chunks without creating a temporary vector -

i'm trying iterate vector pairs of chunks (in case it's image represented contiguous bitmap , i'd have access pixels 2 rows @ once). the problem can't .chunks(w).chunks(2) , have create temporary vector in between. is there way purely iterators? (i'm ok if result iterator itself) playpen let input : vec<_> = (0..12).collect(); let tmp : vec<_> = input.chunks(3).collect(); let result : vec<_> = tmp.chunks(2).collect(); [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]] this solution create 2 iterators, 1 odd lines , 1 lines. combine 2 using .zip(), give iterator filled pairs: fn main(){ let input : vec<_> = (0..12).collect(); let it1 = input.chunks(3).enumerate().filter_map(|x| if x.0 % 2 == 0 { some(x.1) } else { none }); let it2 = input.chunks(3).enumerate().filter_map(|x| if x.0 % 2 != 0 { some(x.1) } else { none }); let r: vec<_> = it1.zip(it2).collect(); println!("{:?}"...

javascript - Meteor JS: Shopping Cart Without Login - session id, etc -

i'm working on e-commerce project. customers of e-commerce site able add items shopping cart , checkout without having login. to this, have decided store items customers add shopping cart inside collection. e.g. cartitems = new mongo.collection("cartitems"); in order differentiate customer's shopping cart items other customers, have decided add field var sessid = meteor.default_connection._lastsessionid; e.g. { "_id" : "hco7jysaruybnquc9", "qty" : 1, "productid" : "haajzgxplk4zj3pxw", "session" : "uqtiaeqiawsxlmu7a" } to document added cartitems collection. the problem solution whenever page refreshed, last session id changes , therefore cart becomes empty again though same user still using page. also, documents added collection not cleaned (deleted) have no way of detecting if session going ended browser/user. 1.) what's ideal solution problem? 2.) how...

c# - How to find out memory consumed by classes, objects, variables, etc -

this question has answer here: how object size in memory? [duplicate] 7 answers i trying play memory profiling (for first time, please forgive ignorance), see how memory consumed classes, objects, variables, methods etc. wrote sample c# console program called memplay.exe: using system; using system.text; namespace memplay { class program { static void main(string[] args) { someclass myobject = new someclass(); stringninemethod(); } private static void stringninemethod() { string somestring0 = "abcdefghijklmnopqrstuvwxyz"; string somestring1 = string.empty; string somestring2 = string.empty; (int = 0; < 9999; i++) { somestring1 += "9"; somestring2 += somestring1; } } } class someclass ...

javascript - Stop script execution after refresh -

i wrote single program using html , javascript contains submit button. problem have when refresh page, it's pressed submit button again!! want not execut script if refresh page. don't know if it's clear it's want program intialized if refresh page instead of executing previous script ! i believe referring browser behaviour when submit form same page, if refresh prompt resubmit data again. you can avoid issuing redirect @ end of script, refresh page , clear history of submit. if (isset($_post['submit'])) { // ... code here header('location: ' . $_server['php_self']); }

icons - Mobile Favicons -

so i'm doing research regarding mobile site user experience , stumbled upon fact of whole favicon.ico being outdated , all. looking around i've gathered require various new sets of images/icons present "favicon" on various mobile devices android, iphones , windows phones. now question here is, i've got following code: <link rel="apple-touch-icon" sizes="57x57" href="images/favicons/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="images/favicons/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="images/favicons/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="images/favicons/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="images/favicons/apple-touch-icon-114x114.png...

javascript - GSAP Animation Failing to Interpolate CSS3 Transforms -

i'm in process of converting of css3 animations javascript animations via gsap library . unfortunately, i'm having trouble getting css3 transforms work correctly. i have bunch of images positioned throughout user's screen. hidden. when images loaded, animated move vertically offscreen , down final resting positions. img { /* other styles size, position, etc. */ ... transform: perspective(400px) rotatex(50deg) rotatey(-5deg) rotatez(30deg); ... } and of javascript: var _timeline = new timelinemax(), _animation = { 'transform' : 'translatey(' + offset + 'px)', 'ease' : power2.easeinout }; all of images queued timeline successive animation. _timeline.from('#someelement', 1, _animation, 0); i use .from() function because elements' final styles present in css; need position them offscreen , move them downwards. here's description of function direct gsap's documentat...

c# - How Can I Shorten This Code -

private void button4_click(object sender, eventargs e) { textbox1.text = datagridview1.rows[0].cells[0].value.tostring() + "&" + datagridview1.rows[0].cells[1].value.tostring() + "&" + datagridview1.rows[0].cells[2].value.tostring() + "&" + datagridview1.rows[0].cells[3].value.tostring() + "%" + datagridview1.rows[1].cells[0].value.tostring() + "&" + datagridview1.rows[1].cells[1].value.tostring() + "&" + datagridview1.rows[1].cells[2].value.tostring() + "&" + datagridview1.rows[1].cells[3].value.tostring() + "%" + datagridview1.rows[2].cells[0].value.tostring() + "&" + datagridview1.rows[2].cells[1].value.tostring() + ...

github - How exactly (with a diagram) does Git Fetch + Merge work? -

Image
i'm attempting merge git repositories subfolders under 1 large repository. working fine, , doing: git remote add -f <name> <url> git merge <name>/master however, after doing steps above, accidentally removed new files came remote. git-committed. wanted "add" them again, did git merge /master, nothing appeared, , console output, "already up-to-date". in mind, remote name/master, points github directory aka files want add; since local master branch pointing bunch of files missing remote files, can merge them , wah-lah. apparently i'm misunderstanding here.. i'm newbie this, think it'd super helpful have diagram pointers , such describing above steps do, , went wrong when deleted files? appreciate insight! your mistake wasn't removed new files (it can happen anyone), error new commit. when did that, local branch moved forward work, remote branches 1 commit behind. that's why new git merge didn't work (...

java - Why Does Map Marker Lurch Around The Map -

i'm in android studio , have map fragment (com.google.android.gms.maps.supportmapfragment) has 2 markers. 1 static , called target. other tracks movements , called hunter. works problem hunter marker lurches about. have update interval set @ 15 milliseconds, @ walking speed updates once every block. so, how add marker track location , have reasonably accurate , update in real-time? or doing wrong here? greg oncreate() setupmapifneeded(); if (mmap != null) { latlng target = new latlng(targetlat, targetlong); mmap.movecamera(cameraupdatefactory.newlatlngzoom(target, 15)); } locationmanager locationmanager = (locationmanager) this.getsystemservice(this.location_service); locationlistener locationlistener = new locationlistener() { public void onlocationchanged(location location) { makeuseofnewlocation(location); } public void onstatuschanged(string provider, int status, bundle extras) {} ...

uilocalnotification - Swift: Local notifications seem to duplicate then some vanish -

i have reminder app searching through array send reminders take medication. when notifications come through, i'm getting sea of multiple notifications coming through , seemingly vanishing instantaneously , 1 remains @ end. my initial view controller uitableviewcontroller . tried placing firenotifications function in viewdidload didn't seem send notifications. if put firenotifications function call in 1 of tableview functions (ie numberofsectionsintableview ) i'm able notifications come through, have odd behavior mentioned above. my code is: func firenotifications() { if nsuserdefaults().boolforkey("notifyswitch") { //checks settings make sure user wants reminders (index, items) in mymedslist.enumerate() { let notification = uilocalnotification() notification.firedate = nsdate(timeintervalsincenow: 20) notification.alertbody = "reminder: take \(items.name) now!" notification.aler...

java - Can I create a JSVGCanvas without an svg file? -

looking through documentation jsvgcanvas , seems might not able this. however, makes lot of sense possible. how can create jsvgcanvas string variable instead of file ? my idea following: string svg = "svg data"; jframe frame = new jframe(); jsvgcanvas canvas = new jsvgcanvas(); canvas.setcontentsfromstring(svg); frame.add(canvas); frame.setvisible(true); i know create temporary file , set contents of jsvgcanvas file, i'd rather avoid that. perhaps extend file , override methods? note: using jython, think relevant java well, hence i'm using both tags. i'd prefer solution in java, jython solution work yes, can: string parser = xmlresourcedescriptor.getxmlparserclassname(); saxsvgdocumentfactory factory = new saxsvgdocumentfactory(parser); svgdocument document = factory.createsvgdocument("", new bytearrayinputstream(svg.getbytes("utf-8"))); canvas.setsvgdocument(document); this works creating svgdocument via saxsvgdo...

java - Exposing whether an application is undergoing GC via UDP -

the motivation behind question see whether can make theoretical load balancer more efficient edge-cases first applying regular strategy of nominating particular node route http request (say, via round robin strategy) , "peeking" internal state of system see whether undergoing garbage collection. if so, load balancer avoids node altogether , moves onto next one. in ideal scenario, each node "emit" internal state every few seconds via udp message queue letting load balancer know nodes potentially "radio-active" if they're going through gc (i'm visualizing simple boolean). the question here is: can tweak application tap jvm's internal state , (a) figure out whether we're in gc mode right instant (b) emit result via protocol (udp/http) on wire other entity (like mq or something). there whole bunch of ways monitor , report on vm remotely. well-known protocol, example, snmp. complicated subject. implementation sort of depends o...

java - Explanation of Gradle build error -

what error about? don't understand it. error:execution failed task ':app:processdebugresources'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\android\sdk\build-tools\22.0.1\aapt.exe'' finished non-zero exit value 1 ps sdk build version 22.0.1 the problem writing of old , new versions of android studio. in file manifest.xml. android: icon = "@ drawable / ic_launcher" should replaced by android: icon = "@ mipmap / ic_launcher"

osx - haskell/gloss example error w/ GLUT dynamic library "Symbol not found: _glutBitmap8By13 error" -

when load haskell / gloss examples (so far i've tried wave , snow), seem getting error finding in glut shared libraries. might cause error , how can fix it? can't load .so/.dll for: /users/jd/sandbox/.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/glut_j2zzfjoyoch4hqyflxhepp/libhsglut-2.7.0.1-0waw9bzutcf5s5h5zsv4oh-ghc7.10.1.dylib (dlopen(/users/jd/sandbox/.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/glut_j2zzfjoyoch4hqyflxhepp/libhsglut-2.7.0.1-0waw9bzutcf5s5h5zsv4oh-ghc7.10.1.dylib, 5): symbol not found: _glutbitmap8by13 referenced from: /users/jd/sandbox/.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/glut_j2zzfjoyoch4hqyflxhepp/libhsglut-2.7.0.1-0waw9bzutcf5s5h5zsv4oh-ghc7.10.1.dylib expected in: flat namespace in /users/jd/sandbox/.cabal-sandbox/lib/x86_64-osx-ghc-7.10.1/glut_j2zzfjoyoch4hqyflxhepp/libhsglut-2.7.0.1-0waw9bzutcf5s5h5zsv4oh-ghc7.10.1.dylib) this on mac osx 10.9.5 ghc 7.10.1

sql update - INNER JOIN SELECT in MySQL -

i have sql statement works in sql server fails in mysql... shouldn't work in mysql? update t2 set totalamount = t1.sumamount ccs_multiples t2 inner join (select sum(amount) sumamount, serialnumber ccs_multiples_items group serialnumber) t1 on t2.serialnumber = t1.serialnumber error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near from ccs_multiples t2 inner join (select sum(amount) sumamount, seria @ line 3 when updating join , instead of doing join , can specify multiple tables in update, ie. update table1 t1, table2 t2 and specify typically join condition, instead part of where condition, like where t1.somecol=t2.someothercol so instead of join, write query this update ccs_multiples t2, (select sum(amount) sumamount, serialnumber ccs_multiples_items group serialnumber) t1 set t2.totalamount = t1.sumamount t2.ser...

github - How to ignore the contents of a previously tracked directory in git? -

i have seen this post no longer tracking tracked file, here situation. i committed directory. want untrack in directory still track directory itself. i have added /auto-save-list/* .gitignore file (the directory trying ignore auto-save-list directory in root of project, , have run git rm --cached still have multiple filed directory show new when go make commit. files show in origin repo. can me ignore contents of tracked file? this should enough: git rm -r --cached auto-save-list/ echo "/auto-save-list/" > .gitignore git add .gitignore git commit -m "records untracking of /auto-save-list/ folder" no need ' * ' if still need directory there (versioned in git repo, though git doesn't track empty folder), add dummy file in it. touch auto-save-list/.keep git add -f auto-save-list/.keep git commit -m "record auto-save-list/ folder, while ignoring content"

mysql - looping array value with function php -

i'm trying create multi level dropdown menu mysql store data, , use twig theme engine, know there ton of code outside but, of them html output, since use twig, need array output, , let twig render it,(or maybe there other option, let me know if so). code work if use html output. if change array output problem 2nd menu level show 1 array or first array, not loop. array output mysql query , array ( [0] => array ( [id] => 1 [title] => dashboard [link] => 1.html [parent_id] => 0 ) [1] => array ( [id] => 2 [title] => master data [link] => 2.html [parent_id] => 0 ) [2] => array ( [id] => 3 [title] => submaster [link] => 11.html [parent_id] => 2 ) [3] => array ( [id] => 4 [title] => submas...

C++ Fork child, ask child for process list, kill a process in Linux -

i'm trying create child process, send child process command "listall". child process should issue system command ps , return list parent process. parent process should choose process , kill it. have far i'm having trouble getting run. #include <stdio.h> #include <unistd.h> #include <cstring> #include <stdlib.h> #include <iostream> #include <sys/wait.h> char* getlistofprocesses(const char* cmd) { file* pipe = popen(cmd, "r"); if (!pipe) return (char*)"error"; char buffer[128]; char *result = new char[1024]; while(!feof(pipe)) { if(fgets(buffer, 128, pipe) != null) strcat(result, buffer); } pclose(pipe); return result; } int spawngedit() { pid_t gpid = fork(); if(gpid == 0) { execl("gedit", "gedit", null); exit(-1); } else { } return 0; } int main(int argc, char **argv) { int p2c[...

javascript - jQuery: Loop through JSON document -

i have following json structure on "y" location: {"results":[{ "a_id":4529245, "type":"a", "name":"honda" },{ "a_id":1234567, "type":"l", "name":"autos marron" }]} inside js document have following code: var i; i=0; $.getjson('/document/location', function( data ) { console.log(data); $.each( data, function( key, val ) { var contentstring = '<span>'+ val[i].name + '</span>'; $('#info').append(contentstring); i++; }); }); i searched online , readed able val.name , able print each of "name" variables inside json document. but have use incrementing variable (i) in order print only first variable equals "honda" using val[i].name i'd print variables called name....

Python Scapy vs dpkt -

i trying analyse packets using python's scapy beginning. upon recent searching, found there module in python named dpkt . module can parse layers of packet, create packets, read .pcap file , write .pcap file. difference found among them is: missing of live packet sniffer in dpkt some of fields need unpacked using struct.unpack in dpkt . is there other differences missing? scapy better performer dpkt . you can create, sniff, modify , send packet using scapy. while dpkt can analyse packets , create them. send them, need raw sockets. as mentioned, scapy can sniff live. can sniff network can read .pcap file using rdpcap method or offline parameter of sniff method. scapy used create packet analyser , injectors. modules can used create specific application specific purpose. there might many other differences also.

node.js - How to Setup API Environment in Node -

i'm building node.js rest api. have repository hold rest api code. i want able test api. i'll test via express , make requests start want express stuff in separate project because rest api isn't gonna have web app portion. i'm using webstorm. right have created github repo hold api i'll expose rest endpoints. i want create new project again node-express project purpose of pulling in rest api , consume it. doing in seperate project because don't want express stuff checked rest api repo, doesn't belong there. using express testing stuff. i realize can later test rest endpoints headless, right wanna started , figure out later , going express project somehow consume other api rest project. i'm not quite sure on few things, come .net enviornment , no longer .net developer. here questions have: my question : if have node express project open in webstorm, how "include" or "require" rest-api? somehow npm down? rest api...

Yii2 DatePicker installation -

Image
found documentation widget here , library here . tried install composer , failed: tried copy "yiisoft/yii2-jui": "~2.0.0" composer.json , update composer , failed again: class 'yii\jui\datepicker' not found is there way install extension without using composer? did install composer global require "fxp/composer-asset-plugin:1.0.0" ? npm/bower dependency manager composer required yii2. before installing yii2-jui try command, , composer update

jsp - MVC - controller-to-controller in java EE -

in school, payroll application, professor following logic flow: the default page index.jsp page. when add button clicked, addform.jsp page called , there user can enter data payroll when submit button clicked, addform.jsp page call servlet processes form , add table. say insert statement works , there no problem input data, servlet call add.jsp page. contains input data user entered before, informing user data inserted table, , "list of payroll" link. when "list of payroll" link clicked, servlet called, 1 processing rows in table viewing. finally, resultset containing data table, bound request object, servlet call list.jsp view data in table. he said how mvc should done. however, don't when after data inserted, jsp page have created display input data , inform user data inserted. why not go directly list.jsp page , error.jsp page if insert not successful? thought of following wanted: say insert statement works , there no problem input data, s...

java - Spring MVC Validation error -

i have spring controller accepts 1 of business objects argument, spring automatically building form data. 1 of attributes of object enum comes select dropdown in form. using @valid notation validation on object, using implementation of spring validator interface. in testing, manually added selection dropdown (using browser inspector) not valid, since can't converted enum. have thought spring leave enum attribute null, , validator catch error, runtime error: javax.el.elexception: cannot convert cc of type class java.lang.string class com.app.enums.states any ideas on how handle this? we need more details on want happen when occurs. tell spring how convert string instance of states using converter (see this page details).

google chrome extension - Using openweathermap api for free -

can use openweathermap api free in chrome extension? trying build chrome extension use openweather map api. can use free if want place on webstore? check out http://openweathermap.org/price_detailes more details. all data provided openweathermap distributed under terms of creative commons license http://creativecommons.org/licenses/by-sa/2.0/ . under license data can freely used through api non-commercial or commercial purposes. however, openweathermap name must mentioned weather source in visible part of application. enterprise accounts other licenses different creative commons possible. please, send request

ios - Swift: Fatal error: unexpectedly found nil while unwrapping an Optional value (SpriteKit) -

i've started learning program ios games spritekit , i'm novice programming (i have programmed in java , swift before this). started out doing tutorial found online. i'm @ point trying add "game over" scene, , keep getting error "thread 1:exc-bad_instruction(code=exc_i386_invop,subcode=0x0)" when declaring gameoverlabel constant. compiles crashes @ run time ball hits bottom of screen, supposed trigger 'game over' screen. import spritekit let gameoverlabelcategoryname = "gameoverlabel" class gameoverscene: skscene { var gamewon: bool = false { didset { let gameoverlabel = childnodewithname(gameoverlabelcategoryname) as! sklabelnode gameoverlabel.text = gamewon ? "game won" : "game over" } } override func touchesbegan(touches: set<nsobject>, withevent event: uievent) { if let view = view { let gamescene = gamescene.unarchivefromfile(...

java - list view in fragments null pointer exception -

i trying setup swipe refresh in fragment, fetches objects parse. every time, seem null pointer exception on setadapter , list view. although both of them correctly initialized not null. my recentsadapter: package com.astuetz.viewpager.extensions.sample; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import java.util.arraylist; import java.util.hashmap; public class recentsadapter extends baseadapter { layoutinflater inflater; context context; arraylist<hashmap<string,string>> items = null; public recentsadapter(context context,arraylist<hashmap<string,string>> items) { super(); this.context = context; this.items = items; inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); } ...

c# - Storing custom data on a prefab instance -

i have script generates star planets. each planet have information associated it, instance "type" (lava, rocky etc). i have trigger set when mouse on planet working: ray = camera.main.screenpointtoray(input.mouseposition); if(physics.raycast(ray, out hit)) { print (hit.collider.name); } i instantiating planets with: gameobject planetclone = instantiate (planet, pos, quaternion.identity) gameobject; how attach string variable "type" instanced prefab? you can attach script prefab required parameters , method pass them example // scripta string type; public void settype(string _type){ type = _type; } attach scripta prefab, after instantiating prefab, can use scripta scripta = (scripta) planetclone.getcomponent<scripta>(); scripta.settype("data want pass comes here"); this attached script belonging instantiated gameobject , properties associated it! may refer unity documentation more info

php - Converting multiple strings into JSON arrays -

i have multiple strings looks following: 11-16 , 16-12 , 14-16 i have multiple of these, , need store them in json. need store in following format: [ { "score_1": 11, "score_2": 16 }, { "score_1": 16, "score_2": 12 }, { "score_1": 14, "score_2": 16 } ] with score_1 being first number, , score_2 being second number. how able in php? thanks first create array. next create object, explode string on hyphen , store intval 'd first , second number in object. push object array. repeat many strings have. finally, use json_encode json-encoded string. $arr = []; function addstring($str, &$arr) { $str = explode("-", $str); $obj = new stdclass(); $obj->score_1 = intval($str[0]); $obj->score_2 = intval($str[1]); $arr[] = $obj; } addstring("11-16", $arr); addstring("16-12", $arr); echo json_encode($arr); output...

java - Should I be worried about this error? -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i got error game still works. should worried? can provide coding cause error if needed. error: exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ main.gamepanel.paintcomponent(gamepanel.java:77) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent.paint(unknown source) @ javax.swing.jlayeredpane.paint(unknown source) @ javax.swing.jcomponent.paintchildren(unknown source) @ javax.swing.jcomponent.painttooffscreen(unknown source) @ javax.swing.repaintmanager$paintmanager.paintdoublebuffered(unknown sou...

Windows phone Development System Configuration -

i have 4gb ram , windows 8.1 os , intel pentium dual core processor. system did not support developing apps , did not create simulator in system.after searching system did not have slat control. how run apps? there many requirements run windows phone emulator. 2 of them cutting off relevant part of machines: hyper-v virtualization slat technology here official documentation: https://msdn.microsoft.com/en-us/library/windows/apps/ff626524(v=vs.105).aspx you not satisfy these requirements, can't install it. should popup reporting sdk installed without emulator.

images with invalid jpeg marker -

i encountered website images consistently throws 'invalid jpeg marker' error when downloaded. wondering possible intentionally doing causes error of users try download , use images? i want protect jpeg resources of website unauthorised use. possible change in jpeg header or meta tags jpg images display fine on browser if downloads own use throws error 'invalid jpeg marker'? (i don't intend discuss alternative ways of protecting images online or limitations of it.) if can display on browser, can display on else. happening decoder using view when downloaded more strict web browser. presume not using browser view them after downloading. you run "file" command make sure images jpegs. if so, there number of programs available analyze structure of jpeg stream. use 1 see what's going on image. may have odd marker ordering or possibly jpeg image not occur right @ start of file stream. i've seen weird jpegs there bytes after appn marker , b...

php - Mage registry key "_singleton/tax/observer" already exists -

i have encountered error doing this. error happen in both frontend , backend. i have tried below action: flushing cache (delete in var/cache folder) : doesn't work. went compiler , noticed disabled tried & running compiler : doesn't work any suggestions? trace: #0 /var/www/vhosts/jomgroupon.com/httpdocs/app/mage.php(222): mage::throwexception('mage registry k...') #1 /var/www/vhosts/jomgroupon.com/httpdocs/app/mage.php(476): mage::register('_singleton/tax/...', false) #2 /var/www/vhosts/jomgroupon.com/httpdocs/app/code/core/mage/core/model/app.php(1316): mage::getsingleton('tax/observer') #3 /var/www/vhosts/jomgroupon.com/httpdocs/app/mage.php(447): mage_core_model_app->dispatchevent('catalog_product...', array) #4 /var/www/vhosts/jomgroupon.com/httpdocs/app/code/core/mage/catalog/model/resource/product/collection.php(526): mage::dispatchevent('catalog_product...', array) #5 /var/www/vhosts/jomgroupon.com/...

java - No compiling errors, execution on ADB fails -

i'm developing android app google maps apis. first time ever see such error. is? seems "runtime" error agpbi: {"kind":"simple","text":"unexpected top-level exception:","position":{},"original":"unexpected top-level exception:"} agpbi: {"kind":"simple","text":"com.android.dex.dexexception: multiple dex files define lcom/google/android/gms/plus/model/people/person$agerange;","position":{},"original":"com.android.dex.dexexception: multiple dex files define lcom/google/android/gms/plus/model/people/person$agerange;"} agpbi: {"kind":"simple","text":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)","position":{},"original":"\tat com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)"} agpbi: {"kind":"simple...