input
stringlengths
51
42.3k
output
stringlengths
18
55k
Running JIRA on a VM <p>Anyone have any success or failure running Jira on a VM?</p> <p>I am setting up a new source control and defect tracking server. My server room is near full and my services group suggested a VM. I saw that a bunch of people are running SVN on VM (including NCSA). The VM would also free me fr...
<p>We just did the research for this, this is what we found:</p> <ul> <li>If you are planning to have a small number of projects (10-20) with 1,000 to 5,000 issues in total and about 100-200 users, a recent server (2.8+GHz CPU) with 256-512MB of available RAM should cater for your needs.</li> <li>If you are planning f...
Save and Restore Form Position and Size <p>In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application?</p> <p>Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's...
<pre><code>private void Form1_Load( object sender, EventArgs e ) { // restore location and size of the form on the desktop this.DesktopBounds = new Rectangle(Properties.Settings.Default.Location, Properties.Settings.Default.Size); // restore form's window state this.WindowState = ( FormWindo...
Python sockets suddenly timing out? <p>I came back today to an old script I had for logging into Gmail via SSL. The script worked fine last time I ran it (several months ago) but now it dies immediately with:</p> <pre><code>&lt;urlopen error The read operation timed out&gt; </code></pre> <p>If I set the timeout (no m...
<pre><code>import socket socket.setdefaulttimeout(30000) sock = socket.socket() sock.connect(('www.google.com', 443)) ssl = socket.ssl(sock) ssl.server() --&gt; '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com' </code></pre> <p>It works just fine. I can't reproduce your error.</p>
jQuery/JavaScript to replace broken images <p>I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.</p> <p>How do I use jQuery to get the set of images, filter it to broken images then replace the src?</p> <hr/> <p>--I thought ...
<p>Handle the <code>onError</code> event for the image to reassign its source using JavaScript:</p> <pre><code>function imgError(image) { image.onerror = ""; image.src = "/images/noimage.gif"; return true; } </code></pre> <pre><code>&lt;img src="image.png" onerror="imgError(this);"/&gt; </code></pre> <...
Casting array of objects (which implement interface IFoo) to IFoo[] in C# <pre><code>class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } </code></pre> <p>Q1: Why is <code>arrayOfA</code> not an array of <code>IFoos</code>?</p> <p>Q2: Why can't I cast <code>arrayOf...
<p><code>arrayOfA</code> <strong>is</strong> <code>IFoo[]</code>. </p> <p>There must be something else wrong with your program.</p> <p>You seem to have mocked up some code to show the problem, but in fact your code (see below) works as you expect. Try updating this question with the real code - or as close to real as...
Eventhandling in ascx usercontrols <p>What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this:</p> <pre><code>MyPage.aspx: &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server"&gt; &lt;uc1:MyUserControl ID="...
<p>You would want to create an event on the control that is subscribed to in the parent. See <a href="http://www.odetocode.com/code/94.aspx">OdeToCode</a> for an example.</p> <p>Here is the article for longevity sake:</p> <p>Some user controls are entirely self contained, for example, a user control displaying curren...
Built in unit-testing in VS <p>I'm looking for advice on the built-in unit testing feature provided in VS08. Can any body please tell me if they know of any reasons NOT to use this feature over any of the other packages available (I'm vaguely familiar with NUnit)?</p> <p>I'm planning on applying unit testing to an old...
<p>It looks like the discussion <a href="http://stackoverflow.com/questions/92869/nunit-vs-visual-studio-2008s-test-projects-for-unit-testing">here</a> can answer your question.</p>
Handling the data in an IN clause, with SQL parameters? <p>We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? Take the follow...
<p>Here you go - first create the following function...</p> <pre><code>Create Function [dbo].[SeparateValues] ( @data VARCHAR(MAX), @delimiter VARCHAR(10) ) RETURNS @tbldata TABLE(col VARCHAR(10)) As Begin DECLARE @pos INT DECLARE @prevpos INT SET @pos = 1 SET @prevpos = 0 WHILE @p...
SQL Server post-join rowcount underestimate <p>The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000.</p> <p>With a count of 1...
<p>Although the statistics were up to date, the scan percentage wasn't high enough to provide accurate information. I ran this on each of the base tables that was having a problem to update all the statistics on a table by scanning all the rows, not just a default percentage.</p> <pre><code>UPDATE STATISTICS &lt;table...
A free tool to check C/C++ source code against a set of coding standards? <p>It looks quite easy to find such a tool for Java (<a href="http://checkstyle.sourceforge.net/">Checkstyle</a>, <a href="http://jcsc.sourceforge.net/">JCSC</a>), but I can't seem to find one for C/C++. I am not looking for a lint-like static co...
<p>The only tool I know is <a href="http://bitbucket.org/verateam/vera">Vera</a>. Haven't used it, though, so can't comment how viable it is. <a href="http://www.inspirel.com/vera/ce/demo.html">Demo</a> looks promising.</p>
Best Java Obfuscation Application For Size Reduction <p>An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to ...
<p>I also prefer ProGuard for both it's size reduction and breadth of obfuscation - see <a href="http://proguard.sourceforge.net/" rel="nofollow">http://proguard.sourceforge.net/</a>. I don't necessarily have size constraints other than download speeds, but haven't found anything that shrinks further.</p>
Practical Alternative for Windows Scheduled Tasks (small shop) <p>Greetings,</p> <p>I work in a very small shop (2 people), and since I started a few months back we have been relying on Windows Scheduled tasks. Finally, I've decided I've had enough grief with some of its inabilities such as</p> <ol> <li>No logs that...
<p>I think you can look at :</p> <p><a href="http://www.visualcron.com/">http://www.visualcron.com/</a></p>
symbian application as background process <p>is it possible to create java application that will work as background process on symbian smartphones?</p>
<p>You can approximate it but J2ME (the version of java on mobile phones) may not be the right technology to do this.</p> <ul> <li><p>starting a MIDlet (a Java application for mobile phones) when the phone is switched on is tricky at best without coding a small Symbian OS C++ module that will start it for you. If you ...
Is FileStream lazy-loaded in .NET? <p>I have a question about using streams in .NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is.</p> <pre><code>Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(File...
<p>FileStream simply exposes an IO.Stream around a file object, and uses buffers. It doesn't read the entire file in the constructor (the file could be larger than RAM). </p> <p>The performance issue is most likely in the hashing, and you can perform some simple benchmarks to prove whether it's because of file IO or t...
Apply stroke to a textblock in WPF <p>How do you apply stroke (outline around text) to a textblock in xaml in WPF?</p>
<p>Below is my more idiomatically WPF, full-featured take on this. It supports pretty much everything you'd expect, including:</p> <ul> <li>all font related properties including stretch and style</li> <li>text alignment (left, right, center, justify)</li> <li>text wrapping</li> <li>text trimming</li> <li>text decorati...
What's the easiest non-memory intensive way to output XML from Python? <p>Basically, something similar to System.Xml.XmlWriter - A streaming XML Writer that doesn't incur much of a memory overhead. So that rules out xml.dom and xml.dom.minidom. Suggestions?</p>
<p>I think you'll find XMLGenerator from xml.sax.saxutils is the closest thing to what you want.</p> <pre> import time from xml.sax.saxutils import XMLGenerator from xml.sax.xmlreader import AttributesNSImpl LOG_LEVELS = ['DEBUG', 'WARNING', 'ERROR'] class xml_logger: def __init__(self, output, encoding): ...
UML aggregation when interfaces are used <p><strong>How do I represent an aggregation relation between two classes in UML, such that each class has a link to the other class's interface, not the implementing class?</strong></p> <p>E.g. I have a class Foo that implements iFoo, and Bar that implements iBar. Foo should h...
<p>Can you not have Foo (implementation) aggregate iBar (interface)? That seems to me the proper way to describe this relationship.</p> <p>So something like this:</p> <pre><code>----------------- ----------------- | &lt;&lt;interface&gt;&gt; | | &lt;&lt;interface&gt;&gt; | | iFoo |&lt;&gt; &lt;&gt...
EEFileLoadException when using C# classes in C++(win32 app) <p>For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. </p> <p>I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated!</p> <p>Mana...
<p>The problem was where the DLLs were located.</p> <ul> <li>c:\dlls\managed.dll</li> <li>c:\dlls\wrapper.dll</li> <li>c:\exe\my.exe</li> </ul> <p>I confirmed this by copying managed.dll into c:\exe and it worked without issue. Apparently, the CLR won't look for managed DLLs in the path of the unmanaged DLL and will ...
MySQL Trigger & Stored Procedure Replication <p>Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. </p> <p>Now I have a stored procedure (not function) which is called by a trigger on an insert. A...
<p>In MySQL 5.0 (and MySQL 5.1 with statement based binary logging), only the calling query is logged, so in your case, the INSERT would be logged. </p> <p>On the slave, the INSERT will be executed and then the trigger will be re-run on the slave. So the trigger needs to exist on the slave, and assuming it does, the...
Can't add server to a moved workspace <p>I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace. </p> <p>When I select Tomcat v6.0 I get a message </p> <blockquote> <p>Cannot create a ser...
<p>I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.</p> <p>Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appr...
What Python GUI APIs Are Out There? <p>Simple question:</p> <ul> <li>What Python GUI API's are out there and what are the advantages of any given API?</li> </ul> <p>I'm not looking for a religious war here, I'm just wanting to get a good handle on all that is out there in terms of Python GUI APIs.</p>
<p><a href="http://wiki.python.org/moin/GuiProgramming" rel="nofollow">Here's a good list.</a></p>
Volume (Balance) Control for XP/Vista <p>Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista?</p>
<p>Vista has a new api for everything related to mixers and audio, per process legacy api's should still work, but to change global volume, you would have to look at the new COM interfaces added to Vista</p> <p><a href="http://www.codeproject.com/KB/vista/CoreAudio.aspx" rel="nofollow">This</a> should get you started<...
Windsor Interceptors AOP & Caching <p>I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site.</p> <p>Does anyone have any thoughts/experience with doing this?</p> <p>Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCach...
<p>Hey there, We've used Castle Windsor Interceptors, based on this article: <a href="http://www.davidhayden.com/blog/dave/archive/2007/03/14/CastleWindsorAOPPolicyInjectionApplicationBlock.aspx" rel="nofollow">http://www.davidhayden.com/blog/dave/archive/2007/03/14/CastleWindsorAOPPolicyInjectionApplicationBlock.aspx<...
Infopath 2007 - Emailed forms not rendering correctly <p>So I have a form that uses infopath services via sharepoint, and after multiple attempts at attempting to fix a rendering problem (tables appear WAY too wide to be readable), I think I have found the problem : date controls.</p> <p>It seems date controls within ...
<p>Do you have web form compatability checked in all the necessary places? Are you using the web compatible date controls? Are you sure you are using SharePoint 2003, I thought Form Services was a 2007 update.</p>
How do I read selected files from a remote Zip archive over HTTP using Python? <p>I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory).</p> <p>I've already writ...
<p>Here's how I did it (grabbing all files ending in ".ranks"):</p> <pre><code>import urllib2, cStringIO, zipfile try: remotezip = urllib2.urlopen(url) zipinmemory = cStringIO.StringIO(remotezip.read()) zip = zipfile.ZipFile(zipinmemory) for fn in zip.namelist(): if fn.endswith(".ranks"): ...
Best way to catch a WCF exception in Silverlight? <p>I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these ca...
<p>I check the Error property of the event args in the service method completed event handler. I haven't had issues with the event handler not being called. In the case where the server goes down, the call takes a few seconds then comes back with a ProtocolException in the Error property.</p> <p>Assuming you have tr...
Stateful Web Services <p>I'm building a java/spring application, and i may need to incorporate a stateful web service call. Any opinions if i should totally run away from a stateful services call, or it can be done and is enterprise ready?</p>
<p>Statefulness runs counter to the basic architecture of HTTP (ask Roy Fielding), and reduces scalability.</p>
DNS- Route DNS for subfolder to different server? <p>LEt's say I want to have a subfolder called- <a href="http://www.foo.com/news/" rel="nofollow">http://www.foo.com/news/</a> but I actually want that news folder on a different server. I realize it can be done easily with subdomains, but I was really hoping for the ...
<p>The <strong>only</strong> real way to it is with a reverse proxy ( <em>Or a webserver acting as a reverse proxy</em> ) between you and the outside world that knows what IP address each folder is in. </p> <p>Its not possible to just make something, for example have google.com appear at <a href="http://foobar.com/go...
Using JQuery with ASP.NET MVC Framework <p>I have searched the forum, and google for this topic. Most of the articles are talking about using JSON to call the controller/action on the server and do ajax effect on the result.</p> <p>I am trying to use some very basic JQuery features, like the JQuery UI/Tabs, and JQuery...
<p>Actually I just got it working. The problem is that I need to modify the path to an absolute path to the view page because the relative path doesn't work with the MVC routes {controller}/{action}/{id}.</p> <p>Thanks!</p>
Fetch one row per account id from list <p>I have a table with game scores, allowing multiple rows per account id: <code>scores (id, score, accountid)</code>. I want a list of the top 10 scorer ids and their scores.</p> <p>Can you provide an sql statement to select the top 10 scores, but only one score per account id? ...
<pre><code>select username, max(score) from usertable group by username order by max(score) desc limit 10; </code></pre>
Where is the best place to store user related data in asp.net? <p>When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in a session va...
<p>As already suggested, the profile system is super easy.</p> <p><a href="http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx</a></p>
Can this macro be converted to a function? <p>While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure:</p> <pre><code>#define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) </code></pre> <p>Very useful as ...
<p>As been stated, the code actually work out the number of elements in an array, not struct. I would just write out the sizeof() division explicitly when I want it. If I were to make it a function, I would want to make it clear in its definition that it's expecting an array.</p> <pre><code>template&lt;typename T,int ...
How to detect whether Vista UAC is enabled? <p>I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?</p>
<p>This registry key should tell you:</p> <pre><code>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System </code></pre> <p>Value <code>EnableLUA (DWORD)</code></p> <p><code>1</code> enabled / <code>0</code> or missing disabled</p> <p>But that assumes you have the rights to read it. </p> <p>Programmatic...
JQuery error option in $.ajax utility <p>The documentation indicates that the error: option function will make available: XHR instance, a status message string (in this case always error) and an optional exception object returned from the XHR instance (Book: JQuery in Action)</p> <p>Using the following (in the $.ajax ...
<p>I find the request more useful than the error.</p> <pre><code>error:function(xhr,err){ alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status); alert("responseText: "+xhr.responseText); }</code></pre> <p><strong>xhr</strong> is XmlHttpRequest.<br/> <strong>readyState</strong> values are 1:loading, 2:l...
VB.Net (or C#) 2008 Multi Threaded Import <p>I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look a...
<p>This is a great article:</p> <p><a href="http://www.devx.com/DevX/10MinuteSolution/20365" rel="nofollow">http://www.devx.com/DevX/10MinuteSolution/20365</a></p> <p>In particular:</p> <pre><code>Dim t As Thread t = New Thread(AddressOf Me.BackgroundProcess) t.Start() Private Sub BackgroundProcess() Dim i As In...
How can I generate a list of function dependencies in MATLAB? <p>In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies is for a ...
<p>For newer releases of Matlab (eg 2007 or 2008) you could use the built in functions:</p> <ol> <li>mlint</li> <li>dependency report and </li> <li>coverage report</li> </ol> <p>Another option is to use Matlab's profiler. The command is profile, it can also be used to track dependencies. To use profile, you could do...
How do I add FTP support to Eclipse? <p>I'm using Eclipse PHP Development Tools. What would be the easiest way to access a file or maybe create a remote project trough FTP and maybe SSH and SFTP?.</p>
<p>Eclipse natively supports FTP and SSH. Aptana is not necessary.</p> <p>Native FTP and SSH support in Eclipse is in the "Remote System Explorer End-User Runtime" Plugin.</p> <p>Install it through Eclipse itself. These instructions may vary slightly with your version of Eclipse:</p> <ol> <li>Go to 'Help' -> 'Insta...
In Perl, how do I create a hash whose keys come from a given array? <p>Let's say I have an array, and I know I'm going to be doing a lot of "Does the array contain X?" checks. The efficient way to do this is to turn that array into a hash, where the keys are the array's elements, and then you can just say <pre>if($hash...
<pre><code>%hash = map { $_ =&gt; 1 } @array; </code></pre> <p>It's not as short as the "@hash{@array} = ..." solutions, but those ones require the hash and array to already be defined somewhere else, whereas this one can take an anonymous array and return an anonymous hash.</p> <p>What this does is take each element...
How to find Commit Charge programmatically? <p>I'm looking for the total <a href="http://en.wikipedia.org/wiki/Commit_charge" rel="nofollow">commit charge</a>.</p>
<pre><code> public static long GetCommitCharge() { var p = new System.Diagnostics.PerformanceCounter("Memory", "Committed Bytes"); return p.RawValue; } </code></pre>
What is a variable's linkage and storage specifier? <p>When someone talks about a variables storage class specifier, what are they talking about?<br /> They also often talk about variable linkage in the same context, what is that?</p>
<p>The storage class specifier controls the <em>storage</em> and the <em>linkage</em> of your variables. These are two concepts that are different. C specifies the following specifiers for variables: auto, extern, register, static.</p> <p><strong>Storage</strong><br /> The storage duration determines how long your var...
Find a private field with Reflection? <p>Given this class</p> <pre><code>class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } </code></pre> <p>I want to find the private item _bar that I will mark wi...
<p>Use <code>BindingFlags.NonPublic</code> and <code>BindingFlags.Instance</code> flags</p> <pre><code>FieldInfo[] fields = myType.GetFields( BindingFlags.NonPublic | BindingFlags.Instance); </code></pre>
Python reading Oracle path <p>On my desktop I have written a small Pylons app that connects to Oracle. I'm now trying to deploy it to my server which is running Win2k3 x64. (My desktop is 32-bit XP) The Oracle installation on the server is also 64-bit.</p> <p>I was getting errors about loading the OCI dll, so I inst...
<p>sys.path is python's internal representation of the PYTHONPATH, it sounds to me like you want to modify the PATH.</p> <p>I'm not sure that this will work, but you can try:</p> <pre><code>import os os.environ['PATH'] += os.pathsep + "C:\\oracle32\\bin" </code></pre>
Flex best practices? <p>I have the feeling that is easy to find samples, tutorials and simple examples on Flex.<br> It seems harder to find tips and good practices based on real-life projects.<br> Any tips on how to :</p> <ul> <li>How to write maintainable actionscript code</li> <li>How to ensure a clean separation of...
<p>I work often with Flex in my job, and I will be happy to help.. but your questions deserve an article for each one :) I'll try some short answer.</p> <p>Maintenable code: I think that the same rules of any other OO languages apply. Some flex-specific rules I'm use to follow: use strong typed variables, always consi...
OLEDBConnection.Open() generates 'Unspecified error' <p>I have an application that uploads an Excel .xls file to the file system, opens the file with an oledbconnection object using the .open() method on the object instance and then stores the data in a database. The upload and writing of the file to the file system w...
<p>While the permissions issue may be more common you can also encounter this error from Windows file system/Access Jet DB Engine connection limits, 64/255 I think. If you bust the 255 Access read/write concurrent connections or the 64(?) connection limit per process you can get this exact same error. At least I've c...
Web Dev - Where to store state of a shopping-cart-like object? <p>You're building a web application. You need to store the state for a <em>shopping cart like</em> object during a user's session.</p> <p>Some notes:</p> <ul> <li>This is not exactly a shopping cart, but more like an itinerary that the user is building.....
<p>It's been my experience with the Commerce Starter Kit and MVC Storefront (and other sites I've built) that no matter what you think now, information about user interactions with your "products" is paramount to the business guys. There's so many metrics to capture - it's nuts.</p> <p>I'll save you all the stuff I've...
Can I create a Visual Studio macro to launch a specific project in the debugger? <p>My project has both client and server components in the same solution file. I usually have the debugger set to start them together when debugging, but it's often the case where I start the server up outside of the debugger so I can sta...
<p>Ok. This appears to work from most UI (all?) contexts provided the solution is loaded: </p> <pre><code> Sub DebugTheServer() DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate() DTE.ActiveWindow.Object.GetItem("Solution\ServerFolder\ServerProject").Select(vsUISelectionType.vsUISelectionTypeSe...
Best Approach For Configuring Multiple .Net Applications <p>We have a suite of interlinked .Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configuration file (app.config or web.config), and currently there are some duplicate keys across...
<p>Visual Studio has a relatively obscure feature that lets you add existing items as links, which should accomplish what you're looking for. Check out <a href="http://devlicio.us/blogs/derik_whittaker/archive/2008/04/15/how-to-share-configuration-files-between-projects.aspx" rel="nofollow">Derik Whittaker's post</a> ...
Writing post data from one java servlet to another <p>I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there")</p> <pre><code> StringBuilder sb= new StringBuilder(); sb.append("Hello there"); ...
<p>This kind of thing is much easier using a library like <a href="http://hc.apache.org/httpclient-3.x/">HttpClient</a>. There's even a <a href="http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/examples/PostXML.java?view=markup">post XML code example</a>:</p> <pre><code>PostMethod post = new PostMethod(u...
SQL server 2000 Like Statement Usage <p>I have a SQL statement that looks like:</p> <pre><code>SELECT [Phone] FROM [Table] WHERE ( [Phone] LIKE '[A-Z][a-z]' OR [Phone] = 'N/A' OR [Phone] LIKE '[0]' ) </code></pre> <p>The part I'm having trouble with is the where statement with the "LIKEs". I've seen SQL s...
<p>Check <a href="http://technet.microsoft.com/en-us/library/aa933232%28v=sql.80%29.aspx" rel="nofollow">here</a>.</p> <p>[] matches a range of characters.</p> <p>I think you want something like this:</p> <pre><code>SELECT [Phone] FROM [Table] WHERE ( [Phone] LIKE '%[A-Z]%' OR [Phone] LIKE '%[a-z]%' OR [...
How to read the value of a text input in a Flash SWF from a Flex App? <p>I have a Flex application, which loads a SWF from CS3. The loaded SWF contains a text input called "myText". I can see this in the SWFLoader.content with no problems, but I don't know what type I should be treating it as in my Flex App. I thought ...
<p>The <code>fl.*</code> hierarchy of classes is Flash CS3-only. It's the Flash Components 3 library (I believe it's called, I might be wrong). However, you don't need the class to work with the object. As long as you can get a reference to it in your code, which you seem to have, you can assign the reference to an unt...
What's the most current, good practice, and easiest way to use sessions in PHP? <p>Sessions in PHP seemed to have changed since the last time I used them, so I'm looking for a simple way of using sessions but at the same time for it to be relatively secure and a good common practice.</p>
<p>Session management changed some time back (I think it was around 4.4). The old mechanism still works, but is deprecated. It's rather confusing, so I recommend staying clear of it. Today, you use sessions by accessing the global variable $_SESSION (It's an array). You <em>can</em> put object instances in there, but y...
Is there anything wrong with returning default constructed values? <p>Suppose I have the following code:</p> <pre><code>class some_class{}; some_class some_function() { return some_class(); } </code></pre> <p>This seems to work pretty well and saves me the trouble of having to declare a variable just to make a r...
<p>No this is perfectly valid. This will also be more efficient as the compiler is actually able to optimise away the temporary.</p>
Tools To Help You Plan Projects / Features <p>What tools do you use to plan a project or a large feature set? I currently use a mix of Word for writing specs and Photoshop for mockups, but is there something more suited for developers?</p>
<p>I would set up a Wiki. Its what I use for planning, since its visible to everyone on the team, and editable by everyone on the team. <a href="http://trac.edgewall.org/" rel="nofollow">Trac</a> is the Wiki that I use. <a href="http://moinmoin.wikiwikiweb.de/" rel="nofollow">MoinMoin</a> is another Wiki that I have ...
How do I remove the .NET Compact Framework from my Windows Mobile 5 device? <p>I'm trying to get a number of third party applications to work on my Windows Mobile 5 smartphone.</p> <p>I've installed the latest version (3.5) of the Microsoft.NET Compact Framework, but whenever I run the apps I get an error message whic...
<p>It's probably better to <em>not</em> uninstall, and if it's on the device in ROM you can't uninstall it anyway.</p> <p>There are a couple options available to you.</p> <ol> <li>The different CF versions coexist fine, so you can install the older version and leave 3.5 on it.</li> <li>The CF can be set for compatibi...
Why is Visual Studio constantly crashing? <p>Visual Studio randomly crashes when adding/removing references and projects. Any thoughts why? Will installing Sp1 help?</p> <p>EDIT: I do not work with any addons except SourceSafe. I do most of my development in connected mode.<br></p> <p>Developing using:<br> Visual...
<p>Try deleting your .user and .suo files - these are the user options files that VS creates. You get a .user file for each project and a .suo file for your solution. When they get corrupted, odd things happen. Deleting them will make you lose little things like which project is selected as the startup project when you...
Real-world problems with naive shuffling <p>I'm writing a number of articles meant to teach beginning programming concepts through the use of poker-related topics. Currently, I'm working on the subject of shuffling.</p> <p>As <a href="http://www.codinghorror.com/blog/archives/001015.html" rel="nofollow" title="The Dan...
<p>The knuth shuffle is an insignificant change compared to the naive shuffle: Just swap with any card in the remaining (unshuffled) section of the deck instead of anywhere in the entire deck. If you think of it as repeatedly choosing the next card in order from the remaining unchosen cards, it's pretty intuitive, too....
std::map insert or std::map find? <p>Assuming a map where you want to preserve existing entries. 20% of the time, the entry you are inserting is new data. Is there an advantage to doing std::map::find then std::map::insert using that returned iterator? Or is it quicker to attempt the insert and then act based on whet...
<p>The answer is you do neither. Instead you want to do something suggested by Item 24 of <a href="http://rads.stackoverflow.com/amzn/click/0201749629">Effective STL</a> by <a href="http://www.aristeia.com/">Scott Meyers</a>:</p> <pre><code>typedef map&lt;int, int&gt; MapType; // Your map type may vary, just chang...
Any HTTP proxies with explicit, configurable support for request/response buffering and delayed connections? <p>When dealing with mobile clients it is very common to have multisecond delays during the transmission of HTTP requests. If you are serving pages or services out of a prefork Apache the child processes will be...
<p>What about using both nginx and Squid (client — Squid — nginx — backend)? When <em>returning</em> data from a backend, Squid does convert it from C-T-E: chunked to a regular stream with Content-Length set, so maybe it can normalize POST also.</p>
How do I capture an asterisk on the form's KeyUp event? OR, How do I get a KeyChar on the KeyUp event? <p>I'm trying to hijack an asterisk with the form's KeyUp event. I can get the SHIFT key and the D8 key on the KeyUp event, but I can't get the * out of it. I can find it easily in the KeyPress event (e.KeyChar = "*...
<p>Cache the charcode on KeyPress and then respond to KeyUp. There are other key combinations that will generate the asterisk, especially if you're facing international users who may have different keyboard layouts, so you can't rely on the KeyUp to give you the information you need.</p>
Run macro automatically OnSave in Word <p>I have a macro which refreshes all fields in a document (the equivalent of doing an <kbd>F9</kbd> on the fields). I'd like to fire this macro automatically when the user saves the document.</p> <p>Under options I can select "update fields when document is printed", but that's ...
<p>As far as I can remember of Word 97, you're fresh out of luck. The only document events in '97 were Open and Close. </p> <p>I don't have Word 97 available, but in Word 2000+ you can set a field that reads a document property. You could check that out. In Word 2003 it's under <strong>Insert > Field...</strong> and t...
How to get the ROWID from a Progress database <p>I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress?</p> <p>...
<p>A quick caveat for my answer - it's nearly 10 years since I worked with <a href="http://www.progress.com/">Progress</a> so my knowledge is probably more than a little out of date.</p> <p>Checking the <a href="http://www.psdn.com/library/servlet/KbServlet/download/1078-102-885/langref.pdf">Progress Language Referenc...
NHibernate, auditing and computed column values <p>How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties?</p> <p>E.g. every table contains audit columns like CreatedBy, CreatedDate, UpdatedBy, UpdatedDate. But I dont want t...
<p>You might want to try looking into NHibernate's IUserType.</p> <p>At the bottom of the following page is an example where ayende removes some encryption logic out of the entity and allows NHibernate to just take care of it.</p> <p><a href="http://ayende.com/Blog/archive/2008/07/31/Entities-dependencies-best-practi...
What's the best tool to track a process's memory usage over a long period of time in Windows? <p>What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the memory usage over a short period of time, but not g...
<p>Perfmon in my opinion is one of the best tools to do this but make sure you properly configure the sampling interval according to the time you wish to monitor.</p> <p>For example if you want to monitor a process:</p> <ul> <li>for 1 hour : I would use 1 second intervals (this will generate 60*60 samples)</li> <li>f...
force Maven2 to copy dependencies into target/lib <p>How do I get my project's runtime dependencies copied into the <code>target/lib</code> folder? </p> <p>As it is right now, after <code>mvn clean install</code> the <code>target</code> folder contains only my project's jar, but none of the runtime dependencies.</p>
<p>This works for me:</p> <pre class="lang-xml prettyprint-override"><code>&lt;project&gt; ... &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;qa&lt;/id&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; ...
How can I fix this delphi 7 compile error - "Duplicate resource(s)" <p>I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting this error:</p> <blockquote> <p>[Error] WARNING. Duplicate resource(s):<br> [Error] Type 2 (BITMAP), ID EDIT:<br> [Error] File C:[path shortened]\common\CRGr...
<p>Try firing up your resource editor (I'm pretty sure Delphi comes with one) and open the files. Check what bitmap resources are in the two, see which can be the duplicate.</p> <p>If you need to keep both resources, you need to renumber one of them.</p>
WAS hosting vs. Windows Service hosting <p>I'm working on a project using Windows 2008, .NET 3.5 and WCF for some internal services and the question of how to host the services has arisen.</p> <p>Since we're using Windows 2008 I was thinking it'd be good to take advantage of Windows Process Activation Service (WAS) al...
<p>Recently I had to answer very similar question and these are the reasons why I decided to use IIS 7.0 and WAS instead of Windows Service infrastructure.</p> <ol> <li>IIS 7.0 is much more robust host and it comes with numerous features that make debugging easy. Failed requests tracing, worker process recycling, proc...
How to send mail from ASP.NET with IIS6 SMTP in a dedicated server? <p>I'm trying to configure a dedicated server that runs ASP.NET to send mail through the local IIS SMTP server but mail is getting stuck in the Queue folder and doesn't get delivered.</p> <p>I'm using this code in an .aspx page to test:</p> <pre><cod...
<p>I find the best thing usually depending on how much email there is, is to just forward the mail through your ISP's SMTP server. Less headaches. Looks like that's where you are having issues, from your SMTP to external servers, not asp.net to your SMTP.</p> <p>Just have your SMTP server set to send it to your ISP, o...
Version control on a 2GB USB drive <p>For my school work, I do a lot of switching computers (from labs to my laptop to the library). I'd kind of like to put this code under some kind of version control. Of course the problem is that I can't always install additional software on the computers I use. Is there any kind...
<p>I do this with Git. Simply, create a Git repository of your directory:</p> <pre><code>git-init git add . git commit -m "Done" </code></pre> <p>Insert the stick, cd to directory on it (I have a big ext2 file I mount with -o loop), and do:</p> <pre><code>git-clone --bare /path/to/my/dir </code></pre> <p>Then, I ta...
Asterisk AGI framework for IVR; Adhearsion alternative? <p>I am trying to get started writing scalable, telecom-grade applications with Asterisk and Ruby. I had originally intended to use the Adhearsion framework for this, but it does not have the required maturity and its documentation is severely lacking. AsteriskR...
<p>SipX is really the wrong answer. I've written some extremely complicated VoiceXML on SipX 3.10.2 and it's been all for naught since SipX 4 is dropping SipXVXML for an interface that requires IVRs to be compiled JARs. Top that off with Nortel filing bankruptcy, extremely poor documentation on the open-source version,...
How do I parse a PHP serialized datastructure in Java? <p>I have a system that combines the best and worst of Java and PHP. I am trying to migrate a component that was once written in PHP into a Java One.</p> <p>Does anyone have some tips for how I can parse a PHP serialized datastructure in Java? By serialized I mean...
<p>PHP serializes to a simple text-based format. <a href="http://hurring.com/scott/code/java/serialize/v0.1/PHPSerialize.java" rel="nofollow">PHPSerialize</a> looks like a parser written in Java. You can also port the <a href="http://pypi.python.org/pypi/phpserialize/1.1" rel="nofollow">Python implementation</a> to Jav...
What is your favorite hot-key in Eclipse? <p>I've been using Visual Studio with Re-Sharper for the past few years and have recently taken a gig at a Java shop where we use Eclipse. Googling for Eclipse hotkeys has returned a bunch of 'Top 10 Hot-Key' posts, but that's about it. </p> <p>What are your favorite hotkeys...
<p>These are the ones I file under "muscle memory."</p> <h2>Editing</h2> <ul> <li><kbd>Ctrl+Shift+O</kbd> - organise imports (removes unused imports, adds missing imports, sorts imports)</li> <li><kbd>Ctrl+Shift+I</kbd> - unindent selection</li> <li><kbd>Ctrl+/</kbd> - comment/uncomment selected lines</li> <li><kbd>A...
Focus-follows-mouse (plus auto-raise) on Mac OS X <p>(I don't want to hear about how crazy I am to want that! :)</p> <p>Focus-follows-mouse is also known as point-to-focus, pointer focus, and (in some implementations) sloppy focus. [Add other terms that will make this more searchable!] X-mouse</p>
<p><a href="http://steve-yegge.blogspot.com/2008/04/settling-osx-focus-follows-mouse-debate.html">Steve Yegge</a> wrote an essay about this a while back, where he tried and failed to write a suitable extension. I've since tried to find focus-follows-mouse applications for OS X and failed also.</p>
Does having many unused beans in a Spring Bean Context waste significant resources? <p>My model layer is being used by a handful of different projects and I'd like to use a single XML Spring Configuration file for the model regardless of which project is using it.</p> <p>My question is: Since not all beans are used in...
<p>Taken from the <a href="http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-lazy-init">Spring Reference Manual</a>:</p> <blockquote> <p>The default behavior for ApplicationContext implementations is to eagerly pre-instantiate all singleton beans at startup. Pre-instantiation mea...
What are the common undefined/unspecified behavior for C that you run into? <p>An example of unspecified behavior in the C language is the order of evaluation of arguments to a function. It might be left to right or right to left, you just don't know. This would affect how foo(c++, c) or foo(++c, c) gets evaluated.</p...
<p>A language lawyer question. Hmkay.</p> <p>My personal top3: </p> <ol> <li>violating the strict aliasing rule</li> <li>violating the strict aliasing rule</li> <li><p>violating the strict aliasing rule</p> <p>:-)</p></li> </ol> <p><strong>Edit</strong> Here is a little example that does it wrong twice:</p> <p>(as...
How do I examine the configuration of a remote git repository? <p>I've got a git-svn clone of an svn repo, and I want to encourage my colleagues to look at git as an option. The problem is that cloning the repo out of svn takes 3 days, but cloning from my git instance takes 10 minutes.</p> <p>I've got a script that wi...
<p>I'd say the better way to do this would be, instead of requiring that your coworkers do a git clone, just give them a a tarball of your existing git-svn checkout. This way, you don't have to repoint or query anything, as it's already done.</p>
How can I get Eclipse to show .* files? <p>By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.</p>
<p>In the package explorer, in the upper right corner of the view, there is a little down arrow. Tool tip will say view menu. From that menu, select filters</p> <p><img src="http://i.stack.imgur.com/NWo2x.jpg" alt="filters menu"></p> <p>From there, uncheck .* resources.</p> <p>So <code>Package Explorer -&gt; View Me...
What is the strict aliasing rule? <p>When asking about <a href="http://stackoverflow.com/questions/98340/what-are-the-common-undefinedunspecified-behavior-for-c-that-you-run-into">common undefined behavior in C</a>, souls more enlightened than I referred to the strict aliasing rule.<br /> What are they talking about?</...
<p>A typical situation you encounter strict aliasing problems is when overlaying a struct (like a device/network msg) onto a buffer of the word size of your system (like a pointer to <code>uint32_t</code>s or <code>uint16_t</code>s). When you overlay a struct onto such a buffer, or a buffer onto such a struct through p...
How to Naturally/Numerically Sort a DataView? <p>I am wondering how to naturally sort a DataView... I really need help on this. I found articles out there that can do lists with IComparable, but I need to sort the numbers in my dataview.</p> <p>They are currently alpha sorted because they are numbers with 'commas' i...
<p>I often like to add a "SortOrder" column to results that I want to sort in a way other than is provided by the data. I usually use an integer and just add it when I am getting the data.</p> <p>I don't show this column and only use it for the purposes of establishing the order.</p> <p>I'm not sure if this is what ...
Modularity of Classes <p>Are there any tips or tricks to make my classes and application designs more modular?</p>
<p>I would say that the most important thing is <strong>orthogonality.</strong> What is it? Basically you shouldn't need to modify underlying "engine" if there is a cosmetic change in GUI. A bugfix strictly in the "engine" shouldn't need any changes in some other part of program.</p> <p><strong>It is not easy</strong>...
Managing the patch level of multiple windows systems <p>In an environment with multiple windows servers what is the best way to ensure patch compliance accross all systems? </p> <p>Is there a simple tool (some sort of client/server app?) that allows reports to be generated showing the status of all the systems so any...
<p><a href="http://technet.microsoft.com/en-us/wsus/default.aspx" rel="nofollow">WSUS</a> is good for Windows, it's for large distributed enterprises.</p>
How do I have a socket accept connections only from the localhost (in Java)? <p>I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the p...
<p>Peer IP addresses cannot be spoofed in this manner, have you nothing to fear from using the technique of inspecting the peer and deciding to drop the connection during establishment.</p> <p>However: binding to 127.0.0.1 should work, and cause the operating system to tell the connecting host that there is nothing li...
Passing PHP associative arrays to and from XML <p>Is there an easy way to marshal a PHP associative array to and from XML? For example, I have the following array:</p> <pre><code>$items = array("1", "2", array( "item3.1" =&gt; "3.1", "item3.2" =&gt; "3.2" "isawesome" =&gt; true ) ); </...
<p><a href="http://php.net/simplexml" rel="nofollow">SimpleXML</a> works great for your use.</p>
Does writing and speaking on software make you a better programmer? <p>Do you think that writing about software (i.e. having a blog) and speaking on software (and concepts) make you a better programmer?</p>
<p>Statistically speaking yes. You only retain about 20% of what you read and hear, but 80% of what you teach.</p> <p>By writing about something or teaching about it, you force yourself to understand the concepts on a much deeper level.</p> <p><strong>UPDATE:</strong></p> <p>I wanted to update this with some links t...
Does several levels of base classes slow down a class/struct in c++? <p>Does having several levels of base classes slow down a class? A derives B derives C derives D derives F derives G, ...</p> <p>Does multiple inheritance slow down a class?</p>
<p>Non-virtual function-calls have absolutely no performance hit at run-time, in accordance with the c++ mantra that you shouldn't pay for what you don't use. In a virtual function call, you generally pay for an extra pointer lookup, no matter how many levels of inheritance, or number of base classes you have. Of cours...
Is it possible to get Code Coverage Analysis on an Interop Assembly? <p>I've asked this question over on the MSDN forums also and haven't found a resolution:</p> <p><a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3686852&amp;SiteID=1" rel="nofollow">http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=...
<p>To answer your question - it's not possible to instrument interop assemblies for code coverage. They contain only metadata, and no executable code as you mention yourself.</p> <p>Besides, I don't see much point in trying to code coverage the interop assembly. You should be measuring the code coverage of code you wr...
When is it appropriate to use Time#utc in Rails 2.1? <p>I am working on a Rails application that needs to handle dates and times in users' time zones. We have recently migrated it to Rails 2.1 and added time zone support, but there are numerous situations in which we use Time#utc and then compare against that time. Wou...
<p>If you've set:</p> <pre><code>config.time_zone = 'UTC' </code></pre> <p>In your environment.rb (it's there by default), then times will automagically get converted into UTC when ActiveRecord stores them.</p> <p>Then if you set Time.zone (in a before_filter on application.rb is the usual place) to the user's Time ...
How can I create a Netflix-style iframe overlay without a huge javascript library? <p>I'm trying to use a link to open an overlay instead of in a separate popup window. This overlay should consist of a semi-transparent div layer that blocks the whole screen from being clicked on. I also aim to disable scrolling at this...
<p><a href="http://mjijackson.com/shadowbox/" rel="nofollow">Shadowbox</a> is a nice script for inline "popups". It can work with any of the usual JS libraries if you use any (jQuery, Prototype, etc) or on its own, has a pretty comprehensive skinning system so you can adapt the looks without having to go into the sourc...
Is it safe to add delegates to events with keyword new? <p>One thing I am concerned with is that I discovered two ways of registering delegates to events.</p> <ol> <li>OnStuff += this.Handle; </li> <li>OnStuff += new StuffEventHandler(this.Handle);</li> </ol> <p>The first one is clean, and it makes sense doing "OnStu...
<p>Number one is just shorthand that will generate the same MSIL as the 2nd one, at compile type it'll look at this.Handle and infer the delegate to instantiate. But you should never unsubscribe by using new.</p> <p>So there is no difference between the 2, just some syntactic sugar to make our code cleaner.</p>
Eclipse text comparison order <p>I'm using Eclipse 3.4 (on Mac) and I've got an annoyance with the text comparison having the files I'm comparing in a specific order which is not what I want.</p> <p>When I compare two files it always seems to put the first file (alphabetically) on the left, and the latter one on the r...
<p>Yes, that's actually very annoying. We use an external tool called Beyond Compare (we have a corporate licence) which can swap the two sides easily.</p> <p>What you should probably do is raise an enhancement request on the relevant Eclipse team with Bugzilla. If there's enough demand, it'll either make it into th...
Generating a unique machine id <p>I need to write a function that generates an id that is unique for a given machine running a Windows OS.</p> <p>Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question is, what are the suggested par...
<p>I had the same problem and after a little research I decided the best would be to read <code>MachineGuid</code> in registry key <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography</code>, as @Agnus suggested. It is generated during OS installation and won't change unless you make another fresh OS install. Depen...
What tools do you use to implement SOA/Messaging? <p><a href="http://www.nservicebus.com/" rel="nofollow">NServiceBus</a> and <a href="http://code.google.com/p/masstransit/" rel="nofollow">MassTransit</a> are two tools that can be used to implement messaging with MSMQ and other message queues.</p> <p>I find that once ...
<p><a href="http://activemq.apache.org/" rel="nofollow">Apache ActiveMQ</a> is probably the most popular and powerful open source message broker out there with the most active open source community behind it as well as <a href="http://open.iona.com/products/enterprise-activemq/" rel="nofollow">commercial support, train...
Why can't I delete a file in %ProgramFiles% from a Unit Test via Resharper's Test Runner Unit Test? <p>I am trying to write a test which, in it's fixtures Setup, it backs up a file and deletes the original, runs the test without the original present, then in the teardown, restores the original from the backup. The fil...
<p>Not really a solution, but I'd consider fixing this problem from a different angle.</p> <p>You could perhaps consider changing the directory to %AppData% (you might need to make this change for you main application also).</p> <p>It might solve your problem and also will see you well when you move to Vista, since U...
Is there a way to check if there are symbolic links pointing to a directory? <p>I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a s...
<p>I'd use the find command.</p> <pre><code>find . -lname /particular/folder </code></pre> <p>That will recursively search the current directory for symlinks to <code>/particular/folder</code>. Note that it will only find absolute symlinks. A similar command can be used to search for all symlinks pointing at objects ...
What is the standard way to add N seconds to datetime.time in Python? <p>Given a <code>datetime.time</code> value in Python, is there a standard way to add an integer number of seconds to it, so that <code>11:34:59</code> + 3 = <code>11:35:02</code>, for example?</p> <p>These obvious ideas don't work:</p> <pre><code>...
<p>You can use full <code>datetime</code> variables with <code>timedelta</code>, and by providing a dummy date then using <code>time</code> to just get the time value.</p> <p>For example:</p> <pre><code>import datetime a = datetime.datetime(100,1,1,11,34,59) b = a + datetime.timedelta(0,3) # days, seconds, then other...
Connecting to IMDB <p>Has any one done this before? It would seem to me that there should be a webservice but i can't find one. I am writing an application for personal use that would just show basic info from IMDB.</p>
<p>The libraries for <a href="http://www.imdb.com/" rel="nofollow">IMDB</a> seem quite unreliable at present and highly inefficient. I really wish <a href="http://www.imdb.com/" rel="nofollow">IMDB</a> would just create a webservice.</p> <p>After a bit of searching I found a reasonable alternative to <a href="http://w...
Mashups and SharePoint <p>Can somebody in SO please provide me with a list of resources about Enterprise Mashups and technologies related to SharePoint platform?</p> <p><strong>Update</strong> (as per suggestion of @Spoon16 in the comments):- The mashup application may typically retrieve a list of contacts from a Shar...
<p>There are a number of different ways to pull external information into SharePoint.</p> <p>For mashing up SharePoint data in external applications:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/ms479390.aspx" rel="nofollow">Web Services</a>; great web services coverage for the underlying API will al...
Hidden Features of Visual Studio (2005-2010)? <p>Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new/better way to do things or things I didn't even know were possible.</p> <p>For instance-</p> <ul> <li><p><kbd>Crtl</kbd> + <kbd>R</kbd>, <kbd>Ctrl</kbd...
<p>Make a selection with ALT pressed - selects a square of text instead of whole lines.</p>
SSO in webpages <p>I would like to know what's the best technique to do single sign-on in web sites. It means that if you enter in more than one website, you will be authenticated in a "transparent" way. I'm using php + curl to set the cookies for the different sites, but i really would like to know if does exist a sta...
<p>For a standard secure way you need :</p> <ul> <li>an authentication server</li> <li>an authentication filter on each site that need SSO</li> </ul> <p>The mechanism is a little bit complex, it involves http redirects and secure authentication tickets. You will find detailled explanation on the <a href="http://www.j...
How to pause / resume any external process under Windows? <p>I am looking for different ways to pause and resume programmatically a particular process via its process ID under Windows XP.</p> <p><a href="http://www.codeproject.com/KB/threads/pausep.aspx" rel="nofollow">Process suspend/resume tool</a> does it with <cod...
<p>If you "debug the debugger" (for instance, using <code>logger.exe</code> to trace all API calls made by <code>windbg.exe</code>), it appears that the debugger uses <code>SuspendThread()</code>/<code>ResumeThread()</code> to suspend all of the threads in the process being debugged. </p> <p>PsSuspend may use a differ...
How do you bind in xaml to a dynamic xpath? <p>I have a list box that displays items based on an XPath query.</p> <p>This XPath query changes depending on the user's selection elsewhere in the GUI. The XPath always refers to the same document.</p> <p>At the moment, I use some C# code behind to change the binding of t...
<p>I think that you're trying to over complicate the problem. But have you thought about allocating the XPath to a dynamic resource:</p> <pre><code>&lt;.... ={Binding XPath={DynamicResource:res resource-name}} ... /&gt; </code></pre> <p>The best place to read about all-binding is Beatriz's blog: <a href="http://www...