Posts

Showing posts from August, 2013

java - Trigger SOAP after Form submit -

i working ecommerce site written in java (jsp) (2 pages in question). we have page form submits order. once sent, our server sends out invoice email customer. started using email vision couple months ago, , boss wanted me use mailing server api. wanting (in real time), complete order button clicked , using soap, send data emailvision send out invoice us. i have never used api before (or soap matter), , confused on how supposed use trigger in conjunction .jsp page. you have 2 general approaches, , in both cases need consume soap service. consuming soap services orthogonal concern fact happens in web-sever. 1 specific question can ask: how consume soap service in java. as far web-tier , jsp in particular, can either execute call consume soap service in page, or, allow action occur somewhere in request processing chain, post-action filter. if need make call in 1 place fine include in jsp code. next step (in abstraction , reuse), can make custom jsp tag e.g. ...

android - R.id. values get overwritten -

in android app i'm creating new webviews java code; after create these webviews working id's overwritten. example snippet: for (int i=0;i<mywebviewarray.length;i++){ mywebviewarray[i]=new webview(); } ((button)findviewbyid(r.id.mybutton).settext("ok"); if run code, exception on last line: java.lang.classcastexception: android.webkit.webview it seems me if tables backing findviewbyid overwritten. tried calling setid in loop. not help. how can resolve problem? what in mywebviewarray. seems me have in there isnt webview , trying instantiate webview.

mysql management - Having problem with Timestamp -

scenario: 2 tables (table1, table2) format: id:short; timestamp:short; price:single the data in both table thesame except timestamp. timestamp given unix_time in ms. question: minimum time difference between timestamps of same record in table1 , table2. in theory, minimum time difference 0 or 1ms. in practice wouldn't time difference function of takes put data table along other external performance factors? one question have tables why same record being stored in 2 places?

php - nuSoap Function is Not a Valid method -

when trying instantiate nusoap method authenticateuser , says: fatal error: uncaught soapfault exception: [client] function ("authenticateuser") not valid method service in /applications/mamp/htdocs/projo/dev/home.php:14 but when replace method name 1 works, works fine. think instantiation syntax isn't wrong. /*----------- authenticate user ------------*/ $server->register( // method name 'authenticateuser', // input parameters array('sessionusername' => 'xsd:string', 'sessionhash' => 'xsd:string', 'user' => 'xsd:string', 'pass' => 'xsd:string'), // output parameters array('return' => 'xsd:string'), // namespace $namespace, // soapaction $namespace . '#authenticateuser', // style 'rpc', // use 'encoded', // documentation 'authenticates user , retur...

Entity Framework, Oracle, DevArt, Context#ExecuteStoreQuery: System.Int32 constructed as System.Double? -

i have entity-class having property of type int32: on generating ddl using devart oracle number(10) column generated. reading , writing instances works flawlessly. however, on fetching instances of entity-class sending custom query executestorequery on objectcontext property seems returned system.double, such constructing instances fails. can hint devart construct system.int32? thank you. bart the reason fact oracledatareader, used in executestorequery method, has type mapping different 1 used in entity framework provider. recommend use numbermappings , suppose need map number(10) int32: number mappings=((number,10,10,system.int32) . these changes should persisted model connection string (they duplicating default ef mapping rules, necessary oracledatareader executestorequery). please let know if problem persists.

python - Creating and fetching child records n Django -

i have 2 models like: class manager(models.model) id = models.autofield(primary_key=true) name = models.charfield(max_length=65535, null=false) class employee(models.model) id = models.autofield(primary_key=true) manager = models.foreignkey(manager) name = models.charfield(max_length=65535, null=false) when fetching employees manager, correct way it: mgr = manager.objects.get(id=1) emps = employees.objects.get(manager=mgr) or mgr = manager.objects.get(id=1) emps = employees.objects.get(manager=mgr.id) when creating both parent , child objects, okay this: emp = manager.objects.create(name='john').employees.create(name='johns slave') neither =) mgr = manager.objects.get(id=1) emps = mgr.employee_set.all() and second one. no you'll need them seperately , so: mgr = manager.objects.create(name='john') emp = employee.objects.create(name='johns slave', manager=mgr)

c++ - templates and typedef -

i have class : template<int dimension, typename t> vector { ... } now, want specialize typename , provide new type using typedef. found answer on stackoverflow @ c++ typedef partial templates i did : template < int dimension> using vectordouble= vector<dimension, double>; this not compile (error c2988: unrecognizable template declaration/definition). because compiler (visual studio 2008) doesn't allow it, or did miss ? thanks. the answer refer says: if have c++0x/c++1x compiler c++1x not yet current, compilers don't support features. in particular, vc++9.0 (vs2008) has no support them. vc++10 (vs2010) support some features, don't know if need 1 of those.

math - help me to write text on the center of image using PHP GD -

Image
this 1 empty image before writing here code <?php function loadjpeg($imgname) { $im = @imagecreatefromjpeg($imgname); $grey = imagecolorallocate($im, 255, 255, 0); // text draw $text = 'http://www.stackoverflow.com'; // replace path own font path $font = 'consola.ttf'; list($width, $height) = getimagesize($imgname); // wants know how use width/height dynamically // imagettftext($im, 20, 45, 200, 450, $grey, $font, $text); return $im; } header('content-type: image/jpeg'); $img = loadjpeg('blue_hills.jpg'); imagejpeg($img); imagedestroy($img); ?> image after writing text on it what want vertically , horizontally center text on 45 degree. please me on this. all. use imagettfbbox function retrieve dimensions text rendering would require. use information calculate x,y coordinate should target within destination image text centered respective width/height.

How can I make Rails ActiveRecord automatically truncate values set to attributes with maximum length? -

assuming have class such following: class book < activerecord::base validates :title, :length => {:maximum => 10} end is there way (gem install?) can have activerecord automatically truncate values according maximum length? for instance, when write: b = book.new b.title = "123456789012345" # longer maximum length of title 10 b.save should save , return true? if there not such way, how suggest proceed facing such problem more generally? well, if want value truncated if long, don't need validation, because pass. i'd handle this: class book < activerecord::base before_save :truncate_values def truncate_values self.title = self.title[0..9] if self.title.length > 10 end end

eclipse - How to share a session in j2ee application? -

possible duplicate: any way share session state between different applications in tomcat? how can share session attribute in 2 web project in same work space ? i read session on server why when go 2nd project in same work space dont find session attribute . i mean cant use in énd project <% if(session.getattribute("username") != null ){ %> work <% } %> i'm usign tomcat v7 server , eclipse hmmm! if using tomcat can set crosscontext=true in server.xml i.e. <context allowlinking="true" docbase="/home/appa" path="/appa" reloadable="true" crosscontext="true"/> <context allowlinking="true" docbase="/home/appb" path="/appb" reloadable="true" crosscontext="true"/> and can share sessions, if can tell me situation might more helpful

python - How do I use django db API to save all the elements of a given column in a dictionary? -

i've used raw sql query access them, , seems have worked. however, can't figure out way print results array. thing can find cursor.fetchone() command, gives me single row. is there way can return entire column in django query set? dict(mymodel.objects.values_list('id', 'my_column')) return dictionary elements of my_column row's id key. you're looking list of values, should receive via mymodel.objects.values_list('my_column', flat=true) !

python - Color matplotlib plot_surface command with surface gradient -

Image
i convert surf command matlab plot_surface command in matplotlib . the challenge facing when using cmap function in plot_surface command color surface gradient. here matlab script % matlab commands x = -5:.25:5; y = x [x,y] = meshgrid(x); r = sqrt(x.^2 + y.^2); z = sin(r) surf(x,y,z,gradient(z)) the figure such command can found here. (http://www.mathworks.com/help/techdoc/visualize/f0-18164.html#f0-46458) here python scipt when using python , matplotlib create similar function unable color surface gradient. # python-matplotlib commands mpl_toolkits.mplot3d import axes3d matplotlib import cm import matplotlib.pyplot plt import numpy np fig = plt.figure() ax = fig.gca(projection='3d') x = np.arange(-5, 5, 0.25) y = np.arange(-5, 5, 0.25) x, y = np.meshgrid(x, y) r = np.sqrt(x**2 + y**2) z = np.sin(r) surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=gradient(z), linewidth=0, antialiased=false) plt.show() i following error message: traceback (mos...

php - Multi languages site -

i have site texts in 2 languages. how should go between pages point clicked change language see , moment clicks other language, change back? an option when user clicks link change language store session , use it. i've heard won't work search engines. a second option pass language variable through url every page. third option smartly use zend extension ability. (using php + zend framework). seo important me. edit: texts in site(and in several languages), entered admin. works languages objects i've created option admin add texts in each of them. when i'll enter first page(of text can changed) i'll see in english , when click russian flag display page(and others later) in russian. using zend_locale or translate won't work me(i think), , passing through url option. question if best one? it best pass along parameter in url, google uses locale=en this. ok store in session if user logged website , selected preferred locale or something. way se...

ios - Difference in ViewController pushing -

i'm doing cs193p stanford course tutorials , apple ios dev tutorials, , there's difference between how push viewcontroller screen apple this: uinavigationcontroller *anavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:rootviewcontroller]; self.navigationcontroller = anavigationcontroller; stanford suggests doing this: navigationcontroller = [[uinavigationcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:rootviewcontroller animated:no]; how different? ps: btw, apple's method work , stanford 1 doesn't display , don't know why. i think using pushviewcontroller:animated method going add controller @ top of stack of controllers ( push new view controller on stack ). in second method not initializing navigationcontroller.

Android fill percent of layout -

how make elements in layout occupy 50, 25, 10, etc. percent of horizontal/vertical space available? you achieve : ( vertical here ) <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="0dip" android:weightsum="100"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="60"> </linearlayout> </linearlayout>` see android:weightsum documentation

java - JPA: pattern for handling OptimisticLockException -

what correct pattern handling ole in (rest) web service? i'm doing now, example, protected void dodelete(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { ... ... ... try { try { em.gettransaction().begin(); // ... remove entity em.gettransaction().commit(); } catch (rollbackexception e) { if (e.getcause() instanceof optimisticlockexception) { try { clog.e("optimistic lock exception, waiting retry ..."); thread.sleep(1000); } catch (interruptedexception ex) { } dodelete(request, response); return; } } // ... write response } catch (noresultexception e) { response.senderror(httpservletresponse.sc_not_found, e.getmessage()); return; } { em.close(); } ...

PHP array_shift() not working for me. What am I doing wrong? -

i creating array , want delete first element of array , re-index it. can tell, array_shift() right solution. however, not working in implementation. i have member variable of class defined array called $waypoint_city. here variable output prior shifting array: print_r($this->waypoint_city); result: array ( [0] => [1] => jacksonville [2] => orlando [3] => montgomery [4] => memphis ) if following, correct result: print_r(array_shift($this->waypoint_city)); result: array ( [0] => jacksonville [1] => orlando [2] => montgomery [3] => memphis ) however, if try reassign result member variable doesn't work... know why is? $this->waypoint_city = array_shift($this->waypoint_city); if try print_r($this->waypoint_city) looks nothing in there. can save hair haven't pulled out, yet. array_shift [docs] changes array in-place . returns first element (which empty in case): returns shifted value, or null ...

Can only refer to $(this) in jQuery delegate() callback -

normally when use .delegate() refer $(this) in callback function. if want affect other element on page? doesn't work: $("form#my-form").delegate("input#my-textbox", "change", function(){ $("#some-other-div").toggleclass("toggled"); });

Where can I find willing open source Android contributers -

i writing application hope build client in android. however, inexperienced in android development , looking droid devs willing contribute open source client. where can find such people? dont care are, long have strong grasp on english language. *edit: clarify - not trying recruit people through stackoverflow, merely such people register willing contributors looking project, can through profiles , in contact them. i post project on open source repository website github or google code . , start making commits , post information on app. open source projects start few devs , community kicks in once have decent user base. feel best way recruit people to put project out there , show people has potential. people want contribute it.

c# - Pumping Bytes Directly into Response.OutputStream - how to deal with byte count? -

i have need transfer large streams of data web service. rather increase iis buffer size in metabase, i'd pump bytes directly unbuffered response.outputstream. response.clearheaders(); response.clear(); response.contenttype = "text/xml"; response.buffer = false; int len = getreport(protocolname, sourcename, reportname, pageindex, pagesize, response.outputstream); response.end(); this works fine, can know how many bytes have been retrieved after retrieving them, can't set contentlength header. following line throws exception (can't add headers after start returning content): int len = getreport(protocolname, sourcename, reportname, pageindex, pagesize, response.outputstream); response.addheader("content-length", len.tostring()); // can't question: guess there aren't many options. suppose way handle introduce intermediate stream, e.g., memory stream, length of stream, set header, , pump that stream response.output stream. other ...

flex - How to send an ArrayCollection to a new/sub-window? -

yesterday phtrivier showed me how send array new/sub-window . now have replaced static source of data xml file loads arraycollection. unfortunately found arraycollection behaves differently array when try send part of new/sub-window. how can arraycollection? or should take easy road sending array , instead way make xml load array instead of arraycollection? don't think require features ac offers. mymain.mxml <?xml version="1.0" encoding="utf-8"?> <s:windowedapplication ...stuff... creationcomplete="settingservice.send()"> <fx:declarations> <s:httpservice id="settingservice" url="data.xml" result="settingservice_resulthandler(event)"/> </fx:declarations> <fx:script> <![cdata[ // import dependencies import mx.collections.arraycollection; import mx.rpc.events.resultevent; // variables ...

user interface - Pattern for changing program options in a GUI -

i'm adding gui existing command line app. properties used app held in class(es) , i'm creating dialog binds options objects. however, if want cancel out of dialog have reset values of options objects, i'm running probs. i take internal copy of option objects , use re-populate original object allow cancel/rollback seems cumbersome. i can (somehow) implement undo function on each class - there pattern that? i use gui controls standalone hold values , update options objects when dialog has been confirmed. what's best practise? you should consider creating new class used gui. guis have own needs. make sure take care of multi thread issues if have more 1 thread accessing options object. the design patterns address undo functionality called command , memento. think memento fit better on case. take on question on so: design pattern undo engine . following links of interest (and many more): http://www.coderanch.com/t/100676/patterns/memento-vs-com...

vba - IF construct in Excel -

can me perform following... example: b c d row 1 odzn 2 3 row 2 eaxo 3 4 i need if statement gives logic... if a:1 odzn, d1=(b:1)*(c:1)*5 , else if if a:2 eaxo , d1=(b:2)*(c:2)*20 ... , on different variables.... every different variable has different multiplier....... and i'll copy , drag formula down large set of data , macro could help.. , possibly advise me need define variable... the multiplier set me manually. variables defined in excel. thanks!! i suppose mean: for row, if value in column odzn / eaxo, value in column d gets multiplier 5 / 20. answer: =b1*c1*if(a1="odzn",5,if(a1="eaxo",20,0)) and drag. you can nest many if want. (here use unnecessary 0 show how if can nested, can simplified if(a1="odzn",5,20) ). of course, can write function, like =b1*c1*func(a1) however, macros need authentication run in later versions of excel. recommend formula solution if value variatio...

android - Null Pointer exception in layoutInflate makes no sense. why? -

the line of code npe bombs: viewgroup inflate = (viewgroup) layoutinflater.inflate(r.layout.liker,null); inflate's signature (int layoutid, view viewroot) http://developer.android.com/reference/android/view/layoutinflater.html use view instead of viewgroup. please check inflate method returns view

ruby rename elements of array with elements of different array -

i have file looks this: ttitle0=track name 1 ttitle1=track name 2 and directory contains track01.cdda.wav.mp3 , track02.cdda.wav.mp3 i have following code, creates 2 different arrays, 1 track names , 1 track titles: tracks = dir.glob("*.mp3") tracknames = array.new file.open('read').each |line| if line =~ /ttitle/ tracknames << line.split("=")[1].strip! end end this gives me 2 arrays: ["track name 1", "track name 2"] and ["track01.cdda.wav.mp3", "track02.cdda.wav.mp3"] i rename files in second array elements of first array. so, "track01.cdda.wav.mp3" become "track name 1.mp3" . here have tried far: tracks.map {|track| file.rename("#{tracks}", "#{tracknames}.mp3") } and error: no such file or directory - track01.cdda.wav.mp3track02.cdda.wav.mp3 or track name 1track name 2 (errno::enoent) i have keep in mind in future there number of...

Passing Managed Object Data Through didSelectRow UIPickerView -

i'm bit lost on how pass fetched managed object data through didselectrow uipickerview action. on previous view, passed calcinfo object this: calcinfo *calc = (calcinfo *)[_calcinfos objectatindex:indexpath.row]; self.mypageoneviewcontroller.calcinfos = calc; i able use calcinfos.attribute ibaction:(id)sender buttons, pickerview isn't able fetch / use data. updatelabel action has calcinfos.attribute null. here's bit of code - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component { [self updatelabel]; } - (void)updatelabel { double stdrate = [calcinfos.infusionstd doublevalue]; double lowrate = [calcinfos.infusionlow doublevalue]; if (calcinfos.infusionlow == null) { nslog(@"it's null"); } } your appreciated! the picker view subview own hardwired controller. returns row , column/component picked in delegate message `didselectrow:incomponent'. you need pass info along upd...

r - Why is caret train taking up so much memory? -

when train using glm , works, , don't come close exhausting memory. when run train(..., method='glm') , run out of memory. is because train storing lot of data each iteration of cross-validation (or whatever trcontrol procedure is)? i'm looking @ traincontrol , can't find how prevent this...any hints? care performance summary , maybe predicted responses. (i know it's not related storing data each iteration of parameter-tuning grid search because there's no grid glm's, believe.) the problem 2 fold. i) train doesn't fit model via glm() , bootstrap model, defaults, train() 25 bootstrap samples, which, coupled problem ii) the (or a ) source of problem, , ii) train() calls glm() function its defaults. , defaults store model frame (argument model = true of ?glm ), includes copy of data in model frame style. object returned train() stores copy of data in $trainingdata , , "glm" object in $finalmodel has copy of actu...

Sharepoint 2010 Client Object Model - Large Library - Find item without iteration -

i have large document library (at moment ~6000 documents) , need find document based on custom field value (custom column on library). is there way of getting document without iterating through 6000 documents? i understand iteration must occur @ point, prefer happen on sharepoint server side, rather transfer them client side cherry pick document. thanks you can query sharepoint. issue caml query executed on server , brings items match criteria specified. specify name of custom column search on , specify value find. efficiency , can ask few fields (document url example). so, not need iterate on documents in list find item. you can find discussion here: http://msdn.microsoft.com/en-us/library/ee956524.aspx , can find examples how javascript or silvelight. example caml: camlquery camlquery = new camlquery(); camlquery.viewxml = @"<view> <query> <where> <eq> ...

Need an easy way to change my string into an integer in c# -

i have string this: var mystring = "025" is there easy way change number? int mynumber = int.parse(mystring); note throw exception if mystring cannot converted int. can use tryparse instead safer int mynumber if( int.tryparse(mystring, out mynumber){ //conversion ok, , mynumber contains int }else{ //conversion failed. mynumber 0. }

flex - create xml from object -

basically want create xmldesigner kind of thing in flex, using user can add/edit components , properties of view/dashboard. storing view structure in xml file. parsed file @ runtime , display view. how convert object (having properties , sub-objects) xml node (having attributes , elements) , add xml existing xml file. next time when parsed xml file i'll new component in view/dashboard. for e.g, object structure of component in xml file : <view id="productview" label="products"> <panel id="chartpanel" type="chart" charttype="pie2d" title="productwise sales" x="215" y="80" width="425" height="240" showvalues="0" > </panel> </view> thanks in advance. use xml (de)serialization library. there many out there 1 thing have used , found stable flexxb . has got plethora of functions , swear it! flexxb annotation based , easy use ...

javascript - Do you know any article, book, resource that explains how Google makes its apps to work this FAST? -

do know article, book, analyze etc. focuses on strategies used google make applications (not search google calender, tasks, igoogle etc.) work fast? i more interested strategies use obtain intractable web pages. thanks i guess help: http://stevesouders.com/hpws/ steve employee @ google works on latency. mind behind firefox yslow. set of rules read consider fast apps.

Android nfc to read card from samsung nexus -

i want read card samsung nexus phone android nfc api not provide enough options. i've tried using third party api names "open nfc" gives error of not supporting api. can provide me code read data card. have code read tag not read card. here link download open nfc api. http://sourceforge.net/projects/open-nfc/files/open%20nfc%204.3%20beta%20%2810381%29/ any appreciated. this code used. giving error of opennfc failing... public class nfcone extends activity implements carddetectioneventhandler, readcompletioneventhandler,nfctagdetectioneventhandler{ cardlistenerregistry i=null; carddetectioneventhandler hand=null; nfcmanager nfcmngr = null; nfctagmanager mnfctagmanager=null; nfctagdetectioneventhandler taghand=null; readcompletioneventhandler readhand=null; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main1); system.out.println("oncreate"); try { nf...

python - howto create a multidimensional Array of floats with Pythonnet -

i'm using pythonnet (http://pythonnet.sf.net) bind python framework , .net library (i know if ironpython not question). using pythonnet, can create array of floats, , initialize sequence of values: >>> system import * >>> array[float]([1., 2.]) <system.double[] object @ 0x8a6c46c> i need pass 3x3 array of floats method in the .net library, , can't figure out how create this. use array.createinstance: >>> = array.createinstance(double, 3, 3) reference: http://msdn.microsoft.com/en-us/library/system.array.createinstance%28v=vs.90%29.aspx

How to browse an in-memory SQLite database with the command line tool sqlite3 -

is there way load entire sqlite database memory faster results, using sqlite3 cli tool? thanks! i'm not sure of trying accomplish here, have 2 ideas propose: 1- copy database attached in memory database. link tell how attach in memory database: http://www.sqlite.org/lang_attach.html 2- increase cache size, keep transactions in memory, , keep "temp store" in memory: http://www.sqlite.org/pragma.html#pragma_cache_size http://www.sqlite.org/pragma.html#pragma_journal_mode http://www.sqlite.org/pragma.html#pragma_temp_store

jquery - Do I need to create separate forms for simple and Ajax thing in Django -

i have many forms working fine if load them via normal http link. the template below {% extends "app/base.html" %} {% block title %}create account{% endblock %} {% block media %} {% include "app/media_template.html" %} {% endblock %} {% block heading %}form{% endblock %} {% block content %} <div id="stylized" class="myform"> <form action="" method="post" enctype="multipart/form-data" > <h1>account form</h1> <p>this basic of form without table</p> {% csrf_token %} {% field in form %} {{ field.errors }} {{ field.label_tag }} {{ field }} {% endfor %} <button type="submit">sign-up</button> <div class="spacer"></div> </form> </div> {% endblock %} but if have display via ajax need div box containing form , don't nedd other html so want if js not...

java - error in using calendar in android? -

i trying open calendar app , using code below found in question : how can open calendar app? ...but getting following error 07-01 14:19:26.299: error/androidruntime(14167): caused by: android.content.activitynotfoundexception: unable find explicit activity class {com.google.android.calendar/com.android.calendar.launchactivity}; have declared activity in androidmanifest.xml? any useful.. intent = new intent(); componentname cn = new componentname("com.google.android.calendar", "com.android.calendar.launchactivity"); i.setcomponent(cn); startactivity(i); have tried specifying permissions ? http://developer.android.com/reference/android/manifest.permission.html#read_calendar or alternatively use: intent intent = new intent(intent.action_edit); intent.settype("vnd.android.cursor.item/event"); intent.putextra("title", "some title"); intent.putextra("description...

java - How to increment array index -

i using arraylist in java program problem when add item in arraylist adding on same index want know how increment array index in array list. arraylist arr = new arraylist(500); stringtokenizer st = new stringtokenizer(line, ":mode set - out of service in service"); while(st.hasmoretokens()){ arr.add(st.nexttoken()); } in above code keep adding item on same index i.e. arr[0]. do need initalize arraylist size? try original code changing arraylist arr = new arraylist(500); for arraylist arr = new arraylist();

java - Want to develop a servlet container like tomcat -

actually want develop simple servlet container tomcat. it's purely learning purpose. helpful if can , guide me start actually. thanks in advance. first, study java servlet api ( fundementals ) understand understand lifecycle of servlet. now, we're on servlet 3 specification (the latest tomcat) have decide version of servlet api want implement.

.net - OutputCache serving long-stale data -

i'm flumoxed... re this , this "meta" questions... a basic http request: get http://stackoverflow.com/feeds/tag?tagnames=c%23&sort=newest http/1.1 host: stackoverflow.com accept-encoding: gzip,deflate which hits route decorated with: [outputcache(duration = 300, varybyparam = "tagnames;sort", varybycontentencoding = "gzip;deflate", varybycustom = "site")] is repeatedly and incorrectly serving either 304 (no change) if include if-modified-since, or the old data 200, i.e. http/1.1 200 ok cache-control: public, max-age=0 content-type: application/atom+xml; charset=utf-8 content-encoding: gzip expires: fri, 01 jul 2011 09:17:08 gmt last-modified: fri, 01 jul 2011 09:12:08 gmt vary: * date: fri, 01 jul 2011 09:42:46 gmt content-length: 14714 (payload, when decoded = long-stale data) as can see, serving half hour past 5 minute slot; looks internals of outputcache didn't notice time ;p expire eventually (in fact, ...

c# - Service reference complex types -

i have client app consuming wcf service accepting , returning complex type parameters. these complex types held in separate assembly both client app , wcf service referencing.. problem when add service reference in client app, generated reference class builds own versions of complex parameter types , hence cant pass in types assembly original types defined. not sure if @ understandable.. question is.. going have write sort of reflective deep copy routine build service reference generated classes original types? or there better option any ever happily received nat when adding service reference code, select advanced , you'll see option reuse types in referenced assemblies . if ensure checked, , reference added project, wcf won't generate proxy types , use referenced types instead. if you've added service reference, reference shared types first, , right-click service reference, , select configure service reference regenerate client code using referenced ...

c# - Worksheet get_Range throws exception -

i'm using c# manipulate excel worksheet. following 2 pieces of code should work same, 1 works , other throws exception. wonder why. this works: orange = (excel.range)osheet.get_range("a1","f1"); orange.entirecolumn.autofit(); this throws exception: orange = (excel.range)osheet.get_range(osheet.cells[1, 1],osheet.cells[4,4]); orange.entirecolumn.autofit(); exception: runtimebinderexception occurred. "object" not contain definition 'get_range' the osheet instantiated follows: excel.worksheet osheet = new excel.worksheet(); am supposed instantiate both differently? it looks exception thrown osheet.cells[1, 1] , osheet.cells[4, 4] used arguments get_range. by doing following, there no exception: excel.range c1 = osheet.cells[1, 1]; excel.range c2 = osheet.cells[4, 4]; orange = (excel.range)osheet.get_range(c1, c2); orange.entirecolumn.autofit(); so might related osheet.get_range functionality. receives object a...

Twitter json feed? -

does know can find json feed page? http://twitter.com/#!/microsoft the closest have found this: http://twitter.com/status/user_timeline/microsoft.json but not include tweets, i.e. " ... server room going empty & we’re going install jacuzzi in it." http://bit.ly/j1n82d is missing it seems method you're using request feed has been deprecated (at least couldn't find in current docs ). anyways here's do: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=microsoft&include_rts=1 this fetch 20 of microsoft's latest tweets, , include_rts=1 include retweets them.

Weighted Directed Acyclic Graphs: algorithm to find edge weights such that they define a distance function? -

i have technical problem can formuated directed acyclic graph (dag). nodes represent events (with unknown timing), directed edges encoding relation ship: "i'm younger you/i happened before you". i need estimate edge weights (i.e. "dynamic weights") such weighted dag (wdag) implies distance function on dag. in other words sum of weights paths between nodes , b should equal paths. this undetermined problem, if weights integers (same underlying reason topological sorting not unique, suppose). in generality, edge weights, represent timeintervals between nodes/events, real numbers. therefore i'm introducing preset objective function c=j(wdag) on weighted dag, here unspecified. my question is: there algorithm distributes positive definite weights on wdag, subject constraint 1) weights form distance function of dag , 2) minimizing objective function cost c. this seems unrelated shortest-path or minimum-spanning-tree problems classically associated wdag...

html - CSS: Hover on 3 stacked images -

i'm trying build photo gallery stacked photos each album. when hover album want 1 image rotate 20 left, 1 rotate 20 right see bits of 3 images @ same time. i think problem hover signals stuck on topmost image in stacks. i'll post have tried below. ideas? possible? <!doctype html> <head> <title>just-css: rotate stacked images on hover</title> <style> body { background-color: black; color: white; padding: 20px; } ul { margin: 0; padding: 0; } ul li { list-style: none; position: absolute; } img { -webkit-transition: 0.2s; } img:hover.green {-webkit-transform: rotate(-20deg);} img:hover.blue {-webkit-transform: rotate(20deg);} img { border: 4px solid white; } img.red { background-color: red; } img.green { background-color: green; } img.blue { background-color: blue; } </style> </head> <body> <ul class="img-stack"> <li><img class="red" width="...

dllexport - Get functions mangled name from C++ DLL -

i have function declared __declspec(dllexport) void takeinput(); the dll has function exported in c#.i getting failure while executing function call function entry point not found in c# code. googling shows issue correct entry point not provided.i need provide mangled name function. so know how can mangled name of function? in order avoid name mangling, use extern "c" extern "c" __declspec(dllexport) void takeinput(); more reading: using extern specify linkage

php - Removing elements from an array whose value matches a specified string -

i have array looks this: array ( [0] => vice president [1] => [2] => other [3] => treasurer ) and want delete value other in value. i try use array_filter filter word, array_filter delete empty values, too. i want result this: array ( [0] => vice president [1] => [2] => treasurer ) this php filter code: function filter($element) { $bad_words = array('other'); list($name, $extension) = explode(".", $element); if(in_array($name, $bad_words)) return; return $element; } $sport_level_new_arr = array_filter($sport_level_name_arr, "filter"); $sport_level_new_arr = array_values($sport_level_new_arr); $sport_level_name = serialize($sport_level_new_arr); can use method filter word? foreach($sport_level_name_arr $key => $value) { if(in_array($value, $bad_words)) { unset($sport_level_name_arr[$key]) } }

javascript - Uncaught TypeError: Property ... is not a function - after page has loaded -

i'm using cross-domain ajax request external api. every fails, console message: uncaught typeerror: property 'photos' of object [object domwindow] not function looking @ json being returned, valid json, not fault of external api. i can't reproduce error reliably: factor seems trigger error when call request , repeatedly. in case i'm calling ajax request when user moves google map (to add markers map), , occurs if user moves around quickly. here relevant parts of code: // code located inside external js file referenced inside head // not wrapped inside document.ready - code setting // map (calling function calls function adds // tilesloaded listener) *is* inside document.ready function addmarkers() { var pm_url = "http://www.cyclestreets.net/api/photos.json?key=" + my_key; $.ajax({ url: pm_url, crossdomain: true, contenttype: "application/json", datatype: 'jsonp', data: pmdata, ...

delphi - Get foreground CHILD window -

Image
whenever skype in default view , tconversationwindow 's become children of tskmainform window. i having problems finding out tconversationwindow active - it's not mdi interface - one tconversationwindow visible, if tab/page . when getforegroundwindow , skype's mainform handle returned ( tskmainform ). there way can foreground tconversationwindow within skype? this question of mine has screenshots of skype's default view, if need it. :) edit : here screenshot of winspector hierachy: edit2 : tried going thru windows this: procedure tform1.button1click(sender: tobject); function getclassname(handle: hwnd): string; var buffer: array[0..max_path] of char; begin windows.getclassname(handle, @buffer, max_path); result := string(buffer); end; var wnd: hwnd; skypewnd: hwnd; begin skypewnd := findwindow('tskmainform',nil); wnd := gettopwindow(skypewnd); while (getclassname(wnd) <> 'tconversationform') , (wnd <...

java ee - Struts2 locale session rewrite -

can rewrite session attribute ww_trans_i18n_locale in struts2 ? want set locale in cookies, future use, because default session have timeout of 30 minutes, small amount of time locale, if user isn't using site. trying set ww_trans_i18n_locale depending on cookies value, without luck, value remains same is. i found here question mine, of jsp's pass through actions https://stackoverflow.com/questions/5291271/struts-2-internationalisation-problem , , not solution .. so want change session value in action? i'm not clear on last line, implement sessionaware should straight forward. best place set value ever user logs in (if any). something like... import com.opensymphony.xwork2.actionsupport; import java.util.map; import org.apache.struts2.interceptor.sessionaware; public class myaction extends actionsupport implements sessionaware{ map<string, object> session; @override public string execute(){ session.put("ww_trans_i18n_loc...

MySQL Incrementing ID/UUID Question -

i'm attempting create table incremental id. isn't simple id auto_increment. in fact, exact id i'm trying work is: test.script.1/person.n (where n incrementing number) specifically, have table structured as: id | fname | lname | gender | age | each person add in, wish have , incremental id. person 1, test.script.1/person.1 , test.script.1/person.2 second entry , on , forth. is possible this? have searched while in google, not think searching right thing. apologies if there isn't information, , simple question, don't know for. please advise. thanks guys! you can use autoincrementing field trigger populate actual field wish use reference. something this: create trigger set_my_uuid after insert on mytable each row begin set new.uuid_ref_col = concat('test.script.1/person.', new.my_auto_increment_col) end ; where my_auto_increment_col standard autoincrement column in table.

xml - XSD restrictions based on open/closed elements -

is there way in schema indicate requirement of attributes determined open or closed nature of element. example have element if open has no requirement attribute 'test', if closed required. <element name="employee" > blah! </element> ok <element name="employee" /> fail - attribute 'test' required. i guess using "open" mean element has text node child, , "closed" mean hasn't. you're saying element should either have text node child or attribute not both (?) , not neither. that's classified co-occurrence constraint, , can't done in xsd 1.0. can done assertions in xsd 1.1 <xs:element name="employee" type="..."> <xs:assert test="string(.) or @name"/> </xs:element> xsd 1.1 support available in xerces , saxon.

Java: Serialization: How to store only a reference, not the content -

i'm creating undo-redo mechanism. achieve this, i'm using serialization. recording current state writing bytearrayoutputstream , using objectoutputstream , putting byte[] arraylist. but problem that, of classes holding reference/pointer bufferedimage . don't want serialize because of size (and doesn't implement serializable ). reason why don't want write never change. but different image each instance of class , static keyword isn't solution. my attempt solve: public transient bufferedimage img; this causes objectoutputstream not serialize bufferedimage, won't store reference well. after deserializing, null . so, in short, want keep reference object, not object itself. means that, after deserialazing able use bufferedimage (because of isn't removed garbage collector). many thanks. ok, simple enough, keep map<string, bufferedimage> of images somewhere in application, let each of classes serialize key image. , in readres...

java - Spring MVC URL for the AbstractController -

i have controller inherits org.springframework.web.servlet.mvc.abstractcontroller class i have configurated in way: <bean name="/gameservicecontroller.json" class="xx.xxx.gamecontroller"/> so can accepts url of form http://<hostname>:<port>/<context-path>/gameservicecontroller.json but customer has provided me requirement write url in way http://<hostname>:<port>/<context-path>/createnewgame?parameter=<value> but think not possible map type of url controller. know type of configuration can used in order configure type of url mapping ? otherwise, legal ask change format of url in way http://<hostname>:<port>/<context-path>/gameservicecontroller.json?command=createnewgame&phonenumber=<phonenumber> so can manage command parameter in "handlerequestinternal" method of custom controller inherits org.springframework.web.servlet.mvc.abstractcontroller c...

tablecolumn - Prevent certain SlickGrid columns from being reordered -

the drag/drop column reordering great feature, how prevent users moving particular (non-data) columns? for example, using checkbox selectors mutli-select grid, column should locked left, while other columns can freely reordered. i looked @ sortable demos on jquery ui , modified setupcolumnreorder function in slick.grid.js exclude items. excluding checkbox column able prevent getting reordered, dragging other columns before it. function setupcolumnreorder() { var checkboxcolumn = $headers.children([0]).attr('id'); $headers.sortable({ items: "div:not('.slick-resizable-handle','#"+checkboxcolumn+"')", ... since checkbox column first, grab id so. bit of hack, worked.

javascript - Uncaught TypeError: Cannot read property 'value' of undefined -

i have javascript code gives error uncaught typeerror: cannot read property 'value' of undefined code: var i1 = document.getelementbyid('i1'); var i2 = document.getelementbyid('i2'); var __i = {'user' : document.getelementsbyname("username")[0], 'pass' : document.getelementsbyname("password")[0] }; if( __i.user.value.length >= 1 ) { i1.value = ''; } else { i1.value = 'acc'; } if( __i.pass.value.length >= 1 ) { i2.value = ''; } else { i2.value = 'pwd'; } what error mean? seems 1 of values, property key of 'value' undefined. test i1 , i2 and __i defined before executing if statements: var i1 = document.getelementbyid('i1'); var i2 = document.getelementbyid('i2'); var __i = {'user' : document.getelementsbyname("username")[0], 'pass' : document.getelementsbyname("password")[0] }; if(i1 && i2 &...

barcode scanner - Set focus on entry that is not visible in pyGTK -

i want set focus on entry not visible in pygtk barcode scanner. if set entry visible false error when setting focus on it. /home/samuel/visitors-book/visitors_book/__init__.py:60: gtkwarning: ia__gtk_widget_event: assertion `widget_realized_for_event (widget, event)' failed gtk.main() thanks sam you without gtkentry , capture keyboard events directly. but bad have entry visible? barcode terminals i've seen confirm read.

jquery - help with ajax only working once -

been trying put function make live calls, can't figure out. this works once: <script> $(document).ready(function(){ $(".addfavorite").click(function(){ var row = $(this); $.ajax({ type: "post", url: "/app/favs/jsoncreate?id=<%= @place.ven_id %>&name=<%= @place.name %>", success: function(data){ $(row).replacewith('<div id="' + data + '" class="vfav vbtn deletefavorite"><img src="/public/images/icons/favorite-.png" alt="favorite -"></div>'); } }); }); $('.deletefavorite').click(function(){ var id = $(this).attr('id'); var row = $(this); $.ajax({ type: "post", url: "/app/favs/jsondelete?id=" + id, async: true, ...

How to add C/C++ functions to Objective-C code (iphone related) -

i added .h/.cpp files c functions xcode project. how call c function in objective-c function? when included c file (#import "example.h") in app delegate header file exploded errors (could treated cpp file objective-c) though compiles fine without being included/imported. thanks edit: renaming files m mm fixed issue. getting linker error when building (ld: duplicate symbol)... better research first. again all. if want use c++ objective-c module, change file extension .m .mm .

How to express a context free design grammar as an internal DSL in Python? -

[note: rereading before submitting, realized q has become bit of epic. thank indulging long explanation of reasoning behind pursuit. feel that, in position undertaking similar project, more on board if knew motivation behind question.] i have been getting structure synth mikael hvidtfeldt christensen lately. tool generating 3d geometry (mostly) context free grammar called eisenscript. structure synth inspired context free art. context free grammars can create stunning results surprisingly simple rulesets. my current structure synth workflow involves exporting obj file structure synth, importing blender, setting lights, materials, etcetera, rendering luxrender. unfortunately, importing these obj files brings blender grinding halt there can thousands of objects complex geometry. 'fairly' because structure synth generates basic shapes, sphere represented triangles still has many faces. thus, generating structures directly in blender preferable current process (blender...

jquery - Not performing yes click event -

so what's supposed happen when user clicks yes answer supposed id of img , perform tasks don't know if should putting id onto link instead of image main part of question not doing steps of yes click function. i using same plugin page. http://webstuffshare.com/demo/jconfirmaction/index.html , using plugin default usage <td> <a class="ask" href="#"> <img id="2" class="delete" border="0" title="" alt="" src="images/trash.png"> </a> <div class="question" style="opacity: 1;"> sure ? <br> <span class="yes">yes</span> <span class="cancel">cancel</span> </div> </td> $('.ask').jconfirmaction(); $('.yes').bind('click', function(){ var userid = $(this).parent.attr('id'); var datastring = 'userid=' + userid + '&deleteu...

java - JAX-WS clients non-thread safe? -

"official jax-ws answer: no. according jax-ws spec, client proxies not thread safe. write portable code, should treat them non-thread safe , synchronize access or use pool of instances or similar" what means ? i need create pool of proxies if have these type of clients in webapp. until instantiated clients each request , myself did not had problem colleague of mine had stuck threads in logs... we searched , found above answer... how use web service clients in applications ? (metro) there best practices using them ? thank !

sql - C++ DBI Class - best/developer friendliest style -

in our current project, need high level dbi different databases. should provide following features: in memory cache - dbi should able cache reads, , update cache on writing calls (the application coding on heavy threaded, , needs fast access current data time). memory cache based on boost::multi_index automatic sql building - don't want parse sql statement lookup in memory cache as need provide functions for: defining table layout, selects, inserts, updates, joins, ..., interface complex. we need way invoke interface function. there many styles around, not find useful our usage. here few examples: soci sql << "select name, salary persons id = " << id, into(name), into(salary); we don't want sql statements, have define what , from different way. pqxx conn.prepare("select_salary", "select name, salary persons id = $1") ((string)"integer",prepare::treat_direct); the heavy usage of overload...