Posts

Showing posts from April, 2011

c# - Does more specific exception handling improve performance? -

if can catch more specific exception prevent clr doing work , benefit performance wise ? if know might socket exception not care handling differently other exception better still have more specific catch ? working on microframework small improvements in performance , resources worth asking about. catch (system.net.sockets.socketexception netex) { } catch (exception ex) { } i not think in terms of performance. from code correctness perspective: should catch specific exception can. when catch exception exception handler swallow any exception if not prepared handle it. imagine argumentnullexception thrown. catch block swallow , cause confusion. if prepared handle socketexception catch that. if less performant it. code correctness not sacrifice such miniscule performance gain* * or no performance gain @ - almost there zero execution time performance implication @ all. did benchmark on computer , performanc

ios - One task with multiple threading and different viewcontrollers -

i'm still facing problems multithreading on ios. want fetch json in mainviewcontroller (when app launches) , populate left menu (swrevealviewcontroller) data. but let's consider situation low internet speed, when user reveals menu , data didn't come mainviewcontroller. i'm fetching json both controllers. don't know how make sidebar wait data until mainviewcontroller finishes fetching? call mainviewcontroller [[categoriesstore sharedstore] fetchdatawithcallback:^(nsarray *allcategories, nserror* error) { }]; call sidebarviewcontroller inside async blocks [[categoriesstore sharedstore] fetchdatawithcallback:^(nsarray *allcategories, nserror* error) { if (error) { } else { //[self.tableview beginupdates]; blocksafe.alldirectories = allcategories; [blocksafe.tableview reloadsections:[nsindexset indexsetwithindex:1] withrowanimation:uitableviewrowanimationfade]; } }]; fetching json categoriesstore (singleton model)

sql server - Nightly Excel Spreadheet import into mssql database -

Image
i working nightly import need create, not sure best route update/insert current table. done in ms sql server 2012 , pulling excel file server. trying figure out how can loop through columns , pull out data need. if rearrange data, stuck have. in current table tblhw have columns such pmpcount, , numberstages, pmpmodel_pmp1, serialnum_pmp1, pmpmodel_pmp2, pmpmodel_pmp2, serialnum_pmp2, partnum_motor1, serialnumbermotor1, etc…. apologize in advance not being able post real table or picture. example: |name | pmpcount| numstages| pmpmodel_pmp1| stages_pmp1| sn_pmp1| |an 91-23g | 4| 500| fx2347| 250| 354197| |br dn 895r| 5| 521| d2442| 45| 875164| |aln 1-60j | 5| 521| h21342| 95| 594126| |pmpmodel_pmp2| stages_pmp2| sn_pmp2| partnum_mtr1| sn_mtr1| |fx2347 | 250| 354198| null| null| |fx17500 | 143| 102547| m7544| 4512241| |fx17500 |

java - Security: Invalid subject while connecting to JMS External Server Weblogic -

i have ejb module supposed run on weblogic 10.3.5 on weblogic console, have set jms module external server points weblogic instance. in module have jms/myqueue , jms/myconnectionfactory . in ejb module, defined mdb following annotation , works (it notified when messaged present on queue , processes it). @messagedriven( activationconfig = { @activationconfigproperty( propertyname = "destination", propertyvalue = "jms/myqueue"), @activationconfigproperty( propertyname = "destinationtype", propertyvalue = "javax.jms.queue"), @activationconfigproperty( propertyname = "connectionfactoryjndiname", propertyvalue = "jms/myconnectionfactory") } the problem is, when try define client puts message on same queue, using following code inside ejb @stateless public class messagesender implements messagesenderlocal { @resource(mappedname="jms/myconnectionfactory") p

html - XSLT - Dynamic nesting of elements -

i'm working on stylesheet outputs html xml inputs. have generate different nesting levels in output file according position of list of elements in input. instance, news[1] , news[2] should nested under same element news[3] , news[4]. this example of xml input: <news_list> <news> <title>title of notice #1</tile> <img_url>http://media/image_1.png</img_url> </news> <news> <title>title of notice #2</tile> <img_url>http://media/image_2.png</img_url> </news> <news> <title>title of notice #3</tile> <img_url>http://media/image_3.png</img_url> </news> <news> <title>title of notice #4</tile> <img_url>http://media/image_4.png</img_url> </news> </news_list> desired html output: <div class="middle> <div class="un

php - Rest API Request invalid request -

still struggling restapi request. following request: while($erg = odbc_fetch_array($query)){ $count++; $sql_inner = "select * adadr idadadr = ".$erg['idad'].""; $query_inner = odbc_exec($connection, $sql_inner); $erg_inner = odbc_fetch_array($query_inner); $sql_inner_1 = "select * admemo idadmemo = ".$erg['idad'].""; $query_inner_1 = odbc_exec($connection, $sql_inner_1); $erg_inner_1 = odbc_fetch_array($query_inner_1); $jsonpayload = json_encode( ['code' => $erg['kurzcode'], 'shortname' => $erg['kurzcode'], 'classificationtype' => "0", 'iscompany' => "true", 'externalkey' => $erg['idad'], 'website' => $erg_inner['www'], 'federaltaxid' => ' ', 'bankname' => ' ', 'bankaccount' => ' ',

java - Struts application giving JasperException on shared tomcat -

struts problem report struts has detected unhandled exception: messages: 1. org.apache.jasper.el.elcontextimpl cannot cast org.apache.jasper.el.elcontextimpl java.lang.classcastexception: org.apache.jasper.el.elcontextimpl cannot cast org.apache.jasper.el.elcontextimpl file: org/apache/jasper/runtime/pagecontextimpl.java line number: 1,023 org.apache.jasper.jasperexception: java.lang.classcastexception: org.apache.jasper.el.elcontextimpl cannot cast org.apache.jasper.el.elcontextimpl org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:549) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:470) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:728) org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.ja

jquery - overflow-y:hidden, but still scrollable with firefox on android -

i open partial view in overlay using jquery (showing fixed div , disable scrolling underlying webpage). seems work in chromium , firefox on desktop, , in chrome android, not in firefox/android: $('a#manage-albums').click(function(){ $.get( this.href ) .done(function( data ) { $('div#flvr-overlay-content').html(data); $('div#flvr-overlay-back').show(); $('html,body').css('overflow-y','hidden'); }); return false; }); the overlay appears , shows content, fixed , looks good, can still scroll underlying webpage.. i have meta tag in use, if matters: <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, user-scalable=no" /> how can disable scrolling (overflow-y) firefox on android? edit: it looks if firefox not 'overflow-y' . with line: $('html,body').css('overflow','hidden

model view controller - How to clear page cache when hitting back button on browser (IE,Chrome,Firefox Safari)? -

how clear cache of browser when hitting button on browser (ie,chrome,firefox safari) in mvc4.tried following code not working how refresh page when hitting button on browser (ie,chrome,firefox safari)? can guys me out this. thanks, subhnai. you need tell browser discard old page , fetch latest server specifying in html > head <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="expires" content="-1" /> <meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate" />

Jmeter: Is it possible to increment the value of variable for every thread in Jmeter? -

example: thread: 50, ramp-period: 0, loop: 1. i have send different value each thread. possible without changing loop count?. if need add existing variable may done via __intsum() function __counter() function generates incremented number each time it's being called either per-thread or global another candidate __threadnum() function number of current thread. see how use jmeter functions posts series advanced information on above , other useful functions.

python - Writing to JSON produces TypeError: dump() takes at least 2 arguments (1 given) -

i trying load in json file. update , write back. here attempt @ getting error: typeerror: dump() takes @ least 2 arguments (1 given) with open('employees.json') data_file: employees = json.load(data_file) data_file.close employees['employees'].append({ "id": "2", "name": "rob croft", "key": "0003837852"}) open('employees.json', 'w') data_file: json.dump(employees) data_file.close you forgot pass in file object: json.dump(employees, data_file) since using file object context manager with statement, not need manually close file. , using data_file.close entirely redundant since not calling file.close() method.

javascript - How to move div element inside another div element? -

var $selected = $(); var $itemlv1 = $("#create-summary .lv1"); $itemlv1.click(function(){ $selected = $(this); $(this).toggleclass('clicked').siblings().removeclass('clicked'); }); $("#moveup").click(function(){ $selected.add($selected.nextuntil(":not(.lv2)")) .insertbefore($selected.prevall(".lv1:first")); }); $("#movedown").click(function(){ $selected.add($selected.nextuntil(":not(.lv2")) .insertafter($selected.nextall(".lv1:first")); }); .clicked{ color: red; font-weight:700; } .lv2, .lv3 { margin-left:15px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div id="create-summary"> <div class="lv1"> introduction</div> <div class="lv1">1. aaa&

source_group CMake command isn't working -

i don't understand source_group command in cmakelists.txt. when works: file(glob input_head keyboard.h mouse.h) source_group("header files\\input" files ${input_head}) but isn't working: file(glob shaders ../shaders/*.txt) source_group("source files\\shaders" files ${shaders}) any suggestions on how solve this? (i have read documentation command, don't understand whythis doesn't work) you need use files in actual target. example must used in add_library or add_executable statement, in folder within project. also, use ''/'' rather \\ separator. may want use set_property(global property use_folders on) have predefined cmake projects go own solution folder.

perl - Moving catalyst framework project to another server -

i had moved perl catalyst framework project files old server new one. have moved each , every file when take url showing 404 error. there else need when files moved? please let me know 1st time doing it. thanks jitesh you need update web server, if there one. application either running standalone app own psgi server, or psgi server starman, or through fcgi handler web server apache, or cgi. in cases, need move piece of infrastructure new physical server computer. see catalyst::manual::deployment infos. i suggest documentation of project predecessors might have written, or ask local sysadmin.

Oracle: hugely improve query performance -

Image
i have next query i'm trying improve performance: select atx.journal_id ,ab.c_date acct_batch ab join acct_tx atx on ab.acct_id = atx.acct_id , ab.batch_id = atx.batch_id join journal j on j.journal_id = atx.journal_id , j.journal_type_id = 6 join acct on a.acct_id = atx.acct_id , a.acct_type_id = 32 join payments p on p.payment_id = j.payment_id join routing r on r.route_id = p.route_id , r.acq_code = 'rz_ns' join acq_acct aa on aa.acq_code = r.acq_code , aa.acq_acct_code = r.acq_acct_code , aa.slc = 'mxm' ab.c_date between to_date(to_char('01-jul-2015')) , last_day(sysdate); i've ran , reviewed explain plan , total cost 7388. out of this, expensive part join journal table, has cost of 6319. the table has approximately 1.6 million rows 87 partitions, out of 2 contain rows (partition 6 1.4 million , partition 12 approximate rest of 200k rows). the first thing i've tri

java - Migrating from JSF 1.2 to JSF 2.0 -

i working rather large app written in jsf 1.2 . jsf 1.2 around 6 years old now. need upgrade jsf 2.0. how painful be? noticed attributes in custom tags have been changed etc. painfulness painfulness of upgrading jsf 1.2 2.0 depends on view technology using , want use. jsp 2.x jsp 2.x = no effort. facelets 1.x facelets 2.0 = little effort. jsp 2.x facelets 2.0 = lot of effort. double if have custom components. basic changes regardless of view technology switch, at least following steps should done: remove jsf 1.2 jar's /web-inf/lib (if any). drop jsf 2.0 jar's in /web-inf/lib (if jsf 1.2 servletcontainer-supplied, might want change classloading policy load webapp libraries first before servletcontainer libraries, see jsf2 classloading issues in application servers ). update root declaration of faces-config.xml comply jsf 2.0 spec. <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2

Calling web service from Java "The message with Action '' cannot be processed at the receiver" -

i'm newbie web services , java, have issues connect application external web service. time exception the message action '' cannot processed @ receiver maybe assumptions wrong, think action defined inside soap payload. here wsdl: <?xml version='1.0'?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.tempuri.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.tempuri.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types /> <message name="biniciarreportrequest"> <part name="eausuario" type="xsd:string" /> <part name="eamodulo" type="xsd:string" /> <part name="eanomrepor" type="xsd:string" /> <part name="eaparamrepor" type=&

AngularJS Directives check for flag -

i have question angularjs directives. have following directive- code: <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"> <div class="badge pull-right" tooltip="role" tooltip-append-to-body="true" editable-text="vm.mytext">{{vm.mytext}}</div> ... and in code there editable-text="vm.mytext" but use directive lot of times don't need edit ... div class="badge pull-right" tooltip="role" ... every time. use directive this: <div ng-repeat="item in items"> <as-directive-name item="item"></as-directive-name> </div> my question if possible user directive this: <div ng-repeat="item in items"> <as-directive-name item="item" roleeditable="false"></as-directive-name> </div>

networking - [Freeradius][EAP] Issues using EAP-GTC for inner phase 2 authentication. -

i trying set eap-ttls/gtc authentication. in phase 1 ,the server offers eap-ttls , client accepts it. client set automatic phase 2 , expect server offer gtc phase 2 authentication not happening. can me figure out missing in conf file. eap { default_eap_type = ttls timer_expire = 60 ignore_unknown_eap_types = no cisco_accounting_username_bug = no max_sessions = 4096 md5 { } leap { } gtc { auth_type = local } tls { certdir = ${confdir}/certs_freeradius2 cadir = ${confdir}/certs_freeradius2 private_key_password = radius private_key_file = /etc/freeradius/certs/server.key certificate_file = /etc/freeradius/certs/server.pem ca_file = /etc/freeradius/certs/ca.pem dh_file = ${certdir}

Python Pandas groupby assignment of object dtypes -

this python dataframe : df = pd.dataframe({'id': [3553102778, 3553102958, 3553103948, 3553103948, 3553104038, 3553104038, 3553104128, 3553104218, 3557580098], 'based on': ['ctr', 'ctr', 'conv rate', 'ctr', 'conv rate', 'ctr', 'ctr', 'ctr', 'ctr']}, columns=['id', 'based on']) produces dataframe looks this: id based on 0 3553102778 ctr 1 3553102958 ctr 2 3553103948 conv rate 3 3553103948 ctr 4 3553104038 conv rate 5 3553104038 ctr 6 3553104128 ctr 7 3553104218 ctr 8 3557580098 ctr notice how id 3553103948 , 3553104038 have both conv rate , ctr ? how group id assign based on value of conv rate, ctr this? id based on 0 3553102778 ctr 1 3553102958 ctr 2 3553103948 conv rate, ctr 4 3553104038 conv rate, ctr 6 3553104128 ctr 7 3553

java - SonarQube JavaSquid Sensor error with underscore numbering -

we analyzing java project, uses java 7 underscore numbering, getting next error. assume has javasquid sensor. there workaround or update available solve this? error: error during sonar runner execution org.sonar.runner.impl.runnerexception: unable execute sonar @ org.sonar.runner.impl.batchlauncher$1.delegateexecution(batchlauncher.java:91) @ org.sonar.runner.impl.batchlauncher$1.run(batchlauncher.java:75) @ java.security.accesscontroller.doprivileged(native method) @ org.sonar.runner.impl.batchlauncher.doexecute(batchlauncher.java:69) @ org.sonar.runner.impl.batchlauncher.execute(batchlauncher.java:50) @ org.sonar.runner.api.embeddedrunner.doexecute(embeddedrunner.java:102) @ org.sonar.runner.api.runner.execute(runner.java:100) @ org.sonar.runner.main.executetask(main.java:70) @ org.sonar.runner.main.execute(main.java:59) @ org.sonar.runner.main.main(main.java:53) caused by: org.sonar.squidbridge.api

html agility pack - I have code in C# that looks like this that I need to extract the same fields, but I am uncertain how to do it -

in python, have code looks using libxml parser = etree.htmlparser() id = 0 nodes = node.findall(r'.//div[@id="flexbox_flex_calendar_maincal"]//table/tr[@class]') x in nodes: if x.attrib['class'].startswith('calendar'): item = getarow(x, id) newsitems.addrow(item) id = id + 1 id in range(0, newsitems.getlength()): rowdict = newsitems.getrow(id) if rowdict not none: rowitems = qstringlist([rowdict['time'], rowdict['currency'], rowdict['impact'], rowdict['event'], rowdict['actual'], rowdict['forecast'], rowdict['previous']] ) #newsitems[rowdict['time']].append(rowitems) newstable.addrow(rowitems) i have code in c# looks need extract same fields, uncertain how it. whatnodestofind string problematical. using system; using system.text; using system.threa