input
stringlengths
51
42.3k
output
stringlengths
18
55k
C# Why is my code throwing a io.system.directorynotfound? <p>Why would the code below throw a io.system.directorynotfound exception? I can't recreate the problem myself but another user of my code does see it, any ideas why? Thanks</p> <pre><code>try { //create path string strAppData = Environment.GetFolderPath(En...
<p>Have you tried using System.IO.Directory.Exists rather than System.IO.File.Exists when checking to see if the path exists?</p>
SharePoint user's AD group membership <p>I've been tasked with creating a SharePoint web part for our new web site. One of the things it needs to know is which AD groups the current user belongs to (each site user will belong to one or more special security groups within the domain.) Is there a part of the SharePoint A...
<p>I would just do an LDAP query directly. This is much simpler and the LDAP interface to Active Directory is well documented.</p>
In WSE services, with custom types, do constructors work on the consuming client's side? <p>I have custom types in a WSE web service.</p> <p>the consuming client can't seem to see my constructor when instantiating a class, is this normal?</p>
<p>Yes.</p> <p>Web services do not pass objects, they pass messages. The class on the client side is simply a holder for properties on that message, it will not have implementation beyond that.</p>
TransactionScope and multi-threading <p>I was wondering how you would use the TransactionScope class in the correct way when you are dealing with multithreading?</p> <p>We create a new scope in our main thread and then we spawn of a couple of worker threads and we want these to participate in the main scope, so that f...
<p>See <a href="http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">MSDN</a>:</p> <blockquote> <p>You should also use the TransactionScope and DependentTransaction class for applications that require the use of the same transaction across multiple function calls or multiple thr...
Wordpress and Widget using TinyMCE <p>I have written a Text/HTML widget that uses TinyMCE to allow some basic formatting. However, when I save the changes, the data in the textarea is not getting posted. If I use just a simple textarea without TinyMCE then I can save the data properly. Any ideas?</p>
<p>I've experienced this issue recently as well. Just solved it, actually. :)</p> <p>If you write a PHP function to include your tinyMCE code and run the Javascript init, you can include that in admin_head ( add_action('admin_print_scripts-widgets.php', 'NAME OF YOUR INIT FUNCTION HERE'); ).</p> <p>Currently I've als...
White papers on logging <p>I am planning to create a logging framework for Java/J2EE from scratch.In this regard I want some white papers on common industry logging standards for reference.Any pointers to the same are appreciated.</p>
<p>Google 'log4j sucks' or something similar, and try to find out everything you can about what's wrong with the current frameworks. Since they obviously don't meet your needs.</p>
RichFaces: Displaying a notification "popup" when AJAX operation succeeded <p>We are currently developing a B2B web shop based on Java EE 5, JSF, Facelets and RichFaces. The technology has really worked very well so far, but now I am facing a small problem I just can't figure out how to solve:</p> <p>Products are list...
<p>you can try <code>rich:notify</code> for this <a href="http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=notify&amp;skin=blueSky" rel="nofollow">http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=notify&amp;skin=blueSky</a></p>
Binding a static text box to a checkbox <p>I need some help in MFC. The following is my problem:</p> <ol> <li>I have two controls a static text and a checkbox</li> <li>When using MFC Wizard, i place a '&amp;' in front of one of the letters in the static text, while executing if i press Alt+, the checkbox either gets e...
<p>Since the static text is not associated with the checkbox control, how can the system know which checkbox it should link? I bet if you look at the TAB ordering and the group settings of the controls, you will arrive at your solution.</p>
What is the workaround for unaligned memory access exception on ARM9 using C? <p>Architecture ARM9. Programming Language C.</p> <p>We have a third-party stack and one of the calls takes a pointer(<code>pBuffer</code>) to a memory location. Within the stack, they are free to move around the pointer passed and access it...
<p>Copy the value byte by byte. Cast it to a (unsigned) char pointer, and then copy a byte at a time.</p> <p>It's not pretty, but it doesn't sound like you have many options.</p>
How can I make the Django contrib Admin change list for a particular model class editable with drop downs for related items displayed in the listing? <p>Basically I want to have an editable form for related entries instead of a static listing. </p>
<p>Try Django 1.1 beta. It's got the option to make items in the changelist editable (as well as incorporating the django-batchadmin project) </p>
Django syncdb locking up on table creation <p>I've added new models and pushed to our staging server, run syncdb to create their tables, and it locks up. It gets as far as 'Create table photos_photousertag' and postgres output shows the notice for creation of 'photos_photousertag_id_seq', but otherwise i get nothing on...
<p>We use postgres, and while we've not run into this particular issue, there are some steps you may find helpful in debugging:</p> <p>a. What version of postgres and psycopg2 are you using? For that matter, what version of django?</p> <p>b. Try running the syncdb command with the "--verbosity=2" option to show all o...
customize cout <p>How can I derive a class from <code>cout</code> so that, for example, writing to it</p> <p><code>new_cout &lt;&lt; "message";</code></p> <p>would be equivalent to</p> <p><code>cout &lt;&lt; __FUNCTION__ &lt;&lt; "message" &lt;&lt; "end of message" &lt;&lt; endl;</code></p>
<pre><code>class Log { public: Log(const std::string &amp;funcName) { std::cout &lt;&lt; funcName &lt;&lt; ": "; } template &lt;class T&gt; Log &amp;operator&lt;&lt;(const T &amp;v) { std::cout &lt;&lt; v; return *this; } ~Log() { std::cout &lt;&lt; ...
Know of any source-control "stash"-like programs? <p>I once ran across a commercial tool for Windows that allowed you to "stash" code changes outside of source control but now I can't remember the name of it. It would copy the current version of a document to a backup location and undo your checkout in source control. ...
<p>Git: <a href="http://git-scm.com/" rel="nofollow">http://git-scm.com/</a></p> <p>You can use <code>git stash</code> to temporarily put away your current set of changes: <a href="http://git-scm.com/docs/git-stash" rel="nofollow">http://git-scm.com/docs/git-stash</a> . This stores your changes locally (without commit...
Common interface for different OpenID providers and Facebook <p>Is stack overflow uisng https://rpxnow.com/ for login in using different services. If so is it good, and does it have good (preferable free, preferable with PHP api) alternatives.</p> <p>What I'm looking for is a login page wich would allow users to login...
<p>No, StackOverflow does not use RPXNow. And if you choose to use it be careful to avoid <a href="http://blog.nerdbank.net/2009/01/why-using-rpxnow-is-bad-idea.html" rel="nofollow">its pitfalls</a>. </p> <p>I suggest you just accept OpenID, which covers many, many Providers (who uses Facebook but doesn't use one of...
How can I copy my git revision history into svn? <p>I use Git, but some of my colleagues are unable to move away from SVN right now. We want the integration between the two systems to be seamless -- all of our development has been in git so far, so we need to copy that over into svn with complete revision history. </p>...
<p>Have you tried creating the svn repository, git-svn clonning it, git-pull'ing from the old git repo (the one with all the history), git-rebase those changes into the master branch, then git-svn dcommitting the changes up to svn? That's just off the top of my head, but might work.</p> <p>Googling for "git svn export...
Python, __init__ and self confusion <p>Alright, so I was taking a look at some source when I came across this:</p> <pre><code>&gt;&gt;&gt; def __parse(self, filename): ... "parse ID3v1.0 tags from MP3 file" ... self.clear() ... try: ... fsock = open(filename, "rb", 0) ... ...
<p>The <code>def __parse</code> was inside some class definition.</p> <p>You can't pull the method defs out of the class definitions. The method function definition is part of the class.</p> <p>Look at these two examples:</p> <pre><code>def add( a, b ): return a + b </code></pre> <p>And</p> <pre><code>class A...
In Python 2.6, How Might You Pass a List Object to a Method Which Expects A List of Arguments? <p>I have a list full of various bits of information that I would like to pass to several strings for inclusion via the new string <code>format</code> method. As a toy example, let us define </p> <p><code>thelist = ['a', 'b...
<p><code>.format(*thelist)</code></p> <p>It's part of the calling syntax in Python. I don't know the name either, and I'm not convinced it has one. See the <a href="http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists">tutorial</a>.</p> <p>It doesn't just work on lists, though, it works for any i...
Regarding JavaScript for() loop voodoo <p>I was for quite some time under the impression that a <code>for</code> loop could exist <em>solely</em> in the following format:</p> <pre><code>for (INITIALIZER; STOP CONDITION; INC(DEC)REMENTER) { CODE } </code></pre> <p>This is, however, most <em>definitely</em> not t...
<pre><code>shuffle = function(o){ for ( var j, // declare j x, // declare x i = o.length; // declare i and set to o.length i; // loop while i evaluates true j = parseInt(Math.random() * i), // j=random nu...
ClickOnce deployment for restricted users <p>From firsthand experience, it appears that ClickOnce only installs for the current user, and there is no option to install for all users. This is a problem because some users within the company need to use ClickOnce applications but do not have permissions to install applic...
<p>ClickOnce should allow these users to install anyway. That's the point of ClickOnce: it allows restricted users to install your app. Otherwise you could just distribute an msi using group policy.</p>
Where to get D for .Net <p>Where can I get D for the .Net framework?</p>
<p>(Heavily edited.)</p> <p>Assuming you mean <a href="http://en.wikipedia.org/wiki/D%5Fprogramming%5Flanguage" rel="nofollow">D the programming language</a>, you can't currently do so. The currently released D compilers compile to native code, not managed code. A port is in progress, and this <a href="http://www.inf...
Go to the end of the C++ function in Vim <p>If I am in the middle of the function, I would like go to the very end of it in vim. I run into this problem as we sometimes have function of 500+ lines long (don't ask why). </p> <p>I use vim, gvim.</p>
<p><code>][</code> goes to the next '}' in the first column.</p> <p>Read <code>:help 29.3</code> to find out more about moving through a program.</p>
What is the question mark's significance in MySQL at "WHERE column = ?"? <p>I am dissecting some code and came across this, </p> <pre><code>$sql = 'SELECT page.*, author.name AS author, updator.name AS updator ' . 'FROM '.TABLE_PREFIX.'page AS page ' . 'LEFT JOIN '.TABLE_PREFIX.'user AS author ON author.id =...
<p>Prepared statments use the '?' in MySQL to allow for binding params to the statement. Highly regarded as more secure against SQL injections if used properly. This also allows for quicker SQL queries as the request only has to be compiled once and can be reused.</p>
How can I access runat="server" ASP element using javascript? <p>It seems everyone is doing this (in code posts etc.)...but I dont' know how :(</p> <p>whenever i try to manipulate an asp element using javascript i get a "element is null" or "document is undefined" etc. error.....</p> <p>javascript works fine usually,...
<p>What's probably happening is that your element/control is within one or more ASP.NET controls which act as naming containers (Master page, ITemplate, Wizard, etc), and that's causing its ID to change.</p> <p>You can use "view source" in your browser to confirm that's what's happening in the rendered HTML.</p> <p>I...
Regular expression for finding a regular expression? <p>Does anyone have code for finding a file that contains a regular expression? I would assume you could have two different flavors, one for BREs and one for EREs.</p> <p>You would think some kind of test suites would have something like an isRegex() test. Can any...
<p>Regular expressions are themselves not a <a href="http://en.wikipedia.org/wiki/Regular%5Flanguage">regular language</a>. The clue is that they contain parentheses and square brackets and such that must be balanced. </p> <p>A regular expression itself can be described by a <a href="http://en.wikipedia.org/wiki/Con...
inspect javascript calls for gmail's buttons <p>i'm working on a greasemonkey script for gmail in which it'd be very useful to know what function call is made when the "send" button is clicked. (i was unable to find this using firebug, but am relatively new to javascript debugging.) it seems that one should be able to ...
<p>Gmail's Javascript code is obfuscated to avoid this type of inspection (and also to reduce code size). It is very unlikely you'll be able to make heads or tails of it even if you manage to get Firebug to breakpoint in the code properly.</p>
TLS connection with timeouts (and a few other difficulties) <p>I have a HTTP client in Python which needs to use TLS. I need not only to make encrypted connections but also to retrieve info from the remote machine, such as the certificate issuer. I need to make connection to many HTTP servers, often badly behaved, so I...
<p>Although I've never used it for exactly this purpose, <a href="http://twistedmatrix.com" rel="nofollow">Twisted</a> should do what you want. The only downside is that it's a rather large library, and you will also need to install <a href="http://pyopenssl.sourceforge.net/" rel="nofollow">PyOpenSSL</a> (Twisted depe...
python class __getitem__ negative index handling <p>Is there a common function to do this? Right now I'm just doing the following (and overriding __len__)</p> <pre><code>idx &lt; 0: idx = len(self) + idx if idx &lt; 0 or idx &gt;= len(self): raise IndexError, "array index (%d) out of range [0, %d)" %(idx, len(...
<p>That seems fine to me. I don't think there is a better or built-in way to do that; overriding is about providing your own functionality, after all.</p> <p>Edited to remove rather stupid suggestion.</p>
Javascript menu conflict <p>I'm having a Javascript conflict. I have a vertical javascript left nav menu and a horizontal javascript time zone menu. Working code for both but when I call them within the same page, the menu tree does not work. If i take out the <code>&lt;SCRIPT src="timezone.js" type=text/javascript&gt;...
<p>They're both setting window.onload.</p> <p>The quick fix is to change timezone.js from this:</p> <pre><code>onload=function(){ var root = document.getElementById('zonediv'); ... </code></pre> <p>to this</p> <pre><code>var oldOnload = window.onload; window.onload = function() { if (oldOnload) oldOnloa...
Unable to show siteA's content at siteB by domain masking <p>I have a domain <em>www.siteA.com</em>, which uses Joomla, while the domain <em>www.siteB.com</em> is empty.</p> <p>I would like to show the content of the domain <em>www.siteA.com</em> at <em>www.siteB.com</em>.</p> <p>I tried to solve the problem first by...
<pre><code>RewriteEngine On RewriteRule ^.*$ http://www.siteA.tld/$1 [NC] </code></pre> <p>This should rewrite every request to siteA.</p>
Tab-completion in Python interpreter in OS X Terminal <p>Several months ago, I wrote a <a href="http://igotgenes.blogspot.com/2009/01/tab-completion-and-history-in-python.html">blog post</a> detailing how to achieve tab-completion in the standard Python interactive interpreter--a feature I once thought only available i...
<p>This should work under Leopard's python:</p> <pre><code>import rlcompleter import readline readline.parse_and_bind ("bind ^I rl_complete") </code></pre> <p>Whereas this one does not:</p> <pre><code>import readline, rlcompleter readline.parse_and_bind("tab: complete") </code></pre> <p>Save it in ~/.pythonrc.py an...
Mimic AES_ENCRYPT and AES_DECRYPT functions in Ruby <p>I need to mimic what MySQL does when encrypting and decrypting strings using built-in functions AES_ENCRYPT() and AES_DECRYPT().</p> <p>I have read a couple of blog posts and apparently MySQL uses AES 128-bit encryption for those functions. On top of that, since t...
<p>For future reference:</p> <p>According to the blog post I sent before, here's how MySQL works with the key you provide AES_ENCRYPT / DECRYPT:</p> <blockquote> <p>"The algorithm just creates a 16 byte buffer set to all zero, then loops through all the characters of the string you provide and does an as...
What's the best way to embed HTML within a HTML page in a content management system? <p>I'm in the process of building a content management system for a scientific journal. The system is designed with content "blocks" that editors can manipulate using the FCKEditor. I am trying to display these "blocks" read-only in ...
<p>Just let them put anything they want on FCKEditor, and before saving it to the database use <a href="http://htmlpurifier.org/" rel="nofollow">http://htmlpurifier.org/</a> to filter out all the "bad html"</p>
How do I parameterize an extended Collection <p>I've been trying to extend the ArrayList class without much success. I want to extend it, and be able to parameterize it.</p> <p>So normally you have something like</p> <pre><code>ArrayList&lt;SomeObject&gt; list = new ArrayList&lt;SomeObject&gt;(); </code></pre> <p>I ...
<p>You need to specify a type for the <code>ArrayList</code>'s type parameter. For generic type parameters, <code>T</code> is fairly common. Since the compiler doesn't know what a <code>T</code> is, you need to add a type parameter to <code>MyList</code> that can have the type passed in. Thus, you get:</p> <pre><code>...
How do i use a hashing computed column after i have indexed a varchar(max) field? <p>I created a computed column of type varbinary and referenced a varchar(max) field. Now, how do i use or invoke it? </p> <p>thanks</p>
<pre><code>SELECT computedcolumn FROM table </code></pre> <p>For indexing, look for "computed columns" in the <a href="http://msdn.microsoft.com/en-us/library/ms188783%28SQL.90%29.aspx" rel="nofollow">CREATE INDEX</a> statment. There are rules such as deterministic, and no longer than 900 bytes etc.</p> <p>Is...
DDL not executing properly inside of an IF NOT EXISTS statement on SQL Server 2005 <p>I have a fairly complex database that needs to be deployed to a variety of servers which may or may not potentially have existing parts of the DB already implemented on it. To work around this contingency I have setup the following te...
<p>Try removing the 'go' statements within the begin..end block, see if that helps.</p>
C#: "The table 'sometable' cannot be the child table to itself in nested relations." <pre><code>public string GetArtistThumbnail(string artistName) { var request = WebRequest.Create("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&amp;artist=" + artistName + "&amp;api_key=" + APIKey...
<p>As far as I know, DataSets aren't meant to hold just about any type of XML. Do you really need a dataset in this case? </p> <p>I suggest switching to linq 2 xml or XmlDocument to manipulate the results of the web service.</p>
A question about run program <p>How can I run my application (written in C#) and use a SQL Server database without having to install SQL Server first?</p>
<p>If it needs to connect to a Microsoft SQL Server database in order to work, then you need to run it on a network where you have a Microsoft SQL Server installed somewhere.</p> <p>You can use the SQL Server Express, found <a href="http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx" rel="nofollow">here</a>, i...
Finding your application's URL with only a ServletContext <p>I'm writing a Java web app using Spring MVC. I have a background process that goes through the database and finds notifications that must be e-mailed to my users. These e-mail messages need to include hyperlinks to the application. This seems like a fairly co...
<p>It is not recommended to dynamically prepare the URL at run time, especially based on ServletRequest. This is primarily because you have no idea of the URL that users would be using to access the application - the application server could be behind a web server, a firewall or a load balancer. To keep it short, one c...
Typesetting New Functions in LaTeX <p>So, I just have a little question:</p> <p>What is the "best way" to typeset new functions in LaTeX which aren't already included in the various packages? Right now I'm just using <code>\mbox</code> as my go-to method, but I just was wondering if there was a more "acceptable way ...
<p><code>\DeclareMathOperator</code> (or, if you're using some weird distribution of LaTeX that doesn't have the AMS packages, <code>\mathop{\mathrm{Erfi}}</code>)</p> <p>See the always-useful UK TeX FAQ, specifically <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=newfunction">Defining a new log-like function...
Software/languages for online structured data collection from (human) clients <p>I need to develop a web interface to collect and validate a range of data from many of my organization's clients.</p> <p>This isn't a single form, but a collection of forms with interdependencies (i.e., field X on form Y is needed if fiel...
<p>Sounds like you're looking for survey software. If you want to follow the principle of "buy, don't build," take a look at <a href="http://www.surveymonkey.com" rel="nofollow">http://www.surveymonkey.com</a>. If you want this hosted in-house, then <a href="http://www.quask.com/" rel="nofollow">http://www.quask.com/</...
Linux: Mapping Windows key to M-x for the purpose of emacs usage <p>I am an emacs user (on linux laptop) looking to make better use of my keyboard settings. The windows key is unused on my keyboard... is there any way to map it to m-x? This might make many emacs commands faster.</p> <p>Thanks,</p> <p>SetJmp</p>
<p>Use <code>xmodmap</code> to make it the <code>Menu</code> key, as in</p> <pre><code>keycode 115 = Menu </code></pre> <p>You will have to use <code>xev</code> to find out if the Windows key is key 115 on your keyboard.</p>
SDL/C++ OpenGL Program, how do I stop SDL from catching SIGINT <p>I am using <a href="http://www.libsdl.org/">SDL</a> for an OpenGL application, running on Linux. My problem is that SDL is catching SIGINT and ignoring it. This is a pain because I am developing through a screen session, and I can't kill the running prog...
<p>Ctrl-C at the console generates an SDL_QUIT event. You can watch for this event using SDL_PollEvent or SDL_WaitEvent, and exit (cleanly) when it is detected.</p> <p>Note that other actions can generate an SDL_QUIT event (e.g. attempting to close your main window via the window manager).</p>
How to Implement multi language in PHP application? <p>I'm posting this question on it's own as I found post one which lacks full explanation or the best way to do it.</p> <p>Should I use a language file to name items like:</p> <p>$first_name= 'name'; $last_name = 'last_name';</p> <p>and then include this file depen...
<p>You can follow in the footsteps of phpBB - they use a <code>$lang[]</code> array with code that looks like:</p> <pre><code>$lang['Next'] = 'Next'; $lang['Previous'] = 'Previous'; $lang['Goto_page'] = 'Goto page'; $lang['Joined'] = 'Joined'; $lang['IP_Address'] = 'IP Address'; $lang['Select_forum'] = 'Select a foru...
Can a makefile update the calling environment? <p>Is it possible to update the environment from a makefile? I want to be able to create a target to set the client environment variables for them. Something like this:</p> <pre><code>AXIS2_HOME ?= /usr/local/axis2-1.4.1 JAVA_HOME ?= /usr/java/latest CLASSPATH := foo fo...
<p>No, you can't update the environment in the calling process this way. In general, a subprocess cannot modify the environment of the parent process. One notable exception is batch files on Windows, when run from a cmd shell. Based on the example you show, I guess you are not running on Windows though.</p> <p>Usua...
Options for asp.net MVC Validation Framework <p>I'm thinking of two options right now for model-base validation for an ASP.net project I'm starting:</p> <p><a href="http://xval.codeplex.com/" rel="nofollow">xVal</a> (Steve Sanderson's project) and the Enterprise module that Stephen Walther uses on <a href="http://www....
<p>One difference I see in reviewing the two is that Stephen Walther's blog post describes a library which does only validation in the Web server, where as xVal works with jQuery validators to do in-browser validation, as well. This feature, incidentally, is almost completely automatic.</p>
How do we perform multi threading application in C#? <p><strong>Duplicate of</strong></p> <ul> <li><a href="http://stackoverflow.com/questions/177488/c-threading">c# threading</a></li> <li><a href="http://stackoverflow.com/questions/533042/beginners-threading-in-c">Beginners threading in C#</a></li> <li><a href="http:...
<p>There is a good resource by Joseph Albahari..</p> <p><a href="http://www.albahari.com/threading/" rel="nofollow">Threading in C#</a></p>
Do you follow any guidelines (java) in packaging? <p>Do you follow any design guidelines in java packaging?</p> <p>is proper packaging is part of the design skill? are there any document about it?</p> <p>Edit : How packages has to depend on each other?, is cyclic packages unavoidable?, not about jar or war files.</p>...
<p>My approach that I try to follow normally looks like this:</p> <ol> <li>Have packages of reasonable size. Less then 3 classes is strange. Less then 10 is good. More then 30 is not acceptable. I'm normally not very strict about this.</li> <li>Don't have dependency cycles between packages. This one is tough since man...
How to make use of full bandwidth? <p>Using WinPcap I crafted a series of custom UDP packets and injected them into the Ethernet layer.</p> <p>I sent 1000 packets, 1440 bytes each. It takes 2.1 sec for 100 Mbps bandwidth.</p> <p>How do I make use of full bandwidth?</p>
<p>Your throughput seems to be exactly the max you'd get for a <em>10 mbit</em> connection. Sure there's no 10mbit involved anywhere ?</p>
creating something like pageflakes <p>Does anyone know about a tutorial that lets you to create something like pageflakes.com for your website? In jquery perhaps?</p>
<p>The creator of PageFlakes, <a href="http://msmvps.com/blogs/omar/" rel="nofollow">Omar al Zabir</a>, has created an open-source web portal called <a href="http://www.codeplex.com/dropthings/" rel="nofollow">DropThings</a>. Can't get any more similiar to PageFlakes than that!</p>
Different ways of loading a file as an InputStream <p>What's the difference between:</p> <pre><code>InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName) </code></pre> <p>and</p> <pre><code>InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName) </code>...
<p>There are subtle differences as to how the <code>fileName</code> you are passing is interpreted. Basically, you have 2 different methods: <code>ClassLoader.getResourceAsStream()</code> and <code>Class.getResourceAsStream()</code>. These two methods will locate the resource differently.</p> <p>In <code>Class.getReso...
How do i get the Sum in this Linq query? <p>i have a table that has zero to many children. just like how this site has a <code>QUESTION</code> which can have zero to many <code>VOTES</code> (either Up == 1 or Down == 0).</p> <p>I need to get <em>all questions that have the most up votes</em>. Eg. all the questions, or...
<pre><code>myDataContext.Questions .OrderByDescending(q =&gt; q.Votes.Select(v =&gt; v.VoteValue).Sum()) </code></pre> <p>In query comprehension (unchecked):</p> <pre><code>from q in myDataContext.Questions order q by ( from v in q.Votes select v.VoteValue ).Sum() descending select q; </code></pre>
Read eclipse installation path using eclipse API <p>I opened eclipse 3.3.2. Now i need to get the current eclispe installation path. Is</p> <p>there any eclipse API to get the eclipse installation path? Please help in this regard.</p> <p>Thanks in Advance..</p> <p>Snehal</p>
<p>Since eclipse3.4 and the <a href="http://dev.eclipse.org/mhonarc/lists/eclipse-pmc/msg00341.html">p2 mechanism</a>, you coud use <a href="http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/osgi/service/datalocation/Location.html"><code>org.eclipse.osgi.service.data...
Listview Selection <p>HI,</p> <p>I need to select a single item(cell) in a listview </p>
<p>You cannot select 'subitems' in a ListView. If you want to be able to select 'cells', you'll have to use a gridview.</p>
Play 1 sound clip after another without any interruption in iPhone <p>I am developing a simple iPhone sound app. How can I play 1 sound clip after another without any interruption ?</p>
<p>Are you using SystemSounds or AudioQueues? If SystemSounds (for short sounds), you'll need to have a thread that plays them at a specific time interval, as there is no way to know when the sound ends.</p> <p>For AudioQueues, you get callbacks when each section of a sound is finished, and so it's a fairly easy thin...
Eclipse + Git - what does "staged" mean? <p>After working for some time with SVN I decided to try git with my new django project and installed the plugin for it into eclipse. I made a new pydev project and added django initial project files to the src directory. Then I "shared" the project to Git, added and commited ...
<p>It means your file has been added to the <a href="http://gitready.com/beginner/2009/01/18/the-staging-area.html">index</a>.</p> <p><img src="http://i.stack.imgur.com/W7tgI.png" alt="index"></p> <p>As described in <a href="http://tomayko.com/writings/the-thing-about-git">The Thing About Git</a></p> <p>The Index is...
Web crawlers and Google App Engine Hosted applications <p>Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version?</p>
<p>While Google hadn't exposed scheduling, queue and background tasks API, you can do any processing only as an answer to external HTTP request. You'd need some heartbeat service that will process one item from crawler's queue at a time (not to hit GAE limits).</p> <p>To do crawling from GAE, you have to split your ap...
How change List<T> data to IQueryable<T> data <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/73542/ilistt-to-iqueryablet">IList&lt;T&gt; to IQueryable&lt;T&gt;</a> </p> </blockquote> <p>I have a List data, but I want a IQueryable data , is it possible from ...
<pre><code>var list = new List&lt;string&gt;(); var queryable = list.AsQueryable(); </code></pre> <p>Add a reference to: <code>System.Linq</code></p>
Is it possible to have windows integrated and forms auth on the same web app (same url)? <p>Basically I want to build a web app that will try windows authentication and if authentication fails then will provide the user with a login form ? </p> <p>I do not want to have different web apps for different authentication m...
<p>You could go into your IIS Error Pages settings and change the various target pages for the 401 error to point to a Windows Forms login page. That way, then the user bails out/fails for the three requested authentication attempts it redirects to another page.</p>
Vim search and replace selected text <p>Let's say we have a text, and I enter visual mode and select some text. How do I quickly do a search for the highlighted text and replace it with something else?</p>
<p>Try execute the following or put in into your .vimrc</p> <pre><code>vnoremap &lt;C-r&gt; "hy:%s/&lt;C-r&gt;h//gc&lt;left&gt;&lt;left&gt;&lt;left&gt; </code></pre> <p>By pressing ctrl + r in the visual mode you will be prompted to enter text to replace with. Press enter and then confirm each change you agree with '...
What do I need to know before I sell a software license? <p>I've developed a web-based application that a company is interested in licensing. I suspect they intend to appropriate the features they want, and add to their existing codebase, so a license is likely to be a one-time affair. Since it's interpreted at run-tim...
<p>Answer this question: What are you afraid of? That they "steal" from you? As we Germans say: If you can trust someone, you don't need a contract. If you can't trust them, a contract won't save you.</p> <p>So sit back and think of what additional benefit this could give you. If the company likes your software, might...
Can Java annotations be unit tested? <p>I've recently started creating my own annotations and to sport TDD/BDD, I'd want to unit test my annotations to create a clear specification for them. However since annotations are basically merely fancy interfaces which to my knowledge can't be really instantiated directly, is t...
<p>Annotations have some impact (otherwise, it would be pointless to use them). So don't test the annotation presence but the effect it should have.</p>
Scaling HTML layout to the screen size <p>Could you tell me how to fix a HTML layout automatically with the screen resolution? Example, I am coding HTML in screen resolution of 1024 by 768 pixels. If I switch to 800 by 600 pixels, I want my HTML windows changed automatically to fix the screen. </p> <p>How could I do t...
<p>By <em>HTML window</em>, I assume that you are talking about HTML contents and not browser window.</p> <p>If this is the case, the keywords for what you want to do are <code>liquid/fluid/elastic design</code>.</p> <p>You may want to read <a href="http://www.alistapart.com/articles/elastic/" rel="nofollow">Elastic ...
jetty diplays the code of jsp files <p>I am trying to deploy my web application with jetty, but jetty diplays the code of jsp files at the adress: <a href="http://localhost:8080/index.jsp" rel="nofollow">http://localhost:8080/index.jsp</a> has this a relation to my browser?or is it a problem of jetty? Could someone hel...
<p>Make sure you include the jsp and jsp-api jars. Otherwise jetty is unable to render jsp pages.</p>
How do I set a global DateTime format in an ASP.NET project? <p>I have a server with German windows on it, but the DateTime values are stored on a mysql server in English format. How do i force every DateTime.ToString() method (like DateTime.Now.ToString()) to output an 'English' DateTime by default?</p>
<p>I'd set the culture in the web.config so any culture specific conversion or parsing i.e. dates, will use the same culture regardless of the underlying operating system region.</p> <p>i.e.</p> <pre><code>&lt;globalization culture="en-GB" uiCulture="en-GB"/&gt; </code></pre>
How to record something other than Linear PCM on iPhone <p>I'm having a hard time trying to record something other than linear PCM on the iPhone :-( The samples I've found (SDK's SpeakHere, Zdziarski's and Sadun's books and the one at trailsinthesand.com) all use linear PCM but I'd like a commonly used compressed forma...
<p>Keep looking at those docs. In "Core Audio Essentials", the section "Core Audio Plug-ins: Audio Units and Codecs" notes that:</p> <blockquote> <p>iPhone OS contains the recording codecs listed in Table 2-5. As you can see, neither MP3 nor AAC recording is available. This is due to the high CPU overhead, ...
WCF Service reference intermittently breaking <p>I have a service reference on my local dev environment to a WCF service hosted elswhere on our LAN, and it will just stop working at times with an error along the lines of "The document at the url was not recognized as a known document type."</p> <p>A system reboot does...
<p>It's a network issue. When I get the problem, I just repair my LAN connection, clear my DNS cache and things work again.</p>
What is Oracle Native web services? <p>Native web services is a new feature of the XML DB technology. In google i found that it`s very close to SOA.</p> <p>Can anyone simply explain: 1) what is the main usage of Native web services 2) what is the main difference of XML DB 11g and previous XML DB releases.</p> <p>Than...
<p><a href="http://www.inside-oracle-apex.com/oracle-11g-native-web-services/" rel="nofollow">found via google:</a></p> <blockquote> <p>It allows you to publish your PL/SQL packages/procedures/functions as a web service with zero coding and zero deployment effort! </p> </blockquote>
How can I databind a gridview to an arraylist in .NET? <p>How can I databind a gridview to an arraylist in .NET?</p> <p>I am using .NET 3.5 and Visual Studio 2008.</p>
<p>In place of arraylist use generic class BindingList. It will allow you to bind this list in two direcions to DataGridView. So your change in BindingList will be reflected in DGV and vice versa.</p> <p>Here you have more information about BindingList class: <a href="http://msdn.microsoft.com/en-us/library/ms132679.a...
Dictionary enumeration in C# <p>How do I enumerate a dictionary?</p> <p>Suppose I use <code>foreach()</code> for dictionay enumeration. I can't update a key/value pair inside <code>foreach()</code>. So I want some other method.</p>
<p>To enumerate a dictionary you either enumerate the values within it:</p> <pre><code>Dictionary&lt;int, string&gt; dic; foreach(string s in dic.Values) { Console.WriteLine(s); } </code></pre> <p>or the KeyValuePairs</p> <pre><code>foreach(KeyValuePair&lt;int, string&gt; kvp in dic) { Console.WriteLine("Key ...
how can I save results of a Fortran77 code into a text file? <p>I want to save results in a text file. How can I do that? Write command?</p>
<p>Yes, the write command. The details should be in some book, or on the net, but here's a simple example:</p> <pre><code>OPEN(UNIT=20, FILE='FILENAME.TXT', STATUS='NEW') C STATUS='NEW' WILL CREATE A NEW FILE IF ONE DOESN'T EXITST, 'REPLACE' WILL C OVERWRITE OLD ONE WRITE(UNIT=20, *)(A(I),I=1,10) CLOSE(UNIT=20) </code...
Private Member Access Java <p>Is the private member access at the class level or at the object level. If it is at the object level, then the following code should not compile</p> <pre><code> class PrivateMember { private int i; public PrivateMember() { i = 2; } public void printI() { System....
<p>As DevSolar has said, it's at the (top level) class level.</p> <p>From <a href="http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6" rel="nofollow">section 6.6 of the Java Language Specification</a>:</p> <blockquote> <p>Otherwise, if the member or constructor is declared private, then access...
XmlDocument, XmlResolver and www.w3.org <p>One of my users had a single error while opening a file (I'm using standard xml 1.0):</p> <pre><code>The remote name could not be resolved: 'www.w3.org' </code></pre> <p>I found a post here in <a href="http://stackoverflow.com/questions/217841/net-autogenerated-web-service-c...
<p>Another way to avoid connecting to the W3C site is to use <a href="http://msdn.microsoft.com/en-us/library/system.xml.resolvers.xmlpreloadedresolver.aspx" rel="nofollow"><code>XmlPreloadedResolver</code></a>. The <code>XmlPreloadedResolver</code> contains a number of "well-known" DTDs and (AFAIR) schemas embedded an...
Most advanced image compression today (not on browser)? <p>I am writing an application in Java to view images which contain a lot of text and graphics, like a screenshot of a webpage, actually its a image of a magazine article. Some parts are text, some parts are graphics.</p> <p>My client program is written in Java, ...
<p>You haven't supplied one key piece of information: does the compression need to be lossless or is lossy fine? And if lossy is fine withint what tolerance?</p> <p>You can reduce an entire image to a single bit of information if you're prepared to a highly lossy compression format. :-)</p> <p>Seriously though, the t...
Extensibility without Open-Source <p>My company is currently in the process of creating a large multi-tier software package in C#. We have taken a SOA approach to the structure and I was wondering whether anyone has any advice as to how to make it extensible by users with programming knowledge.</p> <p>This would invol...
<p>Just use interfaces. Define an IPlugin that every plugin must implement, and use a well defined messaging layer to allow the plugin to make changes in the main program. You may want to look at a program like Mediaportal or Meedios which heavily depend on user plugins.</p>
How can I open and close a browser window from a Java applet? <p>I would like to open a new window at Google.com, but then later close that window. My current code is as follows:</p> <pre><code>link="http://www.google.com" try { AppletContext a = getAppletContext(); URL url = new URL(link); a.showDocumen...
<p>I'd suggest using the JSObject interface to call into the browser for opening the windows. Then you can get the variable of the new window and use that to close it.</p> <p>More documentation:</p> <ul> <li><a href="http://www.novell.com/documentation/extendas35/docs/help/books/TechWindowOpenClose.html#978293" rel=...
What is the best way to create printable letters from an MVC application? <p>What's the best way to create printable letters from an MVC application? I'm looking for sort of a mail merge thing from my app that prints a form letter with various values filled in.</p> <p>In ASP.NET, I previously did this by creating an H...
<p>Since this is just HTML with the ContentType set to application/msword I can't see any reason why you would want to use code-behind.</p> <p>A standard MVC view with a typical HTML template peppered with appropriate <code>&lt;%=...&gt;</code> where view data needs to be inserted would seem to be the sensible approac...
IE (Z-index rendering problem) <p>I have an ASP.NET application that renders a 3rd party (Telerik's) menu control <em>under</em> another control (RadDock) when the menu expands.</p> <p>This artifact ONLY happens in IE7. Not in Safari/FF/Opera/Chrome (Have I left any out?) </p> <p>The menu control needs to be render...
<p>I don't know if this is similar or not, but I had an issue with z-indexing where when the z-index was applied to the elements of a container, but not to the container itself, the z-index wasn't being properly applied to the child elements. This manifested itself as background borders appearing over the top of the m...
How to fix this JQuery intellisense in Visual Studio 2008 problem? <p>How can i solve this problem "Error updating JScript IntelliSense: D:\myProject\js\jquery-1.3.2.js: Object doesn't support this property or method @ 2139:1", i did all in this <a href="http://stackoverflow.com/questions/218578/visual-studio-jscript-...
<p>Make sure you've got the <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2-vsdoc2.js" rel="nofollow">corresponding vsdoc file</a> sitting beside jquery-1.3.2.js (in /js/ in your case here), and that it's properly named <strong>jquery-1.3.2-vsdoc.js</strong>.</p> <p>Also, while I don't th...
Elevator pitch for Git a/o DVCS <p>Imagine you have a friend on the phone (not VoIP) who asks: "What's so special about Git? I'm fine using Subversion." What would be your "elevator pitch" in order to describe the advantage of using a DVCS like Git?</p>
<p>There was already <a href="http://stackoverflow.com/questions/871/why-is-git-better-than-subversion">a question similar to this</a>. Also, Eric Sink had a <a href="http://www.ericsink.com/entries/dvcs_dag_1.html" rel="nofollow">number</a> of <a href="http://www.ericsink.com/entries/dvcs_dag_2.html" rel="nofollow">ar...
how to read values in the column of a table in sqlserver? <p>There is a table called Friends. It has columns named Names, Address, Phone no, Dob. We want to use Names which are in Friends table one by one. so I want to store all names in an array which is to be used later.</p>
<p>Here's the rundown:</p> <p>In your .config file:</p> <pre><code>&lt;configuration&gt; &lt;connectionStrings&gt; &lt;add name="Test" connectionString="Data Source=[server name here];Initial Catalog=[db name here];User Name=blah;Password=blah"/&gt; &lt;/connectionStrings&gt; &lt;/configuration&gt; </code></p...
Which browsers have problems caching XMLHTTPRequest responses? <p>Do any of the currently popular browsers have particular problems caching* XMLHttpRequest responses that I need to be aware of?</p> <p>I'd like to be able to include XMLHttpRequest queries on every page as a method of dynamically loading content (ie JSO...
<p>Mark Nottingham has <a href="http://www.mnot.net/javascript/xmlhttprequest/cache.html">an excellent set of functional tests</a> that demonstrate browser XMLHttpRequest caching behaviour. Load up the page in the browsers you want to support and work out what techniques you can and cannot rely on to have your response...
Can't import java.lang.instrument.Instrumentation <p>If I try to use</p> <pre><code>import java.lang.instrument.Instrumentation; </code></pre> <p>it says this statement can not be resolved. What could be wrong? I am using jdk1.6.</p>
<p>Are you sure that's <em>exactly</em> your import line? It certainly works for me. Try just compiling this trivial test class:</p> <pre><code>import java.lang.instrument.Instrumentation; public class Test {} </code></pre>
How can I programmatically get the MAC address of an iphone <p>Does anyone know how to programmatically get an iPhone's MAC address and IP address?</p>
<hr> <p><strong>NOTE</strong> As of iOS7, you can no longer retrieve device MAC addresses. A fixed value will be returned rather than the actual MAC</p> <hr> <p>Somthing I stumbled across a while ago. Originally from <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/5293-get-current-ip-address.html...
Crippling Test Environments <p>We have a web application that is sufficiently complicated that it's hard to accurately simulate production load.</p> <p>One of our coping mechanisms has been to make sure that the hardware in the test environment is always slower that our production hardware, so load and performance pro...
<p>I have a 7-year-old 600mHz Celeron laptop with 256MB RAM that I keep around for performance profiling. For testing network latency, you could get a delay proxy (or write one trivially); it gets a packet, waits X milliseconds, then passes it on.</p>
wxPython: Making a scrollable DC <p>I am drawing inside a wx.Window using a PaintDC. I am drawing circles and stuff like that into that window. Problem is, sometimes the circles go outside the scope of the window. I want a scrollbar to automatically appear whenever the drawing gets too big. What do I do?</p>
<p>Use a <code>wx.ScrolledWindow</code> and set the size of the window as soon as your 'drawing go outside' the window with</p> <pre><code>SetVirtualSize(width,height) </code></pre> <p>If this size is bigger than the client size, then wx will show scrollbars. When drawing in the window make sure to use <code>CalcUnsc...
Do I need to explicitly call the base virtual destructor? <p>When overriding a class in C++ (with a virtual destructor) I am implementing the destructor again as virtual on the inheriting class, but do I need to call the base destructor?</p> <p>If so I imagine it's something like this...</p> <pre><code>MyChildClass::...
<p>No, destructors are called automatically in the reverse order of construction. (Base classes last). Do not call base class destructors.</p>
How does one troubleshoot log4net when it stops logging <p>It seems that Log4Net silently shuts down for reasons that are not obvious, and I'm at a loss how to troubleshoot it. My hunch is that a particular appender is failing on a specific log message and that seems to shut down the whole stack.</p> <p>Is there a wa...
<p>Expanding on the previous answer -</p> <p>To add a trace listener for the log4net.Internal.Debug trace, add this to your app config:</p> <pre><code> &lt;system.diagnostics&gt; &lt;trace autoflush="true"&gt; &lt;listeners&gt; &lt;add name="textWriterTraceListener" type="Sy...
One user can't run app <p>I have one user that can't run my iPhone app. It starts up fine but crashes once they select a row in the RootViewController. Selecting a row goes to another tableview. I'm using sqlite in the app bundle and deploy on initial install if no db is available. The db is there because the RootV...
<p>I would ask your user to delete the app from <em>both</em> the iPhone <em>and</em> iTunes and then reinstall it. That will help ensure they aren't getting the data restored.</p> <p>You may also want to make sure they haven't jailbroken their phone. In general, I try to ask for a wide variety of information:</p> ...
Key-Value based databases, can someone explain to me how to use them practically? <p>There seems to be a big push for key/value based databases, which I believe memcache to be.</p> <p>Is the value usually some sort of collection or xml file that would hold more meaningfull data?</p> <p>If yes, is it generally faster ...
<p>What has happened is that some really, <strong>really</strong>, <strong>REALLY</strong> big web sites like Google and Amazon occupy a teeny, tiny niche where their data storage and retrieval requirements are so different to anyone else's that a new way of storing/retrieving data is called for. I'm sure these guys k...
Too much recursion while performing .next in jQuery 1.3.2 <p>I've just upgraded to jQuery 1.3.2, which has mostly been fine, but I'm missing something when it comes to the new event model (I think)</p> <pre><code>$(document).ready(function() { $(".AspNet-Menu-NonLink").click(function() { $(this).next(...
<p>For starters, try using </p> <pre><code>$(".AspNet-Menu-NonLink").next("ul").hide(); </code></pre> <p>Instead. </p> <p>Otherwise, you're implicitly searching for, and returning <em>all</em> <code>ul</code> elements on the page and then passing that <em>massive</em> result to the "<code>next</code>" function. </p>...
Create custom generic list with bitmapimage <p>In my WPF project there is a listbox in which I have to display images and next to each image their text (for example : date the photo was taken, location etc). I have tried creating a generic List but I still can't assign it to the listbox</p> <p>Something like</p> <p>...
<p>Image element do support Uris for Source property. Why not making your LoadImages class return a set of Uris instead of images? Also image element can do async job for you ;)</p>
Win32 printing - cannot set landscape mode <p>I've got an old app that I need to get to print in landscape mode. The documentation I've found says to get a DEVMODE structure, change a couple of fields, and put it back in. What I've got is:</p> <pre><code> HANDLE printer_handle; LPHANDLE printer_handle_pointer...
<p>Have you posted the real code? </p> <p>Also, take a look at the DocumentProperties function signature:</p> <pre><code>LONG DocumentProperties( __in HWND hWnd, __in HANDLE hPrinter, __in LPTSTR pDeviceName, __out PDEVMODE pDevModeOutput, __in PDEVMODE pDevModeInput, _...
How to access Cognos PowerPlay Cubes with other applications? <p>There are Cognos PowerPlay Cubes (Cognos v7.3) which are distributed via Email and then stored on local clients. At the moment, users use MS Access as an interface to access the data and reports in the Cubes. Is there any other tool, application or progr...
<p>You can access Cognos PowerPlay cubes offline using the Cognos Powerplay version 7.x client, which I believe is packaged with the Transformer application that is used to create the cubes. It will most likely be better than anything you develop yourself.</p> <p>To my knowledge, there is no API for accessing the dat...
Set ViewData outside the controller <p>I'm trying to create a logger that will write the queries LINQ executes to the page formatted with the great javascript library SyntaxHighlighter.</p> <p>For that, I've set the DataContext's Log property to my custom logger, which is working well.</p> <p>Now I just need to get t...
<p>If you want to perform operations outside of the controller, then action-filters (etc) are a good bet; just inherit from <code>ActionFilterAttribute</code>, override <code>OnActionExecuting</code> (etc) to inject data into the view, and mark your controller with <code>[YourCustomFilter]</code>.</p> <p><a href="http...
Execute sql statement via JDBC with CLOB binding <p>I have the following query (column log is of type CLOB):</p> <pre><code>UPDATE table SET log=? where id=? </code></pre> <p>The query above works fine when using the setAsciiStream method to put a value longer than 4000 characters into the log column.</p> <p>But ins...
<p>BLOBs are not mutable from SQL (well, besides setting them to NULL), so to append, you would have to download the blob first, concatenate locally, and upload the result again.</p> <p>The usual solution is to write several records to the database with a common key and a sequence which tells the DB how to order the r...
How do you make a table read-only using ASP.NET's dynamic data scaffolding <p>How do you make individual tables and/or columns read-only so the edit button won't show in ASP.NET's Dynamic Data framework?</p> <p>I'm using it against an entity data context.</p> <p>Is it possible?</p>
<p>See my article here <a href="http://csharpbits.notaclue.net/2009/01/making-field-read-only-via.html" rel="nofollow">Making a Field Read-Only via the ReadOnlyAttribute – Dynamic Data</a> should get you what you want.</p>
WPF Style Trigger <p>I am trying to get a row in a datagrid to turn red if the value of a checkbox within the datagrid is true. Any ideas? Here is what I have so far. I am currently turning the columns red if the mouse rolls over the row.</p> <p></p> <p> </p> <...
<p>Take a look at <a href="http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx" rel="nofollow" title="Styling WPF DataGrid rows/columns">this blog post by Vincent Sibal</a>. Sibal gives several code examples of what you're trying t...
Convert Anchor style for Submit buttons? <p>I have a CSS class that makes my links look like nice looking buttons. I would like to be able to apply the same style to Submit buttons and make them look the same as well. The trickiest part is that the anchor tags need to have a span inside them, I don't think that is poss...
<p>Try using the <code>&lt;button&gt;</code> tag instead of <code>&lt;input type="submit"&gt;</code>. The <code>&lt;button&gt;</code> tag lets you nest elements like <code>&lt;span&gt;</code>, and generally gives you much more styling freedom.</p> <p>Once you have switched your forms' submit buttons to use the <code>&...
SQL injections with prepared statements? <p>If I remember correctly, I think Jeff has mentioned in the Stack Overflow podcast a possible weakness in SQL prepared statements. I'm wondering what kind(s) of weakness(es) did he refer to? Was it possibly just about <a href="http://www.owasp.org/index.php/Preventing%5FSQL%5F...
<p>I think what he said was that, when you use Prepared Statements, SQL server could cache your query execution plan, so, even if you modify some of the parameters on the executing query, the server could pick the wrong (probably cached) execution plan that would perform very badly.</p> <p>He also mentioned a new feat...
How can I add non-sequential numbers to a range? <p>I am trying to iterate through the range(750, 765) and add the non-sequential numbers 769, 770, 774. If I try adding the numbers after the range function, it returns the range list, then the individual numbers:</p> <pre><code> >>> for x in range(750, 765), 769, 770, ...
<p>Use the built-in + operator to append your non-sequential numbers to the range.</p> <pre><code>for x in range(750, 765) + [769, 770, 774]: print x </code></pre>