Posts

Showing posts from August, 2013

What is default google analytics session timeout for Android mobile app? -

android ga documentation bit confusing the java api says default timeout 30 seconds. https://developers.google.com/android/reference/com/google/android/gms/analytics/tracker.html#setsessiontimeout(long) however same document says ga_sessiontimeout 1800 30 minutes. ga_sessiontimeout(int) - time (in seconds) app can stay in background before new session started. setting negative number result in new session never being started. default 1800 seconds (30 minutes). https://developers.google.com/analytics/devguides/collection/android/v4/sessions and actual experiment shows timeout 300 seconds. know timeout value session android application? unfortunately tracker object doesn't have method, or other methods figure out value me. what google analytics session timeout setting on? go admin > property column (middle column) > js tracking info > session settings the default timeout 30 minutes, unless has changed timeout value . i well-versed google analytic

android - How to add a ring around the custom image marker pointing down on the map without using drawable file -

want marker in image. have made custom marker circular image unable add ring around circular image pointing down programmatically. private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps); // obtain supportmapfragment , notified when map ready used. supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); } /** * manipulates map once available. * callback triggered when map ready used. * can add markers or lines, add listeners or move camera. in case, * add marker near sydney, australia. * if google play services not installed on device, user prompted install * inside supportmapfragment. method triggered once user has * installed google play services , returned app. */ @override public void onmapready(googlemap googlemap) { mmap = googlemap;

typo3 - Looking for an Extension of an extensive link list -

for construction of extensive list of links, since source page thematic portal, looking suitable ext., runs under typo3 7.6 lts. if list of links permits use of categories , multiple categorization of links possible nice. should weiterrhin links described not destination address , alias here should still outline of target page (possibly photo) possible. additional functions such proposing links users, reporting broken links or user voting nice additional features. there times modern linklist, no longer being developed typo3 <6.x. is there perhaps somewhere alternative or 1 might vorhnandenen solutions might realize? nice of course, without programming knowledge, since i'm not programmer. p.s .: not building spam list high quality links topics relating original page. as seems straight forward usage try build extension extensionbuilder. just build records neccessary data. , let eb generate usefull actions: list & show , create , edit , delete in fe possi

How to implement an image gallery inside an Activity mimicking the Android's default gallery? -

i want implement activity inside android app show photos inside smartphone. i searched everywhere how found tutorials suggesting use intent.action_pick . but want show inside activity in app , not calling other app in smartphone. suggestions or hint of how or how implement own gallery ?

python - Is there a way to add close buttons to tabs in tkinter.ttk.Notebook? -

Image
i want add close buttons each tab in tkinter.ttk.notebook . tried adding image , react click event unfortunately bitmapimage not have bind() method. how can fix code? #!/usr/binenv python3 tkinter import * tkinter.ttk import * class application(tk): def __init__(self): super().__init__() notebook = notebook(self) notebook.pack(fill=both, expand=true) self.img = bitmapimage(master=self, file='./image.xbm') self.img.bind('<button-1>', self._on_click) notebook.add(label(notebook, text='tab content'), text='tab caption', image=self.img) def _on_click(self, event): print('it works') app = application() app.mainloop() image.xbm #define bullet_width 11 #define bullet_height 9 static char bullet_bits = { 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 } one advantage of themed (ttk) widgets can c

Protractor stacktrace does not mention the line number on the .js file where the syntax issue or error occurs -

this conf.js exports.config = { seleniumaddress: 'http://localhost:4444/wd/hub', specs: ['c:\\users\\meiyer\\desktop\\protractor_tests\\specs\\specs.js'], baseurl: 'https://devcp.us.sunpowermonitor.com/#/dashboard', // framework use. jasmine recommended. framework: 'jasmine', //options passed jasmine-node. jasminenodeopts: { oncomplete: null, isverbose: true, showcolors: true, includestacktrace: true } }; this specs.js var elhloginpage = { nameinput : element(by.model('user.username')), passinput : element(by.model('model')), submitbutton :element(by.buttontext('sign in')), setemail: function(email) { this.nameinput.sendkeys(email); }, setpass: function(password) { this.passinput.sendkeys(password); }, clicksubmit:function(){ this.submitbutton.click(); } }; var elhhomepage = { greetingtext : element(by.css('.greeting-des')), getgreetingtext: function() { this.greetingtext.text(); } }; describe('e

jquery - Show/Hide DIV sections based on radio boxes -

i'm trying rework several forms , there several sections have typical "was xxxx required?" yes/no radio boxes. if choose yes want box below open requiring them enter more info. i'd use 1 jquery function if work each of rather separate function each question needing it. i have question choose whether person involved employee or guest. lot of posts here able figure out hiding guest div until selected haven't figured out yet how same employee div, , found out need add 3rd set of questions vendor. this working code shows guest section $(document).ready(function() { $("div.desc").hide(); $("input[name$='victim']").click(function() { var test = $(this).val(); $("div.desc").hide(); $("#" + test).show(); }); }); along with <p> involved in incident? &nbsp &nbsp <input name="victim" type="radio" value="guest" required >guest &a

excel - Separate line breaks into columns -

Image
i have 1 cell text. text string looks following: lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text. i read use text-to-column , use delimiter other , fill in pressing alt 0010 in other field. however, first row stays. my wanted result is: any suggestions how separate line break? use data ► text columns, delimited. on second screen opt other [ctrl]+j delimiter. [ctrl]+j char(10) , line feed character. on third screen, choose b1 destination.

angularjs - How to use an angular filter to search an array of objects with results limited bv more than one property -

i attempting apply standard angular filter array of objects not wanting have search text applied entire object, rather properties. example, if have array of objects looks $scope.ppl = [{ "name": "sue", "age": 37, "location": "40.5630° n, 122.3255° w" }, { "name": "ann", "age": 40, "location": "37.7749° n, 122.4194° w" }] and i'd find age 37, if search text "37", both items in array because 37 matches both age on sue , portion of location on ann, though had no interest in latter property. from docs , see it's possible limit property of interest in array of objects object notation. works fine me use filter expression in html ng-repeat="person in ppl | filter:{age: searchtext}" with input set ng-model="searchtext" perfectly fine. want search on more 1 property, while still not includin

formatting dates with R and as.date -

i'm trying format dates r. can explain why r gives error when these 2 strings exact same format? cannot figure out how manage these date strings, , appreciated i'm new working r. > as.date("09/18/2016 1:00 pm edt") error in chartodate(x) : character string not in standard unambiguous format > as.date("09/08/2016 8:30 pm edt") [1] "0009-08-20" bad <- as.date("09/18/2016 1:00 pm edt") <- as.date("09/08/2016 8:30 pm edt") you missed fact (and warning) non-standard format needs format string as.date() . , want strptime() if want parse hours/minutes etc: r> strptime("09/18/2016 1:00 pm edt", "%m/%d/%y %i:%m %p") [1] "2016-09-18 13:00:00 cdt" r>

math - Why does C give different values to Python for this algorithm? -

i wrote short program in c perform linear interpolation, iterates give root of function given number of decimal points. far, function f(x): long double f(long double x) { return (pow(x, 3) + 2 * x - 8); } the program fails converge 1dp value. program updates variables , b, between root of f(x) lies, until , b both round same number @ given precision. using long doubles , above function, debugger shows first 2 iterations: = 1.5555555555555556 = 1.6444444444444444 though should have been: = 1.5555555555555556 = 1.653104925053533 the program fails update values after this. equation linear interpolation i'm using rearranged version of mathematical 1 given here , code i'm using c-version of python program wrote. why c implementation different values, despite same algorithm, , how can fix it? ok i'm still getting hang of this, below have minimal, complete, , verifiable example: #include <stdlib.h> #include <stdio.h>

How to log to database using the built-in Asp.Net core logging (Microsoft.Extensions.Logging)? -

i have following code set logging database using nlog. use alpha version of nlog.extension.logging. possible let built-in log framework log database don't need use nlog? public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) { loggerfactory.addconsole(configuration.getsection("logging")); loggerfactory.adddebug(); loggerfactory.addnlog(); env.configurenlog("nlog.config"); app.useapplicationinsightsrequesttelemetry(); app.useapplicationinsightsexceptiontelemetry(); app.usemvc(); } there project on github flexible , available ef core : znetcs.aspnetcore.logging.entityframeworkcore it prepared use in asp net core application, not contain references prevents use in plain .net core application. there possibilty extend base log class.

swift3 - Swift 3 - How to download Profile Image from FireBase Storage -

i need on retrieving image firebase storage, learned how save cant download current user profile. here code far: firauth.auth()?.createuserwithemail(email!, password: password!, completion: { (authdata, error) in if error == nil { if (password == "" || name == "" || email == "") { self.showalert("error", message: " please fill in blank") } if (password != confirm_password) { self.showalert("error", message: "password don't match") } } else { self.showalert("error", message: "please try again") } let filepath = "\(firauth.auth()!.currentuser!.uid)/\("userphoto")" var data = nsdata() let metadata = firstoragemetadata() //let imagename = nsuuid().uuidstrin

python - How to verify text using Squish -

i automating windows application using squish. trying verify if required text displayed in window after make changes in gui. used object spy object id, confused how give test verification point. following verification point says in results window 'true' , 'true' equal. want as, example 4x , 4x equal. test.compare(findobject("{name ='textobjective'}").enabled, true) thank you!! instead of enabled property, can compare other property - e.g. text : test.compare(findobject("{name ='textobjective'}").text, "4x")

stack overflow - How do I avoid stackoverflowexception within a finite loop (C#) -

i'm trying write code find prime numbers within given range. unfortunately i'm running problems many repetitions that'll give me stackoverflowexception after prime nr: 30000. have tried using 'foreach' , not using list, (doing each number comes) nothing seems handle problem in hand. how can make program run forever without causing stackoverflow? class program { static void main(string[] args) { stopwatch stopwatch = new stopwatch(); stopwatch.start(); list<double> primes = new list<double>(); const double start = 0; const double end = 100000; double counter = 0; int lastint = 0; (int = 0; < end; i++) primes.add(i); (int =0;i< primes.count;i++) { lastint = (int)primes[i] - roundoff((int)primes[i]); primes[i] = (int)checkforprime(primes[i], math.round(primes[i] / 2)); if (primes[i] != 0) {

java - Hash Table With Coalesced Hashing Instead of Quadratic Probing -

i working on taking hashset class using quadratic probing , trying make use coalesced hashing instead. new hashing concept of coalesced hashing confusing me. @ moment working add , remove methods. add: public boolean add( anytype x ) { int currentpos = findpos( x ); if( isactive( array, currentpos ) ) return false; if( array[ currentpos ] == null ) occupied++; array[ currentpos ] = new hashentry( x, true ); currentsize++; modcount++; if( occupied > array.length / 2 ) rehash( ); return true; } and remove: public boolean remove( object x ) { int currentpos = findpos( x ); if( !isactive( array, currentpos ) ) return false; array[ currentpos ].isactive = false; currentsize--; modcount++; if( currentsize < array.length / 8 ) rehash( ); return true; } i understand how coalesced hashing works on paper when inserting tab

postgresql - Update a particular JSON field using Sequelize in Postgres -

i have "user" table 1 of fields "info" being json structure: user table has these fields: id, name, info, created info filed has structure: info: { email, password, device: { type, token } } how can use sequelize update token field specific user in postgres? i know question sequelize.js , don't know it, let me give general answer postgresql (feel free ignore it). first, postgresql not support modifying json values. json columns should used store json data in database , not manipulate json data. if want manipulate json data in database have use jsonb column. jsonb can modified jsonb_set function , || operator. in case, if can run raw sql queries, this: update "user" set info = jsonb_set(info,'{device,token}','123') id = 31;

java - Expectit interact questions need to provide expect for multiple conditions -

java newbie question, i'm attempting move of scripting perl based java , have had luck finding answers in examples here 1 has me stumped. have tried without success duplicate similar behavior perl script using expect module. $exp->spawn("ssh -l $username $dev_ip\n"); $exp->expect(15, [ qr/ssh -l $username $dev_ip\r/ => sub { exp_continue; } ], [ qr/\(yes\/no\)\?\s*$/ => sub { $exp->send("yes\n"); exp_continue; } ], [ qr/[pp]assword:\s*$/ => sub {$exp->send("$password\n");exp_continue;}], [ qr/user/ => sub { $exp->send("$username\n"); exp_continue;} ], [ qr/press key continue/ => sub {$exp->send("\n");exp_continue;}], [ qr/$prompt/i => sub { $exp->send("\n");],); the above times out after 15 seconds if prompt line never reached. has multiple conditions see , respond while trying log in calling sub routines. i think based on ive read need use interact simil

datetime - How can I parse a date in Rails without a month or a day? -

i need parse date in rails json string possibly provided without month or day, , return in iso8601 format. if day not provided, need return first of month of year, , if month not provided, first of year. simply running datetime.parse(response['date']).utc.iso8601 throws argumenterror when month or day missing, such datetime.parse('2001') . datetime handles exact conditions beautifully datetime.new optional integer parameters, how can best handle when parsing string? i have keep i18n in mind when doing this, while store 3 diferent formatted string args strptime each locale, seems hacky. if indeed best way handle this, i'd love explanation.

node.js - WebPack-Dev-Server error: require is not defined -

webpack working fine, webpack-dev-server not. basically, webpack created 2 build files me, back-end bundle , front-end bundle. so, have webpack-config.js each of these. want develop front-end code webpack-dev-server, can see webpack-config file front-end-bundle.js below. when run web-pack-dev server, able find , build front-end.js , index.html, nothing renders in console , gives me "uncaught referenceerror: require not defined" // var nodeexternals = require('webpack-node-externals'); var webpack = require('webpack'); module.exports = { entry: './browser/entry.js', output: { path: './builds', filename: 'frontend.js' }, plugins: [ new webpack.defineplugin({ 'process.env.node_env': '"development"' }), new webpack.defineplugin({ 'process.env': { 'node_env': '"development"' } }) ], module: { loaders: [ {

javascript - Highcharts - tooltip headerformat for 2 decimal places not working -

i trying configure tooltip of displays 2 decimal places, headerformat not seem wokring , keeps showing entire decimal places. what going wrong here? { "chart":{ "type":"line", "height":40, "width":40 }, "title":{ "text":null }, "subtitle":{ "text":null }, "xaxis":{ "categories":[ ] }, "yaxis":{ "title":{ "enabled":true, "text":"amount (dollars)", "style":{ "fontweight":"normal" } }, "plotlines":[ { "value":0, "width":1, "color":"#80808

mapreduce - In hadoop, I just want to execute my own custom program on each node -

yes, want run custom program on each hadoop node. want deploy no mapper , reducer. distributed computing system doesn't works mapreduce(but uses hdfs internally). how should do? both mapreduce , tez jobs use yarn (yet resource negotiator) distributed , executed on cluster in so-called containers. can use yarn run own jobs instead. please take @ hadoop architecture overview high-level overview.

java - Finding the smallest min in and placing them in an array -

i working on method takes 2d array , find min value in each row. after find min in row, want go array. have array made, keep getting nulls in array. easy fix, i've been looking @ long, need help. public static double[][] largearray; public static double[] minarray; public static double min; private static void min() { ( int row=0; row < largearray.length; row++) { min = largearray[row][0]; for(int col = 1; col > largearray[row].length; col++) { if ( largearray[row][col] < min ) min = largearray[row][col]; for(int t=0; t<minarray.length; t++) { min = minarray[row]; } } } } thank looking @ this! you aren't storing min value(s) in minarray . can use math.min(double, double) in loop. finally, want < (not > ) in inner loop condition , use arrays.tostring(double[]) display minarray when have finished in

javascript - Google Apps Script - Using Sidebar form to append a row to spreadsheet -

this script should append new row spreadsheet 'onclick' of button, doesn't. want able add data each textbox corresponding column , append new row. not sure why doesn't work. how append new row? script works in script editor when run it, not in sidebar html. // use code google docs, forms, or new sheets. function onopen() { spreadsheetapp.getui() // or documentapp or formapp. .createmenu('sidebar') .additem('open', 'opendialog') .addtoui(); } function opendialog() { var html = htmlservice.createhtmloutputfromfile("index"); html.settitle('gmf sent msg form'); spreadsheetapp.getui().showsidebar(html); } function insertrow(){ var doc = spreadsheetapp.openbyurl("https://docs.google.com/spreadsheets/d/1ry3tzvu- tfhlcyf9tkrk4hb4b6q1tnya5k7ixyktyky/edit#gid=0"); doc.getactivesheet().appendrow(['

ruby on rails - How to use same Partial for multiple resources? -

i'm using tables list recorded database in index templates, , usual last 3 table cells used links of show, edit , destroy object. ../users/index.html.erb <table> ... <% @users.each |user| %> <tr> ... <td><%= link_to 'show', user %></td> <td><%= link_to 'edit', edit_user_path(user) %></td> <td><%= link_to 'destroy', user, method: :delete, data: { confirm: 'are sure?' } %></td> </tr> <% end %> </tbody> </table> anyway, trying replace links text bootstrap's glyph icons, , succeeded got messy thought better put in partial variable shared index templates use same table layout. ../shared/_editlinks.html.erb <td> <%= link_to dist %> <span class="glyphicon glyphicon-eye-open"></span> <% end %> </td> <td> <%= link_to send("

android - invalid resource directory name, drawable-anydpi-v21 -

i build application , send on samsung tablet using android 4.2.2. have application compatible newer versions (i.e. api 23) i start application using command : react-native run-android when it's building receive error, clean project twice no success. not use eclipse or android studio. :app:processdebugresourcesinvalid resource directory name: d:\projects\react-native\project\android\app\build\intermediates\res\merged\debug/drawable-anydpi-v21 this part of gradle file. android { compilesdkversion 17 buildtoolsversion "19.1.0" defaultconfig { applicationid "com.project" minsdkversion 17 targetsdkversion 23 ... } dependencies { compile filetree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:18.0.+" compile "com.facebook.react:react-native:+" // node_modules } folders in res-folder are allowed d

regex - Regular expression for contents of parenthesis in Racket -

how can contents of parenthesis in racket? contents may have more parenthesis. tried: (regexp-match #rx"((.*))" "(check)") but output has "(check)" 3 times rather one: '("(check)" "(check)" "(check)") and want "check" , not "(check)". edit: nested parenthesis, inner block should returned. hence (a (1 2) c) should return "a (1 2) c". parentheses capturing , not matching.. #rx"((.*))" makes 2 captures of everything. thus: (regexp-match #rx"((.*))" "any text") ; ==> ("any text" "any text" "any text") the resulting list has first whole match, first set of acpturnig paren , ones inside second.. if want match parentheses need escape them: (regexp-match #rx"\\((.*)\\)" "any text") ; ==> #f (regexp-match #rx"\\((.*)\\)" "(a (1 2) c)") ; ==> ("(a (1 2) c)"

jax rs - Resteasy and Google Guice: how to use multiple @ApplicationPath and resource with @Injection? -

i created project test dependency injection offered google guice in jax-rs resources, using resteasy. my intentions are: use multiple @applicationpath versions of api. in each class annotated @applicationpath load set of classes specific version. each resource have @inject (from google guice) in constructor inject services. i created 2 classes annotated @applicationpath : applicationv1rs , applicationv2rs . in both added same resources classes ( userresource , helloresource ), test. my module configured this: public class hellomodule implements module { public void configure(final binder binder) { binder.bind(igreeterservice.class).to(greeterservice.class); binder.bind(iuserservice.class).to(userservice.class); } } when call http://localhost:9095/v1/hello/world or http://localhost:9095/v2/hello/world , receive same error: java.lang.runtimeexception: resteasy003190: not find constructor class: org.jboss.resteasy.examples.guice.hello

android - Regular Expression failed when I try to get all files that name only contains number -

i try list files under "/proc" on android device,and files' names contain numbers,such '123','435'.i try filter regular expression.i tried 3 expressions below of these failed sometimes: ^[0-9]+$ [0-9]+ \d+ i wonder how can 3 expressions can match such "14971" can't match "15003"? i think boober bunz right, file extension difference. 3 of expressions match both "14971" , "15003" the best way pull extensions off filenames, , use restrictive expression need to: ^[0-9]+$ or if want leave extension on, work you: "^[0-9]+[.][^.]*$" start of string, 1 or more digits, must have . , number of non . end of string. not match: "123.123.txt"

vb.net - How to write one to one LINQ Query -

i beginner , learning linq in vb.net. have 1 table a column workid (pk) , idaccount . and table b column bid(pk), bname , workid(fk) . there one 1 relationship between table , table b . now want put/copy both table data table c has column as workid, idaccount, bname . don't know how write linq query , both table data , put in 3rd table. please me. have tried below till now. below code snippet of project. public function hello(byval dt a, byval dtm b) dim dtreturn new c if dt isnot nothing andalso dt.any dim row workorderrow `row corresponding c table each r in dt row = dtreturn.newworkrow 'traversing row row .workid = r.workid .idaccount = r.idaccount end dtreturn.addworkorderactivityrow(row) next e

Can not add string to the video using ffmpeg base on PHP -

i'm new in ffmpeg , i'm trying make demo using ffmpeg. below php script $cmd = '"c:\program files\ffmpeg\bin\ffmpeg.exe" -i c:\wamp\www\vine-project\cron/tmp/t_42953497622724.mp4 --enable-libfreetype -vf "drawtext=fontfile=c:\wamp\www\demo-ffmpeg\cron/arial.ttf:text='stack overflow':fontcolor='black':fontsize=19" -codec:v libx264 -codec:a copy c:\wamp\www\demo-ffmpeg\cron/tmp/text_42953497622724.mp4'; @exec($cmd, $output); echo '<pre>'; print_r($output); echo '</pre>'; and below result of output: array ( ) before, joined multi videos , add background successfully. input video file exists. wrong? incorrect? 3 cups of beer each :d sorry bad english thanks attention! thanh dao can use this, works me. "ffmpeg -i c:\wamp\www\vine-project\cron/tmp/t_42953497622724.mp4 -vf drawtext=fontfile='c:\windows\fonts\arial.ttf':text=\"stack overflow\":fontsize=30:fon

c++ - Why in this situation only one constructor is called but two destructors are called? -

in first time,the code looks below: #include "stdafx.h" #include<iostream> using namespace std; class test{ public: explicit test(int); ~test(); //test(test&); int varint; }; test::test(int temp){ varint = temp; cout << "call test::constructor\n"; } test::~test(){ cout << "call test::destructor\n"; } /*test::test(test&temp){ varint = temp.varint; cout << "call test::copy constructor\n"; }*/ void func(test temp){ cout << "call func\n"; } int _tmain(int argc, _tchar* argv[]) { func(test(1)); return 0; } output: call test::constructor call func call test::destructor call test::destructor this confuses me,cause there's 1 object created(as argument of func),but 2 destructors called after function ends. started wonder,is because default copy constructor called?so wrote definition of copy constructor,which made things more strange. after add

javascript - Change tag property in Facebook SDK -

Image
how can change vertical-align: bottom; vertical-align: baseline; ? i tried following: use str.replace in javascript, not work, because can not edit innerhtml of element has not been created. use css, same history, sdk replace css. the tag not on frame, must have solution

ios - Quickblox webrtc video call receive method is not called -

quickblox webrtc video call receive method not called .i call accept call , can communicate while calling me not geting call. ` - (void)didreceivenewsession:(qbrtcsession *)session userinfo:(nsdictionary *)userinfo { if (self.session ) { [session rejectcall:@{@"reject" : @"busy"}]; return; } self.session = session; [qbrtcsoundrouter.instance initialize]; nsparameterassert(!self.nav); incomingcallviewcontroller *incomingviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"incomingcallviewcontroller"]; incomingviewcontroller.delegate = self; incomingviewcontroller.session = session; incomingviewcontroller.usersdatasource = self.datasource; self.nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:incomingviewcontroller]; [self presentviewcontroller:self.nav animated:no completion:nil]; } the quickblox webrtc video call receive method called when user online make sure add in - (void)viewdidl

reactjs - Multiple components in react -

iam new react . var ad=react.createclass({ render:function(){ return(<b>{this.props.name}</b>) } }) var az=react.createclass({ render:function(){ return(<b>{this.props.class}</b>) } }) var aa=react.createclass({ render:function(){ return(<div> <ad name={this.props.name}/> <az name={this.props.class}/> </div>) } }) reactdom.render(<aa name="vijay" class="asd"/>,document.body) but showing vijay not asd why? did react support pass 2 props. your component az expecting property called class : return(<b>{this.props.class}</b>) but in code providing property name : <az name={this.props.class}/> you should change class in order work. however, there issue. class reserved keyword in react, should change class else in code, example myclass : // 'class' changed 'myclass' in co

unit testing - java.lang.AssertionError: Status expected:<200> but was:<404> -

i know there many similar posts question. tried implement not working me. please me why getting error java.lang.assertionerror: status expected:<200> was:<404> i tried implement mediatype.application_json annotation @enablewebmvc not working do need include headers working? please let me know code have written is: controller class: @enablewebmvc @controller public class controller { @requestmapping(value = "/app/data", method = requestmethod.post, produces = mediatype.application_json_value, consumes = mediatype.application_json_value) public responseentity<responsedata> datainquiry( @requestbody requestdata requestdata, @requestheader(value = constants.id, required = false) string transactionid) { //do action return new responseentity<responsedata>(responsedata, headers, httpstatus.ok); } controllertest class: @runwith(springjunit4classrunner.class) @contextconfiguration({"classpath*:

java - How can we pass a variable field /method name in Comparator.comparing -

i have report {string name, date date, int score } class. want able sort list of reports member variable using new java 8 syntax so java 8 provides new list.sort(comparator.comparing(report -> report.name)) to sort list on name. lets instead of name want provide variable field name method eg. like list.sort(comparator.comparing(report -> report.anyfield)) where anyfield can name or date or score. how achieve behavior. one generic solution use java's reflection , casting: string sortby = "name"; list.sort(comparator.comparing(report -> { try { return (comparable) report.getclass().getdeclaredfield(sortby).get(report); } catch (exception e) { throw new runtimeexception("ooops", e); } })); if use additional library https://github.com/jooq/joor code becomes simpler: string sortby = "score"; list.sort(comparator.comparing(report -> reflect

Java - Retrieve image on the server side -

i trying retrieve image display in pdf (this on server side). however, no mater path try null pointer exception. code is: try { //option 1 classloader classloader = thread.currentthread().getcontextclassloader(); system.out.println("image path 1"); string path = classloader.getresource("image/1ster_icon_256.png").getpath(); //string path = classloader.getresource("/image/1ster_icon_256.png").getpath(); //string path = classloader.getresource("war/image/1ster_icon_256.png").getpath(); //string path = classloader.getresource("/war/image/1ster_icon_256.png").getpath(); system.out.println("image path = " + path); image image1 = image.getinstance(path); preface.add(image1); document.add(preface); } catch(exception e){ e.printstacktrace(); } } and error is: image path 1 java.lang.nullpointerexception i have tried othe

javascript - RxJS - how to emit buffer manually / view elements in buffer -

what i'm trying numbers of keyboard events if time between these events less provided. maybe that's not correct approach that's why i'm still in same place. so first made simple stream filter catch every events interest me. next made second stream , grouped events pairs can measure time stamps. seems it's working pretty numbers of events - after period of time need check if in buffer , if it's there should add string. code : const timetowait : number = 500; const keydigitsup$ = observable.fromevent(document, "keyup") .filter((event:any) => {return ((event.keycode>=48 && event.keycode <=57) || (event.keycode>=96 && event.keycode <=106))}); let bufferedevents = observable.from(keydigitsup$).buffercount(2); let numbers : string = ""; bufferedevents.subscribe((eventarray) => { if (eventarray[1].timestamp - eventarray[0].timestamp <= timetowait) { numbers+=eventarray[0].key + event

android studio - Can I permanently disable showing debug tool window on debug app (shift + f9)? -

Image
if run app shift + f9 (debug app) on idea/android studio, see showing debug tool window. but not want see window. definitely, can show/hide shortcut. then, need press shift + esc each time. is there way disable showing tool window permanently? go debug configurations -> untick 'activate tool window' under before launch section.

inserting sql with loop -

i have table personal id_pers name --------------- 11 azerty 22 uiop and table tourne_label id_tour name -------------- 1 w 2 p 3 v i want loop on of person , join tourne , insert new table. i have created empty table ls_pda id_pers id_tourn ------------------- 11 1 11 2 11 3 22 1 22 2 22 3 how can ? sql set based operations. if you're thinking loop, chances you're heading in wrong direction. problem, cross-join tables, producing possible combinations, , use insert-select syntax: insert ls_pda select id_pres, id_tour personal cross join tourne_label

r - Empty data frame from Date selection -

i have data frame 3262 rows , 10 columns. 1 of columns has date format yy-mm-dd . want store rows 10 different dates in different data frame tried : newdata= df[df$date %in% as.date(c('2011-08-05','2012-1-13','2012-03-2','2014-04-01')),] but nothing. thought might need specify again format tried: df$date <- as.date( as.character(df$date), "%d-%m-%y") newdata= df[df$date %in% as.date(c('2011-08-05','2012-1-13','2012-03-2','2014-04-01')),] all empty data frame saying no data available in table . @ point made mistake (something stupid guess)? i created example: set.seed(1) df=data.frame(col1=seq(1,10), col2=seq(1,0), date=as.date(floor(runif(min=15550,max=17000,n=10)),origin="1970-01-01")) > df col1 col2 date 1 1 1 2013-08-17 2 2 0 2014-01-19 3 3 1 2014-11-06 4 4 0 2016-03-06 5 5 1 2013-05-17 6 6 0 2016-02-21 7 7

powershell - How can I update only Chocolatey packages that are verified by moderators? -

i use chocolatey install/update applications on pc. there way make sure packages install have been approved moderators? if choco install <package name> might warning package not trusted , press n or y continue, it's tedious task confirm each package. there simpler way this? i'm looking parameter can set -autodenyuntrustedpackages ? a side note, know can use chocolateyui, never prompts regarding untrusted packages. due security flaw or allow updates if update has been verified moderator? in order install package not yet verified moderator, you have specify version . these packages not installed or updated automatically, meaning actual behavior describe implemented default. trusted packages mean else: packages come trusted source (like creator of program package installs). these packages skip human moderation.

java - Get keycode of input.h linux from KeyCode KeyEvent Android -

i need keycode corresponding structure linux/input.h after keyevent android. i'm simulating keyboard in jni android. here part of code code : void keyboardpress(int character) { memset(&ev, 0, sizeof(struct input_event)); ev.type = ev_key; ev.code = character; ev.value = ev_pressed; write(fd, &ev, sizeof(struct input_event)); dev_uinput_sync(fd); ev.type = ev_key; ev.code = character; ev.value = ev_released; write(fd, &ev, sizeof(struct input_event)); dev_uinput_sync(fd); } the value character must value struct linux/input.h example if press 'q', in java code value : public static final int keycode_q = 45; the value of 'q' in linux/input.h : #define key_q 16 is possible value of linux/input.h of character java code or convert java keyevent code linux/input.h code ? thank !

Call web service from SQL Server stored procedure -

i had used query call web service in local system .. getting response "null" the web service working fine .... declare @obj int declare @surl varchar(200) declare @response varchar(8000) set @surl = 'http://localhost/myworks/samplewebservice.asmx/helloworld' exec sp_oacreate 'msxml2.serverxmlhttp', @obj out exec sp_oamethod @obj,'open',null,'get',@surl,false exec sp_oamethod @obj,'send' exec sp_oagetproperty @obj,'responsetext',@response out select @response [response] exec sp_oadestroy @obj web service code: public class samplewebservice : system.web.services.webservice { [webmethod] public string helloworld() { string constring = configurationmanager.connectionstrings["rajeevconnectionstring"].connectionstring; using (sqlconnection con = new sqlconnection(constring)) { sqlcommand cmd = new sqlcommand(&qu

php - How to use a wildcard in an if statement? -

would possible use wildcard in if statement this? if(trim($line) != $delete) full code: $delete = "*totalwar"; $data = file("../oneos/applist.txt"); $out = array(); foreach($data $line) { if(trim($line) != $delete) { $out[] = $line; } } $fp = fopen("./foo.txt", "w+"); flock($fp, lock_ex); foreach($out $line) { fwrite($fp, $line); } flock($fp, lock_un); fclose($fp); i complete php noob, php way see project working. need user able delete line in text file, no matter infront of text enter. example, if user enters delete totalwar , text file looks this: set app24=totalwar , need script delete entire line. you can use fnmatch() this fnmatch() checks if passed string match given shell wildcard pattern. for more info read http://php.net/fnmatch

jquery - How to debug this situation in javascript? -

when page loaded information loads ajax-request displayed, piece of dom dynamically generated. after in cases (i don't know why happens) part of dynamically loaded dom modified. so, when page loaded container present: <div id = "container"></div> after ajax-request in looks following: <div id = "container"> <p>some text</p> <p>some text</p> </div> and if modification made, structure turns out this: <div id = "container"> <p></p> <p></p> </div> i need find out code makes modification. i use dom-breakpoint if html static it's not case. idea pause execution right after html generated , put dom-breakpoint don't think me due following reasons: mysterious modification not happen often, have make procedure many times. pausing execution might alter sequence in different pieces of code works, might unable reproduce situation. i c

php - how to convert minutes into microtime -

i have session contains microtime(true) value. below: yii::app()->user->setstate('portal_logged_time', microtime(true)); now want add 15 minutes in above session, should remain in microtime. $starttime = yii::app()->user->getstate('portal_logged_time'); // want add microtime of 15 minutes $starttime $endtime = // want ($starttime*15*60); i have tried not working $starttime*15*60 . so how achieve that? after trying fetch remaining minutes , seconds: $duration = $endtime-$starttime; $hours = (int)($duration/60/60); $minutes = (int)($duration/60)-$hours*60; $seconds = (int)$duration-$hours*60*60-$minutes*60; values provided microtime() in seconds. should do: $endtime = $starttime + 15*60;

small jquery extension doesnt work -

after trying several ways of (first time) creating extension jquery... , doesn't work yet: (function($){ $.fn.fixinputwidthsforblog = function() { console.log('hi extension'); // var w = $('#newblogentryform input[name="headline"]').outerwidth(); // $('#newblogentryform textarea[name="text"]').outerwidth(w); // $('#newblogentryform submit[name="submit"]').outerwidth(w); }; // endfunc }(jquery)); this (following) error: "jquery-3.1.0.min.js:2 uncaught typeerror: $.fixinputwidthsforblog not function" $(document).ready(function(){ $.fixinputwidthsforblog(); alert('ok1'); $(window).on('resize', function(){ $.fixinputwidthsforblog(); }); $('.linknewblogentry').on('click',function() { $('#newblogentryformdiv').slidetoggle().delay(1200).fixinputwidthsforblog(); // settimeout("fixinputwidthsforblog();",1200);