Posts

Showing posts from August, 2010

json - Data Structure for Range Matching Lookup -

assume have structure of ranges, , associated data, instance: data [ [ [0, 100], "new york"], [ [101, 200], "boston"], ... ] for function receives n arguments , returns entry n in range of left element. for instance, > 103 < "boston" what best structure transform above achieve fastest lookup time? if data set should dynamic, use interval tree .

Docker swarm mode scale service issue with one worker -

so, trying out docker swarm mode in 1.12. took me time figure out mounts during docker service create, got part work. when try scale, gives me below error: invalid bind mount source, so… is error happening because have 1 worker , mount set ? also, because binding ports, , if have 1 worker node swarm still work if scale app 3 or 5 apps ? how swarm handle port conflicts on 1 worker node ? need this. thanks, jason

Auto input credentials when prompted in ruby -

i newbie ruby. have our install process automated in ruby. facing issue on making ruby script adapt changes in shell script. execute "update_imports" cwd import_home command "./import.sh #{download_dir}/#{import_file} #{user} #{shellwords.escape(password)}" action :run end the import.sh modified such asks username , password (doesn't take username , password arguments earlier) earlier: ./import.sh /tmp/importtest.xml test1 password now: ./import.sh /tmp/importtest.xml username: test1 password: i want modify ruby file adapt change. can suggest best way so? tried searching , learning being pretty new ruby, clueless. you can use open3 in ruby standard library: download_dir = "./test/dir" shell_command = "./import.sh #{download_dir}" username = "username" password = "password" open3.popen3("shell_command") |input, output, error, thread| input.puts(username) # answers username prompt inpu...

node.js - mongoose find not returning results when mongodb it does -

based on this question , this issue find faster findone if query not executed, i'm trying in node.js. in mongodb (cli) i'm executing following command: > db.carts.find({_id: objectid("57bd3df5c878685d3ec581d6")}).limit(1).count() 1 then in node.js, using mongoose i'm using code returns 0: const cartid = '57bd3df5c878685d3ec581d6'; const query = cart.find({ _id: new mongoose.types.objectid(cartid) }).limit(1); console.log(query.count()); // 0 also noted if query executed returns cart: query.exec().then(console.log); // [ { _id: 57bd3df5c878685d3ec581d6, __v: 0, ... here cart model: const cartschema = new schema({ cartitems: [], cartitemscount: { type: number, default: 0 }, carttotal: { eur: { value: { type: number, default: 0 }, currencyprec: { type: number, default: 2 }, count: { type: number, default: 0 }, }, }, carttotalineur: { itemscost: { type: n...

javascript - Can I use save button directly in window function -

i have following code.in when click on 'print map' button popup window gets open on there 2 buttons 'save' , 'print'. when click on 'save' button opens window save file. what want when click on 'print map' button window after clicking save button should open. function printelem(elem) { popup($(elem).html()); } function popup(data) { var mywindow = window.open('', 'parent', 'height=400,width=600'); mywindow.document.write('<html><head><title>my div</title>'); /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.document.close(); // necessary ie >= 10 mywindow.f...

Reset/swap two fragments in ViewPager Android -

i have 2 fragments in viewpager along tabs. have settings option in app allows user choose default fragment in viewpager. here have tried: btnsavelayout.click += delegate { var selectedid = radiogrouplayout.checkedradiobuttonid; radiobuttonlayout = dialog.findviewbyid<radiobutton>(selectedid); layoutpreference = radiobuttonlayout.text; meditor.putstring("defaultlayout", layoutpreference); meditor.commit(); dialog.dismiss(); setupviewpager(layoutpreference); ; }; private void setupviewpager(string layoutpref) { adapter = new viewpageradapter(supportfragmentmanager); pager = findviewbyid<viewpager>(resource.id.tabanim_viewpager); if (string.isnullorempty(layoutpref) || layoutpref.equals("first view")) ...

c# - Why this range attribute in mvc does not give me right answer.? -

i'm trying apply range attribute on class field this. [range(typeof(int32), "1","999", errormessage = "must number between 1 , 999")] public long? fieldname{ get; set; } but doesn't validate range expecting. supposed validate range between 1 , 999. how resolve issue. try this.......... [range(typeof(int32), "1", "999", errormessage = "must positive natural number between 1 , 999")] [regularexpression("^[0-9]{1,3}$", errormessage = "must positive natural number between 1 , 999")] public long? fieldname { get; set; }

ios - How to implement only one table controller for all segment in pager? -

i implementing custom horizontal multiple segments table view controller content of each segment. how implement 1 controller segments, because view same segments data change. want pass current index of segment table view controller particular data. using capspagemenu.swift file - https://codeload.github.com/uacaps/pagemenu/zip/master ? here code- class entrance_main_controller: uiviewcontroller { var pagemenu : capspagemenu? override func viewdidappear(animated: bool) { super.viewdidappear(animated) // mark: - ui setup self.title = "entrance exam" // initialize view controllers display , place in array var controllerarray : [uiviewcontroller] = [] let controller1 : entrance_content_viewcontroller = entrance_content_viewcontroller(nibname: "testtableviewcontroller", bundle: nil) controller1.title = "engineering" controllerarray.append(controller1) let controller2 : entrance_content_...

How do I convert string builder to string array in Android? -

this question has answer here: stringbuilder array of strings how convert 2 answers i have string builder in android filled data database, , want display data using list view. want covert string builder array of strings. can me in conversion, or suggest me other technique. here can find link temparray = sb.tostring().split("abcabc"); split string , return array of strings each line.

jquery - Javascript fetch all sub folder names from a directory -

i have requirement like, need subfolder names directory (provided path directory) using js or angular js. example, if have directory structure like, mainfolder - subfolder1 - subfolder2 - subfolder3 if give path main folder , should able subfolder names array ["subfolder1","subfolder2","subfolder3"] please me this kind of operation shouldn't done via client side javascript. should server side task, if use node.js - function getdirectories(path) { return fs.readdirsync(path).filter(function (file) { return fs.statsync(path+'/'+file).isdirectory(); }); }

How can i make whole android project as jar file -

here want make whole android project jar file further used in unity. android project http://www.truiton.com/2015/05/capture-record-android-screen-using-mediaprojection-apis/ . http://answers.unity3d.com/questions/330809/integration-of-jar-file-using-jni.html and main things how can make whole project jar file. // how can package jni; public class testclass { private string a; public testclass() { a="hi all"; } public string func() { return a; } } if want make whole android project jar file, think need aar file, contain build files (the java files , res files), you can choose "android library" type in file > new module create new android library. if library set android library (i.e. uses apply plugin: 'com.android.library' statement in build.gradle file), output .aar when it's built. show in build/outputs/aar/ directory in module's directory.

matlab - Read images from sub folders and save into another folder -

i have code here. start_path = fullfile(matlabroot, '\toolbox\images\imdemos'); % ask user confirm or change. toplevelfolder = uigetdir(start_path); if toplevelfolder == 0 return; end % list of subfolders. allsubfolders = genpath(toplevelfolder); % parse cell array. remain = allsubfolders; listoffoldernames = {}; while true [singlesubfolder, remain] = strtok(remain, ';'); if isempty(singlesubfolder) break; end listoffoldernames = [listoffoldernames singlesubfolder]; end numberoffolders = length(listoffoldernames) % process image files in folders. k = 1 : numberoffolders % folder , print out. thisfolder = listoffoldernames{k}; fprintf('processing folder %s\n', thisfolder); % png files. filepattern = sprintf('%s/*.png', thisfolder); basefilenames = dir(filepattern); % add on tif files. filepattern = sprintf('%s/*.tif', thisfolder); basefilenames = [basefilenames; dir(filepatter...

python - Dask dataframe: Memory error with merge -

i'm playing github user data , trying create graph of people in same city. need use merge operation in dask. unfortunately github user base size 6m , seems merge operation causing resulting dataframe blow up. used following code import dask.dataframe dd gh = dd.read_hdf('data/github.hd5', '/github', chunksize=5000, columns=['id', 'city']).dropna() st = dd.read_hdf('data/github.hd5', '/github', chunksize=5000, columns=['id', 'city']).dropna() mrg = gh.merge(st, on='city').drop('city', axis=1) mrg['max'] = mrg.max(axis=1) mrg['min'] = mrg.min(axis=1) mrg.to_castra('github') i can merge on other criteria such name/username using code memoryerror when try , run above code. i have tried running using sync/multiprocessing , threaded schedulers. i'm trying on dell laptop i7 4core 8gb ram. shouldn't dask operation in chunked manner or getting wrong? writing code using...

Visual Studio 2010 C++: Hard coded strings leading to slow compile times -

so have file taking few minutes compile, , have narrowed down fact contains, roughly, few thousand lines of hard-coded strings being passed qt function. file auto generated source, strings represent enumeration values placed qt controls selection. example: method a mywidget->insertitem("my value 1, string representation of enum value 1"); mywidget->insertitem("my value 2, string representation of enum value 2"); mywidget->insertitem("my value 3, string representation of enum value 3"); ... i commented out section (around 1000 lines) of code, , replaced with: method b const qstring myvalues[] = { "my value 1, string representation of enum value 1", "my value 2, string representation of enum value 2", "my value 3, string representation of enum value 3", ... }; for( int item = 0; item < 1000; ++item ){ mywidget->insertitem(myvalues[item]); } method b compiled quicker. why? have tried op...

node.js - angular2-rc1 http.post not working correctly -

i creating 1 angular2 app in using http in service make post call mongodb . when making post call first time working fine i.e. entry inserted database correctly when sending data second time not getting inserted. if reloading page after first insertion working fine. i did debugging , found during second request req.body blank. here code: page.service.ts savepage(page: object) { this.headers.append('content-type', 'application/json'); let url = this.baseurl+'/pm/pages/'; let data={}; data["data"]=page; console.log(data); //this printing both times correctly //on second request data blank works correctly first time return this.http.post(url, json.stringify(data),{headers: this.headers}) .map((res: response) => res.json()).catch(this.handleerror); } here data in req.body shown in node services. first request : body:{ data:{ name: 'wtwetwet', desc: ...

sql - If no result then another query, can be combined to one query? -

phone_book +----+---------+-----------+--------------+ | id | key | code | value | +----+---------+-----------+--------------+ | 1 | max_val | 111 | reset | +----+------+--------------+--------------+ | 2 | min_val | 222 | set | +----+------+--------------+--------------+ | 3 | min_val | 0 | na | +----+---------+-----------+--------------+ key , code combination primary key. requirement: if key , code present, return value. if key present , code not exist return value of code 0. implementation: achieved using multiple query. syntax used jpql 1) "select param phone_book param upper(key)=:paramkey , code=:estcode"; if returns null, while shoot query 2) "select param phone_book param upper(key)=:paramkey , code=:o"; what looking : can achieve in 1 query, or better way ? thanks in advance. in oracle sql, below suffice need. no need write plsql this. select key, ...

java - How to make a phone number clickable to use in sms service in android? -

Image
i have phone number in xml layout , want make clickable such automatically entered in sms service , can send sms number. alinas.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginright="10dp" android:layout_margintop="5dp" android:layout_marginleft="10dp" android:background="#ffffff"> <imageview android:layout_width="160dp" android:layout_height="140dp" android:layout_marginleft="10dp" android:layout_margintop="10dp" android:background="@drawable/alina_sbakerycafe" android:id="@+id/imageview" /> <textview android:layout_w...

amazon web services - Spark Cluster on EC2 - "ssh-ready" state pops up for password -

i trying create spark cluster on ec2 following command (i referring apache documetnation ) ./spark-ec2 --key-pair=spark-cluster --identity-file=/users/abc/spark-cluster.pem --slaves=3 --region=us-west-1 --zone=us-west-1c --vpc-id=vpc-2e44594 --subnet-id=subnet-18447841 --spark-version=1.6.1 launch spark-cluster once fire above command master , slaves getting created once process reaches 'ssh-ready' state process keeps on waiting password below trace. have referred apache official documentation , many other documents/videos none of creations asked password. not sure whether missing something, pointer issue appreciated. creating security group spark-cluster-master creating security group spark-cluster-slaves searching existing cluster spark-cluster in region us-west-1... spark ami: ami-1a250d3e launching instances... launched 3 slaves in us-west-1c, regid = r-32249df4 launched master in us-west-1c, regid = r-5r426bar waiting aws propagate instance meta...

crash - A prompt for user input makes the app crashes -

i coded demo prompt user input, , crashes when click ok button on prompt dialog, giving me error log: 08-24 06:24:11.669 3275-3275/com.sano.tamer.prompuserinputdialog w/iinputconnectionwrapper: beginbatchedit on inactive inputconnection 08-24 06:24:11.669 3275-3275/com.sano.tamer.prompuserinputdialog w/iinputconnectionwrapper: endbatchedit on inactive inputconnection 08-24 06:24:19.019 3275-3275/com.sano.tamer.prompuserinputdialog d/androidruntime: shutting down vm 08-24 06:24:19.019 3275-3275/com.sano.tamer.prompuserinputdialog w/dalvikvm: threadid=1: thread exiting uncaught exception (group=0x5c8d4160) 08-24 06:24:19.039 3275-3275/com.sano.tamer.prompuserinputdialog e/androidruntime: fatal exception: main process: com.sano.tamer.prompuserinputdialog, pid: 3275 java.lang.nullpointerexception ...

How to update my database after editing the datagridview in c# -

i trying use clicking cell of datagridview2, value of clicked cell edit selected cell of datagridview1. but, adpter.update failed update edited data database. this code clicked cell value of datagridview2 edit selected cell value of datagridview1. private void dataview2_cellclick(object sender, datagridviewcelleventargs e) { int tempcellindex; int temprowindex; tempcellindex = dataview1.currentcell.columnindex; temprowindex = dataview1.currentcell.rowindex; cellchangecontext = dataview1.currentcell.value.tostring(); try { if (((btnflag != 2) && (btnflag != 3)) || (tempcellindex < 2)) return; dataview1.rows[temprowindex].cells[tempcellindex++].value = dataview2.rows[e.rowindex].cells[0].value; messagebox.show(dataview1.rows[temprowindex].cells[tempcellindex-1].val...

ejabberd mod_rest installation warning & crash report -

i've tried test mod_rest ejabberd. received 'ok' result warning : "warning: undefined callback function depends/2 (behaviour 'gen_mod')" during installation of module. when tried test mod_rest installed using rest client, there's crash report in log. ejabberd version : 16.08.23 url : http://localhost:5280/rest ejabberd.yml hosts: - "localhost" - "192.168.88.88" - "127.0.0.1" listen: - port: 5280 module: ejabberd_http request_handlers: "/websocket": ejabberd_http_ws "/rest": mod_rest web_admin: true http_bind: true captcha: true modules: mod_rest: {} installation info $/sbin/ejabberdctl module_install mod_rest src/mod_rest.erl:27: warning: undefined callback function depends/2 (behaviour 'gen_mod') ok ejabberd.log 2016-08-24 11:14:31.516 [error] <0.3683.0> crash report process <0.3683.0> 0 ne...

git can't commit to github -

$ git --version # git version git version 2.7.4 $ ls # 3 directories nim_game reverse_string sum_of_two_integers $ git status head detached origin/master nothing commit, working directory clean $ git log --oneline --decorate --graph --all # part info of commits * dad1c24 (head) add sum_of_two_integers * a7c4e04 (origin/master, origin/head, master) delete * 50d07fe delete * 1323f39 delete * 78a7dda modify file name * 60f58a5 nim_game * 456dfe3 add reverse_string.java i've commit sum_of_two_integers local repo, can't push github. how can fix this? you can shift new temp branch , integrate later in master. git commit -m "suitble message" git branch new-temp-branch git checkout master git merge new-temp-branch

javascript - How to nest components under a common header -

trying understand basics of react-router , i'm little overwhelmed choices , options. have react + redux app built under general guidelines provided teropa's awesome tutorial . essentially need common header component across routes; header, users can click button change main component (each view provides different data visualizations). container should link redux store, , let common data flow down whichever main component selected. strikes me super common need, cannot find solid example/tutorial >_< so far set follows: // index.jsx --> sets redux store , react-router routes const routes = <route> <route path="/" component={appcontainer} /> <indexroute to="/summary" /> <route path="summary" component={summary} /> <route path="users" component={users} /> <route path="devices" component={devices} /> </route>; reactdom.render( <provider store=...

how to open Genymotion in android -

Image
when tried open genymotion in android studio , unable start virtual device. virtualbox cannot start virtual device. find out cause of problem, start virtual device virtualbox. more information, check log files. please refer to: www.genymotion.com/faq/logs or said : according error log, :failed open/create internal network 'hostinterfacenetworking-virtualbox host-only ethernet adapter #2' (verr_supdrv_component_not_found). failed attach network lun (verr_supdrv_component_not_found). result code: e_fail (0x80004005) component: consolewrap interface: iconsole {872da645-4a9b-1727-bee2-5585105b9eed} open " network connections " control panel, select " virtualbox host-only network " right click , check if " virtualbox ndis6 bridged networking driver " enabled properties. if settings looks alright device doesn't starts, uninstall both of virtualbox , genymotion , reinstall new package contains bo...

Vagrant box update - issue -

i using vagrant 1.85 , @ point message teling me upgrade box version of ubuntu/trusty64 here message: ==> web02: newer version of box 'ubuntu/trusty64' available! ==> web02: have version '20160818.0.0'. latest version '20160822.0.0'. run ==> web02: `vagrant box update` update. so ran command sudo vagrant box update , message get: ==> web02: checking updates 'ubuntu/trusty64' web02: latest installed version: 20160818.0.0 web02: version constraints: web02: provider: virtualbox ==> web02: updating 'ubuntu/trusty64' provider 'virtualbox' version ==> web02: '20160818.0.0' '20160822.0.0'... ==> web02: loading metadata box 'https://atlas.hashicorp.com/ubuntu/trusty64' ==> web02: adding box 'ubuntu/trusty64' (v20160822.0.0) provider: virtualbox /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/version.rb:206:in `initialize': malformed version number string temp (argum...

nginx - php proxy remote file download -

i willing "proxy" file located on remote server (let's call server b) , force download visitor, server a. only server can access ressource on server b (ip address secured). ressource can weight few gigabytes. here code far: header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.$filename); header('content-transfer-encoding: chunked'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); header('pragma: public'); $stream = fopen('php://output', 'w'); $ch = curl_init($ruri); curl_setopt($ch, curlopt_readfunction, function($ch, $fd, $length) use ($stream) { return fwrite($stream, fread($fd, $length)); }); curl_exec($ch); curl_close($ch); it works partially. problem number 1: the visitor cannot browse page of website on server while downloading ressource. why? problem number 2: it not support pause or ...

c# - Database connection string -

i'm trying create , write database file. i don't know why connection string has turned such: data source=(localdb)\mssqllocaldb;attachdbfilename=c:\users\user\documents\data_test.mdf;integrated security=true;connect timeout=30 with connection string, error: error cs1009 unrecognized escape sequence xxx_database_test d:\folder\xxx_database_test\form1.cs so i've changed "/" "\": data source=(localdb)\mssqllocaldb;attachdbfilename=c:/users/user/documents/data_test.mdf;integrated security=true;connect timeout=30 error has gone, form loads, database empty, doesn't writes. can me figure out, i'm doing wrong here: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.data.sql; using system.data.sqlclient; namespace xxx_database_test { public partia...

SSIS: Accessing value of sensitive parameter for lookup -

i have package use sensitive environment variables. these variables passwords symmetric keys encrypt , decrypt data databases, , dynamic sql must used, must pass passwords parameters sql statements in components. in lookups, way if input columns, cannot derive columns values of sensitive parameters error, "accessing value of parameter variable sensitive parameter "password" not allowed. verify variable used , protects sensitive information." how use sensitive parameters within package itself? you can retrieve sensitive environment variables using script task. http://www.mattmasson.com/2012/01/retrieving-the-value-of-a-sensitive-parameter-in-a-script/

javascript - Adding keyboard arrow navigation to custom js -

i using wordpress , content looks this <div class="image-wrap"><a class="ajax-load-next" href="http://linktopage.com/2/"><img src="blah1.jpg" alt=""/></a></div><!--nextpage--> <div class="image-wrap"><a class="ajax-load-next" href="http://linktopage.com/3/"><img src="blahab.jpg" alt=""/></a></div><!--nextpage--> <div class="image-wrap"><a class="ajax-load-next" href="http://linktopage.com/4/"><img src="blahco.jpg" alt=""/></a></div><!--nextpage--> <div class="image-wrap"><a class="ajax-load-next" href="http://linktopage.com/5/"><img src="blahneat.jpg" alt=""/></a></div> i have custom javascript loads next image when user clicks on image. want add...

ecmascript 6 - Redux/ES6 - Object literal shorthand syntax for not working in connect function as expected -

while trying dispatch action myaction failing till rearranged es6 code syntactically appears same. it me not getting es6 object literal shorthand, or connect function doing under hood. ex 1 - not working myaction not being interpreted correctly shorthand return of object literal key , value name match. var mapdispatchtoprops = () => ({myaction}); mycomponent = connect( mapstatetoprops, mapdispatchtoprops )(mycomponent); ex 2 - working once added shorthand syntax myaction in connect function directly worked expected. mycomponent = connect( mapstatetoprops, {myobject} )(mycomponent); question: the first case expected function return object literal identical second. why not so. update accompany answer: the answer below correct - if want see video explaining go here https://egghead.io/lessons/javascript-redux-using-mapdispatchtoprops-shorthand-notation try like: const mapdispatchtoprops = (dispatch) => (return {somecallback: () =...

C++ read memory address with pointer+offset -

i trying read address of process should number 20. determined address located @ dll base offset + number offset of 10. using readprocessmemory(phandle, (void*)address, &number, sizeof(number), 0); to read specific address. question how correctly search address located @ "57b86f68" + 10 offset? you can read data handle if phandle process handle process_vm_read access granted: readprocessmemory(phandle, (void*)(0x57b86f68 + 0x10), &number, sizeof(number), 0); to proper access rights process handle check openprocess flags, process_vm_read should there. if still not working things more complex. should translate virtual address physical address , after direct access memory via kernel mode .

c - How to detect if printf will support %a? -

i need losslessly represent double precision float in string, , using sprintf(buf, "%la", x); this works fine on system, when built on mingw under windows, gives warning: unknown conversion type character 'a' in format i coded workaround case, have trouble detecting when should use workaround -- tried #if __stdc_version__ >= 199901l , seems gcc/mingw defines if doesn't support %a . there macro check? this doesn't answer question "how detect if printf support %a?" in general case, can modify compiler installation %a supported. first of , use mingw-w64 . up-to-date fork of mingw. original version of mingw not maintained , not fix bugs such experiencing (preferring blame microsoft or something). using mingw-w64 4.9.2 in windows 10, following code works me: #include <stdio.h> int main() { double x = 3.14; printf("%a\n", x); } producing 0x1.91eb85p+1 correct. still deferring microsoft runtime. ...

php - nothing is displayed due to a php error -

i started learning php , following tutorial until encountered error. with php way page displays nothing though worked in tutorial video. i found many questions similar mine couldn't apply code. anyway, i'm gonna cut chase that's code if ( !isset( $_post['fix_submit'] ) ) { $clickbait = strtolower $_post["clickbait_headline"]; // grab value textarea in $_post collection // make letters lowercase using strtolower() function // store in variable $fake = array( "doctors", "scientists", "shocked me", "won't believe", "will never believe", "hate" ); $replacefake = array( "so-called doctors", "so-called scientists", "was others", "w...

c - How to gracefully make a blocking pthread exit from the main thread? -

i have pthread indefinite polling on file descriptors, negative timeout parameter. from main thread, able indicate polling thread should exit. i did research , found following approaches: use pthread_cancel(): discouraged might lead unintended consequences of not clearing held resources or mutexes use variable flag , set in main thread. polling thread checks flag every iteration , if set, exits calling pthread_exit(). approach won't work because polling thread doesn't loop, blocks indefinitely, waiting on file descriptors. can suggest elegant solution problem ? thanks! asm you can create anonymous pipe pipe(2) , have file-descriptor-watching thread add read end polled file descriptors, exiting when file descriptor reports eof. main thread closes write end when wants thread exit.

parsing - PHP Parse/Syntax Errors; and How to solve them? -

Image
everyone runs syntax errors. experienced programmers make typos. newcomers it's part of learning process. however, it's easy interpret error messages such as: php parse error: syntax error, unexpected '{' in index.php on line 20 the unexpected symbol isn't real culprit. line number gives rough idea start looking. always @ code context . syntax mistake hides in mentioned or in previous code lines . compare code against syntax examples manual. while not every case matches other. yet there general steps solve syntax mistakes . references summarized common pitfalls: unexpected t_string unexpected t_variable unexpected '$varname' (t_variable) unexpected t_constant_encapsed_string unexpected t_encapsed_and_whitespace unexpected $end unexpected t_function … unexpected { unexpected } unexpected ( unexpected ) unexpected [ unexpected ] unexpected t_if unexpected t_foreach unexpected t_for unexpected t_while unexpected t_do ...

gradle - User.current() return null -

jenkins version: 2.7.1 issue: after using envinject plugin, build_user doesn't appear environment variable in build. using user.current().getid() in release plugin retrieve user id. plugin built using gradle. is there way can use logged in user. thanks in advance,

c++ - GLFW and GLEW - Missing .libs -

i've not been having best day today. new opengl , c++ libraries in general. don't know how link libraries msvs2015, decide tutorial on how link opengl libraries glfw , glew. i've read on 6 different tutorials on last 8 hours, , tell me link "lib" folder. folder empty in glew 2.0.0 download, , missing in glfw 3.2.1 download. confused, read online there supposed .lib files in there. searched both downloads "*.lib", thinking have been moved in update , found nothing ".lib" extension. did same ".dll" , nothing found. i'm downloading these libraries from: http://www.glfw.org/ http://glew.sourceforge.net/ am downloading wrong source or tutorials old(the tutorials found stated latest versions glew <1.9 , glfw ~2)? if need more information(setup, pictures...) ask. i needed download binaries system instead of source, or build cmake or other building program. oh well, guess learned :/

javascript - Cannot click on an element although it says it's clickable and I can getText() -

i new end end testing. using jasmine , protractor. issue cannot seem click on element should clickable. here html <span ng-click="togglesubpanel()" class="ng-binding">click add workspace</span> here things have tried this code prints out: is clickable? true browser.wait(ec.elementtobeclickable(element(by.css('span[ng-click="togglesubpanel()"]'))), 10000).then(function(isclickable){ console.log('is clickable? ' + isclickable); }); and code prints out: click add workspace element(by.css('span[ng-click="togglesubpanel()"]')).gettext().then(function(text) { console.log('contentbutton:' + text); }); so, know locating element , should clickable. when try: element(by.css('span[ng-click="togglesubpanel()"]')).click(); it doesn't seem anything. supposed open side panel. can manually click , works fine, won't work when automate it. not sure go he...

java - Changing a static variable with a static method -

this question has answer here: java - static variable , parameter same name 2 answers i'm trying change private static variable via static method , bluej says can't because variable i'm trying change (which declared static) non-static: public class playerinfo { private static string name = ""; //stores name of 'player' public static void setname(string name) { this.name = name; } } the variable called name , method called setname. know can this: playerinfo.name = (insert variable here) i don't above because wish have name variable in playerinfo declared private not meddled other classes easily. there no this inside static method. your best bet rename parameter of method: public class playerinfo { private static string name = ""; //stores name of 'player' public stati...

go - Golang stdin reads german umlauts wrong -

i'm germany use umlauts ä , ö , ü . golang doesn't read them correctly stdin. when execute simple program: package main import ( "bufio" "fmt" "os" ) func main() { { b, _, _ := bufio.newreader(os.stdin).readline() printbytes(b) } } func printbytes(bytes []byte) { _, b := range bytes { fmt.printf("0x%x ", b) } fmt.println() } i output: c:\dev\golang>go run test.go ä 0xe2 0x80 0x9e e2 80 9e isn't correct byte sequence ä in utf-8 ( this tool tells me it's "double low-9 quotation mark" -> „ ) , when print out i've read prints " . i've written small "hack" seems read characters correct: package main /* #include <stdio.h> #include <stdlib.h> char * getline(void) { char * line = malloc(100), * linep = line; size_t lenmax = 100, len = lenmax; int c; if(line == null) return null; ...