Posts

Showing posts from February, 2010

java - JPA OneToOne bidirectional . -

java - JPA OneToOne bidirectional . - i have 2 entity classes in @onetoone relation. illustration code follow: public class { @id private int id; private string name; @joincolumn(name = "b_id", referencedcolumnname = "id") @onetoone(cascade=cascadetype.all) private b b; //setters , getters } public class b { @id private int id; private string name; @onetoone(mappedby="b") private a; //setter , getters } my question here "can utilize seta(a a) method in class b. mean . . em.gettransaction().begin(); aa = new a(); aa.setid(1); aa.setname("jj"); em.persist(aa); b bb = new b(); bb.setid(1); bb.setname("cc"); bb.seta(aa); em.persist(bb); em.gettransaction().commit(); when tried this, foreign_key field in table (b_id) saved null. please help me. here , have specified mappedby in class b above private a; . in bidirectional relationship , mappedby means not owner. means owner of relationship. in table...

linux - Extract string following another string in bash? -

linux - Extract string following another string in bash? - i have next string: [1360308597] service notification: qreda;demo-jms2;outconnectorresponse;notify-service-by-email;critical consumercount=0[1360308817] service notification: qreda;demo-jms2;disk space;critical;notify-service-by-email;disk critical - free space: /data 3018 mb (10% inode=92%): in above string want extract string next demo-jms2 . here demo-jms2 occurs twice. want words next demo-jms2 reply should outconnectorresponse , disk space . what want positive look-behind: $ grep -po '(?<=demo-jms2;)[^;]+' file outconnectorresponse disk space options: -p, --perl-regexp pattern perl regular expression -o, --only-matching show part of line matching pattern explanation: (?<=demo-jms2;) # positive lookbehind: match follow after literal demo-jms2; [^;]+ # match 1 or more non ; characters edit: to filter duplicates results pipe throug...

maps - GoogleMaps API v3 - Trigger event from link in Infowindow -

maps - GoogleMaps API v3 - Trigger event from link in Infowindow - i have listener right-click context menu allows me perform actions specific particular infowindow. instance, here code opens , fills directions panel: google.maps.event.addlistener(contextmenu, 'menu_item_selected', function(latlng, eventname){ switch(eventname){ case 'directions_from_click': showdirections(); geocoder.geocode({latlng: latlng}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { if (results[0]) { faddress = results[0].formatted_address; $('#start').val(faddress); $('#panelwrapper').focus(); } } ...

xna - IntermediateSerializer returning empty arrays -

xna - IntermediateSerializer returning empty arrays - i developing custom editor xna game objects can create graphical editor , unity rip-off style game builder (which going surprisingly well) having issues intermediate serializer acting unusual in relation of entity component objects. i wrote custom deserializer keyboardcomponent follows protected override keyboardcomponent deserialize(intermediatereader input, contentserializerattribute format, keyboardcomponent existinginstance) { keyboardcomponent toreturn = new keyboardcomponent(); input.xml.readstartelement("active"); toreturn.active = input.xml.readstring() == "true" ? true : false; input.xml.readendelement(); input.xml.readtofollowing("keys"); int count = int.parse(input.xml.getattribute("count")); input.xml.readstartelement("keys"); system.diagnostics.debugger.launch(); (int = 0; < co...

java - Is tearDown() supposed to run after each test? -

java - Is tearDown() supposed to run after each test? - i thought teardown() supposed run after each test, see logs is started after setup() method. can guys clarify? public class launchmanageractivitytest extends activityinstrumentationtestcase2<launchmanageractivity> { private solo solo; public launchmanageractivitytest() { super(launchmanageractivity.class); } protected void setup() throws exception { super.setup(); log.e("dev", "setup"); solo = new solo(getinstrumentation(), getactivity()); } protected void teardown() throws exception { super.teardown(); log.e("dev", "teardown "); } output: 02-11 11:33:33.095: e/dev(26779): setup 02-11 11:33:34.395: e/dev(26779): teardown you have no tests in class posted ran setup , teardown. expected behaviour, if had test run: constructor() setup(); testxxx(); teardown(); if had 2 tests ...

Zend Framework 2 Navigation Sub-Sub menu -

Zend Framework 2 Navigation Sub-Sub menu - say have next navigation: home internal folders new folder configuration categories new tags new options new contact external the code used in layout.phtml show menu: $internal = $this->navigation('navigation')->findonebylabel('internal'); echo $this->navigation('navigation') ->menu() ->setulclass('nav nav-list') ->setmaxdepth(1) ->rendermenu($internal); so shows this: folders new folder configuration categories tags options contact at moment i'm getting decent menu, showing parents , first childs, 'new' navigation never showing. however, if i'm on page 'categories' want show childs too, 'new' under 'categories' should showing, following: folders new folder configuration categories ...

javascript - WinJS: Check if is running in debug mode -

javascript - WinJS: Check if is running in debug mode - i need because license information, i'm looking way know if app running in debug or production mode. if app running in debug mode, need utilize windows.applicationmodel.store.currentappsimulator otherwise need utilize windows.applicationmodel.store.currentapp so, i'm looking implementation of function isdebug: var currentapp; if (isdebug()) { currentapp = windows.applicationmodel.store.currentappsimulator; } else { currentapp = windows.applicationmodel.store.currentapp; } any tricks? debug.debuggerenabled tells if debugger attached. note isn't same "it compiled debug" -- since js isn't compiled isn't meaningful indicator. javascript windows-8 winjs

monodroid - How to take picture with MvxPictureChooserTask from mvvmcross vnext? -

monodroid - How to take picture with MvxPictureChooserTask from mvvmcross vnext? - i take image photographic camera , after display on screen. saw post take image mvvmcross monodroid isn't vnext version. (i haven't cirrious.mvvmcross.interfaces.platform.tasks resource) can help me implement feature in application ? using mvvmcross vnext , monodroid the image choosing (camera , library) interfaces moved plugin vnext, need to: reference cirrious.mvvmcross.plugins.picturechooser in viewmodel project reference cirrious.mvvmcross.plugins.picturechooser.droid in droid ui project make sure phone call ensureloaded on picturechooser plugin before utilize it apart that, actual code should work same in master (i think). other perchance helpful links are uploading photo webservice mvvmcross , mono touch issues taking images , showing them mvvmcross on wp need illustration of take image monodroid , mvvmcross https://github.com/redth/wshlst/ - utilize ...

akka - Java stateful actor persistence -

akka - Java stateful actor persistence - i developing application using akka (java api). have few questions: in actor class, okay have few info structures (example: hashmap) part of actor state (attributes of class)? if actor dies, actor restarted supervisory actor. however, wondering how restore contents of these info structures. please suggest? initially, thought of using cassandra persist info , when actor receives messages save fellow member objects cassandra . not sure if right approach. please help thank you, ks have kid actor performs , risky operations, , have actor's supervisor strategy set fit needs child. akka

jQuery UI tabs gets wrong height by heightStyle: "content" if table inside -

jQuery UI tabs gets wrong height by heightStyle: "content" if table inside - i started using jquery ui tabs , want set table within tab. tab should little possible, want height beingness related height of table within , utilize heightstyle: "content". the problem is, when activate tab, slides downwards it's height set correct, when effect of sliding downwards finished, height of tab set 1px. below can see code i'm using. html code: <div id="tab_layer" class="tab_layer_l"> <ul> <li><a href="#content_tab_layer">tab1</a></li> </ul> <div id="content_tab_layer" class="ui-widget"> <table border=1 cellspacing=0 cellpadding=5 align=left> <tr> <td width=50%>...</td> <td width=50%>...</td> </tr> <tr> ...

c++ - Errors in the calculator program -

c++ - Errors in the calculator program - i'm working programme calculate distance between 2 geographical points on earth's surface. im pretty new @ c++ , apologize if english language bad any suggestions on how can content @ programme @ bottom 1 @ top no errors? this programme doesn`t work. #include <iostream> #include <cstdio> #include <cmath> using namespace std; int main () double getdistance(double x1,double y1,double x2,double y2) { const double pi = 3.1415927; double radius, sum; int exit = 1; char choice; while (exit == 1) { cout << "**** calculate programme **** \n\n" << "1. volume\n" << "2. div\n" << "3. calculate 2 geographical points\n" << "4. working\n\n" << "5. quit program\n\n...

javascript - IE10: How to get mouse coordinates on dragover -

javascript - IE10: How to get mouse coordinates on dragover - in ie 10 when event ondragover fired values of attributes clientx, clienty, pagex, pagey, don't seem refreshed when mouse moved. webkit browsers , firefox accurately updates mouse coordinates. simple example: $(document).ready(function () { $('#log').on('dragover', function(e) { $('#log').text(e.originalevent.pagex + " | " + e.originalevent.pagey); }); }); http://jsfiddle.net/kristoffer/kczmg/ is there workaround ie10? i tried pure js, without jquery, had no success. microsoft ie makes our lives not easy. code can give new idea: document.getelementbyid("log").addeventlistener("dragover", test, false); function test(e) { document.getelementbyid("log").innerhtml=e.pagex + " | " + e.pagey; } javascript jquery internet-explorer drag-and-drop

oracle - materialized views that updates every night -

oracle - materialized views that updates every night - want create materialized view updates every night, like: create materialized view my_view refresh finish start (23:00 pm) next 24h select.... any ideas...? create materialized view my_view refresh next sysdate + 1 + (23/24) select * wherever oracle

c# - An entity object cannot be referenced by multiple instances of IEntityChangeTracker even though I detached it -

c# - An entity object cannot be referenced by multiple instances of IEntityChangeTracker even though I detached it - i'm using ef. save entities cache. i detach each entity before putting cache, and attaching new objectcontext after getting cache. i'm using using statement @ high point (in bl class, upon every request) yet error: system.invalidoperationexception: entity object cannot referenced multiple instances of ientitychangetracker. @ system.data.objects.objectcontext.verifycontextforaddorattach(ientitywrapper wrappedentity) @ system.data.objects.objectcontext.attachsingleobject(ientitywrapper wrappedentity, entityset entityset, string argumentname) @ system.data.objects.objectcontext.attachto(string entitysetname, object entity) @ system.data.entity.internal.linq.internalset`1.actonset(action action, entitystate newstate, object entity, string methodname) @ system.data.entity.internal.linq.internalset`1.attach(object entity) @ system.data.entity.dbset`1.a...

swing - jar file not able to oracle driver -

swing - jar file not able to oracle driver - hi have created project, containing swing classes. accessing oracle sql database. when running on eclipse project running fine. butwhen export jar file, error not able find oracle driver class. there no issue code running in eclipse. farther fave added ojdbc jar lib folder classpath in java configuration. have checked exported jar file 7 zip , contains ojdbc driver. swing

jpa - EclipseLink MongoDB @ManyToOne classCastException on very simple example -

jpa - EclipseLink MongoDB @ManyToOne classCastException on very simple example - i trying create eclipselink (2.4.1) on mongodb works expected when having relations. ... i've got entity: @entity @nosql(datatype="account", dataformat=dataformattype.mapped) // datatype -> collectionname, mapped -> because object transformed map in mongodb @table(uniqueconstraints = @uniqueconstraint(columnnames = "email")) public class business relationship extends jpamongobaseentity { @id @field(name="_id") @generatedvalue private string id; @override public string getid() { homecoming id;}; public void setid(string id) { this.id = id;}; // must unique (id fonc) @notnull @size(min = 1, max = 256) @email private string email; ... and : @entity @nosql(datatype="invoice", dataformat=dataformattype.mapped) // datatype -> collectionname, mapped -> because object transformed map in mong...

Facebook : how can we maximize post Count from a particular source_id? -

Facebook : how can we maximize post Count from a particular source_id? - for using fql fetch facebook post particular source_id, fql : select post_id,message stream source_id="21540067693" it giving 20 result. there way maximize no. of post in result ? well solution graph api myself, posting may helpful https://graph.facebook.com/[***page_id***]/posts?access_token=[******]&limit=1000 facebook facebook-graph-api facebook-fql

Is there a way to check index/position in a two dimensional array? for java -

Is there a way to check index/position in a two dimensional array? for java - if build 2 dimensional array such object[][] myarray = new object[5][5]; and used loop traverse array, there way check if current position index? like if(myarray[3][4]) { ..... } like this? for(int = 0; < myarray.length; i++) { object[] row = myarray[i]; for(int j = 0; j < row.length; j++) { object o = row[j]; foo(o); if(i == 3 && j == 4) bar(o); } } but why want on calling bar(myarray[3][4]) after looping? java arrays

java - Reading other process' **unbuffered** output stream -

java - Reading other process' **unbuffered** output stream - i'm programming little gui file converter in java. file converter writes current progress stdout. looks this: flow_1.wav: 28% complete, ratio=0,447 i wanted illustrate in progress bar, i'm reading process' stdout this: processbuilder builder = new processbuilder("..."); builder.redirecterrorstream(true); process proc = builder.start(); inputstream stream = proc.getinputstream(); byte[] b = new byte[32]; int length; while (true) { length = stream.read(b); if (length < 0) break; // processing info } now problem regardless byte array size choose, stream read in chunks of 4 kb. code beingness executed until length = stream.read(b); , blocks quite while. 1 time process generates 4 kb output data, programm gets chunk , works through in 32 byte slices. , waits 1 time again next 4 kb. i tried forcefulness java utilize smaller buffers this: bufferedinputstream strea...

ubuntu - bind / named error -

ubuntu - bind / named error - i got error somehow can't rid of. maybe smbd can help me work out. got plesk 11 running on ubuntu machine. the dns running , working, whenever wanna restart it, next error: root@mach:~# service bind9 restart stopping domain name service... bind9 warning: key file (/etc/bind/rndc.key) exists, using default configuration file (/etc/bind/rndc.conf) named: kein prozess gefunden named: kein prozess gefunden named: kein prozess gefunden [ ok ] starting domain name service... bind9 [ ok ] root@mach:~# do have thought about? tried deleting /etc/bind/rndc.conf, leads dns not starting. you should not remove rndc.conf add together next named.conf: include "/etc/bind/rndc.key"; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; if restart bind error should ...

Perl How to exit from child script which does a telnet? -

Perl How to exit from child script which does a telnet? - i have script executes few commands , telnets machine. need phone call script perl script. $result = `some_script.pl`; the script some_script.pl executes not able exit main script script waits @ telnet prompt. i need capture exit status of script in order create sure some_script.pl executed successfully. i cannot modify some_script.pl. is there way can issue quit after some_script.pl executed successfully? try out, 'magic' close standard in/out/err , may allow programme finish. $result = `some_script.pl >&- 2>&- <&-'; otherwise utilize open2 , expect watch specific string (like done!) in programme output , close when done. http://search.cpan.org/~rgiersig/expect-1.15/expect.pod regards perl telnet exit

mysql - Magento - add an option in Category's Custom Design -

mysql - Magento - add an option in Category's Custom Design - in catalog > manage categories under custom design tab, want add together new field below apply products . upon searching found php file app\code\core\mage\catalog\controllers\categorycontroller.php but cannot find creating tabs custom design , how adding fields. since not thought alter admin panel files, class need inherit create extension adds field in edit category ? i have found loading fields in app\code\core\mage\adminhtml\block\catalog\category\tab\design.php and seems field defined in database catalog_eav_attribute` table , `eav_attribute table i added new field in database no success. how build extension? i found toturial. hope help :) http://www.atwix.com/magento/add-category-attribute/ mysql zend-framework magento-1.7 php

performance - Selectively disabling plugins from loading in Wordpress admin area -

performance - Selectively disabling plugins from loading in Wordpress admin area - does know how disable plugins loading in back-end/admin area of wordpress? currently i'm running site has many plugins geared towards front-end manipulation yet when access pages in backend (ie. /wp-admin/edit.php) all css, js , plugin files beingness loaded plugins not required there, increasing load-time , responsiveness of admin area. i'm looking solution, either plugin based code can selectively load admin plugins, ideally without having hack core files. i'm using wordpress 3.5.1. checkout plugin organizer. haven't used according it's description, can "selectively disable plugins post type or wordpress managed url". guess disable plugins running on urls contain /wp-admin/ . you can modify plugins themselves. depends how written, can find enqueuing css , js files , wrap in is_admin() statement this: // create sure aren't in admin area if ( !i...

sql - Java: insert accented charachters in mysql -

sql - Java: insert accented charachters in mysql - if have query java: string query="insert user (..., name, ...) values (..., 'à', ...)"; class.forname("com.mysql.jdbc.driver").newinstance(); connection con = drivermanager.getconnection("jdbc:mysql://localhost/spinning?user=root"); preparedstatement prest = con.preparestatement(query); prest.executeupdate(); in db have unusual charachter: diamond question mark inside. is there solution problem? in advance! change connection url following: jdbc:mysql://localhost/spinning?user=root&useunicode=true&characterencoding=utf8 java sql prepared-statement non-ascii-characters

mysql - How to create a new table that takes the average of columns in other tables based on name -

mysql - How to create a new table that takes the average of columns in other tables based on name - create table average_professor select ie.instructor ,sum(ie.instreffective_avg + h.howmuchlearned_avg + ir.instrrespect_avg + iv.instroverall_avg + av.availability_avg)/5 instreffective_average ie bring together howmuchlearned_average h using (instructor) bring together instrrespect_average ir using (instructor) bring together instructoroverall_average iv using (instructor) bring together availability_average av using (instructor) grouping instructor it's giving me error code 1166. if omit "create table professor_average" script runs, yet don't have table created. try naming calculation column: create table average_professor select ie.instructor ,sum(ie.instreffective_avg + h.howmuchlearned_avg + ir.instrrespect_avg + iv.instroverall_avg + av.availability_avg)/5 calculation_value instreffective_average ie br...

node.js - In tropo which link i should give for "What URL powers your app?" option while creating new application with Tropo WebAPI? -

node.js - In tropo which link i should give for "What URL powers your app?" option while creating new application with Tropo WebAPI? - in application need utilize tropo node.js.i installed tropo webapi using npm , added code send sms,make phone call don't know how receive incoming text , call.also don't know how mention url in "what url powers app?" option.because don't have url i'm doing locally. sounds doesn't work locally: https://www.tropo.com/docs/webapi/using_tunnlr_reverse_ssh.htm node.js tropo

amazon ec2 - git not uploading all files -

amazon ec2 - git not uploading all files - i have project big (200mb) , wanted force gitlab server (in amazon ec2) , when force seems fine, when upload reaches 8% force "completes" , in console: counting objects: 464, done. delta compression using 4 threads. compressing objects: 100% (421/421), done. writing objects: 100% (464/464), 15.07 mib | 52 kib/s, done. total 464 (delta 47), reused 0 (delta 0) git@ip:myrepo.git * [new branch] master -> master when seek git force 1 time again get branch master set track remote branch master origin. up-to-date i deleted git repo on server , tried 1 time again happend 1 time again , have no thought why came here. has ever happend 1 of before? i running turnkey gitlab ami amazon aws marketplace on microinstance, if somehow relevant. stopping @ 8% may fine illustration if have few big files business relationship 92% of size. best way check have want on remote server clone repo somewhere el...

ios5 - how to access a variable from another nib file in ios -

ios5 - how to access a variable from another nib file in ios - i have 2 view controller files inputviewcontroller , currencyviewcontroller . want access variable declared in inputview within currencyview . designed in empty application project. you can declare variable globally in appdelegate & can access in both viewcontroller. changes made in variable reflect in both controllers. create variable property of appdelegate.h class eg. @property (strong, nonatomic) nsstring *var; & synthesize in appdelegate.m @synthesize var; declare "appdelegate * appdelegate" in both controllers.h & in controller.m in viewdidload write appdelegate=[[uiapplication sharedapplication]delegate]; variable can accessible using appdelegate.var anywhere in code of both viewcontroller & changes reflected in both. hope work more efficiently need. ios ios5

javascript - How to target div id including all child elements in JQuery -

javascript - How to target div id including all child elements in JQuery - i want click specific div , display div containing kid elements, when clicking outside of div , kid elements, div , kid elements set 'display: none' again. next code not work when clicking on kid elements of displayed div, , results in hiding parent div. how include kid divs within event.target.id == 'menu-container' in next code? <body> <div id = "screen"> <div id = "menu-container"> <li class = "menu-options"> <ul>option-1</ul> <ul>option-2</ul> <ul>option-3</ul> </li> </div> <div id = "bottom-panel"> <div id = "menu-button"> click here menu </div> </div> </div> <body> the jquery...

Reducing binary patterns in Python -

Reducing binary patterns in Python - i've got think interesting problem, programming exercise point of view. i have long list of binary patterns want cut down more compact form nowadays users. notation followed '-' can represent either '1' or '0', ['1011','1010'] represented ['101-'] and ['1100', '1000', '0100', '0000', '1111', '1011', '0111', '0011'] could represented ['--00', '--11'] . note patterns same length (though quite perchance longer 4 bits). expanding patterns trivial, reducing them bit trickier. i've come code accomplishes this, long, slow, , kind of hard read. def reducepatterns(patterns): '''reduce patterns compact dash notation''' newpatterns = [] #reduced patterns matched = [] #indexes string matched x,p1 in enumerate(patterns): #pattern1 if x in matche...

DevExpress DataGrid, LinqDataSource, Row Insertion Issues -

DevExpress DataGrid, LinqDataSource, Row Insertion Issues - here screenshot of problem: http://screencast.com/t/zg2nqwjxyflh i'm trying add together record db via linq using devexpress info grid. when submitting data, error is: linqdatasource 'linqdslocales' has no values insert. check 'values' dictionary contains values. this linqdatasource looks like: <asp:linqdatasource id="linqdslocales" runat="server" contexttypename="mycompany.myobject.datadatacontext" tablename="locales" enableinsert="true" enableupdate="true" enabledelete="true" /> this grid: <dx:aspxgridview id="gridlocales" runat="server" autogeneratecolumns="false" datasourceid="linqdslocales" keyfieldname="localeid"> <columns> <dx:gridviewcommandcolumn showincustomizationform="true" visib...

c++ - SIMD intrinsics - are they usable on gpus? -

c++ - SIMD intrinsics - are they usable on gpus? - i'm wondering if can utilize simd intrinsics in gpu code cuda's kernel or opencl one. possible? no, simd intrinsics tiny wrappers asm code. cpu specific. more them here. generally speking, why whould that? cuda , opencl contain many "functions" "gpu intrinsics" (all of these, example, single-point-math intrinsics gpu) c++ cuda opencl simd

symfony2 - FOS UserBundle error on profile change -

symfony2 - FOS UserBundle error on profile change - i'm using symfony 2.0 fos user bundle , when comes profile alter unusual behavior: in user entity im using fosvalidator this: @fosvalidator\unique(property="usernamecanonical", message="fos_user.username.already_used", groups={"facebook", "profile_username"}) an in profilecontroller the form validated via $form = $this->container->get('form.factory')->create(new profilesimpleformtype(array($field)), $user); $session = $this->container->get("session"); if ($this->container->get('request')->getmethod() == 'post') { $form->bindrequest($this->container->get('request')); if ($form->isvalid()) { $this->container->get('fos_user.user_manager')->updateuser($user); homecoming $this->container->get(...

php - Sum of the columns mysql -

php - Sum of the columns mysql - this question has reply here: sum 2 columns in 2 mysql tables 2 answers i have situation this: - name value ------------- - stuff_1 2 - stuff2 5 - stuff2 3 - stuff_1 4 which mysql query have utilize in order sum these values , this: - name value ------------- - stuff_1 2+4=6 - stuff2 5+3=8 you need this: select name, sum(value) table_name grouping name take @ mysql group by , aggregation functions listed there php mysql sum

recursion - Prolog - making a recursive divisor -

recursion - Prolog - making a recursive divisor - okay, i'm beginner in prolog i'm sorry if can't quite question across i'm struggling: divide_by(x, d, i, r) :- (d > x), 0, r x. divide_by(x, d, i, r) :- x >= d, x_1 x - d, i_1 + 1, divide_by(x_1, d, i_1, r), r x_1. i'm trying write programme take 2 arguments (x , d) , homecoming iterations (i) , remainder (r) can display result of x / d when user enters: divide_by(8,3,i,r). example. when tracing code know wrong because first increment makes equal 0 , count wrong. don't know how declare 0 without resetting every time recurses through loop. (i don't want declare 0 in query) i realised when has finished recursing (when x < d) going set 0 because of base of operations case. would kind plenty show me how can prepare this? you need introduce accumulator , utilize helper predicate, this: divide(_,0,_,_) :- !, fail . % x/0 undefined , can't solved. divide(0,_,0,0) :- ...

templates - Modify how the generated views look like with Spring Roo without manually change each one post-creation? -

templates - Modify how the generated views look like with Spring Roo without manually change each one post-creation? - a simple question. how may alter how spring roo generates it's views not need alter them post-creation? if follow tutorial this, alter layout this. understand have alter manually after view has been generated. if wanted sec view base of operations of generated views instead of first one? need modify source code or there simple way override generating code? possible set 1 base of operations different projects? roo uses tiles (used templating) , jsp tags of stuff, , has built-in theme handling well. believe in tutorial pizza shop, using combination of modifing tiles templates , custom theme. once modify default theme, if memory serves css set in special folder under web-inf, , modify tiles templates, , new pages have roo auto-generate inherit new look-and-feel. templates view spring-roo

function posted to boost::asio::io_service::strand not executed -

function posted to boost::asio::io_service::strand not executed - i using boost::asio in quite complex scenario , experiencing problem method posted boost::asio::io_service::strand object not executed although several worker threads on io_service running , idle. as said, scenario complex, i'm still trying develop reasonably little repro scenario. conditions follows: one io_service running , has work-object assigned it 4 worker threads assigned io_service (called io_service::run on each) several strand objects used post numerous different tasks in of tasks executed via strands, new tasks posted strand the whole scheme works , stable, except 1 situation: when calling destructor of 1 of classes, posts abort handler strand (to initiate aborting in sync other taks) , waits until abort done. every 1 time in while happens, abort handler never executed (destructor called invocation of strand object). i assume problem strand waits executing handler on same thread has b...

java ee - Root Cause of EJB Exceptions. Any clever ways ? -

java ee - Root Cause of EJB Exceptions. Any clever ways ? - is there easy way root(real) cause of ejb exception? if @ stack trace of exception can figure out reason. example, in given illustration below hierarchy ejbexception> rollbackexception> databaseexception. is there way find rather going way downwards ? thank you. javax.ejb.ejbexception: transaction aborted @ com.sun.ejb.containers.basecontainer.completenewtx(basecontainer.java:5142) @ com.sun.ejb.containers.basecontainer.postinvoketx(basecontainer.java:4901) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:2045) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:1994) @ com.sun.ejb.containers.ejblocalobjectinvocationhandler.invoke(ejblocalobjectinvocationhandler.java:222) @ com.sun.ejb.containers.ejblocalobjectinvocationhandlerdelegate.invoke(ejblocalobjectinvocationhandlerdelegate.java:89) @ $proxy631.edit(unknown source) @ edu.ac.xxx....

events - Is this the correct code to track AJAX form submission in Google Analytics? -

This summary is not available. Please click here to view the post.

python: loop with socket.recv() -

python: loop with socket.recv() - do know why loop doesn't break? #!/usr/bin/env python socket import * import os import sys if __name__ == '__main__': host = '127.0.0.1' port = 55554 print 'creating socket' socketproxy = socket(af_inet, sock_stream) print 'bind()' socketproxy.setsockopt(sol_socket, so_reuseaddr, 1) socketproxy.bind((host, port)) print 'waiting connection request' socketproxy.listen(1) conn, addr = socketproxy.accept() print 'connected ', addr request = '' while true: info = conn.recv(16); if not data: break request = request+data print request sys.stdout.flush() i writing little server-proxy getting requests can arbitrary long must wait until have received request. anyway loop (when len(data) == 0) doesn't stop , keeps on waiting. how can stop it? thanks one solution create socket non-blocking. receive in loop until no more info received. if no i...

windows - GetEnvironmentVariable("CSIDL_COMMON_APPDATA") returns null -

windows - GetEnvironmentVariable("CSIDL_COMMON_APPDATA") returns null - i'm trying environmentvariable "csidl_common_appdata" using below statement system.environment.getenvironmentvariable("csidl_common_appdata"); i expected "c:\programdata\" back. null i'm running c# programme on windows 7 32 bit machine. please help. you one thousand miles away doing correctly. not environment variable, constant pass shgetfolderpath() winapi function. write kind of code in native language. in c#, utilize environment.getfolderpath() instead: string path = environment.getfolderpath(environment.specialfolder.commonapplicationdata); console.writeline(path); output: c:\programdata windows c#-4.0 windows-7

debugging - In Ruby, why aren't variable names in the stack trace? -

debugging - In Ruby, why aren't variable names in the stack trace? - in rails app associations (such post belongs_to user ), mutual exception this: nomethoderror: undefined method `user' nil:nilclass ubiquitously, causes beginners believe user nil. why don't have more intuitive errors, such following? nomethoderror: `@post' nil:nilclass , doesn't have method `user' edit: why beingness downvoted? question legitimate. i'd know if there technical reason preventing this. first of all, disagree original assertion. message says user undefined method, not variable or value. i'm not sure how think user variable based on message. however reply question time "user" method called, target object has been loaded whatever variable referenced it. phone call logic invoking "user" doesn't know object came from. have been local variable, instance variable, constant...there's no way tell. also, rails "whiny n...

javascript - regex literal pattern match with multiple words -

javascript - regex literal pattern match with multiple words - trying match literal word negative (just itself) but regex matching on these: negative negative dilute how not have not match @ when phrase negative dilute or other phrase besides negative this in jquery , regex far this: /\bnegative\b/i any help appreciated. ^negative$ this match negative , , not match if there before or after it. basically, if string contains phrase , nil else. here's site explain regex , others input: http://www.regex101.com/r/ia7fy5 javascript jquery regex

c++ - Why does Google name accessors and mutators after member variables? -

c++ - Why does Google name accessors and mutators after member variables? - http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=function_names#function_names regular functions have mixed case; accessors , mutators match name of variable: myexcitingfunction(), myexcitingmethod(), my_exciting_member_variable(), set_my_exciting_member_variable(). isn't whole point of encapsulation hide implementation details user he/she not aware of whether accessor/mutator method returns/modifies fellow member variable or not? if alter variable name or alter way it's stored within object? edit: if have instance variable int foo_ seems straightforward int foo() const { homecoming foo_; } but if add together method returns foo_ + 2 , should name if bar or getbar ? int bar() const { homecoming foo_ + 2; } int getbar() const { homecoming foo_ + 2; } if take getbar , later decide cache returned value in fellow member variable bar_ , have...

scala - Spray.io directive not registering? -

scala - Spray.io directive not registering? - i want access path users/{id}/permission via spray route using post method. reason (and i've tried different configurations) doesn't register route , 405 method not allowed . the code below part of pathprefix "users". works, post not. path(rest / "permission") { id => /** * save permissions object user */ post { entity(as[string]) { body => seek { val uperm = parse[userpermission](body) userpermission.store(uperm) respondwithmediatype(`application/json`) { finish { generate(uperm) } } } grab { case e: com.codahale.jerkson.parsingexception => finish { httpresponse(badrequest, "submitted malformed data.") } }...

c# check if event is null -

c# check if event is null - i have event in webservice: public event findproductsbycharacteristicscompletedeventhandler findproductsbycharacteristicscompleted { [methodimpl(methodimploptions.synchronized)] add together { _findproductsbycharacteristicscompleted += value; } [methodimpl(methodimploptions.synchronized)] remove { _findproductsbycharacteristicscompleted -= value; } } and im checking if event value null later in class: private void onfindproductsbycharacteristicsoperationcompleted(object arg) { var handler = _findproductsbycharacteristicscompleted; if (handler == null) return; handler(this, new findproductsbycharacteristicscompletedeventargs(completedeventargs.results, completedeventargs.error, completedeventargs.cancelled, completedeventargs.userstate)); } your event implementation looks endless recursion. using pr...

dynamic attribute for a rails model -

dynamic attribute for a rails model - i'm wondering best way accomplish want :p i have model 'modela' has many 'modelarate'. modelarate contains comment or rate (or both). i don't want calculate average rate each time modela shown. because it's not cool database (accessing modelarate , getting rate ...) need know lowest , highest rate. how best way accomplish in rails ? (without using gem, need understand how works) i thinking of adding attribute rate_score in modela increasing when modelarate created, , method homecoming rate_score / modelarates.size lowest , highest rate, attribute ? there no mechanism can me in rails ? thanks help you can utilize calculation method on rails http://api.rubyonrails.org/classes/activerecord/calculations.html for models, given modela record, can maximum = model_a.model_a_rates.maximum(:rate) minimum = model_a.model_a_rates.minimum(:rate) average = model_a.model_a_rates.average(:rate) all of t...

java - Using a single JFrame across multiple classes -

java - Using a single JFrame across multiple classes - i working on video game in java far has main menu class , class game. have set right now, each class uses own jframe, means when user clicks "start game", main menu jframe closes , games jframe opens. not ideal , have both classes utilize same jframe, don't know how go , net searches have not been helpful. the class main menu is: public class frame extends javax.swing.jframe { ... } i have set right game class imports frame class, when seek create jframe display elements game nil comes up. question is: how utilize 1 single jframe across multiple classes? any help much appreciated! rather needing pass reference of main frame each of kid panels, might expose parts of programme don't want them have access (as example), should utilize cardlayout , utilize main frame main display hub, switching out panels need to check out how utilize cardlayout more examples java swing user-int...

java - Overriding a method in a subclass while retaining the contents of the superclass method -

java - Overriding a method in a subclass while retaining the contents of the superclass method - in java, there way override superclass method in subclass while retaining contents of superclass method? this: class person { public void update(){ statement 1; statement 2; } } class pupil extends person { @override public void update(){ super().update(); statement 3; statement 4; } } such calling update() on pupil cause statements 1, 2, 3 , 4 executed? place super.update() in origin of subclass method. java

oracle - How to update record which is duplicated PL/SQL in procedure -

oracle - How to update record which is duplicated PL/SQL in procedure - i have table called sales_staff_08 , firstname, surname, username 3 cols. username concatenated using firstname , surname. because might duplicated. hence want avoid adding number. current table username ---------- johsmith1 tomnguye1 steredmo1 bobjohn1 carjones1 dancreig1 steredmo1 tomnguye1 i want update record duplicated, should shown this: username ---------- johsmith1 tomnguye1 steredmo1 bobjohn1 carjones1 dancreig1 steredmo2 tomnguye2 my first effort update records create or replace procedure proc_concate_names vc_username varchar(25); v_number number (2) := 1; cursor cur_concate_username select firstname, surname, username sales_staff_08; begin rec_cur_concate in cur_concate_username loop vc_username := rec_cur_concate.firstname || rec_cur_concate.surname || v_number; update sales_staff_08 ss set username = vc_username ss.username ...

pmd eclipse jdk compatibility -

pmd eclipse jdk compatibility - i have installed version 3.2.6.v200903300643 of pmd plug-in eclipse (which version 3.7.*). when seek run generate abstract syntax tree, next error pmd exception : net.sourceforge.pmd.ast.parseexception: can't utilize static imports when running in jdk 1.4 mode my question is: how can configure jdk compatibility mode pmd running in when used through eclipse ? i can't find configuration options in properties overview. regards esben most need configure maven-pmd-plugin utilize right targetjdk alternative value. not explicitly if alternative defaults 1.4 , seems so. eclipse-plugin pmd

Turing Machine - Generate number sequences -

Turing Machine - Generate number sequences - http://morphett.info/turing/turing.html how create looping number sequence such as: 01011011101111011111... so adding zero, adding 1, zero, 1 on top of previous number of ones. write 01 on tape. move 1 space right. if you're looking @ zero, scan left until see zero. move 1 space right. if you're looking @ one, replace 2 , move right until see zero; maintain moving right until zero. replace 0 one. then, move until see two. replace 2 one. move 1 right; if you're looking @ one, repeat process of replacing 2 , again. eventually, you'll exhaust previous supply of 1s, you're looking @ 0 when move 1 right. in case, move right next zero, , replace one. loop on entire process (minus "write 01 part) longer strings of ones. the intuition behind straightforward. if move right , see zero, move 2 zeroes left, re-create one's between lastly , second-to-last 0 after 0 found, , add together 1 more one. 2...

java - NumberFormat.getCurrencyInstance(); Failure -

java - NumberFormat.getCurrencyInstance(); Failure - i'm trying parse currency string bigdecimal using numberformat.getcurrencyinstance(); the next scenario $1,000.01 pass 1000.01 pass 1,000.01 fail -> needs parsed 1000.01 in order pass. abc fail -> right behavior. my method public bigdecimal parseclient(field field, string clientvalue, string message) throws validationexception { if (clientvalue == null) { homecoming null; } numberformat nf = numberformat.getcurrencyinstance(); seek { homecoming new bigdecimal(nf.parse(clientvalue).tostring()); } grab (parseexception ex) { throw new validationexception(message); } } anybody know of solution work properly? it brute force, why not check presence of currency characters @ origin of string, , if not there, prepend it? if ( !clientvalue.startswith( "$" ) ) { clientvalue = "$" + clien...

swing - GUI based java calculator: Adding window to a container exception -

swing - GUI based java calculator: Adding window to a container exception - this question has reply here: exception : adding window container how solve it? 3 answers i'm working on java swing gui-based calculator. i'm having problem running code test did far. when compile it, returns next exception. exception in thread "main" java.lang.illegalargumentexception: adding window container @ java.awt.container.checknotawindow(container.java:429) @ java.awt.container.addimpl(container.java:1037) @ javax.swing.jlayeredpane.addimpl(jlayeredpane.java:212) @ java.awt.container.add(container.java:925) @ javax.swing.jrootpane.setcontentpane(jrootpane.java:608) @ javax.swing.jframe.setcontentpane(jframe.java:671) @ calculator_project.calculator_project.main(calculator_project.java:184) java result: 1 build successful (total time: 4...