Posts

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...