Posts

Showing posts from August, 2013

plot - R - How to display values of a ordered factor on axis with ggplot2 -

Image
i display values of ordered factor on barplot ggplot2 (ideally, otherwise standard plot). i have ordered factor one: "how satisfied exercises :" - absolutely not satisfied => value 1 - not satisfied => value 2 - satisfied => value 3 - satisfied => value 4 i want plot barplot mean , values "absolutely not satisfied" -> "very satisfied" on axis instead 1 -> 4. is possible ggplot2 ? in point of view, main difficulty plot mean of factor , not distribution of values (actually plot made transformation of ordered factor integer). here result of dput on dataset. structure(c(3l, 2l, 3l, 2l, 2l, 3l, 2l, na, 2l, 3l, 4l, 2l, 1l ), .label = c("pas du tout satisfait", "plutôt pas satisfait", "plutôt satisfait", "très satisfait"), class = c("ordered", "factor")) and here example of barplot (without values on axis...): the code following. toto <- structu...

Using same Android-sdk in Linux and Windows -

hello possible share android sdk both linux , windows' android studio ? do mean sharing between dual boot on same pc? if no since windows can't access linux files. if mean want download same version both yes why wouldn't able ?

r - Rmd file opens instead of HTML in browser -

Image
i have file test1.rmd. on clicking knit internal window opens. when click "open in browser",it shows output in .rmd , not in .html. when include output: html_document, display messed up. how can keep same view/display when converting html rmd? this correct behaviour when use shiny in rmarkdown document. rstudio starts temporary shiny server serves rmd file users can interact it. shiny elements need run shiny server, cannot contained in pure html file.

C++: reference wrappers and printf -

i have std::vector of std::reference_wrapper objects want print printf (without cout); now, if write int a=5; std::reference_wrapper<int> b=a; printf("%i\n\n",b); i nosense number (i think address of a ); obtain value have do printf("%i\n\n",b.get()); is there way have automatic call .get() function in printf (e.g. different % specificator print me reference_wrapper content ) can make generalized function works both std::reference_wrapper<type> , type ? you want @ least consider using c++ io library instead of legacy c functions. being said, can write wrapper around printf provide unwrapping of reference wrappers: template<typename... params> void my_printf(char const* fmt, params&&... ps) { printf(fmt, unwrap(std::forward<params>(ps))...); } with unwrap implemented follows: template<typename t> decltype(auto) unwrap_impl(t&& t, std::false_type){ return std::forward<t>(t);...

java - File content redirection to args doesn't works -

i testing little piece of code need implement in java school project. public class prova { public static void main(string[] args){ system.out.println(args.length); for(int = 0; < args.length; i++){ system.out.print(args[i]); } system.out.print("\nend!"); } } when type in console java prova < test.dot while content of test.dot file is: digraph g1 { c -> e; -> e; -> f; f -> b; g; } i this: c:\users\lorenzo\workspace\progetto_asd\bin>java prova < test.dot 0 end! i tryed java prova > output.txt see if pipe worked , (i same above in file). if try type test.dot get: c:\users\lorenzo\workspace\progetto_asd\bin>type test.dot digraph g1 { c -> e; -> e; -> f; f -> b; g; } as expect. i don't know what's wrong i'm doing (i'm using windows way). you mixing 2 different approaches: args you should run program java prova arg1 arg2 ... argn : ...

Regarding id() in python -

this question has answer here: “is” operator behaves unexpectedly integers 10 answers i have doubt regarding id() in python. >>> x=2 >>> y=2 >>> id(x) 94407182328128 >>> id(y) 94407182328128 but if same list,i different id's >>> a=[1,2,3] >>> b=[1,2,3] >>> id(a) 139700617222048 >>> id(b) 139700617135528 why so? why int type id's same , why different lists? thanks in advance. python doesn’t have variables c. in c variable not name, set of bits; variable exists somewhere in memory. in python variables tags attached objects. example: tags exaple image regarding list part: you created new reference . more details illustrated in brilliant video: https://www.youtube.com/watch?v=enlaee1c7x4

Java Slick2d rectangle collision detection strange behavior -

i want make slick2d java game , encountered problem not solve in last couple of hours. i've looked many other posts non of fits problem. the collission detection works fine in 9/10 cases. everytime intersects rectangle moves according code below , shown in picture1 . if near possble edge edges seem overlap shown here picture2 . if go detects intersection , moves down. if go down fine. if go left or right nothing happens. happens if corners of rectangles intersects. if go , left or right @ same time goes in wrong direction sometimes. seems if go , sideways @ same time detects collision , moves in opposite direction until reaches point intersects corners , stops again. point after detecting , collision never moves more he has moves foreward before. further shouldn't detect intersection of rectangles , move again why doesn't detect intersection @ edge shown in picture2? hope has ideas why happening. problem occures on every side. here code. public class player extends...

lambda - Java Method reference not expected here -

how chain method references instances java 8? example: collections.sort(civs,comparator.comparing(civilization::getstrategy.getstrateglevel)); getstrategy of civilization instance returns strategy object instance has instance method getstrategylevel . why doesn't comparator.comparing method return comparator it's functional interface implemented lambda expression? in case, should use lambda, can't apply method reference directly: collections.sort(civs, collectors.comparing(c -> c.getstrategy().getstrateglevel())); though, there way use method reference here. assuming have class like class civilizationutils { public static integer getkeyextractor(civilization c) { return c.getstrategy().getstrateglevel(); } } the issue solved like collections.sort(civs, collectors.comparing(civilizationutils::getkeyextractor));

c# - Is there a way to check if RDP connection possible? -

i have home server, , want create manager wake computer , check if rdp connect possible. i accomplished wol behavior, there problem checking if computer os turned on , ready rdp connections. is possible 'ping' rdp? you can check if can connect rdp port (by default 3389): static bool isrdpavailable(string host) { try { using (new tcpclient(host, 3389)) { return true; } } catch { return false; } } usage: bool available = isrdpavailable("your_server_ip_or_name");

wordpress - Amazon Linux AMI: NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream -

i receive nginx error in error log like: [error] 4257#0: *3470 upstream timed out (110: connection timed out) while reading response header upstream, client 120.x.x.x this wordpress webserver running aws , using nginx reverse proxy. here conf file: user nginx nginx; worker_processes 2; worker_rlimit_nofile 10240; include /etc/nginx/modules.d/*.conf; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 8192; use epoll; accept_mutex_delay 100ms; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr $server_name $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time'; log_format backend '$remote_addr $server_name $remote_user [$time_local] "$re...

java - Spring does not discover @RequestMapping annotation for a new context at runtime -

i tried develop plugin system spring boot web application. application deployed on tomcat server using root context path. plugin system allows me load specially prepared jar files @ runtime. system should able undeploy plugins @ runtime. jars contained inside plugin folder in current working dir. wanted every plugin have it's own spring context operate with. dependency injection working expected spring not discover @requestmapping annotation plugin context. question is: how can make spring discover @requestmapping annotations plugins (at runtime)? i using latest spring boot version , following application.yml: # server server: error: whitelabel: enabled: true session: persistent: true tomcat: uri-encoding: utf-8 # spring spring: application: name: plugins mvc: favicon: enabled: false favicon: enabled: false thymeleaf: encoding: utf-8 # logging logging: file: application.log level.: error this code loads plugin: a...

How do I break an input into individual characters in python? -

this question has answer here: convert string (without separator) list 9 answers i able take input a-z or 0-9 , of indefinite quantity of characters , put them list. here example of code envisioning. number = input() num_list = break_string(number) print num_list use list comprehension when need turn iterable (string in case) list: print([c c in "hello"]) ['h' 'e' 'l' 'l' 'o'] each character considered element of string. part before for what's put new list. in case, it's taking character , putting list unchanged.

codenameone - SpanButton client property throws NullPointerException -

i trying client property on spanbutton when clicked. throwing nullpointerexception. i tested same code regular button , works fine. believe there bug there. here how can recreate issue barebone project: form hi = new form("hi world"); button button = new button("button"); button.putclientproperty("id", 100); spanbutton spanbutton = new spanbutton("spanbutton"); spanbutton.putclientproperty("id", 200); button.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent evt) { int id = (int) evt.getcomponent().getclientproperty("id"); system.out.println("standard button action listener: id = " + id); } }); spanbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent evt) { int id = (int) evt.getcomponent().getclientproperty(...

Parse public facebook posts with beautifulsoup / python -

i try parse facebook posts made specific topic (like company or product). example posts here https://www.facebook.com/search/latest/?q=facebook i can login facebook (with python) correctly , able source code of page contains posts looking for. after manual code review found out wanted following: <div class="_5pbx usercontent" data-ft="&#123;&quot;tn&quot;:&quot;k&quot;&#125;"> <p>here text of post need </p> </div> so started beautifulsoup , following code: soup = beautifulsoup(pagesourcecode.content, 'html.parser') msg in soup.find_all('div'): print (msg.get('class') as result ... [u'hidden_elem'] does have experience in scraping facebook posts? need myself , education purposes following code should work soup = beautifulsoup(pagesourcecode.content, 'html.parser') divs = soup.find_all('div', class_="_5pbx usercontent") d...

javascript - Drag & Drop HTML with Restictions -

i'm trying without success create html5 / bootstrap based drag , drop facility restrictions can preset. the best way of explaining food menu creator. want have list of ingredients on left side in 3 column div , website user can drag items list of preset ingredients , drop them menu calendar shown on right of page in 9 col div. i can using following script - http://mdn.github.io/drag-and-drop/copy-move-datatransfer.html javascript: function dragstart_handler(ev) { console.log("dragstart"); // change source element's background color signify drag has started ev.currenttarget.style.border = "dashed"; // add id of drag source element drag data payload // available when drop event fired ev.datatransfer.setdata("text", ev.target.id); // tell browser both copy , move possible ev.effectallowed = "copymove"; } function dragover_handler(ev) { console.log("dragover"); // change target element's border signify drag...

ios - Can I reload my React Native application using a command? -

i'm testing on older iphone , have shake phone madman dev menu. there command can send through bridge reload or bring dev menu? i'm aware of live reload that's not want. for example on android device can send adb shell input keyevent 82 simulate shake event , bring dev menu. there no way open dev menu without shaking phone. here issue related problem: https://github.com/facebook/react-native/issues/10191 . nevertheless can try code inside iphone emulator , open dev menu using ⌃⌘z . best regards.

javascript - Change background color when aria-valuenow="off" -

i have following code: <a class="ui-slider-handle ui-slider-handle-snapping ui-btn ui-shadow" aria-valuenow="off" style="left:0%"> i want change background color when aria-valuenow="on" or style="left:100%" . possible? try adding following wherever you're triggering changing aria-value: if($('.ui-slider').attr('aria-valuenow')=="on"){ $(body).css("background-color","red"); } else { $(body).css("background-color","none"); } i'd recommend using true , false rather on , off standard practice. should allow instead: if($('.ui-slider').attr('aria-valuenow')){ $(body).css("background-color","red"); } else { $(body).css("background-color","none"); }

Updating Date & Time into MySQL via python -

i trying update date & time columns in mysqldb database. have 2 columns name date1 , time1 , both type text. python code import mysqldb import datetime db = mysqldb.connect('localhost','admin','admin','dbname') cur = db.cursor() = datetime.datetime.strftime(datetime.date.today(),'%y-%m-%d')) cur.execute('update data set date1={0}'.format(a)) db.commit() but after code executes see value in column set '2000'. i tried several datetypes in mysql - varchar2, date, datetime show '2000' or '0000-00-00'. when run sql query directly works fine: update `data` set `date1`='22-04-1994' i googled error , tried this: a = datetime.date.today() = a.isoformat() but shows in database 2000. edit: tried using {0} instead of +a. still coming 2000. i using mysql version 5.5.51-38.2 think query does, since concatenate strings. can print out. since don't put date quotes considered calcul...

javascript - Toggling input value angularjs -

i'm creating grocery list app in angularjs. , here problem. codepen while pick item list of categories highlight category icons, not happen in reverse. tried many different solutions , can't seem work. im sorry, couldn't work snippet here. posted because couldn't post other way. working 1 @ codepen angular.module('myapp',['ngmaterial']) .controller('itemsctrl',function($scope){ $scope.amounts = ('1kg 2kg 3kg 4kg 5kg '+'1szt 2szt 3szt 4szt 5szt 6szt 7szt '+'1l 2l 3l 4l 5l').split(' ').map(function(amount){ return {abbrev: amount}; }); $scope.items = [ ]; $scope.categoriesobj = [ { name:'vegetables', img:'img/noun_75334_cc.svg' }, { name:'vegetables', img:'img/noun_75333_cc.svg' }, { ...

java - Overhead if GC for memory in the JVM vs Swift style ARC -

the company work in have kind of different viewpoints regarding jvm development platform. based on paper here - http://people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf they saying oracle jvm requires 3-5x memory overheead i.e operate 1gb jvm require 3-5 gb of ram counteract jvm overhead , swift style arc answer gc issues. i have made counter arguments not oracle/sun jvm conducted study on , experimental vm , arc has own problems circular references. is there research conducted on exactly/approximately overhead of gc memory in jvm, not find any. my questions summarized 1) there visible overhead gc. cause 3-5x cost of ram seems unreasonable if fact true. also, big data applications such apache spark,hbase,cassandra operate in terabyte/petabyte memory scale. if there such overhead in gc why develop in such platform? 2) arc considered inferior other runtime gc tracing algorithms. if true, helpful if there papers directly comparing effects of arc compile time malloc/free ...

php - Cant create customer in Stripe after getting token -

after following "using checkout , php" documentation line line have working except last part. my code reads <?php require_once('config.php'); $token = $_post['stripetoken']; $customer = \stripe\customer::create(array( 'email' => 'customer@example.com', 'source' => $token )); echo '<h1>successfully charged $50.00!</h1>'; ?> everything works great can var_dump on token , see working fine, issue customer array. have tried using stripe_customer instead of \stripe\customer still isn't working. a few things might have note downloaded files manually , i'm using mamp dont think thats problem i'm able receive tokens, stops working add customer array. here config.php file <?php require_once('../stripe/init.php'); $stripe = array( "secret_key" => "test", "publishable_key" => test" ); \stripe\stripe::setapikey($stripe[...

React-Native bulleted lists using flex-wrap -

Image
i'm trying create bulleted list looks this: but i'm ending instead: react-native doesn't seem use of nested flex boxes. i'm not sure how express need 3 line elements (bullet, bolded text , normal text) displayed inline , wrap next line when necessary. here react-native code: var styles = stylesheet.create({ textwrapper: { flexwrap: 'wrap', alignitems: 'flex-start', flexdirection: 'row', }, textblock: { flexwrap: 'wrap', alignitems: 'flex-start', flexdirection: 'row' position: 'absolute', left: 10 }, boldtext: { fontweight: 'bold', }, normaltext: { } }); <view style={ styles.textwrapper }> <text>{'\u2022'}</text> <view style={ styles.textblock }> <text style={ styles.boldtext }>{categoryname + ':'}</text> <text...

python - Confusing read_table error in pandas -

i trying read seeds dataset using pandas. when loading file using: df = pd.read_table("seeds_dataset.txt", header=none) i get: cparsererror: error tokenizing data. c error: expected 8 fields in line 8, saw 10 now, loading file excel, needed specify tab , space delimiters @ same time, correctly read file @ line 8, can't done pandas (as far know). sublime text reads file accurately directly. i don't want skip bad lines error_bad_lines there nothing wrong them. used lineterminator no success. try option "delim_whitespace". df = pd.read_table("seeds_dataset.txt", header=none, delim_whitespace = true) edit: more detailed explanation: the method signature read_table here . has sorts of options, 1 of sep . defines delimiter between fields, , default '\t' (tab). 1 solution change sep argument. python implementation of pandas parser lets use regex delimiters, sep = "\\s+" delimit on amount of whites...

java - How do I clear the input field of a TextInputDialog? -

Image
my javafx program has series of prompts asking user information. rather create new textinputdialog each prompt, want create single textinputdialog , reuse multiple prompts. import java.util.optional; import javafx.application.application; import javafx.scene.control.textinputdialog; import javafx.stage.stage; public class inventorylist extends application { public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) { optional<string> name; optional<string> price; // fetch user input textinputdialog textdialog = new textinputdialog(); textdialog.settitle("create new item"); textdialog.setheadertext(null); textdialog.setcontenttext("enter item name:"); name = textdialog.showandwait(); textdialog.setcontenttext("enter item price:"); price = textdialog.showandwait(); } } unfortunately...

python - Removing chars/signs from string -

i'm preparing text word cloud, stuck. i need remove digits, signs . , - ? = / ! @ etc., don't know how. don't want replace again , again. there method that? here concept , have do: concatenate texts in 1 string set chars lowercase <--- i'm here now want delete specific signs , divide text words (list) calculate freq of words next stopwords script... abstracts_list = open('new','r') abstracts = [] allab = '' ab in abstracts_list: abstracts.append(ab) ab in abstracts: allab += ab lower = allab.lower() text example: micrornas (mirnas) class of noncoding rna molecules approximately 19 25 nucleotides in length downregulate expression of target genes @ post-transcriptional level binding 3'-untranslated region (3'-utr). epstein-barr virus (ebv) generates @ least 44 mirnas, functions of of these mirnas have not yet been identified. previously, reported bruce target of mir-bart15-3p, mirna produced...

php - Laravel 5.3 - Structuring controllers into Modules with separate sessions, authorisation requirements and standard functionality/services -

we have built , continue develop web application in php, based on in-house web-framework. our web-framework written before ruby on rails anywhere , before similar available in php (ie before symfony). have reviewed using more standard framework, until there functionality missing doing (particularly queues, jobs etc). we believe frameworks laravel 5+ cover our framework , more. it's more modern, more expressive, etc, considering rewriting our application using laravel 5, because easier obtain programming resources etc. have been researching laravel, have little experience it. this question how approach general architecture using laravel controllers, providers , middleware, auth, routing etc. our application has 250 controllers , our model has 110 sql tables using propel orm (which migrate eloquent). 250 controllers structured call "modules", each of targeted @ different subset of userbase. our application serves "organisations" have "members" of...

node.js - "OR" operator in regex, in express routing -

i want both "/" , "/home" path, direct user same page ("/home"). how can write regex in express routing . tried this: router.route('/|/home') dose not work. you may use router.route(/^\/(home)?$/) the regex matches: ^ - start of string \/ - slash (home)? - optional sequence of literal chars home $ - end of string. basically, same /^(\/|\/home)$/ 2 alternatives, \/ , \/home both anchored @ start , end of string, optional group (i.e. (home)? ) more optimal way match 2 alternatives. note non-capturing group can used here (and preferred), tiny bit less readable: /^\/(?:home)?$/ .

linux - How to search multiple patterns in using grep command? -

i learning use grep , tried use following commands find entries in /var/log/messages file, errors: grep "oct 23 21:22:44" | "80" /var/log/messages i error this. tried following , replaced double quotes single quotes: grep 'oct 23 21:22:44' | '80' /var/log/messages this did not work either. why wrong because can search multiple patterns using pipe! because oct 23 21:22:44 , 80 in different places! 80 , date in different orders in file! this syntax: grep "oct 23 21:22:44" | "80" /var/log/messages is equivalent running grep , pass output file called 80 . a way need enabling -e option ( --extended-regexp ) able use | as-is, this: grep -e "oct 23 21:22:44|80" /var/log/messages

machine learning - better results from simple linear regression than multivariate/multiple reg -

i have existing model predicts house prices, uses simple linear regression. input have date , output price. i wanted improve overall results have added 1 more feature. new feature distance estimated property. problem multiple/multivariate regressions performs bit worse simple regression. (all data normalised) do have ideas why happening , how can approach this? there dozens of possible reasons, list few: if new feature barely correlated trying predict - efficiently injecting noise system cannot expect better performance if have few data points more features can lead harder problem since using linear model, if new feature predictor, relation not linear dependent variable - model fail well linear regression such naive model, ridge/lasso regression might change result (especially lasso since deals better bad features)

c++ - winsock , how to send an RST,ACK or RST packet -

i have winsock server uses wsaeconnreset, error code 10054 event. can perform using exit() function have relaunch application. the question how kill established connection , send rst packet server processes take place when use exit() not using it. app has keep running has kill connection rst packet. want imitate ctrl+c, or exit() or terminate() process rst packet sent. i tried so_linger socket options in combination socketclose(); , shutdown(); not cause wsaeconnreset event. i tried so_linger socket options you need set 'on' 0 timeout. in combination socketclose(); correct. and shutdown(); incorrect. remove that. sends fin. but not cause wsaeconnreset event. because of shutdown() . remove that.

c++ - NVENC Nvidia Encoder D3D11 Wrong image dimension and other questions -

Image
first few basic information: os: win7 64bit | gpu: gtx970 i have staging id3d11texture2d wich encode. i use texture directly via nvencregisterresource seems pass d3d9 , no d3d11 texture. otherwise nv_enc_err_unimplemented . thefore, create input buffer , fill manually. the texture in format dxgi_format_r8g8b8a8_unorm . format dxgi_format_nv12 possibly windows 8 onwards. the input buffer format nv_enc_buffer_format_argb . should 8 bits per color channel. since alpha value interchanged expect wrong picture should still encoded. my process far: create id3d11texture2d render texture create id3d11texture2d staging texture create nvenc input buffer nvenccreateinputbuffer create nvenc output buffer nvenccreatebitstreambuffer :: update routine :: render render texture copyresource() staging texture fill nvenc input buffer staging texture encode frame get data nvenc output buffer as can see, encode 1 frame per update. so far works without error, if @ fra...

arrays - Finding the largest value and the smallest in my code in Java -

i creating code let user type in temperature of different sort. the user should able type in: amount of weeks how many time person measuring temperature in 1 week. temperatures every week. when user has typed information, program should show temperatures have been typed in. the program should show lowest temperature every week. program should show highest temperature every week. program should show lowest, , highest temperature during weeks. program should show average temperature during every week, , during weeks. this how far i've come: { system.out.println ("temperatures\n"); scanner in = new scanner (system.in); in.uselocale (locale.us); //here information being put in system.out.print ("amount of weeks: "); int amountofweeks = in.nextint (); system.out.print ("measuring temperature per week: "); int measurementsperweek = in.nextint (); //array store information double[][] t = ...

mysql - PHP UTF-8 Not working -

this question has answer here: utf-8 way through 14 answers i've got big issue! i've site made in php mysql, i'm getting data out of database characters good! out of every character á , ë e.g. outputted � character. i hope guys can me. thanks in advance, remy i followed problem, , came conclusion think forgot add tag: mysqli_set_charset($conn,"utf8"); you should add before gather data mysql

Python inheritance change attribute type -

i trying build class inherits class sklearn class my_lasso(linear_model.lasso): def __init__(self, alpha=1.0, fit_intercept=true, normalize=false, precompute=false, copy_x=true, max_iter=1000, tol=1e-4, warm_start=false, positive=false, random_state=none, selection='cyclic'): super(my_lasso, self).__init__( alpha=alpha, fit_intercept=fit_intercept, normalize=normalize, precompute=precompute, copy_x=copy_x, max_iter=max_iter, tol=tol, warm_start=warm_start, positive=positive, random_state=random_state, selection=selection) def fit(self, x, y): super(my_lasso, self).fit(x, y) self.x = x self.y = y self.residus = self.y - self.predict(self.x) self.r2 = self.score(self.x, self.y) self.error = np.linalg.norm(self.residus) ** 2 self.support = np.zeros(x.shape[1]) self....

.htaccess - Htaccess redirect subdomains to a specific page without changing the link -

i working on php script on generate links random subdomains.for example : x.domain.com sius.domain.com x5-.domain.com , on. in fact these subdomains doesn't exist want when user goes link (random).domain.com shows content of domain.com/result.php?rand=(random). ps:i considered (random) variable. , want exclude www. tried this: rewriteengine on rewritecond %{http_host} !^www\.domain\.com$ [nc] rewriterule ^ http://domain.com/result.php [l,r] but nothing seems work. can ? try with: rewriteengine on rewritecond %{http_host} !^www\. [nc] rewritecond %{http_host} ^(.+)\.domain\.com$ [nc] rewriterule ^ /result.php?rand=%1 [l,qsa] you can't redirect ( http://... , [r] ) without link change. code rewrite without redirection.

javascript - How to handle uploaded files with Node-pdf-image? -

i'm trying create app allow user upload pdf , convert first page of uploaded file image. using https://github.com/mooz/node-pdf-image . i'm having trouble because don't know path give tool. don't have full path of pdf available on user's computer, tried uploading file s3 , using path. uploadfile(file, 'temps') .then(uploaded => { const pdffile = new pdfimage(uploaded.secure_url); return pdffile.convertpage(0); }) .then(imagepath => console.log(imagepath)) .catch(error => console.log(error)); the above throws error fs.stat not function. how use plugin , allow users upload file app?

vbscript - How do I let cmd know VB script has finished? -

i using solution here convert .csv .xlsx: convert .csv .xlsx using command line dim file, wb createobject("excel.application") on error resume next each file in wscript.arguments set wb = .workbooks.open(file) wb.saveas replace(wb.fullname, ".csv", ".xlsx"), 51 wb.close false next .quit end wscript.echo "done!" i have tried running .cmd , works, when run cmd, command finishes right away though vb script still processes. there way let cmd know vb has finished? i'm trying create batch file, great know when part finished before moving on next step. thanks! you're running script itself: c:\path\to\your.vbs doing runs script associated interpreter, in normal installation wscript.exe . basically, above same as wscript.exe c:\path\to\your.vbs wscript.exe launches scripts asynchronously, meaning returns while script continues running in background. running scripts synchronously need use commandline in...

vb.net - How can I make Timer do different things based on how it was started -

how can make timer different things depends on activated it? i've tried using code dim integer = 0 dim b integer = 0 private sub button1_mousehover(sender object, e eventargs) handles button1.mousehover timer1.start end sub private sub button2_mousehover(sender object, e eventargs) handles button2.mousehover timer1.start end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick, button2.mousehover, button1.mousehover if sender button1 = + 1 textbox1.text = end if if sender button2 b = b + 1 textbox2.text = b end if end sub but textbox add 1 once. means timer act 1 time not continuously timer do. there wrong there, or can different?. another possibly simpler approach, use timer.tag property , use 1 handler both buttons: private sub button_click(sender object, e eventargs) handles button1.click, button2.click timer1.tag = sender timer1.start() end sub private sub timer1_tick(...

if statement - Perl else error -

hello new programming in perl trying make number adder (math) gives me 1 error here's code: sub main { print("first: "); $num1 = <stdin>; print("second: "); $num2 = <stdin>; $answer = $num1 + $num2; print("$answer") } else { print("you have entered invalid arguments.") } main; now not done error on else here error: c:\users\aries\desktop>"second perl.pl" syntax error @ c:\users\aries\desktop\second perl.pl line 9, near "} else" execution of c:\users\aries\desktop\second perl.pl aborted due compilation errors. please (also tried googling stuff still error) since you're new perl, recommend add strict , warnings @ top of scripts. identify common problems , potentially dangerous code. the main problem code you've appended else statement subroutine. here example of code think intended be: use strict; use warnings; use scalar::util qw(looks_like_number...

java - Joern: access graph database directly without neo4j-server -

the joern documentation says: it possible access graph database directly scripts loading database memory on script startup. how can that? after running java -jar $joern/bin/joern.jar $codedirectory on code, neo4j database directory (.joernindex) created these .id- , .db-files. possible to access code (with python-joern) without running neo4j server? (is server necessary?) the web interface way use joern database documented here: http://joern.readthedocs.io/en/latest/import.html and python-joern interface documented here: http://joern.readthedocs.io/en/latest/access.html#python-joern-api and program: from joern.all import joernsteps j = joernsteps() j.setgraphdburl('http://localhost:7474/db/data/') # j.addstepsdir('use inject utility traversals') j.connecttodatabase() res = j.rungremlinquery('getfunctionsbyname("main")') res = j.runcypherquery('...') r in res: print r basically url-way talk neo4j...

elasticsearch - Range query for a keyword or a date type field? -

i have field store insert time,such 2016-10-10 11:00:00.000 ,i tried keyword type , date type,they meet range requirements,such { "query": { "range" : { "time" : { "gte" : "2016-10-10 11:00:00.000", "lte" : "2016-10-10 12:00:00.000" } } } } keyword , date type better? in case, since you're storing dates, it's more appropriate use date data type, indeed. internally, dates stored long timestamps , range query run on them, have numerical range . keyword intended used string data. if store dates keyword, dates stored unanalyzed strings , range query run on them consider them lexical range . if ever need create date_histogram aggregation out of dates, keyword type won't it. should prefer date data type.

java - SQLiteDatabase: Get column and store into an array -

is there way grab column database created, , store values found in column array? my main goal, values in column, , store them spinner. look below code! patientdbhelper.java package tanav.sharma; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.provider.basecolumns; import android.util.log; import java.util.arraylist; import java.util.list; /** * created tanav on 11/4/2016. */ public class patientdbhelper extends sqliteopenhelper { private static final string database_name = "patientinfo.db"; private static final int database_version = 1; private static final string create_query = "create table " + patientinfo.newpatientinfo.table_name + " (" + patientinfo.newpatientinfo.patient_id + " integer primary key autoincrement, " ...