Posts

Showing posts from February, 2015

How do I envoke a MSBuild target in the middle of another target? -

what i'm looking like: <target name="dostuff" > <message text="doing stuff..." /> //run target dootherthing <message text="doing more stuff..." /> </target> there's calltarget you'd use like <target name="dostuff" > <message text="doing stuff..." /> <calltarget targets="dootherthing" /> <message text="doing more stuff..." /> </target> and there's more idiomatic, albeit bit on top case, way: <itemgroup> <mytargets include="message1" /> <mytargets include="dootherthing" /> <mytargets include="message2" /> </itemgroup> <target name="message1" /> <message text="doing stuff..." /> </target> <target name="dootherthing" /> <calltarget targets="dootherthing" /> </target> ...

jquery mobile - Possible to ajax load only the <page/> instead of everything of an HTML document? -

i need to on page a, when clicking link page b, ajax injects of b, not refreshing whole page now on page b, pressing reload button refreshes whole page, js being run the js must not loaded more once method x) standard way, satisfies 1,2 not 3. alert seen after clicking link page b. a.html <before_page> <script>alert('abc')</script> </before_page> <page> <a href=b.html>b</a> </page> <after_page/> - b.html <before_page> <script>alert('abc')</script> </before_page> <page/> <after_page/> method y) satisfies 1,3 not 2. a.html <before_page> <script>alert('abc')</script> </before_page> <page> <a href=c.html>c</a> </page> <after_page/> - c.html <!--nothing before <page/> --> <page/> <!-- nothing after <page/> --> the question is how satisfy 1,2,3? ...

c++ - My program will run but it prints out all 100's for values that should be all different -

my program run when reaches point prints out vector values come out 100, far programming skills go (which pretty low) see no reason should creating values 100. think may have input_seconds im not sure. suggestions on whats wrong? #include<iostream> #include<cmath> #include<vector> using namespace std; double altitude(){ double alti; cout << "please input altitude in meters:"; cin >> alti; return alti; } double roc() { double climbr; cout << "please input climb rate in m/s:"; cin >> climbr; return climbr; } double speed(){ double v; cout << "please input current speed on ground in m/s" << endl; cin >> v; return v; } // gives time take reach desired altitude double time(double a, double r){ double t; t = / r; return t; } //distance travelled horizontally in given time double distancetravelled(double veloc, double time){ do...

classname - How do I add a class name to Javascript string? -

i'm js newbie trying alter following code. looks it's adding style attributes. add class name "reveal" string or below. syntax like? many help, guys! inline = ( elem.domel.getattribute( 'style' ) ) ? elem.domel.getattribute( 'style' ) + '; visibility: visible; ' : 'visibility: visible; ' (i guess) html may this: <div class="some other"> in such case, if like elem.domel.classname = 'reveal'; then you'll get <div class="reveal"> all styles brought class some , other gone! don't want that, right? don't want repeated classname, like <div class="reveal reveal"> so, here solutions: the best way use html5 api classlist : elem.domel.classlist.contains('reveal') // check whether element has classname elem.domel.classlist.add('reveal') // add classname elem.domel.classlist.remove('reveal') // remove classname elem.dom...

java - Can not run empty AndroidStudio 0.8.14 project with google-cloud-storage client library -

i creating simple android app take picture , upload google cloud storage. simplest (and recommended) way use provided client library . but empty androidstudio dependency gcs fails run. compiles, fails run failures: warning: dependency org.apache.httpcomponents:httpclient:4.0.1 ignored debug may conflicting internal version provided android. in case of problem, please repackage jarjar change class packages. error:execution failed task ':app:predexdebug'. com.android.ide.common.internal.loggederrorexception: failed run command: /home/milan/androidstudiosdk/sdk/build-tools/21.1.1/dx --dex --output /home/milan/androidstudioprojects/test/app/build/intermediates/pre-dexed/debug/transaction-api-1.1-d542431644c5559f18a80700bbbf3a2bc4472ff7.jar /home/milan/.gradle/caches/modules-2/files-2.1/javax.transaction/transaction-api/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/transaction-api-1.1.jar error code: 1 output: trouble processing "javax/t...

java - Subtracting two dates with time in JSTL -

this question has answer here: display date diff in jsp 3 answers let's have 2 variables called admitteddate , currentdate . contain values "2014-10-13 14:47:44.0" i want cast them dates , subtract them , show them in webpage. can help? javascript var differenceinmin=(new date(admitteddate ).getmilliseconds()-new date(currentdate).getmilliseconds())/60000; var diffinhrs=differenceinmin/60; var diffindays=parseint(diffinhrs/24)+" "+parseint(diffinhrs)+":"+((diffinhrs-parseint(diffinhrs))*60);

c# - ASP.Net MVC 5 Entity Framework Select Where In? -

i have 3 tables project, province, projprovrel in project page when add data select multiple provinces each project means province multi select dropdown list. i insert data working inserted id , added projprovrel selected ids of province now in details view want display data not solve it. here code: // get: project/details/5 public actionresult details(int? id) { if (id == null) return new httpstatuscoderesult(httpstatuscode.badrequest); var mydata = db.projects.find(id); if (mydata == null) { return httpnotfound(); } var prov_id = o in db.prorel o.projectid.equals(id) select o.provinceids; foreach (var p_id in prov_id) { int[] pids = new int[] {p_id}; } var prov= c in db.provinces c.id in pids; viewbag.province = prov; return view(mydata); } one problem how can select data table based on condition var prov_id = o in db...

Passing XML(DataSet) as Parameter ksoap2 android -

i trying send xml requst webservice using ksop2 not workig my web service request format is <envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <body> <updatevehicleviaobj xmlns="http://tempuri.org/"> <userhash>[string?]</userhash> <vehicleobject> <colour xmlns="http://schemas.datacontract.org/2004/07/stockservice">[string?]</colour> <comments xmlns="http://schemas.datacontract.org/2004/07/stockservice">[string?]</comments> <condition xmlns="http://schemas.datacontract.org/2004/07/stockservice">[string?]</condition> </vehicleobject> </updatevehicleviaobj> </body> </envelope> i using ksoap2 create request like soapobject request = new soapobject("namespace", "methodname"); requ...

ienumerable - C# - Create Enumeraor that Get Values Randomly -

i want create ienumerable class in c# when next value randomly list of object i want random value each time want next example list length 100 , 1000 times value each time random value i create below class program hanged when create new instance class public class myenumerable:system.collections.ienumerable { public int regionid { get; set; } list<medium> rankedlist; mediaenumerator pe; public mylist(int regionid) { regionid = regionid; rankedlist = showvideo.getranklist(regionid); pe = new mediaenumerator(rankedlist); } public system.collections.ienumerator getenumerator() { return (ienumerator)(pe); } } public class mediaenumerator : ienumerator { list<medium> rankedlist; int position = -1; public mediaenumerator(list<medium> list) { rankedlist = list; } random rnd = new random(); public bool movenext() { position = rnd.next(rankedlist...

ios - Storing date and time separately in NSDate -

so getting string containing date , time in format "2014-12-22t11:00:00+0500" in order convert nsdate using nsdateformatter* dateformatter = [[nsdateformatter alloc]init]; [dateformatter setdateformat:@"yyyy-mm-dd't'hh:mm:sszzz"]; nsdate* date = [dateformatter datefromstring:start_time]; [dateformatter setdateformat:@"yyyy-mm-dd"]; nsstring* temp = [dateformatter stringfromdate:date]; self.eventdate = [dateformatter datefromstring:temp]; nsdateformatter* timeformatter = [[nsdateformatter alloc]init]; [timeformatter setdateformat:@"hh:mm:ss"]; nsstring* temp2 = [timeformatter stringfromdate:date]; self.start_time = [timeformatter datefromstring:temp2]; now though conversion successful problem eventdate has has time after date 00:00:00 . how can remove eventdate contains date. conversly start_time has time of event has arbritrary reference date before that. how can remove have time in start_time i have searched hard , fast ...

html - Vertical div expansion w/o fixed heights -

before roll eyes , move on, know how solve problem using fixed height , absolution positioning top: , bottom:, want solve without using fixed heights. want learn more css i'm trying solve different way. i have set typical navbar running across top, , scrolling content div below. however! how fit bottom scrolling div container remaining space without using absolute coordinates? can't position: absolute, because i'd need know height of navbar set "top:". , can't "bottom: 0" because i'd have specify height. here's js filddle: http://jsfiddle.net/8dugffz4/1/ the class of interest ".result". have height fixed, don't want. thanks, y'all. pt css: * { font-family: helvetica, sans; border: 0px; margin: 0px; padding: 0px; } .navbar { width: auto; overflow: auto; border-bottom: 1px solid #bbb; } .pagebar { float: right; } .pager { cursor: pointer; float: left; border: 1px solid #bbb; width...

c# - windows phone listbox stretch Item template items with ItemPanel Orientation Horizontally aligned -

i creating listbox in windows phone application such items aligned horizontally. want if there 5 items should occupy space equally if there 2 items in collection there should aligned accordingly occupying totalwidth/2 space. how can achieve below code have written: <listbox x:name="carselector" itemssource="{binding listdata}" verticalalignment="center" horizontalalignment="stretch" scrollviewer.verticalscrollbarvisibility="disabled" background="white" itemcontainerstyle="{staticresource selectorcontainerstyle}" style="{staticresource lstbxselectorstyle}" > <listbox.itemspanel> <itemspaneltemplate> <grid> <i:interaction.behaviors> <c...

ios - Scroll content size not getting set.Horizontal scroll not needed -

i have designed view in xib using auto layout , programmatically trying set content size of scrollview.horizontal scroll happening on load not expecting.on orientation of device scroll size set on load not working , able scroll horizontally .how avoid this? - (void)viewdidlayoutsubviews { scroll.contentsize = cgsizemake(scroll.frame.size.width, attbtn.frame.origin.y+attbtn.frame.size.height+40);//attbtn added programmatically }

unity3d - Yield return in AssetBundle.CreateFromMemory -

as documentation says ienumerator methods executed thread, i'm confused why assetbundlecreaterequest assetbundlecreaterequest = assetbundle.createfrommemory(bytearray); yield return assetbundlecreaterequest; freezes game 2 seconds. can explain? well freezes 2 seconds because requesting yield return assetbundlecreaterequest asynchronous operation coroutine. you can yield until asynchronous operation continues, or manually check whether it's done (isdone) or progress (progress). asyncoperation so right requesting coroutine wait till assetbundlecreaterequest done. for manually checking wheter function done, without having freeze application using isdone or progress command instead if need further clarification feel free comment. edit sample of using isdone assetbundlecreaterequest acr = assetbundle.createfrommemory(decrypteddata); while (!acr.isdone) { yield; } assetbundle bundle = acr.assetbundle;

asp.net mvc 4 - IHttpActionResult return Json object -

i have created 1 method in mvc api returns string. instead of returning string , want return json object . here code. [allowanonymous] [httppost] [route("resetpassword")] public ihttpactionresult resetpassword(string email) { createuserappservice(); string newpassword =_userappservice.resetpassword(email); string subject = "reset password"; string body = @"we have processed request password reset.<br/><br/>"; string = configurationmanager.appsettings[common.constants.fromemaildisplaynamekey]; body = string.format(body, newpassword, from); sendemail(email, subject, body, string.empty); return ok<string>(newpassword); } here returns ok<string>(newpassword); want return json object . how can return json object ? try that: [allowanonymous] [httppost] [route("resetpassword")] public ihttpactionresult resetpassword(stri...

teamcity - I have unit tests that pass in NUnit GUI and Resharper, but fail when Team City runs them -

i have teamcity server set build multiple solutions , run unit tests in them using nunit test runner. this has been working several months; however, our latest build encountering following error: setup method failed. setup : system.io.fileloadexception : not load file or assembly 'log4net, version=1.2.13.0, culture=neutral, publickeytoken=669e0ddf0bb1aa2a' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) it happens single testfixture contains 9 tests out of hundreds in entire system. tests pass when run using resharper or nunit gui. the nuget package correctly referenced in both project being tested , test project itself. there no runtime assembly binding redirects necessary 1 version of log4net has ever been installed. has else had similar issue have solved or ideas issue might possibly be? why work locally , not on server, given same tests passed previously. the versions ...

cursor - i want number of rows in android -

i using cursor.getcount not working confused. trying data labels against given date not working. @override public void onclick(view v) { // todo auto-generated method stub date=et.gettext().tostring(); cursor= db.rawquery("select count(*) labels date='" + date + "'", null); // db.opendatabase(path, factory, flags) // log.d("query", "select count(*) labels date='" + date + "'"); //log.d("cursor length", ) if(cursor!=null && cursor.getcount()>0) { cursor.movetofirst(); toast.maketext(getapplicationcontext(), "already exist", toast.length_short).show(); } else{ toast.maketext(getapplicationcontext(), "please download latest data", toast.length_short).show(); return; ...

Grails test-app consumes too much cpu? -

i have grails 2.4.4 app , i'm running tests on local machine. intel® core™ i5 cpu m 480 @ 2.67ghz × 4 , 8gb memory ubuntu 12.04 os. run around 1000+ tests , when tests finish, machine shuts down , have start on again. consumes memory. try run tests without on other terminal, , shoots 100%. :(

excel - Trim returns error 424 object required -

i'm trying make function makes hyperlink 2 text fields. here's code: option explicit sub addlink() dim mypath dim mychar dim integer dim mystring dim numbers dim siteid dim mywb dim siteaddress mypath = "somefilepath\" mychar = "\" = 2 4000 step 1 mystring = range("b" & i).value numbers = mystring.trimstart(mychar) siteid = range("f" & i).value mywb = "wo_" & numbers & "_" & siteid & ".xls" siteaddress = mypath & mywb activesheet.hyperlinks.add range("b" & i), siteaddress next end sub so error on "numbers = mystring.trimstart(mychar)" - error 424 object required. i'm rly big noob @ vba, me? ps know should define variable type, when again f... errors drives me nuts. that looks vb.net not vba. trim removes spaces. vba x = trim(str) . ma...

sql - Find the missing number group by category -

i want find missing batchno group each category try , work missing number categories how group data ? create table #tmp (batchno int, category varchar(15)) insert #tmp select 94, 'a01' union select 97, 'a01' union select 100, 'a02' union select 105, 'a02' declare @valmax int, @valmin int, @i int; select @valmax=max(batchno) #tmp; select @valmin=min(batchno) #tmp; set @i=@valmin; while (@i<@valmax) begin if (not exists(select * #tmp batchno=@i)) begin -- select @i, category #tmp group category select @i end; set @i=@i+1 end; the out put shold 95 a01 96 a01 101 a02 102 a02 103 a02 104 a02 you can joining number table. query uses the spt_values table , should work: ;with cte ( select category , min(batchno) min_batch, max(batchno) max_batch #tmp group category ) select number, category master..spt_values cross ...

node.js - Set object into Request in NodeJS -

i'd set in request object contains options on web interface... object have accessible in views... , doesn't work code below... fs.readfile(optionfile, 'utf8', function (err, data) { if (err) throw err; var options = json.parse(data); request.options = options; }); <title><%-request.options.title%></title> edit #1 and don't want kind of thing : response.render('myview', {request: request}); edit #2 exports.locals = function(app){ app.use(function(request, response, next){ fs.readfile('./configs/options.json', 'utf8', function (err, data) { if (err) throw err; var options = json.parse(data); response.locals.options = options; }); response.locals.request = request; response.locals.path = url.parse(request.url).pathname; response.locals._ = _; next(); }); }; <title><%- options.title %></title> ...

Google Apps Script Iterating over Spreadsheets very slow -

first time posting, long time reading :) i've written first google apps script collate information 14 spreadsheets, each sheet 2-30 worksheets single report spreadsheet. the script runs beautifully, checks single column data , if found grabs spreadsheet name, worksheet name, first column data row , data check column , adds array sub-array of data. it calculates area of array of sub-arrays , writes data report file (which script run from). my issue takes script around 2 minutes run. i wonder if i've been inefficient in method , hoping review script , let me know if i've made mistakes? here goes: /** * retrieves rows in active spreadsheet contain data , logs * values each row. * more information on using spreadsheet api, see * https://developers.google.com/apps-script/service_spreadsheet */ function getfaults() { /** opens each spreadsheet liddon , examines "report/replace" column "f" if there data there [sheetname], [fault area (colum...

html - Custom editable page templates using asp.net web page runtime -

how create custom page template asp.net web page. have make page generic make flexible in creating different styles of templates.(kind of creating own tables required columns according requirement using drag , drop user control) thanks

java - JNDI Lookup of local EJB (no @EJB) -

i have requirement i'm asked load both remote , local ejbs jndi lookup, without @ejb annotation. my ejb defined follows: @remote public interface myobjectinterfaceremote extends myobjectinterface { } @local public interface myobjectinterfacelocal extends myobjectinterface { } public interface myobjectinterface { // bunch of methods both remote , local ejbs inherit } @remote(myobjectinterfaceremote.class) @local(myobjectinterfacelocal.class) public class myobjectejb implements myobjectinterfacelocal, myobjectinterfaceremote { //implementation of methods inherited myobjectinterface. } i'm using code lookup remote ejb: private myobjectinterfaceremote getejb() throws namingexception { initialcontext context = new initialcontext(); return (myobjectinterfaceremote) context.lookup(myobjectinterfaceremote.class.getname()); } it works fine, if make method this: private myobjectinterfacelocal getlocalejb() throws namingexception { initial...

embedded - Homemade USB HID pen device only works on Windows 7 / Linux -

i've made (with stm32f4 microcontroller) usb hid pen device. device works on windows 7, or debian 7 (linux). the problem => doesn't work on windows 8, 8.1, 10, ... my device recognized "hid stylus", usb view give me no error, pipe open, cursor won't move. worse, don't see packets coming in or out usblyzer ! edit: on windows 7 = powerdevice = stay @ d0 on windows 8 = powerdevice = d0 1s = d3 here how device seen computer (usbview) : device descriptor: bcdusb: 0x0200 bdeviceclass: 0x00 bdevicesubclass: 0x00 bdeviceprotocol: 0x00 bmaxpacketsize0: 0x40 (64) idvendor: 0xffff idproduct: 0x0001 bcddevice: 0x0200 imanufacturer: 0x01 0x0409: "homemade" iproduct: 0x02 0x0409: "homemade usb pen device" iserialnumber: 0x03 0x0409: "00000000050c" bnumconfigurations: 0x01...

c# - Coded UI + Windows Phone 8.1 — get screen size and orientation? -

things tried: windows.graphics.display.displayinformation winrt api — getforcurrentview throws saying “getforcurrentview must called on thread associated corewindow”, looks codedui tests run in process without windows. getsystemmetrics winapi — returns correct size values, screen isn’t rotated. enumdisplaysettingsex winapi — doesn’t fill values. displayproperties winrt api — both currentorientation , nativeorientation portrait. any other ideas? thanks in advance. codedui tests indeed run in separate process. uses specific form of "reflection" find controls in "other" processes. base class of codedui test controls uitestcontrol the windows operating system design prevents other processes interrupting or snooping in on what's going on. so, msft had come abstraction of process under test, allow "see" other controls. addressiblity not actual control representation of control in other process. able control because mstest has a...

Unable to start eclipse on linux server -

i installed eclipse in linux server, while starting eclipse getting below error. command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product !entry org.eclipse.osgi 4 0 2014-11-27 15:32:33.157 !message application error !stack 1 org.eclipse.swt.swterror: no more handles [gtk_init_check() failed] @ org.eclipse.swt.swt.error(swt.java:4467) @ org.eclipse.swt.widgets.display.createdisplay(display.java:934) @ org.eclipse.swt.widgets.display.create(display.java:918) @ org.eclipse.swt.graphics.device.<init>(device.java:157) @ org.eclipse.swt.widgets.display.<init>(display.java:514) @ org.eclipse.swt.widgets.display.<init>(display.java:505) @ org.eclipse.ui.internal.workbench.createdisplay(workbench.java:732) @ org.eclipse.ui.platformui.createdisplay(platformui.java:162) @ what might reason this? access linux server through putty. thanks i'v...

How to display Unicode string in with Lua in Cocos Code Ide -

i'm using cocos code ide create simple project lua. main.lua saved in utf-8 without bom , contains following snippet: local label1 = cc.label:createwithttf("長い","fonts/marker felt.ttf",32); local label2 = cc.label:createwithttf("long","fonts/marker felt.ttf",32); local label3 = cc.label:createwithttf("rất dài","fonts/marker felt.ttf",32); label1 japanese string rendered correctly, label2 ansi string. however, label3 wasn't rendered correctly. in fact, rendered "rt dài". i had tried use other unicode fonts has character. still, couldn't character rendered correctly. have done wrong? i have same issue, , have solved. figure out that, font file marker felt.tff include in cocos project not unicode version. after while, have found unicode version of marker felt font in mac pc in: system/library/fonts/markerfelt.ttc markerfelt unicode image

php - get the size of a file stored on my database -

i need size of pdf file stored in database i try $sid = 1; $getfile = $db->prepare("select * pwork id=?"); $getfile->bind_param('i', $sid); if ($getfile->execute()) { $fileres = $getfile->get_result(); if ($f = $fileres->fetch_object()) { $filename = $f->work_file; $filesize = filesize($filename); } } and got error ( ! ) warning: filesize(): stat failed ch03-libre.pdf in xxx on line 57 my file stored blob , need file size 5mb if whole file inside blob, can use mysql functions directly calculate how big blob is. see article: https://www.virendrachandak.com/techtalk/how-to-get-size-of-blob-in-mysql/ and example: select octet_length(blob_content) test_blob id = 1 length returned in bytes.

mysql - database connection in java with separated class -

i wrote java code connect mysql database in main method, , success , results. when separate database code in separated class have problem connection database nothing this code: package database; import java.sql.resultset; import java.sql.sqlexception; public class database { public static void main(string[] args) throws classnotfoundexception, sqlexception { //connection connect = drivermanager.getconnection("jdbc:mysql://localhost/javadb", "root", "123"); system.out.println("sadsa"); connecttodatabase db = new connecttodatabase("javadb", "root", "123"); system.out.println("sadsa"); string sqlstatement = "select *\n" + "from `javadb`.`user`\n" + " limit 1000;"; resultset result = db.makequery(sqlstatement); while (result.next()) {...

jquery - Bootstrap based framework for page layout building -

Image
i want have page, user can dynamicly add\del\change rows , panels. i saw similar in graphana: user can add rows , panels inside row dynamicly, can change wide of panels (in "spans"). does similar frameworks exist? use laravel framework twist, can want , use bootstrap want styling.

android - Get the current location of user on background -

just have question best approach use, need send query device other device current location, think have 2 choices. first using sockets. or push notification. the idea to send query start service current location of user. using services, not sure if best choice. user location don't want him see anything, work done on background. thank you. you have write webservice device continually ping , update lat, long on server , service other device location of first device.

php - Converting SQL query into Doctrine, Error -

i trying convert sql query doctrine querybuilder query. sql query works want within sql console (workbench). when converted ,my sql query doctrine 'query' error cannot head around..... pure sql query: select concat('news/', feeds.slug, '/', articles.slug) 'url' article_feeds left join articles on article_feeds.article_id=articles.id left join feeds on article_feeds.feed_id=feeds.id doctrine query: $stmt = $this->db->createquerybuilder() ->select('faf.article_id', 'faf.feeds_id') ->addselect('f.slug feedslug') ->addselect('a.slug articleslug') ->addselect("group_concat(distinct concat(feedslug, '/' , articleslug) separator ',' ) url") ->from('article_feeds', 'faf') ->leftjoin('a', 'article_feeds', 'faf', 'af.article_id = a.id') ->leftjoin('f...

ruby on rails - Guest User for Devise using Null Object Pattern -

i trying implement guest user within devise, in doing user_signed_in? evaluates true how can around this? i can't use signed_in? because have admin user if signed in on admin panel , go main website thinks signed in if use signed_in? here code application controller def current_user if devise_controller? @current_user = super else @current_user ||= super || guest.new end end view <p>welcome <strong><%= current_user.first_name %></strong></p> <ul> <% if user_signed_in? %> <li> <%= link_to 'sign out', destroy_user_session_path, method: :delete %> </li> <% else %> <li><%= link_to 'sign up', new_user_registration_path %></li> <li><%= link_to 'sign in', new_user_session_path %></li> <% end %> </ul> update i have decided override user_signed_in? method,...

java - How to avoid possible Null Pointer deference -

i have made simple add method takes 2 args. here code : public list<mylisttype> add(list<mylisttype> mytypes, mylisttype mytype) { if (mytypes == null) { mytypes = new arraylist<mylisttype>(); } int size = mytypes.size(); if (size > 1) { boolean laststatus = mytypes.get(mytypes.size()-1).getavailabilitystatus(); boolean secondlastelement = mytypes.get(mytypes.size() - 2).getavailabilitystatus(); if (laststatus == null && secondlastelement == null) { mytypes.remove(mytypes.size()-1); } else if (laststatus.equals(secondlastelement)) { mytypes.remove(mytypes.size()-1); } } mytypes.add(mytype); return mytypes; } i think there possible null pointer deference in if condition, on laststatus . see can in order avoid ? thanks. assuming you're using java 7+, can use objects.equals , takes care of both conditions: boolean second...

When android facebook Development Key Hashes has validity -

i'm having trouble facebook development key hash. i try share content facebook using feed dialog fallback showing in facebook quick start page. i've done whole step set adding facebook sdk in android project. i've set development key hash of application , add "add development , release key hashes" field, after generated debug apk file of application. trying sharing device facebook app running developer account logged (the same on i've registered application) works fine. when trying sharing content device running facebook app, different facebook account error com.facebook.facebookauthorizationexception: app has no android key hashes configured. configure app key hashes @ -my application settings page- my question development key hash limited developer testing works developer account interactions? ps: made application public , available users on settings account, set development key hash given application installed on test devices, didn't...

axapta - AX2012 X++ Partial posting of Purch lines -

i want post invoice of selected lines of purch order(po) through code. need in code. can me coding ? the formletter framework has method chooselinesquery accepts query of lines update. see this blog . code sales order (you can more or less substitute 'sales' 'purch'): salestable salestable = salestable::find('your-order'); salesformletter salesformletter = salesformletter::construct(documentstatus::invoice); query query = new query(querystr(salesupdatepackingslip)); querybuilddatasource qbds = query.datasourcetable(tablenum(salesline)); // build query range find lines needs posted. qbds.addrange(fieldnum(salesline, salesstatus)).value(queryvalue(salesstatus::backorder)); salesformletter.chooselinesquery(new queryrun(query)); salesformletter.update(salestable);

java - JNativeHook Keyboard listener isn't working with my Swing/GUI -

i'm making mouse/keyboard/pixels classes can simulate , read native input events. these implementated wrappers around java.awt.robot , jnativehook . they're intended used replacements autohotkey or autoit on mac. i'm doing testing on windows 7 64bit machine. my problem can't figure out why keyboard listener jnativehook isn't working. haven't got around testing if mouse listeners work yet. it's possibly related multi-threading issues swing , jnativehook , haven't ruled out problems library or build version. most of code directly example page. jnativehook spams logger , console debug information mouse/keyboard doesn't call listener. i'm using latest jar download page eclipse , latest jdk/jre unless went horribly wrong installs. test class the program displays button , colored panel. pressing button , typing "1" should change panel's color same pixel under mouse cursor. import java.awt.awtexception; import java.awt.color...

SASS: Extra selectors added from extended class? -

i attempting use modernizr class extended class. have following scss code: %some-extended-class { color:red; } .no-csstransforms %some-extended-class { color:blue; } .class-one { .class-two { .class-three { @extend %some-extended-class; } } } note 2 extended class declarations; second preceded .no-csstransforms modernizr class. expect get: .class-one .class-two .class-three { color: red; } .no-csstransforms .class-one .class-two .class-three { color: blue; } however, output getting: .class-one .class-two .class-three { color: red; } .no-csstransforms .class-one .class-two .class-three, .class-one .class-two .no-csstransforms .class-three { color: blue; } note .class-one .class-two .no-csstransforms .class-three , unnecessary, , don't understand why being added?

node.js - How to excute .bat script on windows from node js -

i have node js file excute bat file. tried using exec of node js child-process module no luck let me share node js script: var starttime = '2014-11-27 17:0:42'; var threadname = '<thread 0>'; var categoryname ='alarmcategory'; var alarmlevel = 'fatal'; var alarmcategory = 'os'; var alarmmessage = 'corrupt'; var cp = require('child_process'); msg = cp.exec('handler.bat' +" " + starttime ,function (error, stdout, stderr) { if (error) { console.log(error.stack); console.log('error code: '+error.code); console.log('signal received: '+error.signal); } console.log('child process stdout: '+stdout); console.log('child process stderr: '+stderr); }); my bat script . script takes input parms , echos. @echo off set starttime=%1 set thread=%2 set categoryname=%3 set alarmlevel=%4 set alarmcategory=%5 set alarmmessage=%6 echo ##########...

elasticsearch - How can I get FacetFilter work properly? -

i'm trying calculate stats elasticsearch short time period but, eventhough specified interval, i'm still getting results whole data set. this code var mindate = new datetime(1970, 1, 1); var fromdate = datetime.parse("2014-11-27t11:00:00.000z").addticks(-mindate.ticks).addhours(-2); var todate = datetime.parse("2014-11-27t11:15:00.000z").addticks(-mindate.ticks).addhours(-2); var results = client.search<dalsp>(s => s .from(0) .size(100) .facettermsstats(fts => fts .facetfilter(fdesc => fdesc .range(range => range.greater(fromdate.ticks / 10000).lower(todate.ticks / 10000) ) ) .keyfield(t => t.sp_name) .valuefield(t => t.total_time) ) ); what can problem? in advance. problem solved after using strings timestamp, instead of long. var results = client.search<dalsp>(s => s .from(0) .size(100) .que...