Posts

Showing posts from March, 2010

c++ - boost asio timer : run 2 timers -

i try run asynchronous timer , synchronous timer : here code : boost::asio::io_service io; boost::asio::steady_timer t1(io); boost::asio::steady_timer t2(io); void callback(boost::system::error_code const&) { std::cout << "foo" << std::endl; t1.expires_from_now(boost::chrono::seconds(1)); t1.async_wait(&callback); } int main(int argc, char **argv) { t1.expires_from_now(boost::chrono::seconds(1)); t1.async_wait(&callback); io.run(); t2.expires_from_now(boost::chrono::seconds(5)); t2.wait(); io.run(); std::cout << "finish" << std::endl; return exit_success; } i foo printed 5 times, , finish printed. in code, foo printed every 1 second , finish never reached. how achieve want ? thanks according the documentation of io_service::run : the run() function blocks until work has finished , there no more handlers dispatched, or until io_service has been s

wpf - how can i find reference of scroll bar head button in xamcomboeditor -

i working on wpf application uses third party infragistics controls.for dropdows using xamcomboeditor. want find reference of scroll bar arrow head button in code behind file. possible? in order access element, can first obtain relevant scrollbar xamcomboeditor scrollviewer 's controltemplate , can find out how how to: find controltemplate-generated elements page on msdn. in order though, need know names of elements within default controltemplate , can find how access in answer how extract default control template in visual studio? question here on stack overflow. it's difficult answer without knowing elements in default controltemplate , in short, this: scrollviewer scrollviewer = (scrollviewer)combobox.template.findname("nameofscrollviewer", combobox); scrollbar scrollbar = (scrollbar)scrollviewer.template.findname("part_verticalscrollbar", scrollviewer);

email - New OAuth2 needed to run script -

i have been using script send google-spreadsheet e-mail when modified. can replace authentication section oauth2 apps script. oauth 1.0 support deprecated in 2012 , scheduled shut down on april 20, 2015. thanks. function onopen() { var ss = spreadsheetapp.getactivespreadsheet(); var menuentries = [ {name: "send email", functionname: "sendemail"}]; ss.addmenu("scripts", menuentries); }; function sendemail() { var ssid = spreadsheetapp.getactivespreadsheet().getid(); var sheetname = spreadsheetapp.getactivespreadsheet().getname(); //var email = session.getuser().getemail(); var email = session.geteffectiveuser(); var subject = "this subject"; var body = "this body :)"; var oauthconfig = urlfetchapp.addoauthservice("google"); oauthconfig.setaccesstokenurl("https://www.google.com/accounts/oauthgetaccesstoken"); oauthconfig.setrequesttokenurl("https://www.google.com/ac

javascript - Protractor: cleanup after test suite is finished -

in "conf.js" test suites arranged follows(using saucelab's webdriver): suites: { abc: './abc/spec.js', xyz: './xyz/spec.js', pqr: './pqr/spec.js' }, the problem above arrangement if 1 of alert box/window unexpectedly appears in 1 of test suite,test suites after particular suite suffer , start failing. is there in-built way in protractor close windows/alert box etc. when test suite finished or can handled manually? from understand, there no place in protractor provide "before test suite" or "after test suite" logic (correct me if i'm wrong it). the idea use aftereach() , try switching alert , dismiss() if exists (or accept() depending on need), nothing if not exist: describe("my test", function () { aftereach(function () { browser.switchto().alert().then( function (alert) { alert.dismiss(); }, function (err) {}

angularjs - Does it make sense to implement md-data-table for angular material design? -

i created md-data-table repository based on google material. extension angular-material design: https://github.com/iamisti/md-data-table demo: http://iamisti.github.io/md-data-table/ does make sense implement? i mean, didnt see md-data-table in milestone of angular material (which dont see why). want make sure, don't waste time. update: answer 2015. said below feature did not arrive. as thomasburleson wrote month ago in this github comment on issue similar question or poll here. this important component angular material , ui component library. with current schedule , goals v1.0, however, mddatatable implemented after v1.0 release of angular material. at time of writing ng-material on version 0.10/0.10.1-rc1, , has been stated working v1 release summer. thomasburleson again: ( source ) angular material 1.0 has planned release summer of 2015. i'm sure i've seen implementations of datatables far ng/ng-material community, g

c - Linux : setting locale at runtime and interprocess dependencies -

i stuck in strange problem. i have 2 scripts (c program executables) running on arm linux machine mounting same usb device (containing chinese character filenames) on 2 different paths, device inserted. int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); in last parameter, script passes "utf8" , script b passes 0. so, insert usb device, scripts race mount device. if script mounts first (which passes utf8 parameter), proper filenames. mount command output [notice second mount has utf8 parameter, if not passed. why?] /dev/sdb1 on /home/root/script1 type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-r o) /dev/sdb1 on /home/root/script2 type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed ,utf8,errors=remount-ro) but if script b mounts first(which passes 0

c# - Grouping mongodb filtered results by reference id throws -

i have simplified model: public class parent { public objectid id { get; set; } } public class child { public objectid id { get; set; } public objectid parentid { get; set; } [bsonrepresentation(bsontype.string)] public gender gender { get; set; } } i have queried parents filter on fields i've intentionally omitted. have parent id collection. want children gender.male parents had obtained first query , group them can have mapping between parent , list<child> . var parentids = filteredparents.select(p => p.id).tolist(); var childrenfilter = builders<child>.filter.in(c => c.parentid, parentids) & builders<child>.filter.eq(c => c.gender, gender.male); var aggregation = children .aggregate() .match(childrenfilter) .group(c => c.parentid, g => new keyvaluepair<string, list<child>>(g.key, new list<child>(g))); var groupcursor = await aggregation.tocursorasync();

php - file upload validation returns application/force-download -

i have problem when uploading files web server. created validation in order limit uploads server, inspired post here on stackoverflow. idea user should able upload file types server in order avoid can upload scripts etc. $upfile = $_files['cont2']; if($upfile) { $acceptable = array( 'application/pdf', //.pdf 'application/vnd.adobe.xdp+xml', //.pdf 'application/vnd.ms-excel', //.xls 'application/vnd.openxmlformats-officedocument.presentationml.presentation', //.pptx 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', //.ppsx 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', //.xlsx 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', //.xltx 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', //.docx 'applicati

javascript - How to show loading gif while request is being processed? -

i have looked @ several similar questions before, , none of them match situation i'm having. have 2 div blocks this: #container { width: 800px; height: 600px; margin: 0 auto; display: flex; align-items: center; justify-content: center; text-align: center; font-family: 'helvetica neue', helvetica, arial, sans-serif; color: #fff; } .status { height: 100px; width: 100px; background: #efefef; margin-left: 2px; border: 1px solid #ccc; display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 3px; } .online { background: #8bc34a; } .offline { background: #e53935; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="container">' <div id="loading"><img src="http://i.stack.imgur.com/kz3hi.gif" style="display: none;" /></div>

sql - NVARCHAR(MAX) doesn't accommodate 50478 characters -

i'm trying store string of 50478 characters length in nvarchar(max) database field. according this link , tells nvarchar(max) field can store 1 billion characters, when tried store 50478 characters sql truncates them , doesn't store full string. how solve such problem? do think printing problem sql server management studio? you need ensure data being inserted field cast nvarchar otherwise not able achieve you're looking for. take example: create table #temp (this nvarchar(max)) insert #temp values (replicate(cast('a' nvarchar(max)), 50478)) select this, len(this) #temp drop table #temp also can viewed on sql fiddle here: http://sqlfiddle.com/#!6/551f7/2/0

java - Dropwizard returns 400 on valid GET -

i'm developing dropwizard app , facing strange bug on request after have included mongojack . i have simple query id path parameter. worked before included mongojack , added 2 annotations entity: public class bill { @javax.persistence.id @org.mongojack.objectid private string id; @javax.persistence.id @org.mongojack.objectid public string getid() { return id; } //... } what puzzles me request accepted. when debug, can step method. entity loaded mongodb memory , looks fine. suspect might serialization issue, i'm stuck. ideas? update seems known mongojack issue: https://github.com/devbliss/mongojack/issues/26 . later want use custom dtos without objectids gets anyway, shouldn't relevant anymore. still don't understand why dropwizard maps 400 response... what still don't understand why dropwizard maps 400 response dropwizard, via jackson, generates json using getters (or @jsonproperty annotated fields/methods) know.

nginx - SSL/TLS with Eclipse Paho JavaScript Client -

i've got javascript-based webapp includes eclipse paho client. the webapp stored , executed on nginx webserver. on same server webserver installed, mqtt broker mosquitto running. i've defined port 8884 listener port secured connections. running mosquitto_sub (simple c client) --cafile , -p 8884 works fine! now want secure webapp using ssl passing mqttoptions = { usessl: true } in mqtt client implementation. i can see app trying establish connection wss://ip instead of ws://ip. server responds connection refused totally clear because did not configure on webserver not have clue how manage this. wss connection 'mapped' https or something? need websocket proxy in nginx? in advance help. you can not use same port raw mqtt , mqtt on websockets mosquitto, need create 2 separate listeners. the fact can connect mosquitto_sub implies have set listener raw mqtt. e.g. listener 8883 listener 8884 protocol websockets this create native mqtt listener on

sql server - Second largest bid in auction -

i need produce report shows second highest bidders various auctions. sample data single auction included below. how might write query return: the auctionid . the second highest bid. the time difference between highest bid , second highest bid. auctionid bidamount biddate userid 15410 42559.23 16/11/2012 19:38 41 15410 23613.12 16/11/2012 19:16 2 15410 18000.00 16/11/2012 19:13 16 15410 15249.94 16/11/2012 18:38 9 15410 9813.50 16/11/2012 18:36 7 15410 5341.58 16/11/2012 18:16 7 try row_number function: declare @t table ( auctionid int , amount money , biddate datetime , userid int ) insert @t values ( 15410, 42559.23, '20121116 19:38', 41 ), ( 15410, 23613.12, '20121116 19:16', 2 ), ( 15410, 18000.00, '20121116 19:13', 16 ), ( 15410, 15249.94, '20121116 18:38', 9 ), ( 1541

java - Tomcat manager HTTP Status 404 - /manager/html -

Image
i working on apache-tomcat-6.0.35. when start tomcat using startup.sh manually tomcat working fine. i want configure tomcat use eclipse. , did adding new server eclipse , when start tomcat hitting localhost:8080 , starts fine when try navigate manager http status 404 - /manager/html . cant navigate link in tomcat. as mentioned works fine when start tomcat startup.sh script please let me know doing wrong here. you're using workspace metadata server , deploy path, manager isn't available. switch using tomcat installation , should work (the manager application resides in webapps/-directory inside tomcat installation). to that, double click server name in servers -tab, , activate use tomcat installation . able might have remove deployed webapps , clean server.

Casting generics list in Java -

i found weird situation when casting generics. run code: class { } class b { } public class program { @suppresswarnings("unchecked") public static void main(string[] args) { list<a> lista = new arraylist<a>(); list<?> list = lista; ((list<b>)list).add(new b()); (object item : lista) { system.out.println(item.tostring()); } } } it compiles (only warning without error) , run without exception , output was: b@88140ed how did that? mean why java allow me such thing? added instance of b class list of a s? it bad behaviour of generics. why happening? btw, tried java 7. edit: surprised me java notify problem warning every programmer can ignore it. know suppresswarnings bad idea, why java didn't denied such behavior error or exception? in addition, warning showed always, if think casting correct have no choice ignore it. if think casting , ignore isn't?

java - Spring boot cannot start -

i started spring boot , giving me strange exceptions. console exception follows. java.lang.nosuchmethoderror: javax.servlet.servletcontext.addfilter(ljava/lang/string;ljavax/servlet/filter;)ljavax/servlet/filterregistration$dynamic; @ org.springframework.boot.context.embedded.filterregistrationbean.onstartup(filterregistrationbean.java:257) ~[spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.selfinitialize(embeddedwebapplicationcontext.java:222) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.access$000(embeddedwebapplicationcontext.java:84) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext$1.onstartup(embeddedwebapplicationcontext.java:206) ~[spring-boot-1.2.2.release.jar:1.2.2.release] ... i located method servletcontext#addfilter exception keep saying such

javascript - Reactjs working with sockets: rerender when socket receive a message -

i'm try implement chat application usage of websockets. when websocket got message, no components rerendering. please review code # main ancestor, chat application @chat = react.createclass componentwillmount: -> @setstate signals: [] # list of signals received websockets socket = new websocket('ws://localhost:19108') socket.onmessage = (event) => @state.signals.push { message: event.data, direction: 'in' } console.log @state.signals # regularly write message console after receiving socket message @setstate socket: socket render: -> <div> <div classname="row"> <div classname="col-md-12"> <signallist signals={@state.signals} /> # pass signals here </div> </div> </div> $ -> react.render(<chat />, document.getelementbyid('container')) signal list try show changes of props , no success. it'

javascript - Saving the click counts of an item each item it is clicked -

Image
currently try build counter web page. below can see click counter. it's working. sadly (but sure) current session... there possibility store value forever? one last thing! on website more 1 picture like. have no idea how store values using cookies or localstorage. maybe have idea? maybe no js? var currentvalue = 0, count = $('.count'); $(document).ready(function() { count.each(function(i) { $(this).addclass('' + (i += 1)); }); }); $('.heart').on('click', function(e) { var clickelement = $(this).find('.count'); clickelement.html(parseint(clickelement.html(), 10) + 1); }); <p>click on number increase 1</p> <a class="heart"> <span class="icon"></span> <span class="count">0</span> </a> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> her

android - Toast not showing -

i want show toast on actionitem() function inside. doesn't showing toast. if call context context = getapplicationcontext(); before actionitem() app crashes. import android.content.context; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; import android.widget.toast; public class showwebviewactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.show_web_view); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_show_web_view, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/

properties - Why is happened property write error? -

c++ : run time error happened error message this. "revstrings1-> height of reading included in error: property write-protected." ("revstrings1->height の読み込中のエラー : プロパティは書き込み禁止です.") i'm using c++ builder 3. this source code can compiled setting library, include path , etc. but run time error happened. i guess problem property read & write. how can simplly fix problem ? a variable 'revstrings1' created class 'trevstrings'. //--------------------------------------------------------------------------- #ifndef revstringsh #define revstringsh //--------------------------------------------------------------------------- #include #include #include #include #include //--------------------------------------------------------------------------- class package trevstrings : public tstringgrid { private: // void __fastcall setwidth(int w); // int __fastcal

java - Create dataframe from rdd objectfile -

what method create ddf rdd saved objectfile. want load rdd don't have java object, structtype want use schema ddf. i tried retrieving row val myrdd = sc.objectfile[org.apache.spark.sql.row]("/home/bipin/"+name) but get java.lang.classcastexception: [ljava.lang.object; cannot cast org.apache.spark.sql.row is there way this. edit from understand, have read rdd array of objects , convert row. if can give method this, acceptable. if have array of object have use row apply method array of any. in code this: val myrdd = sc.objectfile[array[object]]("/home/bipin/"+name).map(x => row(x)) edit you rigth @user568109 create dataframe 1 field array parse whole array have this: val myrdd = sc.objectfile[array[object]]("/home/bipin/"+name).map(x => row.fromseq(x.toseq)) as @user568109 said there other ways this: val myrdd = sc.objectfile[array[object]]("/home/bipin/"+name).map(x => row(x:_*)) no m

java - Scala scope, initialization -

imagine following java class: class test { private button b; private table t; public test() { setupbutton(); setuptable(); } private void setupbutton() { b = ... b.doawesomestuff(); // ... more stuff going on } private void setuptable() { t = ... t.attach(b); // works, because b in (class) scope } } the same code in scala: class test() { setupbutton(); setuptable(); private def setupbutton(): unit = { val button: button = ... } private def setuptable(): unit = { val table: table = ... table.attach(button) // <--- error, because button not in scope, } } now, of course there solutions this. one being "use vars": class test { private var b: button = _ private var t: table = _ // ... rest works now, because b , t in scope, vars, not necessary } another 1 being &quo

javascript - Node large data processing -

i have 500 mongodb databases , need connect databases , check record in collection based on condition , record. one approach use loop , manipulate database one: for(var i=0; i<databases.length;i++){ //connect database //find query // add record array } it work fine take long time. there other way fast processing in optimizes way ? at bare minimum, run more 1 query @ same time. look @ this: http://www.sebastianseilund.com/nodejs-async-in-practice i need iterate on collection, perform asynchronous task each item, let x tasks run @ same time, , when they're done else so, code become like: var results =[]; async.foreachlimit(databases, 5, function(database, callback) { //connect database //find query //add record array - results.push(result) }, function(err) { //handle error here }); this running 5 concurrently... not sure maximum number of outbound connections be.

Move or resize the windows of 3rd party programs with c# -

we have c# base frame program here in company, able run c# codes. when starts, runs in full screen mode, besides have more program runs in parallel. i put our program left side, program right side on screen @ startup. how can move or resize 3rd party program windows in c#? you can movewindow winapi function: //import: [dllimport("user32.dll", setlasterror = true)] internal static extern bool movewindow(intptr hwnd, int x, int y, int nwidth, int nheight, bool brepaint); //usage: movewindow(applicationhandle, 600, 600, 600, 600, true);

linux - wkhtmltopdf pagination issue during converting html into pdf -

i converting html pdf using wkhtmltopdf in command line , working fine. but issue facing related page size, since page size a4 creating pagination in document, so there way can create pdf height according html content height. since html content page dynamic , height different every time according user id. command using in linux ubuntu environment: wkhtmltopdf <source> <destination> ok, have resolved issue , after searching lots of option , suggestion have used wkhtmltoimage , convert (imagemagick) command . first have converted html image shell_exec("/usr/bin/wkhtmltoimage <source html path> <destination path image>"); second have converted image pdf shell_exec("/usr/bin/convert <source image path> <destination pdf path >"); which give me long single page pdf without pagination

c++ - signal() : any performance impact? -

i need catch sigabrt, sigsegv , sigill present user proper critical error message when out of control fails , program need exit. however program lot of realtime computing, performance important. does signal() ( http://www.cplusplus.com/reference/csignal/signal/ ) cause performance loss (some sort of constant monitoring ?) or not @ (only triggered when exception happen, no performance lost otherwise). edit: software runs on windows (7 , higher) , os x (10.7 , higher). if time critical process catches signals, there no "special" time wasting. indeed, kernel holds table of signals , actions process has walk through if signal send. every way of sending message process or invoking handler needs time. message queue or waiting on "flag" have same "waste". but using signals can have other implications should mentioned. every system call can interrupted if signal arrives. return value call eintr . if have many signals pass process, may slow

angularjs - Set ons-switch with predifined values from Angular controller -

i cannot seem correct way set 'checked' attribute in ons-switch. can setup user configurations page pre-checked select boxes. the docs: checked switch how set using variable in angular controller? for example, if ons-switch has syntax have done: i cannot seem set attribute "checked" no value in angular, needed in docs. i'm unable access variable since part of array of configurations. code example: controller: var categinfo = [{interest:'classic', ischecked:true}, {interest:'new', ischecked:false}]; html: <ons-list-item ng-repeat="interest in categinfo" > <span style="color: #666">{{interest.interest}}</span> <ons-switch modifier="list-item" var="{{interest.interest}}" checked="{{interest.ischecked}}"></ons-switch> </ons-list-item> so want html should show buttons checked/unchecked depending on interest.ischecked true or false.

highcharts - Rendered rectangles do not move with chart when scrolling -

i want draw rectangle on chart , have move rest of chart. however, stays rendered in pixel coordinates. i have thought there way add annotations such in world coordinates rather screen coordinates, not able find way. such thing possible? assuming stuck annotating in screen coordinates, event(s) need handle redraw rectangle when user zooms or scrolls? simple example: chart.renderer.rect(chart.xaxis[0].topixels(1432897200000),chart.yaxis[0].topixels(1.09674),14,14, 0) http://jsfiddle.net/bz3t79p5/ also, have had no luck using axis.topixels() setting rectangle's width , height. getting values way out of whack. there trick converting width , height world coordinates pixels?

spring boot - Java task scheduler run daily from start to end date -

i've got spring boot application in java scheduled tasks need run @ midnight every day, 15th june 15th august @scheduled(cron = "0 0 0 15-30 5 ?") // midnight every day 15th june until end of month public void sendreminderemailsjune() { dostuff(); } @scheduled(cron = "0 0 0 * 6 ?") // every day in july public void sendreminderemailsjuly() { dostuff(); } @scheduled(cron = "0 0 0 1-15 7 ?") // first day in august 15th august public void sendremindersemailsaugust() { dostuff(); } is there better way don't need 3 separate @scheduled functions? you repeat these annotations, if on spring 4 / jdk 8 @scheduled(cron = "0 0 12 * * ?") @scheduled(cron = "0 0 18 * * ?") public void sendreminderemails() {...} else, jdk 6+ @schedules({ @scheduled(cron = "0 0 12 * * ?"), @scheduled(cron = "0 0 18 * * ?")}) public void sendreminderemails() {...}

How do i choose 4G LTE on Project Tango GSM or CDMA? -

i have sim cards can tell me kind of service should getting either gsm or cdma. , steps should take in regards apn settings. project tango support gsm not cdma. not specific setting needed apn following setting sim.

arrays - Choosing cells in a struct with specific conditions -

data looks more this: t = struct('direction', {[1,1,1,1],[1,1,2,1],[2,2,2,2,2], [2,2,2,2,1,2], [2,2,2,2,2],[3,1,4,5]}, 'tr‌ial', {'correct','incorrect','incorrect','correct','correct','incorrect'}); this example , have other fields well t = t(arrayfun(@(x) all(x.direction == 2), t)); i have above code works fine gives me [2,2,2,2,2] , not give me cell [2,2,2,2,1,2] because has 1. i tried using <= 2 includes [1,1,1,1],[1,1,2,1] well. there way this? want 2 things: cells contain all 2 or 1 , allow maximum 1 element different can both [2,2,2,2,2],[2,2,2,2,1,2] unlike code gives [2,2,2,2,2] cells contain random numbers i appreciate help. thank you can change condition sum( x.direction == 2 ) + 1 >= numel( x.direction ) this should return true if 1 of elements 1

R: Adding two dataframes (different number of rows) -

i have 1 dataframe (df1): type ca ar total alpha 2 3 5 beta 1 5 6 gamma 6 2 8 delta 8 1 9 i have dataframe (df2) type ca ar total alpha 3 4 7 beta 2 6 8 delta 4 1 5 how can add above 2 data frames following output: type ca ar total alpha 5 7 12 beta 3 11 14 gamma 6 2 8 delta 12 2 14 if use code along line: new_df = df1 + df2 i following error: ‘+’ defined equally-sized data frames how add 2 dataframes, perhaps matching names under "type" column? thanks in advance!! (slightly out-of-order rows due aggregate() 's behavior of ordering output grouping column, correct data.) df1 <- data.frame(type=c('alpha','beta', 'gamma','delta'), ca=c(2,1,6,8), ar=c(3,5,2,1), total=c(5,6,8,9) ); df2 <- data.frame(type=

i want to prevent Exponential in my floating value in java -

i want prevent exponential in floating value in java float datapoint=9.0e-4; want print this"9.0" only please 1 help!! you can try use decimalformat float f = 9.0e-4f; decimalformat df = new decimalformat("#"); df.setmaximumfractiondigits(8); system.out.println(df.format(f));

read xbee network traffic on xbee hooked to computer -

i have bunch of equipment communicate each other using xbee series 1 radios. i'd read traffic network on computer (which has xbee hooked it's usb port). using xctu, can read traffic particular xbee in network setting in computer's xbee of particular xbee. i'd read traffic of xbees. how configure xbee that? thanks! you need 802.15.4 packet sniffer monitor 802.15.4 network traffic. isn't possible sniff traffic xbee module itself. if you're on budget, various manufacturers have free software works 802.15.4 dongles. example, texas instruments has sniffer software works $49 usb dongle .

gnuradio - Retrieve data from USRP N210 device -

the n210 connected rf frontend, gets configured using gnu radio companion. i can see signal fft plot; need received signal (usrp2 output) digital numbers.the usrp_sense_spectrum.py output power , noise_floor digital numbers well. i appreciate side. answer usrp/gnu radio mailing lists: dear abs, you've asked question on discuss-gnuradio , got 2 answers. in case you've missed those, , avoid people tell know: sylvain wrote that, due large number of factors contributing see digital amplitude, need calibrate yourself, using system want use measure power: you mean want signal power dbm value ? just won't happen ... many things in chain, you'd have calibrate specific freq / board / gain / temp / phase of moon / ... and explained if have mathematical representation of how estimator works, might able write custom estimator block both of values of interest: > i assume have defi

c# - Newtonsoft.Json returning '\' character -

i´m using newtonsoft.json library serialize object. problem when create json string, comes '\' character. i´ve seen answers said debugger issue, i'm getting json '\' client consuming service. tried remove chacater function seems happening exact same stringbuilder. private static string datatabletojson(datatable dt) { string jsonresult; jsonresult = jsonconvert.serializeobject(dt, formatting.none); return jsonresult; } and i´m getting: "[{\"id\":\"72d209d5-0028-4162-94d0-d8cae856e1b7\",\"username\":\"nicolas\",\"nombre\":\"asd\"},{\"id\":\"8ecdd5eb-b6a8-40f7-87a6-28ae39d5924c\",\"username\":\"mario\",\"nombre\":\"asd\"},{\"id\":\"c48d2d27-40af-4bfe-a912-a18689c70076\",\"username\":\"diego\",\"nombre\":\"asd\"}]" can me this?. driving me crazy!. thanks

java - AWS ec2 instance running tomcat 8 gives error: getDispatcherType() is undefined for the type HttpServletRequest -

getdispatchertype() undefined type httpservletrequest when deploying aws ec2 instance running tomcat 8 using beanstalk. same webapp works when deployed on localhost on machine. the project runs when deployed on localhost in machine gives error when deployed on aws using beanstalk. using eclipse aws java toolkit. i have used javax.servlet-api version 3.0.1 scope provided. i have removed maven dependencies on servlet-api 2.5. the webapp runs on localhost in machine. i downloaded zip of uploaded package aws , contains javax.servlet-api 3.0.1 , no other version of it. here stacktrace. org.apache.jasper.jasperexception: unable compile class jsp: error occurred @ line: [82] in generated java file: [/usr/share/tomcat8/work/catalina/localhost/root/org/apache/jsp/web_002dinf/jsp/login_jsp.java] method getdispatchertype() undefined type httpservletrequest stacktrace: org.apache.jasper.compiler.defaulterrorhandler.javacerror(defaulterrorhandler.java:102) org.apache.jasper.compi