Posts

sql server - Prevent ADO.NET from using sp_executesql -

in our sql server 2005 database (tested using management studio dbcc freeproccache , dbcc dropcleanbuffers ), following statement fast (~0.2s compile time, ~0.1s execution time): select ... ... = 1 , b = '' ... the following statement, however, slow (~0.2s compile time, 7-11s execution time): exec sp_executesql n'select ... ... = @a , b = @b ...', n'@a int, @b nvarchar(4000), ...', @a=1, @b=n'', ... sql server chooses different execution plan, although queries equal. makes sense, since, in first case, sql server has actual values of a , b , other parameters available , can use statistics create better plan. apparently, query plan concrete values of parameters much better generic 1 , outweighs "query plan caching" performance benefit. now question: ado.net seems use second option (sp_executesql) when executing parameterized queries, usually makes sense (query plan caching, etc.). in our case, however, kills performance. so, t...

ruby on rails - `/usr/bin/file -i SOME_FILE` returns different result when deployed to Phusion Passenger -

i'm using /usr/bin/file -i some_file detect whether contains non-ascii-and-utf characters. however, produces different result when application deployed apache+passenger. in 'script/console', above line gives: some_file: text/plain; charset=utf-8 in passenger, gives: some_file: regular file since pointing absolute path of 'file', strange. i'm guessing library used different in passenger. comments? if not right way detect text file's encoding, best approach(in ruby)? thank much. i'm guessing difference between versions of 'file' utility between development machine , server. have tried running them terminal of both machines?

Java - Reading input from a file. java.io.FilterInputStream.available(Unknown Source)? -

i haven't written java in years , went refresh memory simple 'read-from-file' example. here code.. import java.io.*; public class filereading { public static void main(string[] args) { file file = new file("c:\\file.txt"); fileinputstream fs = null; bufferedinputstream bs = null; datainputstream ds = null; try { fs = new fileinputstream(file); bs = new bufferedinputstream(bs); ds = new datainputstream(ds); while(ds.available()!= 0) { string readline = ds.readline(); system.out.println(readline); } ds.close(); bs.close(); fs.close(); } catch(filenotfoundexception e) { e.printstacktrace(); } catch(ioexception e) { e.printstacktrace(); } } } this compiles fine (although apparently d...

project server - Using PSI Filter objects from Python -

i'm working sharepoint , projectserver 2007 via psi python. i can't find documentation on how filter class ( microsoft.office.project.server.library ) objects work internally emulate behaviour in python. any ideas? take @ colby africa's blog post . also, msdn docs here . edit the generated filter xml. here filter returns data "lookuptables" table (list of lookup tables): <?xml version="1.0" encoding="utf-16"?> <filter xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" filtertablename="lookuptables" xmlns="http://microsoft.com/projectserver/filterschema.xsd"> <fields> <field tablename="" fieldname="lt_uid" /> <field tablename="" fieldname="lt_name" /> <field tablename="" fieldname="lt_sort_order_enum" /> <field tablename...

Web parts in SharePoint -

i wonder if there's limit in sharepoint number of webparts can have in page. also, if web part zone has kind of limit, or if page can have number of web part zones. there no limits far can tell on sharepoint or asp.net side of things. of course, you'll limits of can fit in page (horizontally or vertically), matter.

ruby on rails - Acts_as_taggable_on link_to -

i installed acts taggable on plugin 'post' model, i'm unable call list of posts tagged tag. here's have in show. <%= link_to tag.name, posts_path(:view =>'tag', :tag => tag.name) %><% end %> except when click on it, shows posts. want show posts tagged keyword...what doing wrong here? thanks help modify controller code reads like: @posts = post.tagged_with(params[:tag], :on => 'tags')

java - Can I trigger an IceFaces action using JavaScript? -

if have simple button: <ice:panelgroup> <ice:commandbutton value="foobar" action="#{filemanager.opennoflashvisiblepopup}" /> </ice:panelgroup> is possible trigger action opennoflashvisiblepopup using javascript? know there icefaces has javascript bridge don't know see simple way this. i need because have chunk of javascript detects flash , need show icefaces popup. one way button element id , call click() function. document.getelementbyid('clientid').click(); you need give form , button fixed id can use generated html id clientid in javascript code.