Posts

Showing posts from February, 2010

Will data saved in chrome.storage be synced if user switch to another computer with same google account? -

background: hi everyone, developing chrome extension in form of new tab. hyperlinks contained in new tab page fixed , wanna make links customizable. progress i did research in internet , found chrome.storage can provide data storage pages. however, wondering if can sync data between multiple computers when user logs in same google account? i looked further chrome.storage api description. luckily provide data sync user same google account across different computers! network again! chrome.storage usage to store user data extension, can use either storage.sync or storage.local. when using storage.sync, stored data automatically synced chrome browser user logged into, provided user has sync enabled. it's hard find useful information in chinese when facing problem, sof splendid.

javascript - Angular $routeParams is empty -

i have url that's getting passed angular code via rails. however, when try pick parameter in url, shows blank. can me out? sample url: http://localhost:3000/events/event1 plnkr: http://plnkr.co/edit/yg8wazhhgpth2pbfzql3?p=preview angular: eventsapp = angular.module('eventsapp', ['ngroute']) eventsapp.config [ '$routeprovider' '$locationprovider' ($routeprovider, $locationprovider) -> $locationprovider.html5mode(true) $routeprovider.when '/events/:eventname', templateurl: '../../views/events/events.html.erb' controller: 'eventsctrl' return ] eventsapp.controller('eventsctrl', [ '$scope' '$routeparams' ($scope, $routeparams) -> console.log($routeparams.eventname) # shows undefined $scope.greeting = $routeparams.eventname ]) html: events.html.erb <div> {{...

db2 luw - File loading issues in DB2 using Load utility -

i have .csv file, comma-delimited (located @ c:/). using db2 load utility load data present in csv file in db2 table. load client c:\users\somepath\filename.csv of del modified nochardel coldel, insert schemaname.table_name; csv file has 25 rows. after utility completed got error message nochardel. table has 25 rows loaded. when try execute insert/update/delete statement on of tables present in schema getting following error. lookup error - db2 database error: error [55039] [ibm][db2/aix64] sql0290n table space access not allowed. could please me whether making mistake or missing parameter causing lock on table. earlier while loading file similar situation occurred, dba confirmed table space in question in “load in progress” state changes generated db2 load utility not logged (one of side-effects of high performance). if database crashes after load impossible recover table loaded replaying log records, because there no such records. reason tablespace c...

Is there a way to initialise an array using an expression/function in R -

is there easy way initialise array using function based on indexes of each cell within array? for example if wanted create array values equal i+j+k such (for example): > a[1,2,3] 6 > a[4,8,9] 21 i'd along lines of: a <- array( i+j+k , dim=c(10,10,10) , dimnames=list(i,j,k) ) do first need create array of size want, , apply function array (ie two-stage process)? or there way initilize values @ same time creating matrix? nested outer calls seem trick (here 3 visibility): outer(outer(1:3,1:3,"+"),1:3,"+") or duplicate example: > a=outer(outer(1:10,1:10,"+"),1:10,"+") > a[1,2,3] [1] 6 > a[4,8,9] [1] 21

Difference between Jquery Html callback function and append function? -

what difference between jquery html callback function (source http://www.w3schools.com/jquery/jquery_dom_set.asp ) , jquery append function (source http://www.w3schools.com/jquery/jquery_dom_add.asp ) also ecsctly use of parameter index in jquery html callback function? callback used manipulate content of html element. here can put logic handle text provided , return modified text. in below code, adding original text new 1 return index. same way can put own logic handle text. $("#test1").text(function(i, origtext){ return "old text: " + origtext + " new text: hello world! (index: " + + ")"; }); while in append got choice add more text after existing text , nothing can done extra. in below example, appending new text existing text. $("p").append("some appended text.");

mysql - need absent and present count with month name -

i need month name absent , present count. database query: select sid,count(case when status ='a' 1 end) absent_count,count(case when status ='p' 1 end) present_count, monthname(attendance_date) `month_name` attendance sid = '2' , campus_id = 2 group sid; there's no point in group sid - '2' , per where clause. instead, since want count per month name, should appear in group by clause: select monthname(attendance_date) `month_name`, count(case when status ='a' 1 end) absent_count, count(case when status ='p' 1 end) present_count, attendance sid = '2' , campus_id = 2 group monthname(attendance_date);

javascript - Trouble with Wordpress Ajax Login System - 302 -

i'm trying create simple ajax login system wordpress. unfortunately, every time "wp_signon" function fired, system failed , information have 1 : post myurl/wp-admin/admin-ajax.php - 302 found myurl/?login = failed - 200 found so, whether try log in informations or not, js script goes in "error part" of ajax function. can tell me doing wrong? appreciated! many thanks! js : jquery(document).on('submit', loginform, function(event) { event.preventdefault(); var usernameval = jquery('.modal-login .login-form #user_login').val(); var passwordval = jquery('.modal-login .login-form #user_pass').val(); var remembermefield = jquery('.modal-login .login-form #rememberme'); var securityval = jquery('.modal-login .login-form #security').val(); if ( remembermefield.prop('checked') ) { var remembermeval = 'true'; } else { var remembermeval = 'false';...

asp.net mvc 3 - How to get Max(ID) from Student and Create in MVC -

i using 1 mvc example in id incremental in database. create record like: in case id in student table not incremental, need max(id) student table. [httppost] [validateantiforgerytoken] public actionresult create([bind(include = "id,lastname,firstmidname,enrollmentdate,countryid,account_code")] student student) { if (modelstate.isvalid) { db.students.add(student); db.savechanges(); return redirecttoaction("index"); } return view(student); } i want remove "id" include , want max(id) student table through linq , save table. please me thanks. me please

javascript - Exporting HTML table with < to Excel using XML -

i using this method export html tables excel. of colums in data have < characters. cause error when try open file in excel. there way ignore these characters or automatically replace them? eg: <tr> <td>assume a>b</td> </tr> ps: have html data < character. pulling new page, has button export excel (using xml format). i not aware of solution problem mentioned you. workaround can write small data sanitation script using perl/sed sanitize data. details of such script might taken here .

algorithm - Pseudo-code for Network-only-bayes-classifier -

Image
i trying implement classification toolkit univariate network data using igraph , python . however, question more of algorithms question in relational classification area instead of programming. i following classification in networked data paper. i having difficulty understand paper refers " network-only bayes classifier "(nbc) 1 of relational classifiers explained in paper. i implemented naive bayes classifier text data using bag of words feature representation earlier. , idea of naive bayes on text data clear on mind. i think method (nbc) simple translation of same idea relational classification area. however, confused notation used in equations, couldn't figure out going on. have question on notation used in paper here . nbc explained in page 14 on the paper , summary: i need pseudo-code of " network-only bayes classifier "(nbc) explained in paper , page 14. pseudo-code notation: let's call vs list of vertices in graph. len(...

symfony - How to specify Symfony2 Bootstrap checkbox inline style? -

the symfony2 boostrap template has conditional switch on 'checkbox-inline'. how triggered? {% if 'checkbox-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} since conditional check looking in parent_label_class , can add form builder option called label_attr , , there can append class. example: $builder->add('checkbox', 'checkbox', array( 'label_attr' => array( 'class' => 'checkbox-inline' ) ) ); which give following output: <div class="checkbox"> <label class="checkbox-inline required"> <input type="checkbox" id="form_checkbox" name="form[checkbox]" required="required" value="1" />checkbox </label> </div>

protractor - Accessing Iframe inside Iframe -

i working on angular app, runs inside non-angular page. on angular page, have iframe(iframe2) inside iframe(iframe1). able move iframe1 non angular page, not able access iframe2 iframe1 throws error "angular not found on window" it('iframes testing',function(){ brower.driver.navigate().to('url') browser.driver.ignoresynchronization = true; browser.driver.findelement(by.id('username_str')).sendkeys("username"); browser.driver.findelement(by.id('password')).sendkeys("password"); browser.driver.findelement(by.name('submit')).click(); browser.driver.ignoresynchronization = false; browser.driver.switchto().frame(0); browser.waitforangular(); browser.driver.switchto().frame(0); element(by.model('formname')).click(); });

javascript - knockout.js foreach binding: property value to array of column names -

i have question knockout foreach binding table. i have array of columnnames , array of items . the items array has property called columnname . how use knockout foreach bind self.items self.columnnames? my view model looks this: var vm = function () { var self = this; self.items = ko.observablearray(); self.columnnames = [ "name", "age", "job"]; }; var vm = new vm(); ko.applybindings(vm); vm.items.push([ { 'columnname': 'name', 'value': 'john' }, { 'columnname': 'age', 'value': 25' } ]); vm.items.push([ { 'columnname': 'name', 'value': 'jane' }, { 'columnname': 'age', 'value': 26 }, { 'columnname': 'job', 'value': 'developer' } ]); ...

sql - Complex Postgres query -

i have db schema following - (country table) | country | country code| ------------------------- abc bcd b (organization table) |organization | country code | organization code org 1 o1 org 2 b o2 org 3 o3 (transaction table) | organization | export(in $) | import(in $)| o1 x1 y1 o2 x2 y2 o3 x3 y3 i want result set - | corridor | total export | total import | ------------------------------------------ abc-bcd x1+x2+x3 y1+y2+y3 corridor column should combination of countries in country table. how can form query implement logic? thanks all need run aggregate query: select sum(t.export) totalexport, sum(t.import) totalimport country c inner join organization o on c.country_code = o.country_code inner join transaction t on o.organization_code = t.organiza...

Python SHA1 Integer -

i did 2 sha1 in c code, 1 string, , integer, , different result. sha_init(&ctx); sha_update(&ctx, "1234", 4); sha = sha_final(&ctx); unsigned n = 1234; sha_init(&ctx); sha_update(&ctx, &n, sizeof(n)); sha = sha_final(&ctx); string result: 7110eda4d09e62aa5e4a390b0a572acd2c220 integer result: c7f07b846cc46631c2079cdd7179afdd783d643 in python, it's easy string sha1 sha1 = hashlib.sha1() sha1.update('1234') sha1.hexdigest() '7110eda4d09e062aa5e4a390b0a572ac0d2c0220' we can see string result same c code. how integer sha1 in python? because python sha1 doesn't support integer. i tried following code, can't same result c code. aint = unpack('>4b', pack('>i', 1234)) sha1 = hashlib.sha1() sha1.update(bytearray(aint)) sha1.hexdigest() 'ac9928e78cf6ea117451ecd6654fea2adae73e21' how integer sha1 in python? i can't reproduce results in c, sha library using? open...

vim - solarized color theme not working properly in tmux -

Image
i'm on ubuntu 14.04, installed: konsole tmux 1.9.6 vim 7.4.52 when directly start vim in konsole, it's working fine. if start vim in tmux, there's coloring issues annoying, please see below screenshot. here's part of color setting in vimrc: set background=light let g:solarized_termcolors=256 set t_co=256 colorscheme solarized where's problem? here? this due wrong term environment variable value. tmux pretty explicit should either screen or screen-256color . you can first check have typing inside tmux echo $term . the usual fix add line .tmux.conf : set -g default-terminal "screen-256color" restarting tmux recommended after this. now, when executing echo $term inside tmux, output should screen-256color . if not, term variable overridden in .bashrc (you wanna delete there or set conditionally).

html - What CSS can display right, center and left aligned images like a table can? -

i want use css reproduce behaviour of simple html table below. the html table has width of 100% 1 row , 3 columns. each column contains image image1 left-aligned; image2 centered; , image3 right-aligned. importantly, when browser window resized small, images should not overlap or wrap onto next line. should stay next each other in same line (this table solution does). this sounds such simple requirement, i've been struggling many hours , appreciated. <html> <head> <title>test</title> </head> <body> <table width="100%"> <tr> <td align="left"> <img width="150" height="129" src="image1.gif"> </td> <td align="center"> <img width="400" height="120" border="0" src="image2.jpg"> <!-- main logo --> </td> <td align="right"> <img width="141" height="80"...

css - zurb-foundation icon as a dropdown menu -

i'm having trouble using foundation icon set. i'd use icon button dropdown menu in navbar. <div class="contain-to-grid sticky"> <nav class="top-bar" data-topbar role="navigation" data-options="sticky_on: large"> <ul class="title-area"> <li class="name"> <a href="#"><img src="http://placehold.it/100x45&text=logo"/></a> </li> <li class="toggle-topbar menu-icon"><a href="#">menu</a></li> </ul> <section class="top-bar-section"> <ul class="right"> <li> <i class="fi-thumbnails has-dropdown"></i> <ul class="dropdown"> <li>all</li> <li>art</li> <li>music</li> <li>l...

php - Using wordpress functions to add featured image to block -

hi i'm bit new adding custom functions in code i'm building blog , in every post page has button says previous or next article. wanted use pre existing function display block featured image each previous/next post. i'm using radcliffe theme , arrows in bottom of page. part of code want add "block": thank you! <div class="post-nav"> <?php $next_post = get_next_post(); if (!empty( $next_post )): ?> <p class="post-nav-next"> <a title="<?php _e('next post:', 'radcliffe'); echo ' ' . get_the_title($next_post); ?>" href="<?php echo get_permalink( $next_post->id ); ?>"><?php echo get_the_title($next_post); ?> </a> </p> <?php endif; ?> <?php $prev_post = get_previous_post(); if (!empty( $prev_post )): ?> <p class="post-nav-prev"> <a t...

c++ - Store pointer to map key -

std::map<key,value> mymap; (void)mymap[key(...)]; // create value if not there typename std::map<key,value>::iterator = mymap.find(key); it->second.pkey = &it->first; // store pointer actual key is safe? in other words, map allowed copy key around during insert/erase operations, invalidate value::pkey ? any c++98 vs c++11 differences on this? std::map iterators invalidated on erasure ( erase or clear ). inserting new elements map doesn't affect existing iterators. same in c++98 , c++11. if iterator remains valid follows key points remains valid.

java - Encoding Path to URI behaves differently when built into JAR or not -

i have call hashmap's containskey method expect return true. returns true if compile program .class files , run that, if build jar same call returns false reasons cannot comprehend. i've debugged both .class , jar versions (the jar using remote connection described in http://www.eclipsezone.com/eclipse/forums/t53459.html ) , in both cases hashmap appears contain key i'm trying check. the hashmap uses uri objects keys. here contents of variables shown in each debug session: when run .class file hashmap key: java.net.uri = file:/e:/ssd%20app%20libraries/google%20drive/programming/bet%20matching/java%20sim/target/classes/simfiles/paytables/ uritocheck: java.net.uri = file:///e:/ssd%20app%20libraries/google%20drive/programming/bet%20matching/java%20sim/target/classes/simfiles/paytables/ result: gametreeitemsmap.containskey(uritocheck) true when run jar hashmap key: java.net.uri = jar:file:/e:/ssd%20app%20libraries/google%20drive/programming/bet%20matching/...

linux - Go HTTP server testing ab vs wrk so much difference in result -

i trying see how many requests go http server can handle on machine try test difference large confused. first try bench ab , run command $ ab -n 100000 -c 1000 http://127.0.0.1/ doing 1000 concurrent requests. the result follows: concurrency level: 1000 time taken tests: 12.055 seconds complete requests: 100000 failed requests: 0 write errors: 0 total transferred: 12800000 bytes html transferred: 1100000 bytes requests per second: 8295.15 [#/sec] (mean) time per request: 120.552 [ms] (mean) time per request: 0.121 [ms] (mean, across concurrent requests) transfer rate: 1036.89 [kbytes/sec] received 8295 requests per second seems reasonable. but try run on wrk command: $ wrk -t1 -c1000 -d5s http://127.0.0.1:80/ and these results: running 5s test @ http://127.0.0.1:80/ 1 threads , 1000 connections thread stats avg stdev max +/- stdev latency 18.92ms 13.38ms 234.65ms 94.89% ...

jquery - How to get a different window's html with javascript -

i open new window using url, grab html string , display in console of original window. from how element , html window.open js function jquery , tried: console.log('response', url) var popup = window.open(url, '_blank', 'width=500,height=500'); popup.onload = function() { settimeout(function(){ console.log( 'hi',popup.document.documentelement.outerhtml) }, 2000); } the popup window created, don't see popup's html in original window's console. what doing wrong? if it's not on same domain, i'm pretty sure isn't possible it's not possible iframe: get html inside iframe using jquery . however, if own both pages, should able use described in first answer question linked ( how element , html window.open js function jquery ) note: if control both parent , child source, have child invoke method on parent passes in it's html: child window // call when body loaded function sendhtmltopa...

ios - programmatically send money in native app BUT with delay -

here's use case i'm trying support: i have 3 native app users a, b , c. on day one, users , b manually make commitment send user c $20 7 days day 1 based on successful completion of action user c. app retains logic determine if user c has completed action , if so, programmatically sends payment user c on behalf of users , b on day seven. 1) above supported paypal? (assuming transaction completed @ service layer, not app layer) i've researched https://developer.paypal.com/webapps/developer/docs/api/#create-a-batch-or-single-payout seems geared toward one many relationship between merchant , multiple payees. what need support many many relationship between users aren't merchants https://www.paypal.com/webapps/mpp/send-money-online 2) if not, there alternate providers can support above? this looks more server based app ios clients. clients make commitment server, when action completed server sent information , dispenses cash recipient.

Write string value to the arduino or the serial port using java -

i trying write string data serial port, cannot write string value arduino serial port. can me solve this. this java code: portlist = commportidentifier.getportidentifiers(); while (portlist.hasmoreelements()) { portid = (commportidentifier) portlist.nextelement(); if (portid.getporttype() == commportidentifier.port_serial) { if (portid.getname().equals("com9")) { try { serialport = (serialport) portid.open("simplewriteapp", 2000); } catch (portinuseexception e) { system.out.println("error1 "+ e); } try { outputstream = serialport.getoutputstream(); } catch (ioexception e) { system.out.println("error2 "+ e); } try { serialport.setserialportparams(9600, ser...

python - Selenium not working on Pycharm -

i installed selenium on system using 'pip install selenium' , works great on mac console. when tried using selenium in project on pycharm, got error no module named selenium exists. doing wrong? so found doing wrong. mac terminal , pycharm using different python installed on system, changed path on pycharm interpreter local path selenium installed.

PHP & Illegal mix of collations in MySql dump file -

i wrote php script harvest data want enter database. includes user's usernames need entered, users chose usernames upside down text, i.e, 'uıɯpɐ' i collation error when use username in clause, there way php sanitize before going database avoid this? #1267 - illegal mix of collations (latin1_swedish_ci,implicit) , (utf8_general_ci,coercible) operation '=' the way script set don't have of choice use username in clause.

Python find and replace script doing incomplete job -

from answer previous question ( efficient means of mass converting >600,000 different find , replaces within 1 file ), received bit of python code 1000s of find/replaces en masse. the code worked then, trying use conduct ~20,000 find/replaces on second column of table looks this: 1 1:565596 0 565596 1 1:567137 0 567137 1 rs7419119 0 842013 1 rs13302957 0 891021 1 rs6696609 0 903426 1 rs8997 0 949654 there 600,000 lines in overall table. these values colons (e.g., 1:565596) need replaced other values. each substitution needed on once in data table. have substitution table looks similar 1 used before. coordinate affy_snp_id 17:4744823 affx-14001316 1:8362754 affx-14761301 3:128686912 affx-21139873 8:11830502 affx-31417216 12:23201352 affx-7455925 the adapted code above implemented such import csv subs = dict(csv.reader(open('coordtoaffy.txt'), delimiter='\t')) source = csv.reader(open('neanderthal.map'),...

ember.js - Who defines the "store" object? -

from code snippet : todos.todoscontroller = ember.arraycontroller.extend({ actions: { createtodo: function() { // todo title set "new todo" text field var title = this.get('newtitle'); if (!title.trim()) { return; } // create new todo model var todo = this.store.createrecord('todo', { title: title, iscompleted: false }); // clear "new todo" text field this.set('newtitle', ''); // save new model todo.save(); } } }); which is, in fact, ember website who defines (and defined) this.store ? looked in controller class , in dsl the store ember data bookkeeping object. it has been injected via ember's dependency injection api application's controllers , routes using initializer , can referenced route or controller this.store the store same instance of 'store:main' regardless of called from, because has be...

angularjs - Focusing on input should select a radio button -

this might seem easy thing can't find neat way of achieving want... i have rows contains values taken array in scope. these rows contain radio input each , 1 of them contain text input. the original array looks like: $scope.items = [ {name: 'one', value: 1, checked: true}, {name: 'two', value: 2}, {name: 'custom', value: 0, custom: true} ]; to make simpler understand prepared demo here show how looks. the expected behaviour first row gets selected @ initialisation time. focusing on text input should check corresponding radio input. behaviour seems work fine first time focus on input. after that, if radio button checked, focusing in input doesn't tick matching radio button... i tried wrapping whole row or input in label linked radio button doesn't work either. if of know how handle scenario in neat way, i'm eager know! when select item pickitem function change item.check property. don't change when chec...

Assigning a number to an Object... Strangely, but this piece of code runs in Java -

assigning number object... strangely, piece of code runs in java: object a="123abc"; system.out.println("a="+a); object b=123; system.out.println("b="+b); the result being: a=123abc b=123 could please explain why , how works? i want expand on @juned's answer, based on @art's comment "it's still not obvious me. b's type still - object, right?" in code: object = "123abc"; system.out.println("a=" + a); object b = 123; system.out.println("b=" + b); 123abc object of class string — string happens defined constant value @ compile time. a variable reference object of class object or any compatible sub-class . it similar doing this: object a; string s = new string("123abc"); // redundant way make string = s; the variable string s can assigned variable object a because string is-a subclass of object; object a can reference any kind of object including s...

asp.net - URL not redirecting to default page -

i have website developed in asp.net. have hosted in iis , url www.web.com. whenever request page typing url in browser redirected login page url www.web.com/login.aspx?returnurl=%2f. i have added following in web.config make default.aspx default page. <defaultdocument> <files> <clear/> <add value="default.aspx"/> </files> </defaultdocument> also, <forms loginurl="login.aspx" defaulturl="~/default.aspx"> the pages present on root folder, tried few things mentioned here . there else missing ? direction towards solution or links helpful. edit: website redirects default.aspx when run on localhost a couple of minor differences, may help. assume using iis 7 or higher. if @ same folder level, can try: <forms loginurl="logon.aspx" defaulturl="default.aspx"/> you can try: <defaultdocument enabled="true"> <files> <clear/...

javascript - For a regex pattern, how to determine the length of longest string that matchs the pattern? -

having regex pattern regexpattern , how can determine length of longest string matches regexpattern . the imaginary int longestlength(string pattern) should work this: assert.equals(longestlength("[abc]"), 1); assert.equals(longestlength("(a|b)c?"), 2); assert.equals(longestlength("d*"), int.maxvalue); // or throws nolongestlengthexception although question in c#, both c# , javascript answers good. it's pretty straightforward proper regex using operators ? , * , + , | , plus parentheses, character classes , of course ordinary characters. in fact \1 -style backreferences (which aren't part of formal definition of regex, , complicate questions regexes) can handled without problems. a regex compact encoding of tree structure (similar how mathematical formulas compact encodings of tree structures describing arithmetic). between every adjacent pair of characters there implicit "follows" operator corresponds node 2 c...

angularjs - Aggregation does not working in Mongoose with Match and Group -

i'm coding application using angularjs, nodejs , mongoose. now, i'm doing chart , need return data passsing parameters. aggregation not work. have query working in mongodb: var user = db.getcollection('users').find( {profile: "supervisor"},{_id: 1}).map(function(u){return u._id;} ) db.getcollection("visitas").aggregate( { '$match': { createdat: { '$gte': isodate('2015-01-10t00:00:00.000z'), '$lt': isodate('2015-07-01t00:00:00.000z') } } }, { '$group': { _id: { usuario: user, dia: [object] }, visitas: { '$sum': 1 } } } ) when try run same query in application using mongoose, query not work. problem i've seen comma between match , group disapearing. when try search group or match, query works. can me? application code: .then(function (listausuarios){ var argsvisit; console.log({ $match : { "createdat" : { $g...

cannot run python MRJob locally -

if understand mrjob correctly, can simulate hadoop's multi process run using mrjob running with python mrfile.py -r local input.txt i'm running windows(no choice now), , when issue above command, i'm getting bunch of mambo jumbo , @ end tells me : windowserror: [error 2] system cannot find file specified this full error. help? c:\users\someuser\documents\python_projects\something>python mrjob_parser.py -r loc al test2.txt no configs found; falling on auto-configuration no configs found; falling on auto-configuration creating tmp directory c:\users\someuser\appdata\local\temp\mrjob_parser.someuser. 20150701.211822.496000 writing wrapper script c:\users\someuser\appdata\local\temp\mrjob_parser.bw401 45.20150701.211822.496000\setup-wrapper.sh writing c:\users\someuser\appdata\local\temp\mrjob_parser.someuser.20150701.211 822.496000\step-0-mapper_part-00000 > sh -ex setup-wrapper.sh 'c:\users\someuser\documents\python_venv\something_project\ scripts\pyth...

c# - Why is the else not a valid expression -

the error i'm getting code else invalid expression term. why this? private void button2_click(object sender, eventargs e) { int magicnumber; if(int.tryparse(textbox2.text,out magicnumber)); { messagebox.show ("your number " + magicnumber); } else { messagebox.show("failure"); } } you closed if statement semicolon: if(int.tryparse(textbox2.text,out magicnumber)); the block below declares new scope, , execute. else block below that has no matching if , error.

android - RecyclerView Grid - define number of items per row in -

i'm typically against posting question without code, have no code show. i'm converting project listviews , gridviews recyclerview. in 1 class, use small gridview place items pulled server. the max number of items per row 3, remainder needs on top. if there's 5 items, top row has 2, bottom has 3. if there's 4 items, top row has 1, bottom has 3. my google-fu failing me , i'm not able find examples type of customization. if point me in right direction, i'll post completed code find post in future. thanks all there constructor of gridlayoutmanager , takes 4 parameters. new gridlayoutmanager(this, 3, gridlayoutmanager.vertical, true) the second 1 spancount, number of columns or rows in grid, while forth called reverselayout , when set true, cells laid out end start .

Word Vba Input Box to set Document Orientation - IF with OR -

in macro want prompt page orientation -- p or p portrait, l or l landscape. here developed. works - want know if there better/more efficient way develop if statements "or" --- have use "nested" if?? dim integer dim otbl table dim rng range dim orientation string selection.pagesetup .linenumbering.active = false .orientation = wdorientportrait .topmargin = inchestopoints(1) .bottommargin = inchestopoints(1) .leftmargin = inchestopoints(0.4) .rightmargin = inchestopoints(0.4) .gutter = inchestopoints(0) .headerdistance = inchestopoints(0.5) .footerdistance = inchestopoints(0.6) .pagewidth = inchestopoints(8.5) .pageheight = inchestopoints(11) .firstpagetray = wdprinterdefaultbin .otherpagestray = wdprinterdefaultbin .sectionstart = wdsectionnewpage .oddandevenpagesheaderfooter = false .differentfirstpageheaderfo...

oracle - IF ELSE check variable value without needing to define entire resultset -

i have 2 similar queries use work research , trying use boolean variable decide 1 run. the problem: in order save variable, think need use pl/sql block, seems require me define every column of resultset , bulk collect resultset. setting template coworkers, of whom know basic sql, can't ask them define new columns. is there way me allow them set boolean variable , run corresponding sql query outside of pl/sql block? there better way it? what have far (doesn't work): declare submit_denied_lines boolean; begin submit_denied_lines := true; --or false depending on needs if submit_denied_lines = false goto qry_status_x; else goto qry_resolution; end if; end; <<qry_status_x>> (the status_x query) goto the_end; <<qry_resolution>> (the resolution query) <<the_end>> notes: if asking not possible, post 2 sql files them use , leave notes 1 applies situation. thank help. your missing lot of information. same se...

netbeans - java.lang.NoClassDefFoundError jar application -

i got maven project netbeans 8 (linux). my project maven application have 'export' jar runnable java application. while i'm developing system in netbeans works fine maven dependencies, after compile , generate .jar file in target folder got error noclassdeffounderror. in searches through google found problem caused when have dependencies in development environment not when it's compiled classpath. one solution include dependencies jar library in project, lost maven functionality. don't wanna make it, in last case. how can solve problem without add dependencies library inside project? thank much! you not use correct maven plugin generate runnable jar, meaning jar dependencies within it. here how should like <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> <version>2.4</version> <configuration> <finaln...

linux - Python is not able update the time according to selected timezone in inux -

python not able update time according selected timezone in inux. i have python code trying print time in iso format using python date time module in below code. { import datetime current_time = datetime.datetime.now().isoformat() print current_time } i trying run code in startup script of linux. have set time zone in linux utc-05:30 . still getting "current_time" in utc , not in utc-05:30 . "current_time" lags behind system time 05:30 hours. sure why python not able use system time during boot up. please let me know know issue. my problem has starting python script @ bootup. think linux not able set time according timezone @ bootup . have printed system time @ boot in utc , not in utc-05:30 though timezone utc-05:30. since script starting @ bootup,it took system time set according utc , not utc-05:30. once system boots up, system time set correctly according timezone.i correct output date command. how python application not able time according time...

c++ - Why do I get two return values here? -

int main(){ int recurse(int); int a=recurse(0); printf(" return %d",a); } first one: int recurse(int c){ //printf("%d", c); if(c<10){ recurse(c+1); }else{ return(c); } } second one: int recurse(int c){ //printf("%d", c); if(c<10){ recurse(c+1); } return(c); } in first one..i return value of 10 while in second 1 return value of 0. why 2 different values , why 0?? in fact function int recurse(int c){ //printf("%d", c); if(c<10){ recurse(c+1); }else{ return(c); } } has undefined behaviour because returns nothing in case when c < 10 this function int recurse(int c){ //printf("%d", c); if(c<10){ recurse(c+1); } return(c); } always returns value of argument c independently of value itself. function has unconditional return statement , returns argument. called argument equal 0 returned it.:) a correct function following way int recurse( int c ) { return c < 10 ? recu...

Asynchronous Programming in Java when using blocking APIs -

this question has answer here: java executors: how notified, without blocking, when task completes? 11 answers i working on java project uses apis blocking. i use asynchronous programming , callbacks, don't have block while waiting result. i've looked using java future , way think use calling get() method block. open using other ways asynchronous programming well. my current code looks this. object res = blockingapi(); sendtoclient(res); if use future , this. understanding get() blocking. private final int threads = runtime.getruntime().availableprocessors(); private executorservice executor = executors.newfixedthreadpool(threads); public void invokeapi() { future<object> future = executor.submit(new callable<object>() { public object call() { return result; } }); object result = future.get(5, ...

android - SlidingTabLayout not displaying on output -

i using android studio 1.2.2 , trying implement tabs 1 of activities. have added code don't seem getting output on phone. not need actionbar, slidingtablayout, doesn't show other blank screen when run. iphone6activity.java package com.hashmi.omar.vodafonestore; import android.app.activity; import android.graphics.typeface; import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.viewpager; import android.support.v7.app.actionbaractivity; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; public class iphone6activity extends activity { private viewpager mpager; private slidingtablayout mtabs; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setconten...

html - MultipartMemoryStreamProvider and reading user data from MultiPart/Form Data -

i have file , user data being posted multipart/form data post method in apicontroller class. able read file without problems unable read user data. i tried couple of things using model binding, passing individual fields method parameter in post method get: no mediatypeformatter available read object of type 'formdatacollection' content media type 'multipart/form-data'. var provider = await request.content.readasmultipartasync(new multipartmemorystreamprovider()); foreach (var item in provider.contents) { var fieldname = item.headers.contentdisposition.name.trim('"'); if (item.headers.contentdisposition.filename == null) { var data = await item.readasstringasync(); if(fieldname = 'name') name=data; } else filecontents = await item.readasbytearrayasync(); } thanks. i had considered adding other post per comment, (as decided), separate question. public async task<httpresponsemessage> post() { if (!request.content.i...

Grails Spring Security Rest - 403 Forbidden -

so started learning grails, , trying incorporate spring security rest plugin app, plugin installed in addition spring security core working. in rest client, when hit "api/login" able access token , says have role of "role_admin", when try hit using that, keep getting 403 forbidden. in postman, rest client using, have authorization header "bearer {key}", url of " http://localhost:8080/test/api/secret " , gives 403 error. trying setup log4j logging see other issues, know should into, appreciated. provided classes below if helps, used default values such urlmappings. randomcontroller.groovy package test import grails.plugin.springsecurity.annotation.secured @secured(['is_authenticated_anonymously']) class mycontroller { @secured(['role_admin']) def secret() { render "you have access!!!" } } bootstrap.groovy class bootstrap { def init = { servletcontext -> def adminrole = new secro...

php - Laravel : Redirections in a subfolder -

i'm working on local version of website developed laravel. have url : http://localhost/s/seo/userinstall returns 404 error. in app/http/routes.php , tried following i'm still getting same error : route::get('userinstall', 'installcontroller@userinstall'); route::post('userinstall', 'installcontroller@saveuser'); then tried route::get('s/seo/userinstall', 'installcontroller@userinstall'); route::post('s/seo/userinstall', 'installcontroller@saveuser'); i checked allowoverride directive in apache configuration file , seems fine : <directory /> allowoverride </directory> i'm using defaut laravel .htacess file. idea how can fix this? thanks by looking url, http://localhost/s/seo/userinstall i assuming s->seo directories under apache root directory , because have use "s/seo/userinstall" in route::get('s/seo/userinstall', 'installcontroller@userins...

vba - Creating folders in Outlook 2010 -

i have folder containing many subfolders on desktop need recreate in outlook 2010. folders empty , have template. there 400 folders trying avoid manually creating every 1 of them in outlook. the issue have these folders aren't being put under inbox, going created under common mailbox accessible coworkers. using archiving purposes. of codes have found creating folders under inbox. how go recreating directory under public mailbox? have little experience in vba programming. have folder names in excel if makes easier accomplish this. thanks in advance help. well, i'd suggest starting getting started vba in outlook 2010 article in msdn learn basics. outlook object model there no difference folder located. add method of folders class creates new folder in folders collection. you may use stores property of namespace class returns stores collection object represents store objects in current profile. getshareddefaultfolder method of namespace class returns folde...