Posts

Showing posts from August, 2014

c# - Can't use int array from Form1 in Form2 -

i have int array in form1 need use in form2 . when i'm trying use array values in form2 , gives me zeros. private void button1_click(object sender, eventargs e) { frm1 = new form1(); (int = 0; < 26; i++) { label1.text += frm1.thecode[i]; } } http://i59.tinypic.com/b4cf2b.png http://i59.tinypic.com/b4cf2b.png but when try same thing in form1, works great! private void button5_click(object sender, eventargs e) { frm2 = new form2(); (int = 0; < 26; i++) frm2.label1.text += thecode[i]+ " "; frm2.show(); } http://i59.tinypic.com/jujthi.png http://i59.tinypic.com/jujthi.png but still need use array in form2 , not form1 in form1 must declare int array static field , public in order access form. so how declare thecode in form1 public static int[] thecode; // should public , static and how use array in form2 private void button1_click(object sender, eventargs e) { // no need create new instance of f...

vb.net - Google Account Registering Bot -

thanks spending time on post. i'm experiencing easier way create google account, , apparently there no google account creating bot or such thing that, decided write 1 self.(well, it's not actual bot, asks manually enter captcha.) had problem when setting value of combo box , when grabbing captcha image picture box..... here's part of code(where error occurred): 'webbrowser1 has been navigated "https://accounts.google.com/signup?continue=https:%2f%2faccounts.google.com%2fmanageaccount" private sub webbrowser1_documentcompleted(sender object, e webbrowserdocumentcompletedeventargs) handles webbrowser1.documentcompleted dim r system.random = new system.random 'sets value of other textboxes webbrowser1.document.getelementbyid(":0").innertext = monthselect(r.next(1, 12)) webbrowser1.document.getelementbyid(":d").innertext = genderselect(r.next(0, 1)) captcha.imagelocation = webbrowser1.document.getelementbyi...

python - IMAP error when accessing gmail from command line -

i working on writing simple script read unread mail gmail through python script. have following script, when run python script, imap error marked below. assistance in issue appreciated. i have imap enabled in gmail settings. there other configuration need take care of, working? import imaplib obj = imaplib.imap4_ssl('imap.gmail.com','993') obj.login('username','password') obj.select() obj.search(none,'unseen') where, username gmail username, , password password gmail account. traceback (most recent call last): file "test.py", line 3, in <module> obj.login('ashwin.tumma23@gmail.com',password) file "/usr/lib/python2.7/imaplib.py", line 519, in login raise self.error(dat[-1]) imaplib.error: [alert] please log in via web browser: https://support.google.com/mail/accounts/answer/78754 (failure) visibleman's answer correct. alternative though may wish switch script using gmail ...

Timestamp in Batch File not Updating Properly -

i'll start off saying i'm new scripting... i'm trying create batch file periodically pings host. @ moment, i'm testing on local pc. here's i've got far: @echo off set servername=127.0.0.1 set limit=3 echo %date%, %time% starting ping test localhost>>c:\users\%username%\desktop\pingtest.txt /l %%x in (1,1,%limit%) ( ping %servername% -n 3 | find "reply" >>c:\users\%username%\desktop\pingtest.txt echo %time% >>c:\users\%username%\desktop\pingtest.txt timeout /t 5 ) exit however, timestamp stays same. should show time being ~5 seconds after (or long timeout value set), stays same first timestamp. here's example of output: 25/08/2015, 2:09:18.34 starting ping test localhost reply 127.0.0.1: bytes=32 time<1ms ttl=128 reply 127.0.0.1: bytes=32 time<1ms ttl=128 reply 127.0.0.1: bytes=32 time<1ms ttl=128 2:09:18.34 reply 127.0.0.1: bytes=32 time<1ms ttl=128 reply 127.0.0.1: bytes=32 time<1ms ttl=128 r...

javascript - Express res.render breaks extends layout when using deep url paths -

if stay 1 level deep in app /level1 , call res.render(mypage.jade) runs great when go /level1/level2 res.render(mypage.jade) 404s on css/js , styling breaks. folder structure views pages pages/mypage.jade layout.jade mypage.jade extends ../layout you must use absolute link resource try /css/... not use css/... (same js file)

android - How to filter only the Brandname in my custom adapter without using Viewholder? -

i'm creating android application has custom listview , custom listview adapter. how can filter brandname using custom listview adapter without using viewholder? possible? if is, how can filter it? import java.util.arraylist; import java.util.hashmap; import android.content.context; import android.content.intent; import android.graphics.color; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview; public class listviewadapter extends baseadapter { // declare variables context context; layoutinflater inflater; arraylist<hashmap<string, string>> data; imageloader imageloader; hashmap<string, string> resultp = new hashmap<string, string>(); public listviewadapter(context context, arraylist<hashmap<string, string>> arraylist) { this.context = co...

rust - Expected bound lifetime parameter, found concrete lifetime -

i can't figure out lifetime parameters code. try results in compiler error: "expected bound lifetime parameter 'a , found concrete lifetime" or "consider using explicit lifetime parameter shown" (and example shown doesn't help) or "method not compatible trait". request , response , , action simplified versions keep example minimal. struct request { data: string, } struct response<'a> { data: &'a str, } pub enum action<'a> { next(response<'a>), done, } pub trait handler: send + sync { fn handle<'a>(&self, req: request, res: response<'a>) -> action<'a>; } impl<'a, t> handler t t: send + sync + fn(request, response<'a>) -> action<'a>, { fn handle(&self, req: request, res: response<'a>) -> action<'a> { (*self)(req, res) } } fn main() { println!("running...

eclipse - Hint word getting cut in android -

how make hint inside editview positioned center without cutoff , want make bottom line of editview hidden how make it,below code <textview android:id="@+id/phnum_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:fontfamily="font sans" android:text="@string/cell_num_label" android:textcolor="@color/labelcolor" android:textsize="15sp" /> <edittext android:id="@+id/txt_num" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_torightof="@+id/phnum_text" android:ems="10" android:hint="enter number" android:textsize="15sp" > <requestfocus /> </edittext> </relativelayout> ...

xmpp - Removing user from MUC member list -

is there way user can remove himself xmpp multi-user chat member list without being owner or admin (i.e., change affiliation member none)? from the xep 045 muc (section 5.2.2) states affiliation changes member none requires admin or owner change affiliation, third section in table: (for clarification, table states affiliation change, i.e. member -> -> none) table 7: affiliation state chart member | admin or owner changes affiliation "none" so sorry answer no, if you're looking way unnoticeable user - might need layer, or web service works admin , make these changes in background. hope helps.

for loop - plot multiple 3D rectangles in matlab -

this question exact duplicate of: how can make 3d plots of planes using spreadsheet in matlab 2 answers i have array of data points of size 400x3 (400 points x,y,z coordinates). each group of 4 consecutive points represent corners of rectangle, there 100 rectangles (finite planes). i plot 100 rectangles in 3d, new matlab. so far able plot single rectangle: % sample rectangle pointb=[16.1445 20.0025 1.64238]; pointc=[21.7378 29.1242 1.64238]; pointd=[30.8595 23.5309 -1.64238]; pointe=[25.2662 14.4092 -1.64238]; % plot in 3d points=[pointb' pointc' pointd' pointe']; fill3(points(1,:),points(2,:),points(3,:),'r') grid on alpha(0.3) so how repeat remaining rectangles.. help! this should it... % load sample points pointb=[16.1445 20.0025 1.64238]; pointc=[21.7378 29.1242 1.64238]; pointd=[30.8595 23.5309 -1.64238]; pointe=[25.26...

How to give only bottom border to RelativeLayout in Android -

i have created relative layout in requires bottom border. how can that? below relativelayout have used. i have added view inside relative layout shows @ bottom of screen <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#eaeaea" android:orientation="vertical" > <textview android:id="@+id/auth_lbl_register_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:background="#eaeaea" android:clickable="true" android:ellipsize="none" android:fontfamily="fnb sans" android:gravity="left" android:maxlines=...

c++ - Is tcp socket can notice the exception of network broken? -

i have tcp link server socket on linux. , used select() function monitor if there data, if there have, use recv data. now want know if network broken(such cable removed). can't exception monitor exception. fd_set( m_socket, &except_fds ); int result = select( m_socket + 1, &fds, 0, &except_fds, timeout == -1 ? 0 : &tv ); what confused me there similar implementation (java.net.socket) on android, can catch exception if set phone flight mode. is select() implementation platform specific? in short, if method can used monitor network broken? if not, there solution this? what confused me there similar implementation ( java.net.socket ) on android, can catch exception if set phone flight mode. not similar. java.net.socket not use select() , except read timeouts on platforms don't support so_rcvtimeo . is select() implementation platform specific? of course. in short, if method can used monitor network broken? no. if...

ios - Xcode 7 Beta 5 - All subviews missing from Storyboard -

Image
i've switched xcode 7 beta 5 , i've been trying solve uitableview issue know lots have experienced. 1 solution found disable size classes, however, once did wanted roll solution commit performed before that. after discarded changes presented view controllers , none of subviews visible in them. in hierarchy left listed 'greyed out'. can solving this? screenshot reference: it's worthwhile noting when app runs of ui elements still present expected - in storyboard not displaying. try checking in different layout such width compact height. grey out means view active on particular layout. can see changes when tap in bottom wany hany , select different sizes...

How do I slice X rows from a Dataframe begining at a specific label index in Pandas and Python -

i want specify label index, slice int x rows dataframe. , not know end label. labels timestamps, should not matter. having trouble achieving this, mixing labels , integer numbers of rows wanted. so if: df= pd.dataframe(np.random.rand(8,3), columns = list('abc'), index = list('lmnopqrs')) how result given code: df.loc['q':'o':-1] but, if know 'q' index? want returns logic this: df.loc['q':"3 rows only":-1] so never know int index 'q' is, know name, , not know in dataframe is. thanks. i not sure if there better ways this, can use df.index access indexes in dataframe, , df.index.tolist() access index list. so in case, df.index.tolist() give - in [13]: df.index.tolist() out[13]: ['l', 'm', 'n', 'o', 'p', 'q', 'r', 's'] then, can find index of q in list, using list.index() method , element 2 indexes before q . example - i...

angularjs - Angular-Ui Bootstrap DatePicker Open on focus -

though may seem simple question, can't find anywhere solution. simple this: <input type="text" datepicker-popup> i want when cursor enters, calendar popup automatically shows up, jquery-ui datepicker. have either provide button or alt-down, both unfriendly me. there is-open attribute dont want complicate things putting variables in scope should available configuration? :d. thanks edit: i found solution. it's little tricky works. here directive: app.directive("autoopen", ["$parse", function($parse) { return { link: function(scope, ielement, iattrs) { var isolatedscope = ielement.isolatescope(); ielement.on("focus", function() { isolatedscope.$apply(function() { $parse("isopen").assign(isolatedscope, "true"); }); }); } }; }]); and view: <input type="text" datepicker-popup="" ng-model="ctrl.dt" aut...

hadoop - History server is not receiving any event -

i working on streaming application. tried configure history server persist events of application in hadoop file system (hdfs). however, not logging events. i running apache spark 1.4.1 (pyspark) under ubuntu 14.04 3 nodes. here configuration: file - /usr/local/spark/conf/spark-defaults.conf #in 3 nodes spark.eventlog.enabled true spark.eventlog.dir hdfs://master-host:port/usr/local/hadoop/spark_log #in master node export spark_history_opts="-dspark.history.fs.logdirectory=hdfs://host:port/usr/local/hadoop/spark_log" can give list of steps configure history server?

apache pig - Using Pig's ORDER BY on Return Value of Function -

i trying sort using pig on date string column date_time_stamp , looks cannot sort when function operates on column / field. c = order b todate(date_time_stamp, 'dd-mmm-yy hh.mm.ss.ssssss a') asc; here's sample data: 19-jun-15 04.45.00.000000 pm,6 20-jun-15 11.15.00.000000 am,5 19-jun-15 07.15.00.000000 am,17 21-jun-15 12.00.00.000000 am,0 20-jun-15 12.35.00.000000 pm,33 how sort on column operated on function? as per docs : http://pig.apache.org/docs/r0.12.0/basic.html#order-by the field_alias on order performed should present in relation/ alias. pig supports ordering on fields simple types or tuple designator (*). cannot order on fields complex types or expressions. in use case shared, before performing order on alias b, have project value of todate() field_alias , can perform order on field.

azure - Claims Transformation with ADAL -

is there way claims transformation adal .net library , using usewindowsazureactivedirectorybearerauthentication ? i'm able in secuitytokenvalidated event when using useopenidconnectauthentication jwtsecuritytokenhandler defines virtual function createclaimsidentity can take control of. you need provide custom implementation of jwtsecuritytokenhandler , set windowsazureactivedirectorybearerauthenticationoptions.tokenhandler custom implementation.

iar - Internal error: [CoreUtil/General]: index too large -

how fix above error ? trying build code on iar embedded workbench through makefile. while building, throws above error. i think more details need specified. if can paste full error got when compiling code, help. compiling error must referring source file specified line number also....it helpful if can paste snippet around line of error source file.

Why do i need to set platform in cocoapods? -

i started working cocoa pods recently(should have done long time ago), , im wondering should value of platform be. instance right have platform :ios, 8.0 (there tick marks around 8.0 dont know how escape them in editor) tells me minimum version of code using these dependencies ios 8.0. few questions. is interpertation right platform? if not platform do? does mean install on version 8.0? if how make version 8.0 , higher versions? so later on when ios version 9.0 comes out dependencies don't work ios 9.0. need place platform ios: 9.0 underneath list of dependencies 8.0 , add list of dependencies 9.0 work with? this enough questions now. help. example of number 3 platform :ios, '8.0' target 'my target' //list of pods end platform: ios, `9.0` target `my target` //list of pods end

java - Does wicket tree work for "not direct" children? -

hey have following situation: class foo has list of foos , every foo contains 1 or more objects of class bar , has therefore list bars . every bar has 1 or more objects of qux , class , because of safed in list named quxs . is possible loop through these lists / sets wicket tabletree , treetable , defaulttreetable or whatever else. right i'm trying solve 3 nested listviews , seems not best solution. because if have use listview, whitin listview of listview, difficult object refering to. the decision whether use listviews or 1 of tree components should made based on desired look&feel (ie. possible user interactions opening/closing nodes in tree). possible present nested list 3 different classes in tree (though may not able take advantage of java generics in case, unless classes have suitable common interface). the itreeprovider interface place start, if want build own tree structure ( https://ci.apache.org/projects/wicket/apidocs/7.x/org/apache/wicket...

c - Create a zero byte file in specific directory -

#include <stdio.h> #include <stdlib.h> int main() { file * fp; fp = fopen ("file.txt", "w+"); fclose(fp); return(0); } the above programs create file . need file needs placed in specific directory. please help add path parameter of fopen() . fp = fopen ("/path/to/file.txt", "w+");

gnu make - "define" and "endef" syntax-rules in makefile -

from docs : note lines beginning recipe prefix character considered part of recipe, define or endef strings appearing on such line not considered make directives. my worry is, not case. as evident, following makfile: ifeq "x" "y" define xxx else foo = 1 endef else bar = 2 endif :: @echo 'foo is: "$(foo)"' @echo 'bar is: "$(bar)"' running, get: $ make foo is: "" bar is: "2" going makefile, evident lines 3 , 4 inside ifeq directive, i.e. ifeq "x" "y" define xxx else foo = 1 endef else bar = 2 endif are ignored make. put simply, make ignores these 2 lines, within define xx else foo = 1 because inside define , , therefore, make not evaluate else directive (i.e. else part, ifeq "x" "y" ). but, make parses endef line ( 5th line in ifeq block ), directive end define directive. hence, after ending defi...

sum - wrong calculation of power query - 101 -

my data in table 2.8202148 1.810577904 4.399182566 78.56037454 4.62585733 3.905997503 3.877795355 normal sum gives result 99.9999999954482 but in pivot table (power query) gives 101 ! somehow... any suggestions ? thanks, if round numbers nearest integer, , sum then, 101. you've set use integers instead of floating point numbers. change to floating point , should fine.

xml - how to create Android Burger Button with options icon? -

Image
creating burger button multiple customized options in android. when click button, want show options corresponding icons (shown in image). i used popupmenu how set icons in popupmenu options? please me?? you can try using listpopupwindow , anchor burger button (in case aren't using actionbar) http://developer.android.com/reference/android/widget/listpopupwindow.html string [] items = new string[]{"item1" , "item2", "item3"}; view anchor= (button)findviewbyid(r.id.burgerbutton); anchor.setonclicklistener(new onclicklistener(){ showpopup(); }); public void showpopup() { listpopupwindow popup = new listpopupwindow(this); //replace adapter custom adapter , layout custom menu item popup.setadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_1, android.r.id.text1,items)); popup.setanchorview(anchor); popup.setwidth(200); popup.show(); }

ios - Having a UIButton be tapped in a UICollectionViewCell -

i have uicollectionview cells laid out. i have declared subview: @property (nonatomic, strong) uibutton *abutton; i have declared in each cell so: if (_abutton == nil) { _abutton = [uibutton buttonwithtype:uibuttontypesystem]; } // add in _abutton info here [self.contentview addsubview:_abutton]; // call button pressed button [_abutton addtarget:self action:@selector(abuttonpressed:) forcontrolevents:uicontroleventtouchupinside]; the button click method so: - (ibaction) abuttonpressed:(uibutton *) sender { // code never gets heree } the if(_abutton == `nil) needed since cells reused. how make work now? thanks. add button action code before button added view.... may work . // call button pressed button [_abutton addtarget:self action:@selector(abuttonpressed:) forcontrolevents:uicontroleventtouchupinside]; // add in _abutton info here [self.contentview addsubview:_abutton];

ruby on rails - Not able to add extension in spree -

i'm using spree 3.0.4 in rails (4.2.3) , ruby (2.2.0). now want add extension this. add gem gem 'spree_simple_sales',:path => '../spree_simple_sales' in application, when bundle gives me error like: could not find gem 'spree_simple_sales (>= 0) ruby' in source @ ../spree_simple_sales. source not contain versions of 'spree_simple_sales (>= 0) ruby' can tell why gives me error? you need specify version gem using, such gem 'spree_simple_sales', '0.1.0', :path => '../spree_simple_sales' hope helps, think reference necessity of specifying version should added 'extensions' tutorial on spree website.

Erlang application exit,, but vm is still running -

my erlang applicaation processed crashed , exited, found erlang vm still running. recieve pong when ping "suspended node" types regs() , results show below, there not app process. (hub@192.168.1.140)4> regs(). ** registered procs on node 'hub@192.168.1.140' ** name pid initial call reds msgs application_controlle <0.7.0> erlang:apply/2 30258442 1390 auth <0.20.0> auth:init/1 189 0 code_server <0.26.0> erlang:apply/2 1194028 0 erl_epmd <0.19.0> erl_epmd:init/1 138 0 erl_prim_loader <0.3.0> erlang:apply/2 2914236 0 error_logger <0.6.0> gen_event:init_it/6 49983527 0 file_server_2 <0.25.0> file_server:init/1 16185407 0 global_group <0.24.0...

sql server - SQL Select Specific Date format dd/mm/YYYY hh:mm:ss -

i want select record table date format stored 'jan 27 2015 12:00am' when select should covert date following format '27/01/2015 00:00:00' . i tried following works date not time. used date. select convert(varchar(10), convert(date,startdate,106), 103) + ' ' + convert(varchar(8), getdate(), 14) startdate logistic can 1 me convert date format correctly. i tried answer: convert(varchar(10), startdate, 103) + ' ' + convert(varchar(8), startdate, 108) result: aug 25 201 aug 25 2 convert mmm dd yyyy hh:mm[am|pm] dd/mm/yyyy hh:mm:ss declare @date varchar(20) = 'jan 27 2015 12:05am' select convert(varchar(10), convert(datetime, @date),103) + ' ' + convert(varchar(8), convert(datetime, @date),108) result: 27/01/2015 00:05:00

bluej - Prompting user for password and then checking it in Java -

using code second , third videos, change them prompt user information. on password video (2nd one), once write code prompt user 4 character password, see if can print “wrong, try again” message if entered incorrectly. (hint, use if else). video 2: ap computer science if statements (comparing strings) video 3: ap computer science if statements "multiple" boolean expressions i need finding way prompt user password , saying if right or wrong (can use jscanner). asking people watch videos not idea , should try upload basic code can guide you. did basic skim , believe need import this import java.util.scanner look documentation scanner learn how use it. check if password correct, basic loop goes ( have looked up) if (password correct){ } else{ message wanted print }

c# - ViewData Int32 must be of type IEnumerable when viewing from stored procedure -

i don't know if because of stored procedure did. error the viewdata item has key 'department' of type 'system.int32' must of type 'ienumerable'. here's code : (view) <div class="col-lg-4"> <%: html.dropdownlistfor(m => m.department, model.departments, "please select", ((viewbag.role >= 2 && viewbag.role <= 5) ? (object)new { @class="form-control", @onchange="onchangedepartment(this.value);" }:(object)new { @class="form-control", @disabled="disabled" }))%> </div> (model) public bool loaddepartmentsfromdb() { workflowentities entity = new workflowentities(); list<selectlistitem> departments = new list<selectlistitem>(); list<selectlistitem> supervisors = new list<selectlistitem>(); foreach (sp_departmentmaster_getall_result sp_depts in entity.sp_depar...

Meteor - Multi File Select UI to CollectionFS -

i've been using yogiben/meteor-autoform-file, pretty awesome uploading files directly collectionfs! however, uploading many files pain user: user has click "+" icon once each file upload, , select each file individually. i use blueimp jquery file upload multi-file select, files don't written collectionfs. is there easy way multi-file select , have files written collectionfs? i used https://github.com/tomitrescak/meteor-uploads in previous project. supports collection-fs, has drag-n-drop , multiple files features. maybe not simple put in place yogiben's package still. take might fit needs.

haskell - How to create two ByteStrings calling this external library API? -

i'm writing bindings cryptographic library exposes function generating keypairs: const size_t publickeybytes = 32; const size_t secretkeybytes = 32; int random_keypair(unsigned char pk[publickeybytes], unsigned char sk[secretkeybytes]); this function randomly generates secret key, computes corresponding public key , puts results in pk , sk . when returning 1 bytestring i've found easiest way use create :: int -> (ptr word8 -> io ()) -> io bytestring data.bytestring.internal . however, function can't create 2 bytestrings @ same time. my first approach write like: newtype publickey = publickey bytestring newtype secretkey = secretkey bytestring randomkeypair :: io (publickey, secretkey) randomkeypair = let pk = b.replicate 0 publickeybytes sk = b.replicate 0 secretkeybytes b.unsafeuseascstring pk $ \ppk -> b.unsafeuseascstring sk $ \psk -> c_random_keypair ppk psk return (publickey pk, sec...

image load not with canvas -

i'm try load image on webpage image can not display. these code in body tage <canvas height="400" width=""400"" id="c"></canvas> <script> var c=document.queryselector("#c"); var ctx=c.getcontext("2d"); var image=new image(); image.onload=function(){ console.loge("loaded image"); ctx.drawimage(image,0,0,c.width,c.height); } image.src="barn.jpg"; </script> i not sure asking, @marke commented, there syntax errors, wouldn't call bugs. way see need put image.src="barn.jpg"; before image.onload(); function. how make code: <canvas height="400" width="400" id="c"></canvas> <script> var c=document.qu...

css3 - Unable to get transition effect when using display block -

i'm animating menu showing 1 item multiple can't transition add display: block; , need hidden elements doesn't take space. using visibility instead doesn't work since takes space. how can fix this? .feed-menu { border: 2px solid white; border-radius: 10px; } .feed-menu:hover .feed-menu-item { display: block; width: auto; opacity: 1; } .feed-menu > .feed-menu-item { display: none; width: 0; opacity: 0; float: left; padding: 10px 20px; text-align: center; -webkit-transition: 400ms ease-in-out; -o-transition: 400ms ease-in-out; transition: 400ms ease-in-out; } .feed-menu > .feed-menu-item.selected { display: block; width: auto; opacity: 1; } fiddle: https://jsfiddle.net/9yxr5bap/3/

node.js - Calling Java from NodeJS outputs file in root -

for project structure this: /myfolder/app/components/owl2vowl.jar /myfolder/app/uploads/ontology.owl /myfolder/app.js i using owl2vowl convert ontology json i wrote code in app.js run jar file parameters, run command this: java -jar e:\myfolder\app\components\owl2vowl.jar -file e:\myfolder\app\uploads\ontology.owl here code: var exec = require('child_process').exec, child; child = exec('java -jar ' + __dirname + '/components/owl2vowl.jar' + ' -file ' + syncpath , function (error, stdout, stderr){ if(error !== null) console.log('there error parsing ontology' + error); else console.log('succes parsing ontology'); where syncpath = e:\myfolder\app\uploads\ontology.owl the problem result generated in folder myfolder generating file ontology.json how can change path result of java file generated? ideally \app\uploads ? /myfolder/app/components/owl2vowl.jar /myfolder/app/uploads/ontology.ow...

Add a new field to every document and give it the value of another field of the same document in mongodb -

this question has answer here: update mongodb collection using $tolower 4 answers i know how add field same value every document. want add "title_lower" field has same value "title" in lowercase. { "_id" : objectid("55a3907b8c5bf672f4ad319b"), "title" : "oracle", "title_lower" : "oracle", "status" : "active", "company_default" : true, "is_deleted" : false } i've come query add field cannot figure out second part: db.getcollection('group').update( {} , {$set : {"title_lower" : "title"}}, {multi:true}) will need write javascript file this? the answer linked question worked me: db.getcollection('group').find().foreach( function(e) { e.title_lower = e.t...

html - padding in the `a` element goes out of table cell instead of fetch the height -

in table, have a element. applying padding on that. padding goes out of cell instead of fetch height of table-cell - wrong here? here snippet : .table{ display:table; width:100%; clear : both; border-top:1px solid gray; } .column { display:table-cell; border-bottom:1px solid red; height:2em; border-right:1px solid gray; vertical-align:bottom; } .table2 { clear:both; padding-top:2em; background:yellow; } <div class="table"> <div class="column">another table</div> <div class="column"></div> <div class="column"></div> <div class="column"></div> <div class="column"></div> </div> <div class="table table2"> <div class="column"> <a href="#">testing</a> </div> <div ...

linux - How test SSH connectivity with expect script -

i have linux red-hat machine - version 5.x i want create expect script verify if ssh login remote machine successfully my test password prompt on remote login ( not want enter password ) its test ssh connectivity what created until following script so if password prompt script need return 0 if not script need return 1 the problem script - script return 0 ssh login failed ( no password prompt ) #!/usr/bin/expect set login [lindex $argv 0] set password [lindex $argv 1] set ip [lindex $argv 2] set timeout 10 spawn ssh -o stricthostkeychecking=no $login@$ip expect -re "(password:|word:)" exit 0 expect { timeout {error "incorrect password"; exit 1} eof } please advice how update script ? you have enclose condition in 1 expect as, set timeout 10 spawn ssh -o stricthostkeychecking=no $login@$ip expect { timeout {puts "timeout happened";exit 0} eof {puts "eof received"; exit...

Javafx combobox not updating dropdown size upon change on realtime? -

Image
i using javafx v8.0.25-b18. the problem occur size of dynamic combox's dropdown list doesn't change, if had 2 items in dropdown, dropdown size 2 items, if populate dynamic combox 3 items small scrollbar inside!?, if remove item - have blank space in combox !? i want "reset" dropdown size each time put values it, right size each time gets populated @ runtime. to clarify more adding 3 images: 1. first screenshot shows initial dropdown size of 2 the second screenshot shows same combox, @ runtime adding 2 values, expect have dropdown size of 4, instead dropdown size stays 2 , adds unwanted scrollbar last screenshot when remove items , 1 item remains in combox, expect see dropdown of 1 item, instead unfortunately see dropdown size of 2 empty space instead of second item i adding simple code create scenario, want thank @gikkman helped getting far , code his! public class test extends application { private int index = 0; @override public void s...

php - json_encode add a line between two array -

i working array , json_encode, having 2 array example . array1: ------- [0] => hotels [1] => hotels-hotels - apartments [2] => hotels - ibis [3] => hotels - hotel [4] => hotels - muscat [5] => hotels - stay [6] => --------------------------- array2: [7] => first [8] => second [9] => third echo json_encode($result, true);exit the result is {"status":true,"response":["---------------------------","first","second","third"]} but need join previous array value also, , "----------"(line) should not selectable. merge array before encoding them : json_encode(array_merge($array_1, $array2)); do clean operations on arrays: function array_cleanup($array) { // remove undesired cells... return $array; } you have error using json_encode() function: second parameter must unsigned integer , not boolean, please read official ...

angularjs - Unable to get property 'target' of undefined or null reference -

i have in controller : $scope.searchonenter = function (event) { var element = angular.element(event.target); if (event.keycode === 13) { _search(element.val()); } } in html have this: <input type="search" data-ng-model="searchtext" data-ng-model-options="{ debounce: 1000 }" placeholder="@translator.translate("search_offer")" data-ng-keydown="checkkeydown($event);searchponenter($event)" data-ng-change="search()" data-ng-enter="searchonenter(searchtext)" /> but in console im geting error: unable property 'target' of undefined or null reference check demo: jsfiddle . it works expected. jsfiddle doesn't work because not import angularjs correctly. need add ng-app="myapp" : <div ng-app="myapp" ng-controller="myctrl">

crud - How to write hibernate spatial update query? -

my goal update drawn vector on map. my update method : public boolean update(int id,jsonobject json) { boolean success; try{ entitymanager em = hibernatespatialjpa.createentitymanager(); em.gettransaction().begin(); query query = em.createquery("update savegeojsonentity s set s=:json id=:id"); query.setparameter("id",id); query.setparameter("json",json); int result = query.executeupdate(); em.gettransaction().commit(); if( result> 0){ crudprocess se = new crudprocess(); se.insert(json); } em.close(); success=true; }catch (exception ex){ ex.printstacktrace(); success=false; }return success; } and crudprocess class. made according type of vector added. //(item) geojson in parse(json) method returns //item in data , type information public boolean insert(jsonobject json) { ...

javascript - Adsense get recommendations in JSON, it possible? -

can adsense recommendations in json? this: [    {       "title": "example",       "image": "http://placehold.it/32x32",       "link": "http://placehold.it/32x32"    },    {       "title": "example2",       "image": "http://placehold.it/32x32",       "link": "http://placehold.it/32x32"    },    {       "title": "example3",       "image": "http://placehold.it/32x32",       "link": "http://placehold.it/32x32"    } ] i want create custom ad block on site styles.

jQuery POST 404 not found issue due to http:// -

i have script, have no issue add cart in local development machine. in customization link: * textbox, need pass full url. e.g http://www.google.com in local machine, have not issue add cart, in live server, in inspect show post 404 not found. however, if remove http:// in text box, able add cart. (e.g www.google.com) anyone wrong server or script problem? the part catch clink below code: var clink = getparameterbyname('clink'); if(clink != '') { $("div.options input[name^='option']").val(clink); } //get query string value function getparameterbyname(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); } now problem ajax add cart no...

java - Can't get swipe working for swipeable tabs -

i following http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html , have same code. can't tabs swipe each other , can't view content in tabs. code below. help! activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="activity.mainactivity"> <include android:id="@+id/toolbar" layout="@layout/tool_bar" /> <slidingmodel.slidingtablayout android:layout_below="@+id/toolbar" android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" ...

c# - Given an array contains sequence of numbers from 0 to 1000. -

given array contains sequence of numbers 0 1000. use loop sum array values , break loop if sum >= 500 c# here go: //first initialize array // loop on array , sum. int sum = 0; for(int i=0; < yourarray.length; i++) { sum += yourarray[i]; if(sum >= 500) { break; } } console.writeline("sum : {0}", sum); //print out sum here live demo

c# - iTextSharp: Rectangle is not showing in Acrobat Reader -

i'm using itextsharp v5.1. create pdf file multiple pages. when open pdf in chrome looks expected, when open in systemviewer of win8 parts of context missing. , in acrobat reader parts missing well. i managed track down problem: when draw line, rectangle or roundedrectangle following text not showing anymore until create new page. i'm writing text, no images , have no form objects. when analyze pdf using http://www.pdf-online.com/osa/repair.aspx get page objno description 0 0 form xobject xf2 has empty or unreadable content stream. 9 0 file corrupt , cannot repaired. of contents can possibly recovered. searching day understand xf2 has forms, don't use. here's code create document: var document = new document(); document.setpagesize(pagesize.a4.rotate()); var writer = pdfwriter.getinstance(document, ms); // set template title page titlepageeventhandler("template.pdf")); writer.setpd...

Start VLC and play webcam stream in C# -

i trying start vlc media player (without including it) , play webcam stream delay of 3 seconds. process p = new process(); p.startinfo.filename = @"c:\program files (x86)\videolan\vlc\vlc.exe"; p.startinfo.arguments = ":dshow-vdev=uv-3013xc_4102889504 :dshow-adev= :live-caching=3000"; p.start(); with that, starts vlc player without errors occuring. wont start playing webstream. ideas how solve this? okay, found solution. 1 argument missing: process p = new process(); p.startinfo.filename = @"c:\program files (x86)\videolan\vlc\vlc.exe"; p.startinfo.arguments = "dshow:// :dshow-vdev=uv-3013xc_4102889504 :dshow-adev= :live-caching=3000";//dateiname p.start();//prozess starten

java - Inserting Into MySQL database by click of a button in JSP -

following code insert data mysql database. but code not inserting data database clicking send button. <% class.forname("com.mysql.jdbc.driver"); conn = drivermanager.getconnection(conn_string, username, password); if(request.getparameter("send")!=null){ string scom=request.getparameter("scompany"); string porderno=request.getparameter("pono"); string bdate=request.getparameter("date"); string drug1=request.getparameter("d1"); string qty1=request.getparameter("q1"); //getting todaydate date date = new date(); timestamp timestamp = new timestamp(date.gettime()); string sql = "insert purchaseorderinfo set supplier ='"+scom+"', pono='"+porderno+"', expecteddate='"+bdate+"', podate='"+timestamp+"' "; pst=conn.preparestatement(sql); ...

java - could not initialize proxy - no Session Exception -

i working on project based on hibernate , spring. have spent 2 days can't figure out why "lazy exception" error coming when call piece of code: public memberuser sendemail(memberuser user) throws mailsendingexception { // check if password sent mail // hibernate.initialize(user); user = fetchservice.fetch(user, fetch); // user = userdao.load(user.getid(), fetch); final membergroup group = user.getmember().getmembergroup(); final boolean sendpasswordbyemail = group.getmembersettings().issendpasswordbyemail(); string newpassword = null; if (sendpasswordbyemail) { // if send mail, generate new password newpassword = generatepassword(group); } // update user user.setpassword(hashhandler.hash(user.getsalt(), newpassword)); user.setpassworddate(null); userdao.update(user); if (sendpasswordbyemail) { // send password mail mailhandler.sendresetpassword(user.getmember(), newpassword); } ...