Posts

android - NPE when adding inflated button -

i try create new button programatically , existing viewgroup (i moved custom classical linearlayout ensure bug not in custom viewgroup). a code simple , working in different use case: private void appendtile() { view view = getlayoutinflater().inflate(r.layout.template_tile, null); view.setid(view.generateviewid()); view.setonclicklistener(tilelistener); hiddenpicture.addview(view, view.getlayoutparams()); } template_tile.xml: <button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" style="@style/formulavalue" /> but fails, because view.getlayoutparams() null (though there layout_width , layout_height in xml). caused by: java.lang.nullpointerexception: attempt read field 'int android.view.viewgroup$layoutparams.width' on null object reference @ android.view.viewgroup$layoutparams.<init...

tomcat - Timezone issue with grails application -

i have running grails application timezone set gst parameter jvm on tomcat 7. couple weeks back, application starts misbehaving , time see in logs gmt time. im not sure should more information, setting overridding value. help? as per @jon skeet suggestion, after replacing jvm parameter user.timezone=gst user.timezone=asia/dubai solved issue

linux - combine sed and grep to find using regex and replace recursively -

i got problem when im trying find string (using regex) in files , replace it. i find strings in file contain this: "ip":"([0-9\.]+)" and replace with: "ip":"127.0.0.1" any idea?

c# - Neo4jClient node ids -

i'm having trouble working out how id work in neo4jclient. want .net model have identifier property, , ideally i'd use neo4j autoincremented id node. however, no matter case use ( id , id , id ) in model class, adds field in neo4j (keeping 0 when create new node). when view node in neo4j browser, has <id> auto-incremented, , id field 0 (unless manually set in model in c#). i want able create new .net model class (which have uninitialised id of 0), once i've created neo4j fluent cypher query, have id newly created node's autoincremented id. the examples here: https://github.com/readify/neo4jclient/wiki/cypher-examples show user class of having id this: public long id { get; set; } but in example creating new user ... var newuser = new user { id = 456, name = "jim" }; graphclient.cypher .create("(user:user {newuser})") .withparam("newuser", newuser) .executewithoutresults(); i'm unsure 456 magic n...

javascript - Sending data from node.js back to client? -

i sending post request node.js client .in handler of request making http post request(in node.js) data,which gives me json data in response ,then in turn data making http post request(in node.js) gives me set of data in response . want return response data handler function ,the set of data receive response can send client .how can achieve this. server.route({ path:"/test", method:"post", handler:function(request,reply){ var load=request.payload; userauth(load); return reply({status:"ok"}); } }); function userauth(newdata){ request({ har:{ url:"url", method:"post", headers:[ { name:'content-type', value:"application/x-www-form-urlencoded;charset=utf-8" } ], postdata:{ mimetype: 'application/x-www-form-urlencoded', params:[ { name:"username", value:userdetails[...

wpf - MutliSelect ListBox in Menu -

Image
i creating undo button should work identical visual studios undo button. want user able mouse on item , every item above selected. on click items above passed in , actions performed. if user clicks button itself, undo top object. problem: not using context menu , no idea i'm doing wpf. right user can mouse on object mouse above selected (all code behind vb.net). appreciated! code: <menuitem header="undo" name="menuundo" isenabled="true"> <menuitem.icon> <image source="undo.png" width="24" height="24" /> </menuitem.icon> <stackpanel> <listbox name="listboxundo" horizontalalignment="stretch " verticalalignment="stretch" width="177" height="100 " margin="-33,-5,-65,-5" scrollviewer.verticalscrollbarvisibility="visible" isenabled="true" ...

html - Use jQuery to populate sibling hidden input -

for calculation currencies, need value of input parsed integer , value should populate sibling input of type "hidden". i make reusable possible, use same script inputs it. html : <div class="input-group" id="total-emplcosts"> <span class="input-group-addon">total employer costs</span> <input type="text" class="form-control" name="empl_costs_inp" id="empl_costs_inp" /> <input type="hidden" name="empl_costs" id="empl_costs" /> </div> jquery tried: (not doing @ all) $('.input-group input').on('keyup blur focusout',function() { if($(this).val() !== '') { var inputvalue = $(this).val(); var integervalue = parseint(inputvalue * 100); $('input').siblings('input').val(integervalue); } } and: (adding integervalue hidden inputs) $(...