Posts

java - android unparseble date Exception? -

i making application in using date functionality,but looking after several existing posts, still not able simpledateformat parser working. here code: public class gpsdemo extends activity { public static string tag = "abhi's log"; public static string imeii = "imei"; public static string start_time = "starttime"; public static string working_status = "workingstatus"; public static string address = "address"; public static int level = 0; button stop, hide; sharedpreferences pref; editor edit; date d1 = null; date d2 = null; string startingtime; string currenttime; context ctx = this; textview txt_start_time, txt_total_time, txt_total_distance, txt_address; @suppresslint("newapi") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.demoooo); pref = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); edit...

jsf - SelectManyBox - Enum Not saving -

i still have problem selectmanycheckbox.. selectmanycheckbox: <p:selectmanycheckbox converter="genericenumconverter" value="#{aview.newobject.avalue}"> <f:selectitems value="#{enumbean.avaluevalues}" var="s" itemvalue="#{s}" itemlabel = "#{s.name}"/> </p:selectmanycheckbox> converter selectmanycheckbox same described here: use enum in h:selectmanycheckbox @facesconverter("genericenumconverter") public class genericenumconverter implements converter { private static final string attribute_enum_type = "genericenumconverter.enumtype"; @override public string getasstring(facescontext context, uicomponent component, object value) { system.out.println("getasstring 1: "); if (value instanceof enum) { system.out.println("getasstring 2: "); component.getattribu...

Encrypted databags in chef-environments -

we manage critical information in encrypted databags, e.g. ssl certificates: databags/ssl . we'd prefer give limited set of people access secret decrypts these encrypted databags avoid having our private keys on place. people knife-bootstrapping , deploying servers that, should have access. databags not limited environment global. either have make our recipes toggle on environments , pick different databags, or we'd need encrypt part of databag: only entries : { "id": "some_data_bag_item", "production" : { # hash data here }, "testing" : { # hash data here } } bag_item[node.chef_environment]["some_other_key"] how manage encrypted data-bags? keep secret , how avoid having hand out secret working on chef?

yii - filter grideview work with having condition in search function in criteria? -

i have grideview code $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'lecture-grid', 'dataprovider'=>$model->search(), 'filter'=>$model, 'columns'=>array( array( 'header'=>'name', 'type' => 'raw', // 'name'=>'name', 'value' => 'chtml::link($data->name,yii::app()->baseurl . "/uploads/" . $data->name)', ), array( 'header'=>'pages', 'value'=>'$data->slide_num' ), array( 'header'=>'type', 'value'=>'$data->type' ), array( 'header'=>'size', 'value'=>'$data->size' ), // 'subject.name' array ( 'header'=>'subject', 'value' =>...

android - setGravity in code not working -

Image
in program have edittext . want, set text gravity in code: { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); int size = 40; tablelayout tl; tl = (tablelayout)findviewbyid(r.id.layout); tablerow tr; tr = (tablerow)findviewbyid(r.id.tablerow); edittext et = new edittext(this); tablerow.layoutparams params = new tablerow.layoutparams(); params.height = size; params.width = size; et.setlayoutparams(params); et.setbackgroundcolor(color.blue); et.setgravity(gravity.center_horizontal | gravity.center_vertical); et.settextsize(size - size / 4); et.settext("3"); tr.addview(et); } my xml: <tablelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/layout" xmlns:android="http://schemas.android.com/apk/res/android"> <tablerow android:id="@+id/tablerow...

c++ - Why can't GCC optimize the logical bitwise AND pair in "x && (x & 4242)" to "x & 4242"? -

here 2 functions claim same thing: bool fast(int x) { return x & 4242; } bool slow(int x) { return x && (x & 4242); } logically same thing, , 100% sure wrote test ran 4 billion possible inputs through both of them, , matched. assembly code different story: fast: andl $4242, %edi setne %al ret slow: xorl %eax, %eax testl %edi, %edi je .l3 andl $4242, %edi setne %al .l3: rep ret i surprised gcc not make leap of logic eliminate redundant test. tried g++ 4.4.3 , 4.7.2 -o2, -o3, , -os, of generated same code. platform linux x86_64. can explain why gcc shouldn't smart enough generate same code in both cases? i'd know if other compilers can better. edit add test harness: #include <cstdlib> #include <vector> using namespace std; int main(int argc, char* argv[]) { // make vector filled numbers starting argv[1] int seed = atoi(argv[1]); vector<int> v(1000...

linux - how to get exit code when using xargs (parallel) -

i'd made script launching parallel rsync process: #! /bin/bash list=$1 dest_dir=$2 rsync_opts=$3 #echo "rsyncing from=$src_dir to=$dest_dir rsync_opts=$rsync_opts" echo $list|xargs -n1 -d, echo|xargs -n1 -p 0 -i% rsync --rsync-path='sudo rsync' ${rsync_opts} % ${dest_dir} then, have problems exit status of rsync process. know possible array of pipestatus, need catch exit code know if rsync made or not. anyone knows? the man page xargs shows possible exit status values, can produce single aggregated exit code, not exit code per child runs. try 1 of these options: have process xargs spawns print exit code , have parent task parse exit code outputs determine exit code each rsync. use gnu parallel --joblog option. create file containing commands run in parallel along exit code , other information. file parsed after parallel exits determine rsync commands failed , respective error codes.