Posts

connection - Multiple request handling with node.js -

i new node , things still don't make sense, bare me. may trivial task experienced node people, struggling want work. i want make type of relay server: send request node server client like: http myserver:port/node1?command=foo&type=bar parse out request.url: /node1?command=foo&type=bar send second server request.url attached , receive json object server(request.url) according request : http someotherserver/node1?command=foo&type=bar deliver json object client currently have access url request, may know that's not hard task, since it's 'request.url'. want call heroku instance iphone app, have heroku instance relay request server , send response iphone app. help appreciated. thanks.

Relational database from XML -

i trying learn create relational database schema given xml format. format follows <product description:"cardigan sweater"> <catalog-item gender:"men's "> <item-number>qwz5 67 1 </item-number> <price>39.95</price> <size description:"medium"> <color>red</color> <color>burgundy</color> </size> <size description:" large "> <color>red</color> <color>burgundy</color> <lsize> </catalog-item> <catalog_item gender"'women's"> <item-number>rrx9 8 5 6</item-number> <price>42.5o</price> <size description:"medium"> <color>red</color> <color>navy</color> <color>burgundy</color> <color>black</color> </size> <size description:" large "> <color>bur...

php - mysql object not converting to int -

so, have wp mysql db column following: `update_number` = int(11) null:no, default:0 then have following php: $rss_update = $wpdb->get_results("select update_number $table sub_id = $post_id"); if ( $rss_update ) { foreach ( $rss_update $rss_single ) { $rss_row_new = $rss_single + 1; $wpdb->update($table, array('update_number' => $rss_row_new),array( 'sub_id' => $post_id )); } } so idea that, results sub_id = $post_id , update_number . (ie. "0,2,1,4,2,2") then, each value, want increase integer value +1 , update it. however, getting object of class stdclass not converted int . what doing wrong? i think need ensure $rss_single string or int var_dump($rss_single);exit; $rss_update = $wpdb->get_results("select update_number $table sub_id = $post_id"); if ( $rss_update ) { foreach ( $rss_update $rss_single ) { $rss_row_new = $r...

Which ReactJS syntax to use; React.createClass or ES6 extends? -

i'm beginner of reactjs. learned , studied lot of documents , ebooks on various websites. realize there 2 syntaxes reactjs. example: react.createclass({ displayname: 'counter', getdefaultprops: function(){ return {initialcount: 0}; }, getinitialstate: function() { return {count: this.props.initialcount} }, proptypes: {initialcount: react.proptypes.number}, tick() { this.setstate({count: this.state.count + 1}); }, render() { return ( <div onclick={this.tick}> clicks: {this.state.count} </div> ); } }); and version written es6: class counter extends react.component { static proptypes = {initialcount: react.proptypes.number}; static defaultprops = {initialcount: 0}; constructor(props) { super(props); this.state = {count: props.initialcount}; } state = {count: this.props.initialcount}; tick() { this.setstate({count: this.state.count + 1}); } render() { return ( ...

laravel - Change default column name 'id' when validating -

i trying validate email field make sure it's unique, not in row id, so: 'email' => 'required|email|unique:seller_user,email,'.$seller_id, that works, automatically searches column named id , whereas in table column called seller_id , how can change that? you can specify field search using fourth parameter rule: 'email' => 'required|email|unique:seller_user,email,'.$seller_id.',seller_id',

highlight - JaCoCo/EclEmma's Source highlighting function doesn't work when using PowerMock to Mock Constructor -

i used powermock mock constructor.afer launching application,i thought lines shoud green.however,actually lines red. think mocking constructor results in phenomenon.beacause mocking others,like final classes, ok.how fix problem? //code: public class people { public string sayhello(){ return "hello"; } } public class family { public string doevent() { people p = new people(); string str = p.sayhello(); system.out.println(str); return str; } } @runwith(powermockrunner.class) @preparefortest(family.class) public class familytest { @test public void test() throws exception { family f = new family(); string str = "hello mock"; people p = powermock.createmock(people.class); powermock.expectnew(people.class).andreturn(p); easymock.expect(p.sayhello()).andreturn(str); powermock.replay(p, people.class); string stractual = f.doevent(); ...

python - matplotlib: share x-axis for two barcharts, each with 4 groups -

Image
i trying create figure 2 barcharts using matplotlib. each barchart has 4 groups of bars. current python code using follows: fig,ax=plt.subplots() bar_width=0.15 rects1 = plt.bar(index, group0, bar_width, alpha=opacity, color='b', label='1') rects2 = plt.bar(index + bar_width, group1, bar_width, alpha=opacity, color='r', label='2') rects3 = plt.bar(index + bar_width+bar_width, group2, bar_width, alpha=opacity, color='c', label='3') rects4 = plt.bar(index + bar_width+bar_width+bar_width, group3, bar_width, alpha=opacity, color='m', label='4') after formatting, plot obtain follows: now, have 2 such barcharts , want them share x-axis. i can't figure out way achieve this. appreciated. thanks ...