Posts

Showing posts from February, 2012

html - javascript text doesn't display -

i making simple program "find largest number". problem is, can't display output of answer. there wrong on code? thanks <html> <head> <title> short lab activity 1 </title> <style> #compute{ text-align: center; } </style> </head> <body> <div id="compute"> input 1st number: <input type="integer" id="num1" size="20"/> </br></br> input 2nd number: <input type="integer" id="num2" size="20"/> </br></br> answer: <input type="integer" id="answer" size="20"/> </div> <center><input type="button" id="find" value="find largest" onclick()="find()"/></center> <script type="text/javascript"> function find() { var numb1 = document.getelementbyid("num1").value; var numb2 = document.get

mysql - Wildcard query in PHP renders in SQL not in PHP -

i've been fiddling query in php day or 2 now. i'm using php 5.4 mysql 5.6. query below works fine in sql, doesn't work in php. i've googled answer , searched stack overflow wildcard answers in php , sql. quite thorn in side @ moment why not working. $search_string = preg_replace("/[^a-za-z0-9]/", " ", $_post['query']); $search_string = mysql_real_escape_string($search_string); $query = 'select * population location "'.$search_string.'%"'; let me know if need anymore information - i'm using phpmyadmin sql if helps. thanks edit: i'm trying wildcard search database of cities first 2 characters typed 'al' should produce autocomplete cities starting 'al'. if include both wildcard in front %'.$search_string.'%"'; autocomplete expected (finding matching characters ever might in string), if remove first % returns "no results." update: $query = 'select

c# - Messagepack, CSharp and Abstract Classes -

i have following code: _serializerresponse = messagepackserializer .get<abstractwebresponse>(); and try messagepackserializer! but gives me following error: this operation not supported because 'abstractwebresponse' cannot instanciated. yes, abstractwebresponse can not instaciated, it's child classes wich try serialize (and deserialize) can! , need so, because don't know type of class @ deserialization time! not transmited in data stream works?

c++ - Indy TCP/IP Server with Client using Chilkat Library -

im trying use client chilkat library since client has written in visual c++ , not borland c++(c++builder). connecting work try send string client server doesn't hit idtcpserverexecute function. possible use library client server using? if so, how? edit: got working client sends string server. handle client message this: unicodestring message = acontext->connection->socket->alldata(); instead of: unicodestring message = acontext->connection->socket->readln(); now there simliar option send response string server? if (idhttp->get ("http://*/index.php?option=com_bookpro&controller=customer&task=bpajaxlogin&username=" + sltokens->strings[1] + "&password=" + sltokens->strings[2] + "&product_id=" + class) == "true") { addlog("1"); char* response = "test"; acontext->connection->socke

maven - mvn release - svn error while tagging -

while trying execute release:prepare goal, following failure : ... [info] checking in modified poms... [info] svn commit directory: c:\dev\eclipse\workspace\xxx-parent [info] tagging release label xxx-parent-0.0.1... [info] svn checkout directory: c:\dev\eclipse\workspace\xxx-parent [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 16.603s [info] finished at: thu oct 22 14:43:44 cest 2015 [info] final memory: 10m/244m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project xxx-parent: unable tag scm [error] provider message: [error] svn tag failed. [error] command output: [error] svn: commit failed (details follow): [error] svn: commit blocked pre-commit hook (exit code 1) output: [error] message m

java - Tracking which HashMap values have been returned -

i have large hashmap<integer, myobject> located on server. need send string myobject across network client. problem can't figure out way keep track of myobject has been accessed send string . i'd client can repeatedly call server's function retrieve string , client can add string s arraylist . server indicate string s have been sent returning null . i can't send arraylist<string> of string s limited tiny message size due use of rsa encryption. the way i've thought of far keep static instance variable hashset<integer> holds of accessed myobject s. mean i'd have cross reference hashmap hashset every lookup. there must better way. this tiny example of map keeps track of keys did accessed. basicly has overriden get method of hashmap , additionaly adds key did accessed set import java.util.hashmap; import java.util.hashset; import java.util.set; public class trackmap<k, v> extends hashmap<k,v>{ priva

java - how to get some value from url using jstl -

i have 2 forms have same-url action , following form on page http://www.domain.com/pre-foo-url , is <form:form commandname="some" class="form" action="/app/same-url"> <form:input path="title"/> <input type="hidden" name="redirect" value="foo"/> <button>ok</button> </form:form> and other form on http://www.domain.com/bar/{id} <form:form commandname="some" class="form" action="/app/same-url"> <form:input path="tile"/> <input type="hidden" name="redirect" value="bar"/> <button>ok</button> </form:form> two methods in controller, 1 deciding redirect to @requestmapping(value = "/same-url", method = requestmethod.post) public string handleredirect(@requestparam("redirect") string redirect) { if (redirect.equals("foo

scala - How to use Flink streaming to process Data stream of Complex Protocols -

i'm using flink stream handling of data traffic log in 3g network (gprs tunnelling protocol) . , i'm having trouble in synthesis of information in user session of user. for example: how map start , end 1 session. don't know there flink streaming suited handle complex protocols that? p/s: capture data exchanging between sgsn , ggsn in 3g network (use gtp protocol gtp-c/u messages). session started when sgsn sends createreq (teid, seq, imsi, teid_dl,teid_data_dl) message , ggsn responses creatersp(teid_dl, seq, teid_ul, teid_data_ul) message. after session established, others gtp-c messages (ex: updatereq, deletereq) sent sgsn ggsn uses teid_ul , response message uses teid_dl, gtp- u message uses teid_data_ul (sgsn -> ggsn) , teid_data_dl (ggsn -> sgsn). gtp-u messages contain information such appid (facebook, twitter, web), url,... finally, want handle continuous log data stream , map gtp-c messages , gtp-u of same 1 user (imsi) make report. i've t

java - Including native c++ .so library in IntelliJ using JNI under Ubuntu -

i'm building shared library called java intellij using jni under ubuntu 14.04 x64. when calling .so file using system.loadlibrary("libtestjnilib") in intellij got following error: exception in thread "main" java.lang.unsatisfiedlinkerror: no libtestjnilib in java.library.path the intellij configurations determine path library: 1) run->edit configurations->vm options: -djava.library.path=/home/username/libs 2) in "project structure -> libraries ->native library locations" i added same path: /home/username/libs when testing using method mentioned below have correct path. string javalibpath = system.getproperty("java.library.path"); intellij's started under root. when you're loading shared library using system.loadlibrary() , following applies: loads system library specified libname argument. the manner in library name mapped actual system library system dependent. the best description

screen scraping - Cannot seem to scrape a div class tag in Node.js -

i'm new node.js. experience has been in java , vba. i'm trying scrape website friend , going until can't i’m after. <div class="gwt-label adc2x2-c-q adc2x2-b-nb adc2x2-b-zb">phone: +4576 102900</div> that tag has text. no attr or anything. yet cannot scrape using cheerio. if(!err && resp.statuscode == 200){ var $ = cheerio.load(body); var number = $('//tried here!').text(); console.log(number); this function played around $('.adc2x2').filter(function(i){ console.log("sdfs"); console.log (i); any suggestions appreciated. thanks all! i take answer cheerio documentation . $(".gwt-label").text(); if that's not working, maybe have many frame in page. possibility page renderer @ client side, angular pages, element search not in server html, created after page load. if that's true, use full browser phantomjs , not dom traverser tool cheerio.

Differences between lexical features and orthographic features in NLP? -

features used model training , testing. differences between lexical features , orthographic features in natural language processing? examples preferred. i not aware of such distinction, , of time when people talk lexical features talk using word itself, in contrast using other features, ie part-of-speech. here example of paper means "whole word orthograph" when lexical features one venture orthographic mean more abstract sequence of characters themselves, example whether sequence capitalized / titlecased / camelcased / etc. have useful , understood shape feature denomination that. as such, recommend distinguishing features this: lexical features : whole word, prefix/suffix (various lengths possible), stemmed word, lemmatized word shape features : uppercase, titlecase, camelcase, lowercase grammatical , syntactic features : pos, part of noun-phrase, head of verb phrase, complement of prepositional phrase, etc... this not exhaustive list of possible

java - Program done in netbeans and works fine but when cut and pasted to notepad and then complied will not work properly -

i created program in netbeans , options in program works when take code , pasted in notepad , compile @ cmd options work , dont why that. import java.io.filenotfoundexception; import java.util.scanner; /* should create @ least 2 java classes – titanic , testtitanic */ public class testtitanic{ public static void main(string[] args) throws filenotfoundexception { //use command line arguments send in name of titanic file string filename = args[0]; titanic titanic = new titanic(filename); //the application should keep track of elapsed time (in seconds) long starttime = system.currenttimemillis(); //a user-friendly , well-organized menu s string choices[] = {"total number of passengers on titanic", "total number of passengers perished on titanic", "total number of passengers survived sinking of titanic", "number of passengers survived sinking

postgresql - Pgbouncer timeouts -

i try use pgbouncer eliminate short network disconnects. did test, had clinet->pgbouncer->postgresql. when connection made client, disconnect network cable, if connect faster in ~15 sec still works. if not, totally disconnected, , pgbouncer logs: db/user@server.address.com:5432 closing because: server conn crashed? db/user@127.0.0.1:49837 closing because: server conn crashed? db/user@127.0.0.1:49837 pooler error: server conn crashed? how can control timeout? ps: in pglib on client side, in connectionstring timeout set 60 sec. lukas i try adjust option server_connect_timeout. according doc - if connection , login won’t finish in amount of time, connection closed. default 15 sec. anyway, source pgbouncer tuning https://pgbouncer.github.io/config.html .

php - Add-to-cart coding is that correct with form? -

<?php session_start(); include("conn.php"); $action = $_post['action']; $user = $_session['username']; if(empty($user)){ echo"<script>alert('please log in!');window.location='log in.php';</script>"; exit; } if($action == 'add'){ $cart_arr = array( 'foodid'=>$_post['foodid'], 'order_num'=>$_post['order_num'], 'food_type'=>$_post['food_type'], ); $cart_session = $_session['cart_'.$user]; if(empty($cart_session)){ $cart_session[$cart_arr['foodid']] = $cart_arr; } else if(!empty($cart_session[$cart_arr['foodid']])){ $cart_session[$cart_arr['foodid']]['order_num']+=$cart_arr['order_num']; } else { echo $cart_session[$cart_arr['foodid']] = $cart_arr; } $_session['cart_'.$user] = $cart_session; } else if($action == 'clear'){ $_session[

unique - PHP's uniqid function with more entropy -

question: when using php's uniqid function more entropy set 15th character period (dot) on runs. 15th character guaranteed dot? follow-up: thanks @fuzzytree answer. i investigated bit further, interested php_combined_lcg() function generates random number between 0 , 1 (such 0.862215793). reason there number before decimal because multiplied 10 (which becomes 8.62215793 in example). prevents there being 0 14th character. yes 15th character guaranteed dot if more_entropy set true. from php source uniqid if (more_entropy) { uniqid = strpprintf(0, "%s%08x%05x%.8f", prefix, sec, usec, php_combined_lcg() * 10); ^ hard coded dot here preceeded 14 characters } else { uniqid = strpprintf(0, "%s%08x%05x", prefix, sec, usec); }

ios - Get MySQL data and store it to a PHP array based on the data array returned by another MySQL select operation -

Image
i creating ios application , facing difficulty web service portion, written in php. trying achieve is, sending push notification devices. have completed part. however, need mechanism differentiate between notifications has been delivered phone , haven't. use feedback web-service purpose , working. have mysql table following structure. based on status bit of each notification, collect notifications corresponding each device token, , make array , send device. here facing difficulty. i have 2 tables. this table stores notification id, device token , status of notification. looking @ table, script can determine whether notification has been delivered particular device or not. script collects notification ids has been undelivered particular device id , uses following apps_notif table fetch undelivered notifications. table structure below. my php/mysql script follows. $fecthnotif=mysqli_query($mysqli,"select notif_id notif_status notif_status=0 , dev_token='$dev

opengl - glfw3 - This draw call is entierly out of view frustrum -

Image
i facing strange issue small opengl 4.4 application. before begin here basics. fragment shader #version 440 out vec4 color; void main(void) { color = vec4(1.0, 0.0, 0.0, 1.0); } vertex shader #version 440 layout(location = 0) in vec2 p; void main(void) { gl_position = vec4(p, 0.0, 1.0); } vbo gluint vbo; glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); constexpr std::array<glfloat, 12> vertex = { -1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, -1.0f, 0.0f, -1.0f }; glbufferdata(gl_array_buffer, sizeof(vertex[0]) * vertex.size(), vertex.data(), gl_static_draw); vao gluint vao; glgenvertexarrays(1, &vao); glbindvertexarray(vao); glvertexattribpointer(0, 2, gl_float, gl_false, 0, null); drawing command glclear(gl_color_buffer_bit); gldrawarrays(gl_triangles, 0, vertex.size()); based on above expecting see red box in lower left hand side of screen. what have tried

excel - Import/export named ranges and their values to and from workbook to .csv -

i have .csv 2 columns: cola has named ranges , colb has values. now need import values .csv , assign them named ranges in workbook present in multiple sheets. need export same in same manner. i.e. workbook has named ranges , associated values. is there way export in same format can use import them later? for import modified code provided answer below still unsuccessful: option explicit sub impdata() 'this import data csv xlsm dim mycsv workbook dim filename string dim curfilename string dim myrange range dim mycell range dim x long dim y workbook curfilename = thisworkbook.name filename = application.getopenfilename set y = workbooks(curfilename) application.screenupdating = false set mycsv = workbooks.open(filename) set myrange = mycsv.worksheets("import").range("b2:b7") x = 1 each mycell in myrange.cells range(thisworkbook.names(mycell.offset(, -1).value)).cells(x) = mycell.value 'method "range_of_object&

c++ - The sample code I got from cpp-netlib won't compile -

// copyright 2009 (c) tarro, inc. // copyright 2009 (c) dean michael berris <mikhailberis@gmail.com> // distributed under boost software license, version 1.0. // (see accompanying file license_1_0.txt or copy @ // http://www.boost.org/license_1_0.txt) // //[ hello_world_server_main /*` part of 'hello world' example. it's used demonstrate how easy set http server. in example create request handler , run server. */ #include <boost/network/protocol/http/server.hpp> #include <iostream> namespace http = boost::network::http; /*<< defines server. >>*/ struct hello_world; typedef http::server<hello_world> server; /*<< defines request handler. it's class defines 2 functions, `operator()` , `log()` >>*/ struct hello_world { /*<< function handles incoming request. >>*/ void operator() (server::request const &request, server::response &response) { server

javascript - Angular can not call google API service -

i trying use google place service $http({ method : 'get', url : 'https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels in us&key=xxxxxxxxx&callback=json_callback' }) .success(function(data) { console.log('data' + data); }) .error(function(data) { }); api call ok 200. on console gives error xmlhttprequest cannot load https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels%20in%20us&key=xxxxu&callback=json_callback . no 'access-control-allow-origin' header present on requested resource. origin ' https://192.168.1.85:8443 ' therefore not allowed access. i change method:jsonp returns data syntax error : required. server tomcat 7. using cors filtercom.thetransactioncompany.cors.corsfilter . try changing $http() $http.jsonp(url).succes....

java - Launching NetLogo experiments headless from bash script -

i using line launch experiments bash: java -xmx50g -dfile.encoding=utf-8 -cp netlogo.jar org.nlogo.headless.main --model mymodel.nlogo --setup-file experiments/experiments.xml i trying wrap bash script, it's not working: #!/bin/sh model="mymodel.nlogo" setup="experiments/experiments.xml" java -xmx50g -dfile.encoding=utf-8 -cp netlogo.jar org.nlogo.headless.main --model $model --setup-file $setup i error: exception in thread "main" org.xml.sax.saxparseexception; systemid: jar:file:/users/digitaldust/netbeansprojects/jago2/netlogo.jar!/system/; linenumber: 38; columnnumber: 49; il nome entità deve seguire immediatamente '&' nel riferimento di entità. @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:203) @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.fatalerror(errorhandlerwrapper.java:177) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.repor

Unable to break out of For Loop in Java -

i beginner , making small program practice have learnt. writing code check grade of student. this code : import java.util.*; public class grader { public static void main(string[] args) { string studentname; int rollno = 0; scanner inputter = new scanner(system.in); system.out.println("please enter roll number of student: "); rollno = inputter.nextint(); system.out.println("thank you. now, please enter student's name: " ); studentname = inputter.next(); for(int i=0; ; i++){ system.out.println("please enter valid examination type, i.e fa or sa: "); string examtype = inputter.next(); examtype = examtype.touppercase(); if(examtype == "fa" || examtype == "sa"){ break; } } } } the problem facing though enter valid examtype, loop doesn't break. you need use string.equals() . scanner.next() returns string . using ==

jquery - Which is better for performance, elements in DOM or in Javascript object? -

in terms of performance, better have 20 elements (with children) in dom tree or stored in javascript object? case 1: <html> <body> <div id='el1'> <span>...</span> ... </div> <div id='el2'> <p>...</p> ... </div> <div id='el3'> <img src="" alt="" /> <br/> </div> <div id='el4'> <section></section> ... </div> ... </body> </html> case 2: var obj = {}; obj.el1 = $("<div id='el1'><span>...</span>...</div>"); obj.el2 = $("<div id='el1'><p>...</p>...</div>"); obj.el3 = $("<div id='el1'><img src="" alt=&q

semantic markup - Current usefulness of semantically correct HTML -

i'm working on new website, , i'm trying decide how want balance need semantic correctness, other important stuff, development time. know semantics supposed important seo, , accessibility blind people. , important me, , shouldn't take time. i'll design them in, beginning. anyway, question is, else semantic correctness currently useful for? if there's else may consider worthwhile, i'd rather spend little time build in, wait until later, when may more difficult. also, know there lot of future possibilities. good, , not (i've seen terminator movies:). i'll wait , see happens those. edit: should have mentioned supporting old browsers important project, being semantically correct won't easy. since haven't done lot of browser programming. i did more research, can answer own question. other making sure site accessible disabled people , search engines, there isn't important semantic correctness, project. , think search engines , s

javascript - who can give me some suggestion on DeviceOne? -

recently, want develop android , ios app,but don't want use phonegap,i heard deviceone product can cross platform javascript , component ui native ui, ever used deviceone? http://www.deviceone.net look @ sencha touch: www.sencha.com . it's full javascript framework.

javascript - AngularJS UI Router -> Could not resolve when using ui-sref -

i have setup json file ui-routes in , works. but having trouble using link. have manged use when comes using following state: { "name": "home", "url": "^/home", "abstract": false, "parent": "root", "views": [{ "name": "container@", "templateurl": "/pages/home/index.html", "controller": "homectrl" }] }, to access use: <a ui-sref="home">home</a> and works perfectly. but problem comes when try , 'ui-sref' parameters. example if , state: { "name": "approach:module:section", "url": "^/approach/:module/:section", "controller": "approachctrl", "abstract": true, "parent": "root", "views": [{ "name": "container@",

c++ - Encrypt data with RSA public key in Java and decrypt in Crypto++ -

i'm trying encrypt data rsa public key in java , decrypt in crypto++. results in error: "rsa/eme-pkcs1-v1_5: ciphertext length of 24 doesn't match required length of 128 key" what doing wrong? java : string cipher = encryption.encryptstrrsa(txt, pubkeyk); public static string encryptstrrsa(string str, publickey pubkey) throws nosuchalgorithmexception, nosuchpaddingexception, invalidkeyexception, illegalblocksizeexception, badpaddingexception, nosuchproviderexception { cipher cipher = cipher.getinstance("rsa/none/pkcs1padding", "bc"); cipher.init(cipher.encrypt_mode, pubkey); byte[] encryptedaeskey = cipher.dofinal(str.getbytes()); string cipherstr = new string(encryptedaeskey); system.out.println(cipherstr); return cipherstr; } public static publickey strtopublickey(string key64) throws generalsecurityexception { byte[] data = base64.getdecoder().decode(key64); x509encodedkeyspec spec = n

spring-restdocs is not recognizing apply() -

i trying generate rest api documentation based on spring-restdocs in following code getting compile time error @ apply() the method apply(restdocumentationmockmvcconfigurer) undefined type defaultmockmvcbuilder @contextconfiguration(locations = { "classpath:/testapplicationrestservice.xml" }) @runwith(springjunit4classrunner.class) @webappconfiguration public class customercontrollertest { @rule public final restdocumentation restdocumentation = new restdocumentation( "build/generated-snippets"); @autowired private webapplicationcontext context; private mockmvc mockmvc; @before public void setup() { this.mockmvc = mockmvcbuilders.webappcontextsetup(this.context) .apply(documentationconfiguration(this.restdocumentation)) .build(); } } spring rest docs requires spring franework 4.1 or later. apply method new in spring framework 4.1. compile failure means ha

How to ssh to a wordpress site -

i'm having trouble logging wordpress wp-admin page. when go http://example.com/wp-admin redirects secure https https://example.com/wp-admin.php , says "web page not available". wordpress hosting site, can't ftp it. trying ssh using wordpress username , password isn't working either. ssh user@example.com password: password results in: "permission denied, please try again." appreciated. (comments converted answer) wordpress.com doesn't support direct access ssh or ftp . also, far can tell, support https when using subdomains of wordpress.com, not custom domains. however, if you're looking way https in front of site host doesn't support it, 1 alternative put reverse proxy such cloudflare in front of site. cloudflare offers free tls (ssl) termination users connect cloudflare's server securely, cloudflare decrypt information , transparently pass on origin server.

linux - Shell script cronjob -

i need shell script run 2 .sh files in directory: /opt/tomcat-latest/bin #!/bin/sh cd /opt/tomcat-latest/bin ./shutdown.sh ./startup.sh would code achieve goal? if how make on cron job runs every 2 hours? have linux centos vps , directadmin admin panel. i think easiest solution run directly commands full path cron, instead of using sh script. something in crontab work : * */2 * * * /opt/tomcat-latest/bin/shutdown.sh && /opt/tomcat-latest/bin/startup.sh that run every 2 hours can edit crontab crontab -e , check crontab syntax here : https://fr.wikipedia.org/wiki/crontab

vbscript - vb script single line mail merge -

i have peculiar need. need able read single line csv file, merge data mailmerge document, save document unique name, proceed next line, rinse , repeat. i complete unaware of how use/merge single line of data extracted file data source mail merge. can give me insight odoc.mailmerge... line below should like? i know open , closes in code below isn't efficient, through point across. can work rest out. need merge line. datafile = "test.txt" docfile = "mydoc.doc" listfile = fso.opentextfile(datafile).readall listlines = split(listfile, vbcrlf) each line in listlines wscript.echo line 'my stuff dim objword, odoc, wdname set objword = createobject("word.application") wdname = "d:\my documents\docfile" set odoc = objword.documents.open (wdname) objword.visible = true odoc.mailmerge.opendatasource ?line?, , ,true, , , , , , , , , "idontknowwhatgoeshere" odoc.mailmerge.execute odoc.printout

php - My array is look like as result array and i want it like r1 and r2 -

i have kind of array:- $result=array([city] => xyz [name] => array( [0] => xyz1 [1] => xyz2 ) [email] => array ( [0] => xyz1@gmail.com [1] => xyz2@gmail.com ) [phone] => array ( [0] => 23423423-1 [1] => 23423423-2 ) [address] => array ( [0] => xyz1 [1] => xyz2 ) [dis] => xyz); and want $r1=array ( [city] => xyz [name] => xyz1 [email] => xyz1@gmail.com [phone] => 23423423-1 [address] => xyz1 [dis] => xyz ); $r2=array ([city] => xyz [name] => xyz2 [email] => xyz2@gmail.com [phone] => 23423423-2 [address] => xyz2 [city] => xyz ); this assumes have more 1 array process , sorts elements new, formatted array. <?php $results = array( array( 'city' => 'xyz', 'name' => array( 'xyz1', 'xyz2' ), 'email' => array( 'xyz1@gmail.com', 'xyz2@gmail.com' ), 'phone' => array( '

Temp files in Google Cloud Dataflow -

i'm trying write temporary files on workers executing dataflow jobs, seems files getting deleted while job still running. if ssh running vm, i'm able execute exact same file-generating command , files not destroyed -- perhaps cleanup happens dataflow runner user only. is possible use temp files or platform limitation? specifically, i'm attempting write location returned files.createtempdir() , /tmp/someidentifier . edit: not sure happening when posted, files.createtempdirectory() works... we make no explicit guarantee lifetime of files write local disk. that said, writing temporary file inside processelement work. can write , read within same processelement. similarly, files created in dofn.startbundle visible in processelement , finishbundle. you should avoid writing /dataflow/logs/taskrunner/harness . writing files there might conflict dataflow's logging. encourage use standard java apis file.createtempfile() , file.createtempdirectory() instea

Upload file from android to server using OkHttp and PHP -

i make android uploader pand php script. can not upload csv file android local folder. php sclipt can work alone. error undefined index:upfile in /example/html/php/ uploadfile.php online 9 do not choice file public class mainactivity extends activity { textview outputtext; button senddata; edittext edtuser, edtpass; final string url = "http://example/php/uploadfile.php"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); outputtext = (textview) findviewbyid(r.id.textview1); outputtext.setmovementmethod(new scrollingmovementmethod()); senddata = (button) findviewbyid(r.id.button1); edtuser = (edittext) findviewbyid(r.id.edittext1); edtpass = (edittext) findviewbyid(r.id.edittext2); string text = "tue oct 06 18:56:24 jst 2015,tue oct 06 18:57:12 jst 2015,35.4708118,139.6251623\n"; try { outputstream out = openfi

c# - Determine if an object is an array of any type, and access the array length -

i have overridden method has object parameter. determining if array, , want determine length: public override bool isvalid(object value) { type type = value.gettype(); if (type.isarray) { return ((object[]) value).length > 0; } else { return false; } } the problem if value int[] , errors when try cast object[] . there way handle cast work type of array? cast value base system.array class: return ((array) value).length > 0 by using as operator, can simplify code further: public static bool isvalid(object value) { array array = value array; return array != null && array.length > 0; } note: return true multidimensional arrays such new int[10, 10] . if want return false in case, add check array.rank == 1 .

powershell - Find Available Drive Letter and Change -

i trying create powershell script find available drive letter, map network drive, , change mapped drive. found following mapped \\server\share d: drive: $drive = new-psdrive -name $(for($j=67;gdr($d=[char]$j++)2>0){}$d) -psprovider filesystem -root \\server\share\ i can manually enter d: , how can change in script? thinking along lines of this: $drive = $drive.trim(":") but statement above throws following error: method invocation failed because [system.management.automation.psdriveinfo] not contain method named 'trim'. @ line:1 char:1 + $drive = $drive.trim(":") + ~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [], runtimeexception + fullyqualifiederrorid : methodnotfound you check list of potential drive letters against list of assigned drive letters , use first unused one: $used = get-psdrive | select-object -expand name | where-object { $_.length -eq 1 } $drive = 90..65 | foreach-o

javascript - Communication between controller fail on page reload -

i have been using below reference sharing $scope between controllers. use controller1 in xxx.html , controller2 in yyy.html. this worked fine until 1 thing have happened. when reloaded page, service not read previous controller's $scope. used controller's in single page, case have different pages controller1 , controller2. can 1 give me solution overcome this? reference service: app.factory('scopes', function ($rootscope) { var mem = {}; return { store: function (key, value) { $rootscope.$emit('scope.stored', key); mem[key] = value; }, get: function (key) { return mem[key]; } }; }); this lead more work here. 1 : first thing if reloading page ( browser reload ) using angular wrong way . 2 : angular should single page application. 3 : here need sharing data after $state change (may be) if using $state routes not reload change pages , urls. 4: in 3rd c

javascript - Adding Comment in textarea and displaying text with Edit and delete buttons -

i have textarea save , cancel buttons updating textarea text in mysql db. initially mysql db id text 1 null if enter text in textarea i'm updating mysql db text entered value i'm able achieve requirment once entered text in textarea should update db , text value should display edit , delete buttons. on clicking edit button should open textarea save , cancel buttons. can aid me out how achieve thanks! http://jsfiddle.net/a32yjx0k/ html <div id="b_news"> <form method="post" action=""> </div> <div class="breaking_news_content"> <div> <form method="post" action=""> <div> <div> <textarea id="breaking_news_text" class="breaking_news_text" rows="6" cols="50" placeholder="add text here..." required></textarea>

sftp - Spring Integration: Get rid of code duplication for setting up beans -

for sftp client project, using spring integration. have different clients , have connect different sftp servers, but, of logic same, have abstracted them out abstractsftpendpoint. each client-specific class implements getclientid(), used abstractsftpendpoint client-specific details sftp credentials. however, entire logic same clients, still having implement specific classes each client. because need separate "messagesource" each client. how can rid of duplication? public class sftpendpointforclientaaaa extends abstractsftpendpoint { public string getclientid(){ return "clientaaaa"; } @bean(name = "channelforclientaaaa") public queuechannel inputfilechannel() { return super.inputfilechannel(); } @serviceactivator(inputchannel = "channelforclientaaaa", poller = @poller(fixeddelay = "500")) public void serviceactivator(message message) { super.serviceactivator(message); }