Posts

Showing posts from May, 2011

spring - java.lang.IllegalArgumentException: The 'original' message argument cannot be null -

i'm trying send email using spring. @ code: public class provider { private mailsender mailsender; private simplemailmessage message; public void setmailsender(mailsender mailsender) { this.mailsender = mailsender; } public void setmessage(simplemailmessage message) { this.message = message; } public static string gettemplatename() { return "mainlayout/layout.jsp"; } public void placeorder() { // ... * business calculations.... // ... * call collaborators persist order // create thread safe "sandbox" of message simplemailmessage msg = new simplemailmessage(this.message); msg.setto("babobka@bk.ru"); msg.settext("hello"); try { mailsender.send(msg); } catch (mailexception ex) { // log , go on system.err.println(ex.getmessage()); } } } don't know why it...

Use 2 legged in Google API v3 for python -

i have code describe here. need create lot of events in calendar. i cannot find way make work. using 2 legged seems deprecated import sys import httplib2 rfc3339 import rfc3339 apiclient.discovery import build oauth2client.file import storage oauth2client.client import accesstokenrefresherror oauth2client.client import flow_from_clientsecrets oauth2client.tools import run import pytz import datetime import time start_zone = pytz.timezone('europe/london') end_zone = pytz.timezone('europe/oslo') start_time = datetime.datetime(2013,8,13,15,0, tzinfo=start_zone) end_time = datetime.datetime(2013,8,16,19,0, tzinfo=end_zone) flow = flow_from_clientsecrets('client_secrets.json', scope='https://www.googleapis.com/auth/calendar', redirect_uri='http://localhost') storage = storage('credentials.dat') credentials = storage.get() if credentials none or credentials.invalid: credentials = run(flow, storage) http = httplib2.http()...

html - margin-left and margin-right for Setting Center position -

i want set center .user-menu position, code below isn't working. how can solve this? html <body> <div class="user-menu"> <div class="menu-items"> <div class="bought-tickects centered hover-effect"></div> <label>تاریخچه خرید</label> </div> <div class="menu-items"> <div class="profile centered hover-effect"></div> <label>حساب کاربری</label> </div> <div class=""></div> </div> <div class="clear"></div> <div class="container-of-selected"> </div> </body> css * { margin: 0px; padding: 0px; font-family: tahoma; } .centered { margin-left: auto; margin-right: auto; } .menu-items { float: left; height: 90px; margin-left: 10px; m...

android - Setting data of EditText not working -

i trying set text of edittext via listview. once user chooses product listview, go activity holds edittext, , change text within edittext. i relatively new android , java, excuse me being absolute nub. list java: final listview listviewcpu = (listview) findviewbyid(r.id.listviewcpu); listviewcpu.setchoicemode(listview.choice_mode_single); string cpulist[] = { "products go here", "products go here", "products go here", "products go here", "products go here", "products go here" }; arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, cpulist); listviewcpu.setadapter(adapter); listviewcpu.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> listview, view myview, int pos, long mylng) { string cpu = (string) listview.get...

ruby on rails - Use assets from gem in production mode -

i trying figure out how boostrap-sass working in production mode. using apache reverse proxy either webrick or puma, serve static assets in public/assets directly. when precompile assets, bootstrap css gets included application-(hash).css , works correctly. however compiled css references image file (glyphicons-halfling.png) without appending hash of file contents. image file included in public/assets directory, , possible browse putting correct filename in address bar, filename in css not match it. have created simple demo app demonstrates problem, code on github page the glyphicon filename glyphicons-halflings-c806376f05e4ccabe2c5315a8e95667c.png [edit] would still answer question, i've renamed offending files remove hash. since these files unlikely change should work fine think have cracked, when run rake assets:precompile, seems must prefix rails_env=production in order work in production mode (i guess kind of makes sense). if don't, of assets precompil...

erlang - how can I send a param into websock connection using cowboy -

in cowboy websocket example in toppage_handler.erl handle(req, state) -> {echo, req2} = cowboy_req:qs_val(<<"echo">>, req), {ok, req, state}. i want param echo following function for example: localhost:8080/?echo=123 in ws_handler.erl websocket_init(_transportname, req, _opts) -> %%how can use echo(123) here? erlang:start_timer(1000, self(), <<"hello!">>), {ok, req, undefined_state}. a simple workaround use path bindings : in routes : dispatch = cowboy_router:compile([ %% {hostmatch, list({pathmatch, handler, opts})} {'_', [{"/echo/:echo", my_handler, []}]} ]), then in code : {echo, req2} = cowboy_req(echo,req) it's best in websocket_handle because able send response socket. in init, have carry in state, : websocket_init(_transportname, req, _opts) -> {echo, req2} = cowboy_req:binding(echo,req), erlang:start_time...

java - unable to connect to Mongodb using HibernateOGM -

Image
i want use hibernateogm interact mongodb. have cfg.xml file this: <hibernate-configuration> <session-factory> <property name="hibernate.transaction.factory_class">org.transaction.jdbctransactionfactory</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.ogm.datastore.provider">mongodb</property> <property name="hibernate.ogm.datastore.grid_dialect">org.hibernate.ogm.dialect.mongodbdialect</property> <property name="hibernate.ogm.mongodb.database">rcfdb</property> <property name="hibernate.ogm.mongodb.host">127.0.0.1</property> <property name="hibernate.ogm.mongodb.port">27017</property> <property name="hibernate.connection.provider_class">org.hibernate.connection.c3p0connectionprovider</pr...

c# - Update two progressbar in same time -

i have auto-upload application ftp server , 2 progressbar's update overall , current download state. first 1 works fine (update% = currentfile int / allfilestodownload *100%). i'd upload current file downloading. code: uri url = new uri(surltodnldfile); int inde = files.tolist().indexof(file); string subpath = ... bool isexists = system.io.directory.exists(subpath); if (!isexists) system.io.directory.createdirectory(subpath); sfilesavepath = ... system.net.ftpwebrequest request = (ftpwebrequest)ftpwebrequest.create(new uri(file)); system.net.ftpwebresponse response = (system.net.ftpwebresponse)request.getresponse(); response.close(); long isize = response.contentlength; long irunningbytetotal = 0; webclient client = new webclient...

Emacs Evil mode: how to create a new text object to select words with any non-space characters? -

i trying create new text object in evil. example, text object iw select subsets of strings containing hyphens. want new text object match words non-space characters. got far is: (evil-define-text-object evil-inner-space (count &optional beg end type) "select inner space." :extend-selection nil (evil-regexp-range count beg end type "[ \n]" " " t)) (define-key evil-inner-text-objects-map " " 'evil-inner-space) this code fails correctly match words @ end of line. works words @ beginning of line \n. i tried many things did not work. trouble me when not work, don't know if due wrong regexp or limitations in evil-regexp-range. example, using \s- reports error, seems limitation in evil. update : evil-regexp-range replaced evil-select-paren . works on current evil , has same usage old one: (defmacro define-and-bind-text-object (key start-regex end-regex) (let ((inner-name (make-symbol "inner-name")) ...

Cannot read property 'features' of undefined when use Ext.ux.touch.grid -

when use ext.ux.touch.grid,an error happened? "cannot read property 'features' of undefined " but happen when use this, this.testgrid = ext.create('geo.view.grid'); in file application.js,a main controller file config: { refs: { main: 'mainview', worklist: 'worklist', testgrid: 'testgrid' }, this testgrid view file ext.define('geo.view.grid', { extend : 'ext.ux.touch.grid.list', xtype : 'testgrid', requires : [ 'ext.ux.touch.grid.feature.feature', 'ext.ux.touch.grid.feature.editable', 'ext.ux.touch.grid.feature.sorter', 'ext.field.number', 'geo.store.grid' ], config : { title : 'grid', store : true, columns : [ { header : 'text', dataindex : 'text', ...

Simplify jQuery code showing/hiding form fields -

i need show selects in form or hide them depending on previous selected option. think code simple, here javascript: $(document).ready(function() { $('#a2').hide(); $('#a3').hide(); $('#a5').hide(); $('#a6').hide(); //a8, a9, a11... $('#a1').change(function(){ if($(this).val() == "1"){ $('#a2').show(); $('#a2').focus(); } else $('#a2').hide(); }); $('#a2').change(function(){ if($(this).val() == "1"){ $('#a3').show(); $('#a3').focus(); } else $('#a3').hide(); }); //the same a4, a5, a7... }); and here portion of html: <select name="a1" id="a1"> <option selected="selected">¿conoce?</option> <option value="1">sí</option> <option value="0"...

c# - How to scroll through each Datagrid Item on button click wpf -

i have datagrid , 2 , down buttons user can scroll through each datagrid item on button click; either or down. how go doing this? have tried selectedindex doesn't seem work datagrid . examplecode: private void btndowncheckedmedication_click(object sender, routedeventargs e) { if (medicationcheckedindatagrid.selectedindex > 0) { medicationcheckedindatagrid.selectedindex = medicationcheckedindatagrid.selectedindex - 1; } } private void btnupcheckedmedication_click(object sender, routedeventargs e) { medicationcheckedindatagrid.selectedindex = medicationcheckedindatagrid.selectedindex + 1; } you had it... use selecteditem instead: private void btndowncheckedmedication_click( object sender, routedeventargs e ) { if(datagrid.selectedindex > 0 ) { datagrid.selecteditem = datagrid.items[datagrid.selectedindex - 1]; } } private void btnupcheckedmedication_click( object sender,...

c++ - Data member and rvalue life-time -

somehow inspired expression template code in expression templates , c++11 , written paul preney, decided test following: template<typename t> struct x { x(t t) : t(std::forward<t>(t)) {} t t; }; template<typename t> auto createx(t&& t) -> x<decltype(std::forward<t>(t))> { return x<decltype(std::forward<t>(t))>(std::forward<t>(t)); } then, used produce instance of x<const vector<int>&> , x<vector<int>&&> follows: int main() { int vec = {1,2,3,4}; auto x1 = createx(vec); auto x2 = createx(vector<int>{5,6,7,8}); cout << "x1: "; for(auto x : x1.t) cout << x << " "; cout << endl; cout << "x2: "; for(auto x : x2.t) cout << x << " "; cout << endl; } the output is: x1: 1 2 3 4 x2: 0 0 33 0 0 0 7 8 which shows life-time of temporary vector<int>{5,6...

c++ - UDP Cannot Assign Requested Address -

i want open datagramsocket , send packets network device. when use following cood exception thrown saying: cannot assign requested address: 192.168.1.114:1900 poco::net::socketaddress sa("192.168.1.114",1900); poco::net::datagramsocket dgs(sa); std::string text = "hello"; dgs.sendbytes(text.data(),text.size()); what's problem here. use udp testing software test receiving end if it's capable receive udp packets on port , works, poco code above not work. kind regards i don't know poco must bind local address , port, sendto send packet from local address:port remote address , port.

c++ - How to get the date and time from the internet using MFC -

i trying build application tryout, , need download date , time site time.windows.com , application stop working after several days. thought getting local date , time user set in windows, don't think that's reliable. thought using classes csocket , csocketfile , that, not sure. can superheroes please tell me how download information time.microsoft.com ?

c# - Graphics.DrawImage unexpectedly resizing image -

Image
i've got code takes png greyscale image transparency , attempts create new image has given background colour (looked database) , overlays original image on create image of required colour highlights , shading. code run in asp.net context don't think relevant. the code works fine on local computer when deployed our uat server gives unexpected results. on uat creates image of right size shaded/highlighted area seems have been shrunk in each dimension 20%. main image looking @ 5x29 , output image 5x29 shaded area 4x23.2 (the 24th row different background colour assumed doing interpolation resize). my code failing follows: private byte[] getimagedata(cachekey key) { byte[] imagedata; using (image image = image.fromfile(key.filepath)) using (bitmap newimage = new bitmap(image.width, image.height)) { using (graphics graphic = graphics.fromimage(newimage)) { using (solidbrush brush = new solidbrush(colortranslator.fromhtml(key.back...

osgi - Can't get reference of ConfigurationAdmin in RAP -

i'm trying configure osgi-jax-rs-connector in rap application. the readme says use configuration admin service configuration. servicereference caref = context .getservicereference(configurationadmin.class.getname()); the code above returns null servicereference . what's correct way obtain reference configurationadmin. bundle needs started before? if run equinox please make sure config admin bundle (org.eclipse.equinox.cm) installed , started.

extjs - How to apply template to ItemSelector -

i using ext.ux.form.itemselector in application. want apply conditional xtemplate display list. using ext js 4.2 please me you should able specify itemtpl within listconfig option. http://docs.sencha.com/extjs/4.2.1/#!/api/ext.ux.form.multiselect-cfg-listconfig

oop - Difference between JavaScript methods structure -

what difference between method structures/callings? see different method structures , can not understand benefits of each are. var obj = { some_method: function(){ return 'this works'; } } var obj2 = function(){ return { some_method: function(){ return 'this works too'; } } } console.log(obj.some_method()); var obj3 = new obj2(); console.log(obj3.some_method()); both of them return should, here's jsfiddle , in case should use each of them? the first 1 resembles singleton , i.e. cannot have multiple objects of same type distinct state. it's possible have 1 actual animal in entire application instead of many. a more practical example, consider page. there multiple post s, each own state (what comment s have, text have, being edited , on). if did var post = means there can 1 post. suspect have ad-hoc jquery manipulate multiple posts in singleton not doing object oriented modeling of proble...

JBOSS ESB(Jboss developer studio) -

in jboss developer studio while creating esb project getting following error java.lang.noclassdeffounderror: org/jboss/tools/esb/core/runtime/jbossruntimemanager @ org.jboss.tools.esb.project.ui.preference.controls.jbossesbruntimepreferencepage.<init>(jbossesbruntimepreferencepage.java:43) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:57) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:525) @ java.lang.class.newinstance0(class.java:372) @ java.lang.class.newinstance(class.java:325) @ org.eclipse.core.internal.registry.osgi.registrystrategyosgi.createexecutableextension(registrystrategyosgi.java:184) @ org.eclipse.core.internal.registry.extensionregistry.createexecutableextension(extensionregistry.java:90...

c++ - how to release struct pointer elements after push_back into the vector -

hi every 1 having issue insertion of struct stuct vector... please see following codes struct stline { double** ptrroadcords; int isize; }; //i having struc , vector is std::vector<stline> m_vecstline; //i creating temp struct stline line; line.ptrroadcords = new double*[cnt]; ( int = 1; < cnt-1; i++ ) { line.ptrroadcords[i-1] = new double[2]; line.ptrroadcords[i-1][0] = ptrcords[i-1][0]; line.ptrroadcords[i-1][1] = ptrcords[i-1][1]; } m_vecstline.push_back(line); //so working perfect causing meomory leaks //so put releasing code if (line.ptrroadcords != null) { (int = 0; < cnt-2; i++) { delete[]line.ptrroadcords[i]; } if(line.ptrroadcords) delete[]line.ptrroadcords; } but because of application crashes because clears vector element because inserting refernce please me resolve issue thank u in advance

c - How do i count the number of elements on a given line of a file? -

something along line of: int n = sscanf(%s %s ... it save how many string element on given line in int n, the file can contain many lines each line having many elements e.g. efefefef efefef dfefe fefef eef efef efef efefef efefef efefef efefe efeefef [wdfefefef] first line n = 2 ; second line n = 6 also how should remove brackets strings thr string inside bracket? regards presuming 'element' mean word, best bet use strtok , pass appropriate list of terminators (which include space, '[', ']', etc.

datetime - How to get the total hr from start time to end time using 12 Hour Format in php -

how can total hour 2 given time "hh:mm:ss" format? here code: $start = 01:00:00 pm; $end = 02:00:00 pm; expected output: $total = 1; you can try this: $start = new datetime('01:00:00 pm'); $end = new datetime('02:00:00 pm'); $diff = $start->diff($end); echo $diff->format('%h'); you can more info: http://in1.php.net/manual/en/datetime.diff.php

python - Multiprocessing incompatible with NumPy -

this question has answer here: why multiprocessing use single core after import numpy? 3 answers i trying run simple test using multiprocessing. test works until import numpy (even though not used in program). here code: from multiprocessing import pool import time import numpy np #this problematic line def costlyfunc(n): """""" tstart = time.time() x = 0 in xrange(n): j in xrange(n): if % 2: x += 2 else: x -= 2 print "costlyfunc : elapsed time %f s" % (time.time() - tstart) return x #serial application resultlist0 = [] starttime = time.time() in xrange(3): resultlist0.append(costlyfunc(5000)) print "elapsed time (serial) : ", time.time() - starttime #multiprocessing application starttime = time.time() pool = pool() asyncresult = pool.map_async(...

Clear firefox cache quicker -

i make changes js clear out cache doing cmd + shift + space (on mac) , select want clear out cache , leave cookies etc alone. i wondering there faster way clear out cache. any firefox plugin in 1 click or 1 button? thanks ctrl f5: refresh page clearing cache. reloads images, css, js , swf

package - Update multiple dependencies with Bower -

i listed (and/or installed) several dependencies bower inside bower.json file and/or bower install https://github.com/username/project.git that worked fine. now can list them with bower list and can pick name of each dependency of project , run bower update dependency-name question: how can bulk update of them? or have write shell script loop through , update them? you can update running bower update . use -h flag on command see how can use it. eg bower update -h .

Printing different than on page with JavaScript -

i've been printing images using standard window.print() function. i'm dealing image when printed, doesn't print correctly on 1 page(takes 2 pages no matter how small make image). put image in .pdf can format print size , orientation need, have no clue how make .pdf print without new popup window. there solutions out there, perhaps image size accomplish printing image onto 1 8 1/2 x 11 inch page? i've googled no luck, i'm kind of new, maybe i'm searching incorrectly.

loops - How to calculate a sum of sequence of numbers in Prolog -

the task calculate sum of natural numbers 0 m. wrote following code using swi-prolog: my_sum(from, to, _) :- > to, !. my_sum(from, to, s) :- = 0, next 1, s 1, my_sum(next, to, s). my_sum(from, to, s) :- > 0, next + 1, s s + next, my_sum(next, to, s). but when try calculate: my_sum(0,10,s), writeln(s). i got false instead of correct number. going wrong example? this surely false next \= 0: s s + next . more fundamental problem you're doing computation in 'reverse' order. is, when from > to , program stop, don't 'get back' result. should add accumulator (another parameter, propagated recursive calls) , unify partial sum @ last step... anyway, should simpler: my_sum(from, to, s) :- < to, next + 1, my_sum(next, to, t), s t + from. my_sum(n, n, n). | ?- my_sum(2, 4, n). n = 9

Opening a xml file from eclipse and from a .jar file in java -

yesterday, had problem because couldn't manage open xml file (it owuld give me filenotfoundexception) located in ressources folder of .jar file, managed open on eclipse using following lines of code. can see old problem here . code problem : file xmlfile = new file("ressources/emitter.xml"); configurableemitter emitter = particleio.loademitter(xmlfile); someone told me 1 way use getclassloader().getressourceasstream method open xml file in .jar file exported inputstream i= this.getclass().getclassloader().getresourceasstream("ressources/emitter.xml"); configurableemitter emitter = particleio.loademitter(i); unfortunately, solution works when export project .jar file, if want go debugging program, have take old code works on eclipse. my question is: there better way without having change code if want export or if want debug it? thank you edit : thank all, works fine problem put ressources folder : +project +src +ressources +emitter....

Accessing attributes of Chef::Provider::Package subclass instance from recipe -

i need somehow "return" variable custom subclass of chef::provider::package recipe called from, can use variable later in same recipe. i tried add custom chef::resource::package subclass attribute , appropriate setter/getter wrapper set_or_return function. can write , read attribute chef::provider::package subclass, when try access attribute recipe see nil value. can illustrated following recipe: a = apt_package "bzip2" action :install end # won't work, a.version nil log "bzip package version #{a.version}" however, can see in lib/chef/provider/package/apt.rb @current_resource.version being set: @current_resource.version(installed_version) what right way of reading arbitrary attribute ( version in example) of chef::resource::aptpackage instance, created apt_package provider same recipe? maybe like:: a = apt_package "bzip2" action :install end ruby_block "init logger" ...

matlab - Using MNIST DATABASE for digits recognition. -

i trying use mnist database in order recognize hand written digits. have far binary matrix represents digit , algorithm written in matlab . love on getting started using mnist database recognize digit binary image. thanks. if using matlab , have binary images need to: 1) extract features images (you have many choices). example, can start using raw pixels ==> convert each image matrix row vector. (use part of data training , rest testing) create feature matrix these row vectors. each row "instance" in feature matrix. 2) can select , try different classifiers. try example, svm (support vector machine). basic way using svmtrain , svmclassify functions. usage simple , explained in matlab's help. 3)test different partitions of data. 4)experiment other features , classifiers.

c++ - Restriction of access to function -

this question has answer here: std::enable_if conditionally compile member function 6 answers i have generic class function want restrict instances of floating point types only, @ compile time. shown in example below: template <typename t> class classname { // instance variables, etc.. void some_method() { // stuff, floating point types } } how make compiler reject usage of some_method classname of non-floating point types? i have been looking @ sfinae can't work, after several hours of failing i'm asking help. thanks :) you can use combination of std::is_floating_point , std::enable_if enable function floating point types: #include <type_traits> template <typename t> class classname { // instance variables, etc.. public: template<typename t2 = t, typename = typename std::en...

html - Hovering images main menu -

Image
this when hover title , can see there little white arrow, when go on subtitle image disappears. #menu { float: left; height: 58px; width: 100%; margin-top: 30px; } #menu .menu_layer { float: left; height: 58px; width: 100%; filter: alpha(opacity = 50); -moz-opacity: 0.5; opacity: 0.5; border-top: #d8d6d2 1px solid; border-bottom: #f5f3f0 1px solid; background: #ffffff; z-index: 99; } #menu .menu_list { position: absolute; width: 100%; height: auto; z-index: 9999; } #menu .menu_list .egnav_menu_box { width: 940px; height: 60px; margin: 0 auto; } #menu .egnav_menu_box .egmenulevel_0 { float: left; position: relative; display: block; z-index: 99999; } #menu .egnav_menu_box .egmenulevel_0 { display: block; line-height: 60px; font-size: 14px; float: left; margin-left: 48px; font-family: "open_sanslight"; font-size: 16px; color: #666666; } #...

delphi - Deploying Custom Units and Components -

when has come redoing or reinstalling delphi, i've run hassle. when comes components , units i've produced use in projects, run having go through entire backup of projects find things i've used in other projects , copy units over, install components through delphi interface, , make sure present. then, forget , when pull out project uses 1 of these units or components, have stop whatever i'm doing, find backup disk, find data install, before continue... main question: has come solve scenario automating of this? otherwise, people here when comes administration of delphi in way? some tips: when possible, avoid installation of components , create instances @ run time. reduce time install them in ide. example, non-visual components not have installed design mode. use build tool apache ant compile projects build script. build script serves documentation of environment , source path requirements. when run build on new computer, need check ant build scrip...

java - When inserting objects into a type-safe heterogeneous container, why do we need the class reference? -

i'm checking out heterogeneous container pattern bloch's effective java , i'm trying determine why class reference needed when inserting objects heterogeneous container. can't use instance.getclass() reference? isn't jpa's entity manager example of this? interface blochsheterogeneouscontainer { <t> void put(class<t> clazz, t instance); <t> t get(class<t> clazz); } interface alternativeheterogeneouscontainer { // class<t> not needed because can use instance.getclass() <t> void put(t instance); <t> t get(class<t> clazz); } no can't that, won't give class of reference type in case of inheritance, rather class of actual object type. consider example: number num = new integer(4); system.out.println(num.getclass()); this print: class java.lang.integer and not java.lang.number .

sql - Select multiple columns into multiple variables -

how can in one select multiple columns , put each column in variable? something this: --code here v_date1 t1.date1%type; v_date2 t1.date2%type; v_date3 t1.date3%type; select t1.date1 v_date1, t1.date2 v_date2, t1.date3 v_date3 t1 id='x'; --code here any help? ty your query should be select t1.date1, t1.date2, t1.date3 v_date1, v_date2, v_date3 t1 id='x'; share , enjoy.

Session management across J2EE app and CQ in tomcat server -

my j2ee app running in tomcat server , trying deploy cq war file in same tomcat container. know cq not support ootb session management.would able maintain session between cq , j2ee app in same tomcat container? mean want store data in session can reuse when navigate , forth between j2ee pages , cq pages? afaik cq doesn't use sessions. can jet cookies , access j2ee , cq pages. trying do?

Are "(function ( ) { } ) ( )" and "(function ( ) { } ( ) )" functionally equal in JavaScript? -

this question has answer here: location of parenthesis auto-executing anonymous javascript functions? 4 answers both of these code blocks below alert foo bar . difference })() , }()) . code 1: (function() { bar = 'bar'; alert('foo'); })(); alert(bar); code 2: (function() { bar = 'bar'; alert('foo'); }()); alert(bar); so there difference, apart syntax? no; identical however, if add new beforehand , .something afterwards, different. code 1 new (function() { this.prop = 4; }) ().prop; this code creates new instance of function's class, gets prop property of new instance. returns 4 . it's equivalent function myclass() { this.prop = 4; } new myclass().prop; code 2 new ( function() { return { class: function() { } }; }() ).class; this code calls new on cla...

Eclipse JFace Wizard jump to next page programatically -

i created jface wizard showing single list user supposed make selection. since page contains list, enable double click selection. if user performs double click on single event, wizard should jump next page. i got following code far: viewer.adddoubleclicklistener(new idoubleclicklistener() { @override public void doubleclick(doubleclickevent event) { istructuredselection selection = (istructuredselection) event.getselection(); if (selection.getfirstelement() instanceof file) { if(canfliptonextpage()) { //perform jump next page here. } } } }); apparently there no method programmatic execution of next button. thank you. you first need reference wizard page want go. if don't have through other means, can find wizard pages via api: getwizard().getpages() next, make following call: getcontainer().showpage( desiredpage )

reporting services - Create different title level with SSRS -

Image
i'm desperately try create report should this: page header title 1 title 2 title 3 title 4 data title 2 title 3 title 4 data page footer the title 1 4 have repeat themself each page. first though using subreport since page header , footer not possible in subreport, i'm stuck. tried table table header wasn't able either. if have idea welcomed. thanks in advance here more details of i'm trying do: the fisrt static row title1, i've put properties, repeatonnewpage= true, keepwithgroup = after, fixeddate=true. made group on 1 have block. each of 2 static row inside detail group filled tablix have different title inside. header of inside tablix render correctly on each page, first row render on first page , cannot understand why. any idea? add each title 'row group' , nest under other. in 'design' mode under 'row groups' should start out 'details', right click , choose 'a...

java - NoClassDefFoundError when code moved from R2007a to R2013a -

i working on moving code r2007a r2013a. getting java.lang.noclassdeffounderror during run in r2013a not appear in r2007a. occurs when call. feval('get',fname,jevent); where fname product.proxyfield object object filter , jevent product.format.java.internal.javaevent . class in jar file on path , being accessed class in same jar file. stack trace not leave realm of product if helps. i not have access original code jar file. have access code derived original code , both classes in same package. i'm guessing has differences in java version i'm not sure since don't have original code recompile. unfortunately can't provide actual source or full detail google search yielded results matlab startup issues. thoughts? seems difference between r2007a , r2013a first uses 1.5 jre , second uses 1.6 jre. easier if provided stack trace showing exception. classes moved around in between jvm versions, having actual missing classes in determining if m...

css - Is there a way to get a second line of text to fill vertically? -

i'm having bit of trouble getting various products line on site. of items have name long enough create second line of text, , when so, items still align top of text rather aligning top of each image. want use of empty space above each div fit second line of text, rather pushing picture down , aligning @ top. code i'm using create divs in loop within php: <div class="new_prod_box"> <a href="details.html"> '.$title.' </a> <div class="new_prod_bg"> <a href="details.html"> <img src="images/'.$image.'" alt="'.$title.'" title="" class="thumb" border="0" /> </a> </div> <a href="cart.php?action=add&id='.$id.'"> <u>add cart</u> </a> </div> here's picture explaining mean: my website here's rules in css: .new_prod_box{ float...

c# - Get the URI of a specific webform -

i'm in process of learning .net, , need uri of specific webform. the framework asp.net 3.5 example: i'm in aboutme.aspx.cs , need find out uri of contactme.aspx be. edit clarify : give method path contactme.aspx --> "~/contactme.aspx" , "www.porcupine.com/contactme.aspx" the reason i'm trying figure out want render email template page, has specific variables per person, , able copy entire page string via webclient().downloadstring() method. method requires uri of page convert string. does know of way this? or of elegant alternative way (i.e., without writing out entire page body of message, etc.)? this should work need: string url = request.url.scheme + system.uri.schemedelimiter + request.url.host + (request.url.isdefaultport ? "" : ":" + request.url.port) + resolveurl("~/contactme.aspx"); in case returns: http://localhost:3165/website88/contactme.aspx

ios - How do I make sure when I change to different views each is set as the First Responder? -

i have app uses tab bar controller 5 different tabs using 1 viewcontroller (uiviewcontroller). on primary viewcontroller there audio function play audio , when switch other views, no longer able use headset buttons make adjustments audio playback (play/stop). told need make each view act first responder can receive notification adjust audio playback. how do this? i using 1 uiviewcontroller entire app, should setup different view controllers each tab of application instead? i'm using xcode 4.6.4 ios sdk 6.1 thanks.

sql - How to I add unique id's to mysql table? -

i have big mysql database. there 800000 records. there no uids have. how can add uids automaticly? alter table `your_table_name` add `uid` int not null auto_increment primary key first; be patient after executing statement. edit: alter table `your_table_name` auto_increment = 300000;

mysql - One-to-One Relationship -

i'm having trouble relationships mysql. tell me if 1 one relationship (between account , guest). create table if not exists account ( accountid int unsigned not null comment 'primary key', guestfk int unsigned not null comment 'account linked particular guest', password varchar(20) not null comment 'password of guest account', constraint account_pk primary key (accountid), constraint account_fk foreign key (accountid) references hotel.guest(guestid) ); create table if not exists guest ( guestid int unsigned not null auto_increment comment 'primary key', addressfk int unsigned not null comment 'foreign key of guest address', vehiclefk int unsigned comment 'foreign key of guest vehicle', firstname varchar(50) not null comment 'first name of guest', lastname varchar(50) not null comment 'last name of guest', phonenum int unsigned no...

python - Modifying a file text -

i have text file this: 0 1 0 10.2 5.82 4.82 1 -1 0 8.21 5.74 3.62 0 1 1 5.33 8.66 5.47 this text file has few hundred rows pattern. in first row, if first column 0, fourth column same. second column 1, fifth column has +10, value 15.82. in second row, if first column 1, forth column has +10, value 18.21. second column -1, fifth column has -10, value -4.26. etc. the final output this: 10.20 15.82 4.82 18.21 -4.26 3.62 5.33 18.66 15.47 i have tried using code wrote: with open('abc') f, open('out.txt', 'w') f1: line in f: reff = line.split() if reff[0] == '0': value = float(reff[3]) = str(value) line = "".join(a) + " " + "".join(reff[4]) + " " + "".join(reff[5]) + '\n' elif reff[0] == '1': value = float(reff[3]) + 10 = str(value) line = "".jo...

php - Form not POSTing values -

form: <form id="register" method="post" action="pro/register.php"> <input type="text" maxlength="30" placeholder="username" id="user" /><br /> <input type="email" maxlength="64" placeholder="email" id="email" /><br /> <input type="password" placeholder="password" id="pass1" /><br /> <input type="password" placeholder="confirm password" id="pass2" /><br /> <input type="submit" value="register" id="submit_register" /> </form> pro/register.php page : $user = $_post['user']; $email = $_post['email']; $pass1 = $_post['pass1']; $pass2 = $_post['pass2']; //debug echo "<strong>details:</strong><br>"; echo $user.", ".$email.", ...

Convert integer to binary in python and compare the bits -

how convert int n binary , test each bit of resulting binary number? i have got following after lot of googling: def check_bit_positions(n, p1, p2): print int(str(n),2) however error invalid literal int() base 2 . let me know how can binary form of input number , test each bit @ position p1 , p2 edit: binary = '{0:b}'.format(n) if list(binary)[p1] == list(binary)[p2]: print "true" else: print "false" the above code works now, how can check postions p1 , p2 end of list? use bin() function: >>> bin(5) '0b101' or str.format : >>> '{0:04b}'.format(5) '0101'

java - Linux javac command erroring on wildcard in classpath -

i running windows 7 java version 1.6.0_31-b05 on pc, , computerlab's network linux (fedora, possibly version 13) running java version 1.6.0_35-b10 . i have c:\myproject (et al) directory, src , lib , , bin subdirectories. the src folder contains of source code in tree structure, corresponds java packages. the lib directory contains jar files. i have re-created tree in linux, under ../myproject (et al). when attempt compile in dos, ..\myproject\src directory, command below, works fine: javac -cp ".;../bin;../lib/*" -d ../bin org/unlv/schillerlab/motif_diversity/step02/*.java when attempt compile in linux, ../myproject/src directory, message incorrect classpath : ../lib/* : javac -cp ".:../bin:../lib/*" -d ../bin org/unlv/schillerlab/motif_diversity/step02/*.java the computerlab network location accessible both dos , linux. in linux, first created ../myproject/src , ../myproject/lib , , ../myproject/bin directories. then, i...

java - How can I make sure my JUnit test method's specific cleanup always runs? -

i have junit test class has 2 test methods: @test public void test1() { // setup: create foo1.m // exercise // tear down: delete foo1.m } @test public void test2() { // setup: create foo2.m // exercise // tear down: delete foo2.m } for each method, make sure that, if exercise section fails reason, tear down still run. note setup , tear down code both test methods different, don't think can use junit's @before , @after annotations want. i put try-catch blocks each test method: @test public void test2() { // setup: create foo2.m try { // exercise } { // tear down: delete foo2.m } } but seems ugly. there way make sure test-method-specific tear down code in each test method executed, without using try-catch block? update: i found better solution, include here, original answer can found below. think junit 4 rules can used here: class preparefile implements org.junit.rules.testrule { @retention(r...

Is there a way to override and not execute the headerCallBack in Spring Batch -

i've created abstract parentflatfilewriter included headercallback default header. works great because i'm writing 6 files. but, on 1 file i'm writing, want skip header 1 file. still want use abstract bean rest of outfiles. can override inherited headercallback property , not write header? thanks header written flatfileitemwriter.headercallback property setted else header writing skipped. in 7th writer set flatfileitemwriter.setheadercallback(null) . in spring xml write: <bean id="my7thwriter" class="my7thwriterimpl" parent="parentflatfilewriter"> <property name="headercallback"><null/></property> </bean>

mysql - JOIN skipping duplicates -

select `bilder_w2l`.filnamn, `bilder_w2l`.md5_hash, `bilddata_w2l`.bildkategori `bilder_w2l` inner join `bilddata_w2l` on `bilder_w2l`.bildid = `bilddata_w2l`.bildid `bilder_w2l`.status = 0 bilddata_w2l has 28 rows. bilder_w2l has 21 rows. i want row data bilddata_w2l on 21 rows... rows in bilddata_w2l can have duplicate bildid. it's issue inner join, say. i'm not sure 1 use or how change sql. select `bilder_w2l`.filnamn, `bilder_w2l`.md5_hash, `bilddata_w2l`.bildkategori `bilder_w2l` left outer join `bilddata_w2l` on `bilder_w2l`.bildid = `bilddata_w2l`.bildid `bilder_w2l`.status = 0 is looking for?

javascript - append meta tag to the head of the main document from iframe -

so i've got issue i've made document responsive it's displayed in iframe parent document has wrong meta tag. i set test see if in iframe. it's appending meta tag head of iframe not main document. have suggestions? index.html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>iframe test</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body> <iframe id="testframe" name="testframe" src="iframe.html"></iframe> </body> </html> iframe.html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>iframe</title> <script> var viewporttag=document.createelement('meta'); viewporttag.id="viewport"; viewporttag.name = "viewport"; viewportt...

html - can't get buttons to be responsive and scale like the rest of my page -

i've got of page responsive thing can't seem figure out 2 buttons. using javascript mouseover effect not sure if messing things or not. want images scale along rest of page when view in different resolutions. http://74.117.156.152/~pr0digy/ here html: <!doctype html> <html lang="en"> <head> <title>us legal support - capex</title> <meta charset="utf-8" /> <link rel="stylesheet" href="style.css" type="text/css" /> <meta name="viewport" content="width-device-width, initial-scale-1.0"> <script type="text/javascript"> if (document.images) { new1 = new image; new2 = new image; existing1 = new image; existing2 = new image; new1.src = "images/new1.png"; new2.src = "images/new2.png"; existing1.src = "images/existing1.png"; existing2.src = ...