Posts

Showing posts from May, 2012

jsf - Handling service layer exception in Java EE frontend method -

i maintain web application have page jsf tag <f:event . have rewrote method in service class throw business exception. however, when business exception thrown, isn't caught in managed bean , exception showed on page. seems code try/catch doesn't work. in xhtml: <f:event listener="#{resourcebean.init(enrollment)}" type="prerenderview" /> listener method in managed bean: private boolean cancreateresource; public void init(enrollment enrollment) { (...) try { cancreateresource = resourceservice.cancreateresource(enrollment); } catch (businessexception e) { cancreateresource = false; } } method in service class: public boolean cancreateresource(enrollment enrollment) { if (...) { if (mandateservice.iscoordinator(user, course)) { return true; } else { throw new businessexception("undefined business rule."); } } return false; } from ...

Python - Multiple array into another array -

basically have no idea how this. but if have multiple array: [[1, 2], [3, 4] which can seen as: ([[x, y], [x, y]...]) and want create new array x , separated 4 sectors: (1, 2, 3, 4) array_(number(y)) = [x, 0, 0, 0] if f.e x = 1 , y = 2 should this: array_2 = [0, x, 0, 0] i'm sorry not posting code begin with, literally have 0 ideas. can me come something? you can achive using itertools: import itertools xyarray = [[1,2],[3,4]] xarray = list(itertools.chain(*xyarray))

mysql - How can I prevent extra quotations being inserted into MySQLdb statement from Python? -

i have series of sql select statements need run python script using mysqldb. 1 of variables pass select statements called unit_ids . i've tried treating unit_ids string tuple of strings. initially, backslashes being inserted string. after looking around online, i've been able avoid backslashes, quotation marks being inserted instead. here current code: connection = mysqldb.connect('localhost', 'root', '*****', 'test') cur = connection.cursor unit_ids = ('0a1', '0a2', '0a3', '0a4') attr = 'sample' cur.execute("""select count(*) test attribute = %s , unit_id in %r""", (a, tuple(unit_ids))) using cur._last_executed , can see actual sql statement performed was: select count(*) test attribute = 'sample' , unit_id in ("'0a1'", "'0a2'", "'0a3'", "'0a4'") any ideas on need change in order hav...

Translating SAS code to R: Simulation and Dataframes -

i working sas code. data a; i=1 10000000; x = 12 + 2.5*rannor(0); y = 15000 + 2500*x + 5000*rannor(0); output; end; i having hard time in attempt find suitable r code can replicate (or rather similar) i've done above. all i've been able this... set.seed(0) x = 12 +2.5*rnorm(1) y = 1500+ 250*x+ 500*rnorm(1) ...but think sas program generates 10000000 x's , y's have values based on equations above, assume dataframe involved. anyone used r or/and sas before? ideas how can similar sas code? set.seed(0) n = 10000000 library(dplyr) data_frame(x = 12 + 2.5*rnorm(n), y = 1500+ 250*x+ 500*rnorm(n) )

iis - How to configure the IIS7 in order to run ASP.net (.aspx) web applications? -

Image
i have configured iis7 , application pools .aspx website run. application runs fine, when click on link direct me page have created, gives me error, following: this application pools settings:

autocad - Attributes of a C# Property Changing after Getter call -

the code below property 1 of classes public subdmesh placeholder { { document doc = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument; database db = doc.database; transaction tr = db.transactionmanager.starttransaction(); documentlock doclock = doc.lockdocument(); using (tr) using (doclock) { return tr.getobject(idofplaceholder, openmode.forwrite) subdmesh; } } } subdmesh, class autocad's api, has property called iswriteenabled want true can make changes object. explicitly specify openmode.forwrite in getobject. however, when go make changes in next code segment placeholder.visible = false; it blows up. looking @ variable after getter called reveals iswriteenabled changed true false right after object returned. how can keep writing enabled? it seems transaction , documentlock objects responsible managing writes subdmesh. both objects dispose...

Unable to start the JVM - Windows 7 -

Image
our company went through upgrade , don't know else changed defaults excel 2013 32-bit (w/ matlab compiler runtime add in) crashes multiple times day , it's driving me crazy. i looked through solutions other similar questions still having no luck. exact error i'm receiving attached in picture below. i've tried editing environment variable various amounts , checked free physical memory available (has 16g total , half free) running java -version in command prompt returns: java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b31) java hotspot(tm) 64-bit server vm (build 24.51-b03, mixed mode) the java control panel runtime environment settings reference javaw.exe changed environment variables on both java.exe , javaw.exe (in both program files , program files (x86). unable start jvm. picked _java_options: -xmx1024m -xms512m error occurred during initialization of vm not reserve enough space budget heap there not enou...

Java comparator for String in EBCDIC encoding -

i have come across requirement need convert string ebcdic encoding , sort it. need sort ebcdic because string has go in mainframe. string sort have alphabets in captial , integers only. i googled , came across link ibm has listed characters in order what realized ebcdic sorting opposite normal java lexicographic sorting (at least type of data going process). my question realization right ? if not missing ? or there java comparator available ebcdic encoding. since char type implicitly utf-16 in java ebcdic strings need compared java byte arrays. example: charset encoding = charset.forname("ibm1047"); comparator<string> enccomparator = (s1, s2) -> encoding.encode(s1) .compareto(encoding.encode(s2));

datetime - python pandas: trying to reference data from another column's previous month end -

i trying create column in dataframe references value in column previous month end. this... date sd sd.prevmo 02/29/00 0.0312 0.0312 03/01/00 0.0304 0.0312 03/02/00 0.0293 0.0312 03/03/00 0.0287 0.0312 03/28/00 0.0502 0.0312 03/29/00 0.0526 0.0312 03/30/00 0.0537 0.0312 03/31/00 0.0556 0.0556 04/03/00 0.0507 0.0556 04/04/00 0.0532 0.0556 04/05/00 0.0536 0.0556 the dateoffset functionality including bmonthend() seems have answer in must butchering that's not terribly complex. df.ix[df.index.is_month_end==true, sd.prevmo] = df[sd] df.ix[df.index.is_month_end==false, sd.prevmo] = ??? has run before? after set values is_month_end==true df['sd'] , can full nas ffill methiod - forward fills values. in [10]: df.ix[df.index.is_month_end==true, 'sd.prevmo'] = df['sd'] in [11]: df['sd.prevmo'].fillna(method='ffill') out[11]: date 2000-02-29 0.0312 2000-03-01 0.0312 2000-03-02 0.0312 200...

jquery - Deferred functions and making sure final function receives both data -

i function displayresults() data before renders value. functions getresulta() , getresultb() using $.deferred. function getresultb() dependent on results getresulta(). function getresulta() { var deferred = $.deferred(); . . . . deferred.resolve(somevalue); return deferred.promise(); } function getresultb() { var deferred = $.deferred(); . . getresulta().done(function(somevalue) { deferred.resolve(somevalue); return deferred.promise(); }) } function displayresults() { getresultb().done(function(response) { // display response }) } is code correct? your getresultb() promise anti-pattern . have promise returned getresulta() . don't need create new one. can return 1 have. function getresultb() { . . return getresulta().then(function(somevalue) { // whatever code want here // code here can return new value, return value have // after doing other operations or can return new promise // added c...

How to replace an Android fragment with another fragment inside a ViewPager? -

i have view pager consisting of 4 tabs. each tab holds own fragment. how able use fragment transaction replace fragment in tab 3 new fragment? i've tried lot of things, have not been able come solution @ all. i've tried looking around on google , stackoverflow, no success. i assume fragment has button put in center. clicking on it, can change layout stays under of button. content/layout of first fragment mentioned should replaced wrappera , content/layout of second 1 should replaced wrapperb. put simple red background wrappera distinguish wrapperb, wrapperb green due same reason. hope want: public class switchingfragment extends fragment { button switchfragsbutton; relativelayout wrappera, wrapperb; view rootview; @override public view oncreateview(layoutinflater inflater, final viewgroup container, bundle savedinstancestate) { rootview = inflater.inflate(r.layout.layout_switch, container, false); wrappera = (relativelayo...

c++ - TAEF Datadriven c# application on windows phone -

i writing c# application read xml using "data driven method" described in taef documentation. https://msdn.microsoft.com/en-us/library/windows/hardware/hh439689(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/hardware/hh439591(v=vs.85).aspx i have vsts dll loaded , te.managed.dll loaded in references , in taef set testcontext property can access data through it. public testcontext testcontext { get { return m_testcontext; } set { m_testcontext = value; } } at runtime when run testcase on phone, getting argument error command - cmdd te.exe "c:\data\test\bin\unittestproject1.dll /select:@testid='1004'" test authoring , execution framework v4.16m arm error: system.argumentexception: object of type 'wex.testexecution.testcontextimplementation' cannot converted type 'microsoft.visualstudio.testtools.unittesti ng.testcontext'. removing references wex.testexecution giving me same error. 1 please me !!!??...

python - How to find the numbers in between the numbers that the user has input? -

i'm using grok learning , need finding numbers in between if user inputs them. for example: 3 6 the numbers in between: 4, 5 but need exactly: up lift lift broken! can still go , down, doesn't display floor it's @ anymore, causing confusion people trying use it. write program display floor numbers on elevator going up. program should read in current floor , read in destination floor, higher current floor. program should print out each of floor numbers in-between. current floor: 3 destination floor: 6 level 3 level 4 level 5 level 6 ​ current floor: 1 destination floor: 2 level 1 level 2 so current code is: current = int(input("current floor: ")) desti = int(input("destination floor: ")) print("level",current) print("level",desti) now i'm confused how output numbers in between. you use range() function using upper , lower...

xaml - UWP Background task timers -

i working on app needs timer fire @ specified time in background. want start timer ticks every 10 minutes or till specified time. in not want user have open app. best way achieve this? have looked around , haven't found good, straight forward, answer. thanks! i want start timer ticks every 10 minutes or till specified time. windows has built-in timer runs background tasks in 15-minute intervals. can create timer trigger start background process in specific interval. for details, please check document run background task on timer .

windows - Why is UWP 10 development so slow? -

does else there have issues sluggish development experience in vs 2015 writing apps universal windows platform 10? compiling, debugging, switching between windows painfully slow compared working similar, basic wpf application. i have not been able find mention of experience on google, leads me wonder if there's in setup throwing monkey wrench uwp dev. has experienced this, or know of ways speed development? update oct 2016 this answer no longer relevant, of visual studio 2015 update 3 . microsoft have done great job bringing development environment stable state. although have issues xaml designer, coding & building faster , more enjoyable. hope of debilitating issues found in xaml designer resolved in next visual studio 15 . has experienced this yes . everyone on team losing hair because of uwp. i'm convinced microsoft wants me hate c# & xaml. ...or know of ways speed development? i'm porting app uwp can't end support win8....

css - How to print labels from a label printer using html -

i have application need print labels browser. have done before when printing sheet of labels (i.e. avery 5160). straightforward requires combination of html , css , content , can print page normal 8.5x11 printer. my dilemma, however, need print labels label printer, kind prints 1 @ time roll. specific model used brother ql-500. part struggling number of labels printed not same. 1, 4, 15. how can style page printer know each label needs printed individually, rather printing out of content on 1 long label. know if possible / has done before successfully? there no way webpage query browser's attached printers paper-sizes or other attributes. however, css3's paged-media module allow webpage declare paper sizes , orientation expects, h owever in working draft status don't believe browsers support it. the best can provide own listing of paper sizes , use javascript re-layout page accordingly) , warn users (in big, red, bold text preferably) must ensure size se...

python - Deploy flask in production with GeventWSGI and Nginx -

i have rest api written in python flask , flaskrestful extension. use gevent wsgi def runserver(): api.debug = true http_server = wsgiserver(('', 5000), api) http_server.start() all works charm on machine. want go in production on linux vm,on internet searched hours,i don't choosed mod_wsgi because gevent doesn't work it,so prefer use nginx. on internet saw flask apps hosted uwsgi,my answer need use uwsgi? use geventwsgi in flask application? how work this? in case don't need uwsgi,i need config nginx sites pass request flask app? i'm newbie i'm little confused. thanks in advance you can run uwsgi in gevent mode http://uwsgi-docs.readthedocs.org/en/latest/gevent.html , route flask requests via nginx. server { listen 80; server_name customersite1.com; access_log /var/log/customersite1/access_log; location / { root /var/www/customersite1; uwsgi_pass 127.0.0.1:3031; ...

php - How can I implode() a multidimensional array into a string? -

i have array has multiple arrays inside of like. here how looks like: array ( [0] => array ( [0] => s1 [1] => s2 [2] => s5 [3] => s1 [4] => s25 [5] => s1 [6] => s6 [7] => s6 [8] => s1 ) [2] => array ( [0] => a2 [1] => a1 [2] => a4 ) [3] => array ( ) [4] => array ( ) ) what i'm trying figure out how can turn these multiple arrays 1 string has values arrays split commas $values = "s1,s2,s5.." i used impode() before type of array, it's not functioning. problem in empty arrays believe can removed array_filter() . $destination_array = array_filter($tags_list); $destination_array = implode(",", $tags_list); print_r($destination_array); you have 2 dimensional array here. , neither implode() or array_filter() work multidimensional arrays. this means filter empty values out ...

apache pig - want to replace \ in pig latin using replace command -

i have file having data below in pig <"{\"action\": \"ac_data\",\"data\":{\"nn1\":\"0000000\",\"zerosquare\":\"newuser\",\"nacde\":\"catlogue\",\"user123\":\"99000200340904\",\"lcadq\":\"89148000001972298094\",\"reserve\":\ and want remove \ , output should below <"{"action": "ac_data","data":{"nn1":"0000000","zerosquare":"newuser","nacde":"catlogue","user123":"99000200340904","lcadq":"89148000001972298094","reserve": input : <"{\"action\": \"ac_data\",\"data\":{\"nn1\":\"0000000\",\"zerosquare\":\"newuser\",\"nacde\":\"catlogue\",\"user123\":\"99000200340904\...

ios - How to transfer app from one developer account to another -

Image
i have app on app store developer account , want transfer developer account. apple's website says click on transfer app button under app information in itunes connect button not appearing app. what should do? if have agent role, can find "transfer app" button. my apps > app store > app information > additional information

jquery - While inserting Data into MySQL using Ajax and PHP, taking limited data? -

while inserting data mysql using ajax , php, taking limited data rich textarea,is there problem? jquery script $('#adddesc').click(function(e) { e.preventdefault(); var txtcategoryname=tinymce.get('txtcategoryname').getcontent(); var txttitle=$('#txttitle').val(); var selecterror1=$("#selecterror1").val(); var selecterror2=$("#selecterror2").val(); var selecterror3=$("#selecterror3").val(); //var fimage=$("#fimage").val(); //alert($("#selecterror2").val().length); var datastring; var err; err=(txttitle!='' && txtcategoryname!='' && $("#selecterror1").val()!='0' && $("#selecterror2").val()!='0' && $("#selecterror3").val()!='0')?'0':'1'; // var datastring1="txttitle="+txttitle+"& description="+txtcategoryname+"& ...

android - How start SurfaceHolder.Callback() event if Button Clicked? -

i tried start surfacecallback of camera if button clicked, cannot , if did camera.setpreviewcallback() not invoked although works in invoked surfaceholder.callback() oncreat() method shown in code below public class heartratemonitor extends actionbaractivity { private static final string tag = "heartratemonitor"; private static surfaceview preview = null; private static surfaceholder previewholder = null; private static camera camera ; private static view image = null; private static textview text = null; private static wakelock wakelock = null; private static long starttime = 0; static context context; static circlebutton cb ; static int txt ; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); placeholderfragment p = new placeholderfragment() ; if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.contain, p) ...

python - Periodic Django Logs in Terminal -

i new django , question may seem easy. in terminal "python manage.py runserver" executed, following logs periodically appear. [30/sep/2015 02:36:02] "get /messages/check/?_=1443574208652 http/1.1" 200 1 [30/sep/2015 02:36:08] "get /notifications/check/?_=1443574208653 http/1.1" 200 1 [30/sep/2015 02:36:08] "get /feeds/update/?first_feed=13&last_feed=6&feed_source=all&_=1443574208655 http/1.1" 200 173 [30/sep/2015 02:36:08] "get /feeds/check/?last_feed=13&feed_source=all&_=1443574208654 http/1.1" 200 1 [30/sep/2015 02:36:39] "get /notifications/check/?_=1443574208656 http/1.1" 200 1 [30/sep/2015 02:36:39] "get /feeds/check/?last_feed=13&feed_source=all&_=1443574208658 http/1.1" 200 1 [30/sep/2015 02:36:39] "get /feeds/update/?first_feed=13&last_feed=6&feed_source=all&_=1443574208657 http/1.1" 200 173 [30/sep/2015 02:37:03] "get /messages/check/?_=14435742086...

if statement - How to shorten the same part in jQuery function? -

if have if/else statement: if(a) { $('#aa').removeclass('offselect').addclass('onselect').css('background-image','url(../images/menu.gif)'); } else if(b) { $('#bb').removeclass('offselect').addclass('onselect').css('background-image','url(../images/menu.gif)'); } else if(c) { $('#cc').removeclass('offselect').addclass('onselect').css('background-image','url(../images/menu.gif)'); } else if(d) { //same part } you can see code have same part: removeclass('offselect').addclass('onselect').css('background-image','url(../images/menu.gif)'); is possible or suggestion shorten same code? use function reused code : if(a) { // pass jquery selector reference doprocess( $('#aa') ); } else if(b) { doprocess( $('#bb') ); } else if(c) { doprocess( $('#cc') ); } e...

regex - .htaccess instead a range use 2 options -

i have code in .htaccess file: options +symlinksifownermatch rewriteengine on # turn on rewriting engine rewriterule ^([a-z]+)/([a-z]+)?$ index.php?lang=$1&loc=$2 [nc,l] rewriterule ^([a-z]+)/([a-z]+)/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l] as can see, variables lang , loc can in range ([a-z]+) dont need total range need words: en or chin lang variable , hk or kw loc variable. i have tried this: rewriterule ^([en][chin])/([hk][kw])/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l] but dont know why works hk kw y no para en chin . any idea? you using character sets, match individual characters. so, [hk][kw] match these: hk, hw, kk, kw . want this: rewriterule ^(en|chin)/(hk|kw)/?$ index.php?lang=$1&loc=$2 [nc,l] rewriterule ^(en|chin)/(hk|kw)/restaurants/?$ all_rest.php?lang=$1&loc=$2 [nc,l]

Powering Arduino Relay Shield with Only Digital Pins -

i wondering if possible power dual relay shield on arduino's analog/digital pins. know supposed connect 1 ground , 5v vcc port ports taken other components cannot spare. don't know if draw current, if won't short arduino can send positive signal, bit unsure of grounding in code. thank you

android - Pass data from listview to main activity -

i have main activity included button , textview. when click button, display listview , fill data listview. in listview, click item, want send item data textview in main activity. however, has crash. have no idea find problem , log (does not show). @ code , provide me solution? mainactivity btnmanage = (button) findviewbyid(r.id.btnmanage); btnmanage.settext(managelabel); btnmanage.setonclicklistener(new view.onclicklistener() { @override public void onclick(final view v) { intent intent = new intent(v.getcontext(), listviewactivity.class); intent.putextra("list_data", "hello"); v.getcontext().startactivity(intent); } }); in listviewactivity have bundle bundle = getintent().getextras(); string data_string= bundle.getstring("list_data"); arraylist<string> data = new arraylist<string>(); data.add(data_string); listadapter = new arrayadapter<string>(this, r.layout.simplerow, data); // set a...

AutoCAD installation required? -

i trying create 1 sample autocad app, in trying use "mdiactivedocument" so question per-requisite autocad should installed on client/user machine? use application? referring following reference dll's "c:\program files\autodesk\autocad 2014" "acdbmgd.dll", "acmgd.dll", "accoremgd.dll", "autodeks.autocad.interop.dll", "autodesk.autocad.interop.common.dll"" yes, autocad (or realdwg) must installed on user's machine. well, add-on you're developing runs within autocad memory space you'll want located in autocad trusted directory. it's explicitly stated autodesk not copy autocad dll files locally remote execution isn't option.

django - Display Loop from Database correctly Python -

i display word 'conflict' if value more 1 in list. code list = ['aa','bb','cc','aa'] conf = [s s in list] in list: if len(a in conf) > 1: print a, "-conflict" else: print i think syntax wrong in if len(a in conf)> 1: please me. i expecting result: aa - conflict bb cc aa - conflict you can use count function. if conf.count(a) > 1: print a, "-conflict" the above method similar have tried. inefficient when list large. so, use collections.counter. from collections import counter occurences = counter(conf) in list: if occurences[a] > 1: print a, "- conflict" else: print

c# - How can I load two versions of same assemblies into two different domains from two different subfolders? -

i'm trying build small tool comparing types in bunch of assemblies. purpose created 2 subfolders , put respective dlls there: ..\dlls\v1.1 ..\dlls\v1.2 where .. application folder i created proxy object: public class proxydomain : marshalbyrefobject { public assembly loadfile(string assemblypath) { try { //debug.writeline("currentdomain = " + appdomain.currentdomain.friendlyname); return assembly.loadfile(assemblypath); } catch (filenotfoundexception) { return null; } } } and used loading in following routine should load dll , types declared in it: private static hashset<type> loadassemblies(string version) { _currentversion = version; var path = path.combine(environment.currentdirectory, path.combine(_assemblydirectory, version)); var appdomainsetup = new appdomainsetup { applicationbase = environment.currentdirectory, ...

java - Android notifyDataSetChanged results in parsing idx 1 Illegal State Exception -

in main activity (localfeed) have listview connected asynctask gets data database in json format , sends baseadapter. problem notifydatasetchanged() nothing me (upon further researching got logcat output included below), have read lot of posts on here 1 android notifydatasetchanged not working , have implemented idea's nothing works. data when set adapter when have new data coming in stays same unless call setadapter again bad practice. first activity.. public class localfeed extends activity { string localstreams; edittext post; sharedpreferences myaccount,mya; string pathurl; float tlatmin,tlatmax,tlonmin,tlonmax,latitudes,longitudes; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.local_feed); // inputs used database pathurl = getresources().getstring(r.string.pathurl); // url data api localstreams = pathurl + "/api/streams"; tlatmin = myaccount.getfloa...

java - How to disable the single value from list in f:selectitems? -

<p:selectonemenu id="currency" value="#{element.selectedcurrency}"> <f:selectitem itemlabel="--n/a--" itemvalue="na:-1"></f:selectitem> <f:selectitems value="#{returnbodybean.selectedcurrency}" var="currency"/> <p:ajax listener="#{returnbodybean.oncurrencychange(element)}" update="datatypeconfigid,lovtypeid"></p:ajax> </p:selectonemenu> the list in f:selectitems contains 3 values. want disable values in list based on selection of value in drop down. eg:- if change value in other dropdown, want disable 2 values in f:selectitems list. can please tell me how it? you can't "disable" values in html selection list, need recreate list that's displayed, minus 2 values want removed. set update="currency" attribute on other dropdown, have selectedcurrency method of bean generate list based on...

flash - Dragged object tweened back into original position in actionscript 3 -

i have object on stage can dragged. on release, snaps orginal position. want able tween original position smooth , not choppy. here code have far: var startposition:point; blocksmallz.addeventlistener(mouseevent.mouse_down, dragz); stage.addeventlistener(mouseevent.mouse_up, dragstopz); function dragz(e:event):void { blocksmallz.startdrag(); startposition = new point( blocksmallz.x, blocksmallz.y); } function dragstopz(e:event):void { blocksmallz.stopdrag(); //set or tween position blocksmallz.x = startposition.x; blocksmallz.y = startposition.y; startposition = null; } you need code based tweening library. recommend learning gtween: http://www.gskinner.com/libraries/gtween/ after importing libary, @ point go: blocksmallz.x = startposition.x; blocksmallz.y = startposition.y; you instead insert line of code tween back. simple as: gtweener.addtween (blocksmallz, 1, { x:startposition.x, y:startposition.y } );

android - Context menu does not show in long click even of listview -

i have listview. want show context menu when press long click in item. , context menu show "delete" , "edit". implemented below code. however, not show context menu when press long click item. note that, long click item implemented successfully, however, not show context menu. fix me? public class manageactivity extends activity { private listview mainlistview ; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.list_main); // find listview resource. mainlistview = (listview) findviewbyid( r.id.mainlistview ); mainlistview.setadapter( listadapter ); registerforcontextmenu(mainlistview); } mainlistview.setonitemlongclicklistener(new android.widget.adapterview.onitemlongclicklistener() { public boolean onitemlongclick(adapterview<?> arg0, view arg1, int pos, long id) { // todo auto-generated method stub string ...

selenium webdriver - How to Write Exception in xls for seleniium? -

i using selenium webdriver i have n number of functional test cases. from excel sheet, controlling test cases want run. eg. test case 1 - run, test case 2- no run etc. when see run in excel sheet test case 1, using switch statement, picking relevant classname.methodname() each functional test cases in try /catch method return result pass/fail. if try block runs @ end given result pass else catch block return me result fail. my mainclass calls all.. if test case fails, due browser issues protected mode on or zoom size > 100. not able figure out failure until run debug mode. by chance, can catch every exception , write in excel? any appreciated. thanks

binary - 01 1011 - 11 1101 = ? use 2's complement -

i'm trying figure out doozie: 01 1011 - 11 1101 use 2's complement solve, 6bits signed. this tried: range of 6bits: -32 31 01 1011 = 27 11 1101 = -29 27 -(-29) = 56 (overflow) 11 1101 -- 2s complement --> 10 0011 so 01 1011 + 10 0011 = (missing bit)11 1110 = -2! any luck? ok think figured out: my first mistake 11 1101 not -29 -3. so: 01 1011 = 27 11 1101 = -3 27 -(-3) = 30 i can reverse 2's complement of -3 is: 11 1101 - 1 = 11 1100 then flip 11 1100 gives me 00 0011. so 01 1011 + 00 0011 = 01 1110 = 30 :)

asp.net - Persist checkbox in gridview while custom paging -

i have created gridview , added checkbox in item template. grid has few columns along datakey (primary key) . due performance gain, grid fetch next set of recrods on each page change based on page number click. done. now when user selects checkbox in page 1 , go page 2 , coming page one, user not see checkbox checked user did earlier. so there way persist checkbox when user move page page? this checkbox used flag select rows can deleted later button outside grid. since receive new set each time paging selected, suggest following approach: create array[] object via javascript add list datakey whenever checkbox selected , in turn remove if checkbox deselected. this: var selecteddatakeys = []; $('.checkboxclass').on('change', function() { // considering assign data key id checkbox otherwise implement way retrieve id. var datakey = $(this).prop('id'); // determine if datakey in selected data keys array var iscontained = (se...

struts2 - Up gradation issue while migrate the struts version 2.2.1 from struts 2.3.24.1 -

server: weblogic ide: intellej idea hi, i'm trying migrate struts version 2.2.1 2.3.24.1 added required jars struts version 2.3.24.1 following below url's http://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.3.24.1 http://mvnrepository.com/artifact/org.apache.struts.xwork/xwork-core/2.3.24.1 but getting following error: could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter. java.lang.noclassdeffounderror: org/apache/commons/lang3/stringutils @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:213) @ org.apache.struts2.config.strutsxmlconfigurationprovider.register(strutsxmlconfigurationprovider.java:102) @ com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:240) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:...

ios - San Francisco font + SpriteKit -

is possible use ios 9's new san francisco font in spritekit's sklabelnode ? apple has explicitly asked not instantiate font name, that's way sklabelnode provides selecting fonts. get system font name property fontname of uifont : let mylabel = sklabelnode(fontnamed:uifont.systemfontofsize(45.0).fontname) print result of font name: .sfuidisplay-regular edit: in terms of wwdc 2015 video: introducing new system fonts , page 298 of pdf says don’t access system font name , e.g. let myfont = uifont.systemfontofsize(mysize) // …later in code… let myotherfont = uifont.fontwithname(myfont.familyname size:mysize) the better practice (page 299) do reuse font descriptors , e.g. let systemfont = uifont.systemfontofsize(mysize) // …later in code… let myotherfont = uifont.fontwithdescriptor(systemfont.fontdescriptor() size:mysize) please note code describing situation need access font ( myfont ) defined earlier. in order keep consistency font in app, you...

coreos - Kubernetes: link a pod to kube-proxy -

as understand it, kube-proxy runs on every kubernetes node (it started on master , on worker nodes) if understand correctly, 'recommended' way access api (see: https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/accessing-the-cluster.md#accessing-the-api-from-a-pod ) so, since kube-proxy running on every node, 'recommended' way start each pod new kube-proxy container in it, or possible 'link' somehow running kube-proxy container? originally using url $kubernetes_service_host , credentials passed secret, on gke, calling curl https://$user:$password@${kubernetes_service_host}/api/v1/namespaces/${namespace}/endpoints/${selector} and parsing results, on k8s deployed on coreos cluster seem able authenticate through tls , certs , linked proxy seems better way. so, i'm looking efficient / easiest way connect api pod ip of pod referred service. any suggestion/input? there couple options here, noted in doc link provid...