Posts

awtrobot - Java print screen program -

i trying use robot in java make image file of print screen. far have: robot robot = new robot(); rectangle screenrect = new rectangle(toolkit.getdefaulttoolkit().getscreensize()); bufferedimage capture = new robot().createscreencapture(screenrect); imageio.write(capture, "bmp", new file("printscreen.bmp")); but can't seem create file. s/printscreen.bmp/"printscreen.bmp"

xslt - How to add @xml:base to my .xml files? -

i need stylesheet convert docbook xml files include xml:base element section tags. how go doing (since xml:base needs system , node info???) input: <section xmlns="http://docbook.org/ns/docbook" xml:id="voidvisit" version="5"> <title>void</title> <section> <title>screenshot</title> <mediaobject> <imageobject> <imagedata fileref="screenshots/dialog.png" /> </imageobject> </mediaobject> </section> </section> output: ... <section xml:id="void" version="5" xml:base="file:/c:/projects/my/proj/trunk/spec/module/components/void.xml"> <title>void</title> <section> <title>screenshot</title> <mediaobject> <imageobject> <imagedata fileref="screenshots/dialog.pn...

xml - Java: Oracle XMLType + JDBC -

how can oracle xmlelement jdbc? java.sql.statement st = connection.createstatement(); // works oracle.jdbc.oracleresultset rs = st.execute("select xmlelement("name") dual"); rs.getstring(1); // returns null, why? oracle.sql.opaque = (opaque) rs.getobject(1); // works, wtf opaque ? basically, want read string <name> </name> or whatever xml formatted output. fail cast output reasonable. weird oracle.sql.opaque works, totally dont know that. tostring() not overriden! any ideas? how read oracle's (i using oracle 10.0.2) xmlelement (xmltype) ? you can't. oracle's jdbc driver not support jdbc xml type properly. the thing can do, convert xml part of query: select to_clob(xmlelement("name")) dual then can retrieve xml using getstring() alternatively can use xmlelement("name").getclobval() , again part of query , can accessed string within java class

How do I immediately load another page in JSP/Spring? -

i'm not experienced in jsp. have application, uses spring framework, search. show these results in jsp page. when search returns 1 item, want jump page shows information item. is possible in jsp/spring? i've seen tags like: <c:redirect url="/somepage.html"/> that's jsp file. want (this naive bit of code)... <c:when test="${cmd.totalresults = 1}"> <c:redirect url="/loaditeminfo.html?id=someid"/> </c:when> thanks in advance advice , help! can omit regarding parameters involved; can figure out. i'm asking making happen. page loads. page sees there 1 result. page goes page result, happens anyway when user clicks search result. saves click. you should check number of items logic in spring controller not in jsp file. inside spring controller may have this: if(items.size==1){ //query items[0] info return new modelandview("iteminfo",model); } else{ return new model...

regex - How to compare Unicode characters in SQL server? -

hi trying find rows in database (sql server) have character é in text executing following queries. select count(*) t_question patindex(n'%[\xe9]%',question) > 0; select count(*) t_question patindex(n'%[\u00e9]%',question) > 0; but found 2 problems: (a) both of them returning different number of rows , (b) returning rows not have specified character. is way constructing regular expression , comparing unicode correct? edit: the question column stored using datatype nvarchar . following query gives correct result though. select count(*) t_question question n'%é%'; why not use select count(*) t_question question n'%é%' ? nb: like and patindex not accept regular expressions. in sql server pattern syntax [\xe9] means match single character within specified set . i.e. match \ , x , e or 9 . of following strings match pattern. "elephant" "axis" "99.9"

c# - Associate data with a thread: How do you do that? -

while writing aysnc controllers in asp.net mvc2, ran against situation had call asyncmanager.sync . got me wondering: when retrieve httpcontext.current , what's going on? how asp.net know httpcontext i'm after? how current context associated thread, , how retrieved? thread scoped storage used, called thread local storage . this mechanism allows data affinitized thread i.e. thread allocates data sees data. useful creating called ambient programming models such httpcontext.current , transactionscope. mechanism allows data accessible @ time on executing thread without having "tramp" data through method parameters instance. it's elegant solution context\orthogonal problems. there number of ways of using tls including threadstaticattribute , thread.setdata\getdata.

asp.net - Report Viewer Control Version 10 Not Paging -

i upgraded report viewer control version 9 version 10, , paging controls don't work. whether use next button, last page button, or type in page number, after postback page reset one. i know dataset has more 1 page of data, , returned me in full if export excel via report toolbar. the chrome javascript console shows no errors, , inspection of postback generated paging control in fiddler yields nothing wrong. when manually set page number 2 , inspect form fields in fiddler, see form field looks currentpage property, , value indeed 2. when reloading page, number reset 1. the report viewer displays local rdlc report. opened in vs2010 , opted upgrade format, in case, no avail. i have tried async rendering on , off, no good. i using ajaxcontroltoolkit script manager on master page, instead of asp:scriptmanager. a possibly related issue: getting assembly load error looking system.web.ajax. unable find dll in add reference dialog. ended copying bin folder, machine on proble...