Posts

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 ...