input
stringlengths
51
42.3k
output
stringlengths
18
55k
Question about object-orientation <p>I had this questions since the time I learnt about object-oriented programming. Now, I have got a wonderful forum I thought of asking this.</p> <p>Lets say we are implementing an employee management application using EJB.</p> <p>Now, there are 2 ways of doing this.</p> <ol> <li><...
<p>Of your examples, I would not recommend #2, because it gives the Employee class too many responsibilities.</p> <p>Although not giving a straight answer, I can cordially recommend Martin Fowler's book <a href="http://www.martinfowler.com/books.html#eaa" rel="nofollow">Patterns of Enterprise Application Architecture<...
Whats the best book/site/tutorial for learning object oriented php? <p>Im pretty familiar with procedural side of php, but I would like to learn the OO side of things. Can you guys suggest some (short) reads that would get me on my way?</p> <p>Would prefer online articles, to paper. </p>
<p>I'd personally reccomend <a href="http://rads.stackoverflow.com/amzn/click/1590599098" rel="nofollow">PHP Objects, Patterns and Practice</a></p>
What tool do you use to do burndown charts? <p>do you use a tool? or just manually make them?</p>
<p><a href="http://code.google.com/apis/chart/basics.html">Google charts api/server</a> can make one fairly easily</p> <p><img src="http://chart.apis.google.com/chart?chs=600x250&amp;cht=lxy&amp;chtt=Burndown&amp;chxt=x,y&amp;chxl=days&amp;chdl=Estimated|Actual&amp;chco=FF0000,00FF00&amp;chd=t:-1|40,36,32,28,24,20,16,...
C# - Why won't a fullscreen winform app ALWAYS cover the taskbar? <p>I'm using Windows Vista and C#.net 3.5, but I had my friend run the program on XP and has the same problem.</p> <p>So I have a C# program that I have running in the background with an icon in the SystemTray. I have a low level keyboard hook so when ...
<p>Try this (where <code>this</code> is your form):</p> <pre><code>this.Bounds = Screen.PrimaryScreen.Bounds; this.TopMost = true; </code></pre> <p>That'll set the form to fullscreen, and it'll cover the taskbar.</p>
How do I ignore ampersands in a SQL script running from SQL Plus? <p>I have a SQL script that creates a package with a comment containing an ampersand (&amp;). When I run the script from SQL Plus, I am prompted to enter a substitute value for the string starting with &amp;. How do I disable this feature so that SQL Plu...
<p>This may work for you:</p> <pre><code>set define off </code></pre> <p>Otherwise the ampersand needs to be at the end of a string, </p> <pre><code>'StackOverflow &amp;' || ' you' </code></pre> <p>EDIT: I was click-happy when saving... This was referenced from a <a href="http://blog.andrewbeacock.com/2008/09/usi...
How to start IDLE (Python editor) without using the shortcut on Windows Vista? <p>I'm trying to teach Komodo to fire up <a href="http://en.wikipedia.org/wiki/IDLE%5F%28Python%29">IDLE</a> when I hit the right keystrokes. I can use the exact path of the shortcut in start menu in the Windows Explorer location bar to lau...
<p>There's a file called idle.py in your Python installation directory in Lib\idlelib\idle.py</p> <p>If you run that file with Python, then IDLE should start.</p> <blockquote> <p>c:\Python25\pythonw.exe c:\Python25\Lib\idlelib\idle.py</p> </blockquote>
Best way to manipulate pages while embedding Webkit? <p>I'm using Webkit-sharp to embed Webkit into an application and I need to hook certain links to perform actions in my app rather than their normal action.</p> <p>I've considered using Javascript to iterate over the anchor tags and replace the ones that match with ...
<p>jQuery has a lot of useful iteration features that may be able to use for that. :-) I haven't used jQuery, but <a href="http://docs.jquery.com/Traversing/find" rel="nofollow"><code>find</code></a> and <a href="http://docs.jquery.com/Attributes/attr" rel="nofollow"><code>attr</code></a> look promising for your purpos...
Trying to resize a jQuery dialog in IE6? <p>I thought I had seen a bug report about this on the jQuery site, but now I cannot find it. I'm trying to resize a dialog in IE6. But when the element is resized, the content and title bar don't resize down. They will resize up if the dialog is made larger, however. The result...
<p>I was able to come up with a solution. If you add the style <strong>overflow: hidden</strong> to the dialog container div element (which has the css class .ui-dialog-container applied to it), then everything resizes correctly. All I did was add a css rule as follows to the flora theme:</p> <pre><code>.ui-dialog .ui...
ASP.NET TextBox control with label text in the background <p>I'm creating a login page. I want to create ASP.NET TextBox controls that have "Username" and "Password" as their Text, but as soon as they receive focus, these words should disappear and whatever the user types should appear, just like normal textbox. If the...
<p>Use the <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/TextBoxWatermark/TextBoxWatermark.aspx">TextBox Watermark Extender</a> that's in Microsoft's AJAX Toolkit.</p>
How do you use the ellipsis slicing syntax in Python? <p>This came up in <a href="http://stackoverflow.com/questions/101268/hidden-features-of-python">Hidden features of Python</a>, but I can't see good documentation or examples that explain how the feature works.</p>
<p>The ellipsis is used to slice higher-dimensional data structures. </p> <p>It's designed to mean <em>at this point, insert as many full slices (<code>:</code>) to extend the multi-dimensional slice to all dimensions</em>.</p> <p><strong>Example</strong>:</p> <pre><code>&gt;&gt;&gt; from numpy import arange &gt;&gt...
RTF control for .Net 1.1 Windows <p>Can anyone recommend a cheap and good RTF control for .Net 1.1 Windows development. It needs to be able to do print/preview and some basic text formatting, fonts etc but nothing too advanced.</p> <p>Cheers</p> <p>Andreas</p>
<p>If you're interested in rolling out your own, the framework provides a RTF control by default. It's arcane, but one can learn enough RTF to create simple formatting, and printing/print previewing can both be implemented using native classes as well.</p>
How would you implement a badge system like StackOverflow's? <p>Just wondering how you would do this. Would you have some sort of process that scanned through all the actions that took place over the past X minutes? Would you trigger a badge update check every time any action took place (up vote, down vote, tag, etc....
<p>Perhaps a bit of both. I would probably queue up a check every time an action occurred and have a process that goes down the queue and determines if a badge has been earned for each check. This way it's semi-real time without causing pages to take more time to load. In fact, here on StackOverflow I've noticed a dela...
What is wrong with my snap to grid code? <p>First of all, I'm fairly sure snapping to grid is fairly easy, however I've run into some odd trouble in this situation and my maths are too weak to work out specifically what is wrong.</p> <p>Here's the situation</p> <p>I have an abstract concept of a grid, with Y steps ex...
<p>Ok, I'm answering my own question here, as alexk mentioned, using int to truncate was my mistake. </p> <p>The behaviour I'm after is best modeled by math.floor().</p> <p>Apologies, the original question does not contain enough information to really work out what the problem is. I didn't have the extra bit of inf...
Is there a way to use the same file for both a RTP and a kernel module in vxWorks? <p>We have a vxWorks application that we would like to deploy either as a kernel module, or as a Real-Time process.</p> <p>Is there a way to do this from the same source file, or do we have to create one file for the kernel module and a...
<p>The easiest solution would be to have a single file that can be compiled either as a kernel module, or as a Real-Time Process. It probably should look something like this:</p> <pre><code> void MyModule_Init() { // Initialize the module ... } ... #ifdef __RTP__ int main(...) { // RTP Main just invokes the M...
What is the best signature for overloaded arithmetic operators in C++? <p>I had assumed that the canonical form for operator+, assuming the existence of an overloaded operator+= member function, was like this:</p> <pre><code>const T operator+(const T&amp; lhs, const T&amp; rhs) { return T(lhs) +=rhs; } </code></pr...
<p>I'm not sure if there is much difference in the generated code for either.</p> <p>Between these two, I would (personally) prefer the first form since it better conveys the intention. This is with respect to both your reuse of the += operator and the idiom of passing templatized types by const&amp;.</p>
GCC inline assembler, mixing register sizes (x86) <p>Does anyone know how I can get rid of the following assembler warning?</p> <p>Code is x86, 32 bit:</p> <pre><code>int test (int x) { int y; // do a bit-rotate by 8 on the lower word. leave upper word intact. asm ("rorw $8, %0\n\t": "=q"(y) :"0"(x)); return ...
<p>You can use <code>%w0</code> if I remember right. I just tested it, too. :-)</p> <pre><code>int test(int x) { int y; asm ("rorw $8, %w0" : "=q" (y) : "0" (x)); return y; } </code></pre> <p>Edit: In response to the OP, yes, you can do the following too:</p> <pre><code>int test(int x) { int y; a...
How to count rows in Lift (Scala's web framework) <p>I want to add a property to my User model that returns the number of rows in the Project table that have a user Id of the user.</p> <p>So something like this...</p> <pre><code>def numProjects = { /* somehow get count from Project table The straight sql ...
<p>According to the documentation <a href="http://scala-tools.org/mvnsites/liftweb/lift-webkit/scaladocs/net/liftweb/mapper/MetaMapper.html">here</a> (found <a href="http://scala-tools.org/mvnsites/liftweb/lift-webkit/scaladocs/">here</a>), assuming you're looking for the project count for a User of id 1234 and assumin...
Best way to secure an AJAX app <p>I am currently working on the authentication of an AJAX based site, and was wondering if anybody had any reccomendations on best practices for this sort of thing.</p> <p>My original approach was a cookie based system. Essentially I set a cookie with an auth code, and every data acces...
<p>Personally, I have not found using SSL for the entire site (or most of it) to be overkill. Maybe a while ago when speeds and feeds were slower. Now I wouldn't hesitate to put any part of a site under SSL. <p> If you've decided that using SSL for the entire site is acceptable, you might consider just using the old ...
What are the print functions in Adobe AIR? <p>I've been trying to figure out how to print in Adobe AIR. I know the standard javascript functions don't work. The AIRforJSDev guide says: "The window.print() method is not supported within Adobe AIR 1.0. There are other methods available via the exposed AIRAPIs that give ...
<p>What you need to do is access the AS3 <a href="http://livedocs.adobe.com/flex/201/langref/flash/printing/PrintJob.html" rel="nofollow">flash.printing.PrintJob</a> API. Here's a page on <a href="http://livedocs.adobe.com/air/1/devappshtml/help.html?content=ProgrammingHTMLAndJavaScript_05.html" rel="nofollow">accessin...
Connection to report server could not be made from BI VS 2005 but the report server is browseable <p>I have IIS6 configured such that browsing to <a href="http://localhost:8082/Reports" rel="nofollow">http://localhost:8082/Reports</a> gets me the reporting services default home page, which is all as expected. However, ...
<p>Have you tried to publish you report to:</p> <p><a href="http://localhost:8082/ReportsServer" rel="nofollow">http://localhost:8082/ReportsServer</a></p> <p>"/ReportsServer" is the webservice for Reporting Services. "/Reports" is the front end.</p>
Can I make a SharePoint Image Web Part clickable to link to another page <p>The Image Web Part doesn't seem to have an href attribute that I can set. Is there something I am missing?</p>
<p>Does it have to be an Image Web Part? If not I would simply use a <a href="http://office.microsoft.com/en-us/sharepointserver/HA100240461033.aspx">Content Editor Web Part</a> and paste the required HTML there.</p> <pre><code>&lt;a href="http://www.google.com"&gt;&lt;img src="urlToImage" /&gt;&lt;/a&gt; </code></pre...
What is the difference between Events with Delegate Handlers and those without? <p>What is the difference between this:</p> <pre><code>this.btnOk.Click += new System.EventHandler(this.btnOK_Click); </code></pre> <p>and this?</p> <pre><code>this.btnOk.Click += this.btnOK_Click; </code></pre> <p>They both work. The ...
<p>No difference. Omitting the delegate instantiation is just syntax candy; the C# compiler will generate the delegate instantiation for you under the hood.</p>
What tools allows me to keep track of html tags when doing web development? <p>What tools allows me keep track of tags when doing web development? For example, I would like to be able to quickly find whether I missed closing a div tag.</p> <p>At the moment I am using notepad++ to write html. It highlights starting and...
<p><a href="http://tidy.sourceforge.net/" rel="nofollow">HTMLTidy</a> is pretty much the de-facto standard for this kind of thing nowadays</p> <p><a href="http://dev.int64.org/tidy.html" rel="nofollow">Tidy Windows Installer</a></p> <p><a href="http://tidy.sourceforge.net/docs/faq.html" rel="nofollow">Tidy FAQ</a></p...
Specify the from user when sending email using the mail command <p>Does anyone know how to change the from user when sending email using the mail command? I have looked through the man page and can not see how to do this. </p> <p>We are running Redhat Linux 5.</p>
<p>You can specify any extra header you may need with -a</p> <pre><code>$mail -s "Some random subject" -a "From: some@mail.tld" to@mail.tld </code></pre>
Business Logic: Database or Application Layer <p>The age old question. Where should you put your business logic, in the database as stored procedures ( or packages ), or in the application/middle tier? And more importantly, Why?</p> <p>Assume database independence is not a goal.</p>
<p>Maintainability of your code is always a big concern when determining where business logic should go. </p> <p>Integrated debugging tools and more powerful IDEs generally make maintaining middle tier code easier than the same code in a stored procedure. Unless there is a real reason otherwise, you should start wit...
I want to log the Poison message that my wcf service is dropping using MSMQ 3.0 and windows 2003 <p>I want to log the Poison message that my wcf service is dropping using MSMQ 3.0 and windows 2003</p>
<p>You can implement a custom <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.ierrorhandler.aspx" rel="nofollow">IErrorHandler</a> and associate it with your service using a custom behavior. In your implementation, check if the exception raised is of type MsmqPoisonMessageException, and ...
How do I sort a VARCHAR column in SQL server that contains numbers? <p>I have a <code>VARCHAR</code> column in a <code>SQL Server 2000</code> database that can contain either letters or numbers. It depends on how the application is configured on the front-end for the customer. </p> <p>When it does contain numbers, I w...
<p>One possible solution is to pad the numeric values with a character in front so that all are of the same string length.</p> <p>Here is an example using that approach:</p> <pre class="lang-sql prettyprint-override"><code>select MyColumn from MyTable order by case IsNumeric(MyColumn) when 1 then Replic...
Shortcut to switch between markup and code <p>Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup?</p>
<p>The following is a macro taken from a comment by Lozza on <a href="http://www.codinghorror.com/blog/archives/000315.html" rel="nofollow">http://www.codinghorror.com/blog/archives/000315.html</a>. You just need to bind it to a shortcut of your choice:</p> <pre><code>Sub SwitchToMarkup() Dim FileName If (DTE.Act...
How to export fonts and colors from VS2008 to VS2005? <p>I have been forced to work in Visual Studio 2005 and would like to export my fonts and colors from Visual Studio 2008. However, VS2005 complains about wrong export document version. Is there any good way to do this besides manually changing each color and font?</...
<p>I think there's a tag in the exported file called "applicationIdentity" that is set to a value of "9.0" by 2008, change it to "8.0" and the file should import. I don't recall it causing any problems from settings that are 2k8 specific, but take a backup of your settings first!</p> <p>UPDATE: Just looked in an expor...
Detect via javascript whether Silverlight is installed <p>Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser?</p> <p>I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behi...
<p>Include Silverlight.js (from Silverlight SDK)</p> <p><code>Silverlight.isInstalled("4.0")</code></p> <hr> <p><strong>Resource:</strong></p> <p><a href="http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx" rel="nofollow"><a href="http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx" rel="nofollow...
How can you get more information about processes when Linux runs out of memory? <p>I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious plac...
<p>You can check the messages log file to see which process got killed and some related information. As for the reasons:</p> <blockquote> <p>... the ideal candidate for liquidation is a recently started, non privileged process which together with it's children uses lots of memory, has been nice'd, and does no raw I/...
Save drop-down history in a Firefox Toolbar <p>I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile.</p> <p>Is there any tutorial on how to sort this out?</p>
<p>Since it's taking quite a bit to get an answer I went and investigate it myself. Here is what I've got now. Not all is clear to me but it works.</p> <p>Let's assume you have a &lt;textbox&gt; like this, on your .xul:</p> <pre><code>&lt;textbox id="search_with_history" /&gt; </code></pre> <p>You now have to add so...
How to do query auto-completion/suggestions in Lucene? <p>I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to using Solr in th...
<p>Based on @Alexandre Victoor's answer, I wrote a little class based on the Lucene Spellchecker in the contrib package (and using the LuceneDictionary included in it) that does exactly what I want.</p> <p>This allows re-indexing from a single source index with a single field, and provides suggestions for terms. Resul...
Is there an alternative to the SQL Profiler for SQL Server 2000 <p>I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message "In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.". It seems that onl...
<p>In query analyser:</p> <pre><code>SET STATISTICS TIME ON SET STATISTICS IO ON </code></pre> <p>Run query and look in the messages tab.</p> <p>It occurs to me this may require same privileges, but worth a try.</p>
Short Integers in Python <p>Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. </p> <p>So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?</p>
<p>Nope. But you can use short integers in arrays:</p> <pre><code>from array import array a = array("h") # h = signed short, H = unsigned short </code></pre> <p>As long as the value stays in that array it will be a short integer.</p> <ul> <li>documentation for the <a href="http://docs.python.org/dev/library/array">...
Irretrievably destroying data in Java <p>Is there anyway in Java to delete data (e.g., a variable value, object) and be sure it can't be recovered from memory? Does assigning <code>null</code> to a variable in Java delete the value from memory? Any ideas? Answers applicable to other languages are also acceptable.</p>
<p>Due to the wonders virtual memory, it is nearly impossible to delete something from memory in a completely irretrievable manner. Your best bet is to zero out the value fields; however: </p> <ul> <li>This does not mean that an old (unzeroed) copy of the object won't be left on an unused swap page, which could persis...
Image icon beside the site URL <p>I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself ?</p>
<p>These icons are called <a href="http://en.wikipedia.org/wiki/Favicon">favicons</a></p> <p>Most web browsers support <a href="http://mysite.com/favicon.ico">http://mysite.com/favicon.ico</a> but the proper way to do it is to include an icon meta tag in the head profile.</p> <pre><code>&lt;head profile="http://www.w...
What is the most convincing way to require formalized unit testing? <p>This certainly presupposes that unit testing is a good thing. Our projects have some level of unit testing, but it's inconsistent at best.</p> <p>What are the most convincing ways that you have used or have had used with you to convince everyone th...
<p>A very convincing way is to do formalized unit test yourself, regardless of what your team/company does. This might take some extra effort on your side, especially if you're not experienced with this sort of practice.</p> <p>When you can then show your code is better and you are being more productive than your fell...
NHibernate nvarchar/ntext truncation problem <p>I'm using nhibernate to store some user settings for an app in a SQL Server Compact Edition table.</p> <p>This is an excerpt the mapping file:</p> <pre><code>&lt;property name="Name" type="string" /&gt; &lt;property name="Value" type="string" /&gt; </code></pre> <p>Nam...
<p>Okay, with many thanks to Artur in <a href="http://groups.google.com/group/nhusers/browse_thread/thread/4f865f0f516234ca" rel="nofollow">this thread</a>, here's the solution: Inherit from the SqlServerCeDriver with a new one, and override the InitializeParamter method:</p> <pre><code>using System.Data; using System...
How to update components in different threads? .NET CF <p>I´m programming a .NET Compact Framework application which shows maps on a PDA.</p> <p>I´ve created an ad hoc component that paints it´s own piece of the whole map, using several of this components the big picture is composed. I did it this way to avoid the ...
<p>The approach is wrong. Code that updates the ui has to run on the ui thread. You'll get an exception if you update the ui from another thread.</p>
How to check if a trigger is invalid? <p>I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by removing a column or...
<pre><code>SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = trigger_name AND OBJECT_TYPE = 'TRIGGER' AND STATUS &lt;&gt; 'VALID' </code></pre>
Stuck creating a "security trimmed" html.ActionLink extension method <p>I'm trying to create an Extension Method for MVC's htmlHelper. The purpose is to enable or disable an ActionLink based on the AuthorizeAttribute set on the controller/action. Borrowing from the <a href="http://blog.maartenballiauw.be/post/2008/08/2...
<p>Here is the working code:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Security.Principal; using System.Web.Routing; using System.Web.Mvc; using System.Collections; using System.Reflection; namespace System.Web.Mvc.Html { public static class Ht...
Good Resource Loading System <p>I'm currently looking for a resource management system for actionscript3. More specifically in this case, I'm looking for opinions on off-the-shelf resource loaders/managers from people who have used them, </p> <ul> <li>are they clean/simple to use? </li> <li>are they designed to be ext...
<p>I've been very happy with bulk-loader. We've integrated it with Parsley's MVC and IoC frameworks - <a href="http://spicefactory.org/parsley/" rel="nofollow">http://spicefactory.org/parsley/</a> - with great success.</p>
How to do saturating addition in C? <p>What is the best (cleanest, most efficient) way to write saturating addition in C?</p> <p>The function or macro should add two unsigned inputs (need both 16- and 32-bit versions) and return all-bits-one (0xFFFF or 0xFFFFFFFF) if the sum overflows.</p> <p>Target is x86 and ARM us...
<p>In plain C:</p> <pre><code>uint16_t sadd16(uint16_t a, uint16_t b) { return (a &gt; 0xFFFF - b) ? 0xFFFF : a + b; } uint32_t sadd32(uint32_t a, uint32_t b) { return (a &gt; 0xFFFFFFFF - b) ? 0xFFFFFFFF : a + b;} </code></pre> <p>which is almost macro-ized and directly conveys the meaning.</p>
How do I detect what browser is used to access my site? <p>How do I detect what browser (IE, Firefox, Opera) the user is accessing my site with? Examples in Javascript, PHP, ASP, Python, JSP, and any others you can think of would be helpful. Is there a language agnostic way to get this information?</p>
<p>If it's for handling the request, look at the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">User-Agent</a> header on the incoming request.</p> <p>UPDATE: If it's for reporting, configure your web server to log the User-Agent in the access logs, then run a log analysis tool, e.g., <a href...
Point ADO.Net DataSet to different databases at runtime? <p>I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime.</p> <p>Is that even possi...
<p>In the .Net 2.0 world, you can change your connection string on your table adapters at run-time. You just have to be sure the Connnection property is public, which can be set from the dataset designer.</p>
Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button? <p>The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive,...
<p>I would use ssl it would also depend I suppose on how sensitive your information is.</p>
What's the difference between 'int?' and 'int' in C#? <p>I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy.</p> <p>It's possible that I've been eating the funny ...
<p>int? is shorthand for <code>Nullable&lt;int&gt;</code>.</p> <p><a href="http://stackoverflow.com/questions/110229/how-do-nullable-types-work-in-c">This</a> may be the post you were looking for.</p>
What Exception should be thrown when an ADO.NET query cannot retrieve the requested data? <p>In an attempt to add some parameter validation and correct usage semantics to our application, we are trying to add correct exception handling to our .NET applications.</p> <p>My question is this: When throwing exceptions in A...
<p>The <a href="http://msdn.microsoft.com/en-us/library/ms229021(VS.80).aspx" rel="nofollow">MSDN guidelines</a> state:</p> <ul> <li><p>Consider throwing existing exceptions residing in the System namespaces instead of creating custom exception types.</p></li> <li><p>Do create and throw custom exceptions if you have a...
Remove Right Click Print Context Menu from Outlook 2007 <p><strong>Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA?</strong></p> <p>I am forever right-clicking to reply to an email, only to accidentally click <code>Print</code> and have Outlook send it ...
<p>Based on the link TcKs provide, that was pretty simple. In the example below I check the type of the item so that it only affects e-mails and not calendar items. To enter the code in outlook, Type Alt + F11, then expand the Microsoft Office Outlook Objects in the Project pane. Then double click the ThisOutlookSessi...
Is there a way to get jadclipse working with Eclipse 3.4? <p>I'm a big fan of the Jadclipse plugin and I'd really like to upgrade to Eclipse 3.4 but the plugin currently does not work. Are there any other programs out there that let you use jad to view source of code you navigate to from Eclipse? (Very useful when delv...
<p>Read attentively the documentation ... : </p> <ol> <li><p>The JadClipse plug-in is not activated when I start Eclipse. You'll need to launch Eclipse with the -clean flag to allow the environment to detect the plug-in. Subsequent launching of Eclipse won't require the -clean flag. <strong>eclipse -clean</strong...
Is there an easy way to attach source in Eclipse? <p>I'm a big fan of the way Visual Studio will give you the comment documentation / parameter names when completing code that you have written and ALSO code that you are referencing (various libraries/assemblies).</p> <p>Is there an easy way to get inline javadoc/param...
<p>Short answer would be yes.</p> <p>You can attach source using the properties for a project.</p> <p>Go to Properties (for the Project) -> Java Build Path -> Libraries</p> <p>Select the Library you want to attach source/javadoc for and then expand it, you'll see a list like so:</p> <pre><code>Source Attachment: (n...
What are reserved filenames for various platforms? <p>I'm not asking about general syntactic rules for file names. I mean gotchas that jump out of nowhere and bite you. For example, trying to name a file "COM&lt;n&gt;" on Windows?</p>
<p>From: <a href="http://www.grouplogic.com/knowledge/index.cfm/fuseaction/view_Info/docID/111" rel="nofollow">http://www.grouplogic.com/knowledge/index.cfm/fuseaction/view_Info/docID/111</a>.</p> <blockquote> <p>The following characters are invalid as file or folder names on Windows using NTFS: <code>/</code> <cod...
What is a simple command line program or script to backup SQL server databases? <p>I've been too lax with performing DB backups on our internal servers. </p> <p>Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript? </p>
<p>To backup a single database from the command line, use <a href="http://msdn.microsoft.com/en-us/library/aa214012.aspx">osql</a> or <a href="http://msdn.microsoft.com/en-us/library/ms162773.aspx">sqlcmd</a>.</p> <pre><code>"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\osql.exe" -E -Q "BACKUP DATABASE myd...
How to line up items of varied length in a resizable space in CSS? <p>I'd like to line up items approximately like this:</p> <pre><code>item1 item2 i3 longitemname i4 longitemname2 anotheritem i5 </code></pre> <p>Basically items of varying length arranged in a table like structure....
<p>This can be done using floated div's, calculating the max width, and setting all widths to the max. Here's jquery code to do it:</p> <p>html:</p> <pre><code>&lt;div class="item"&gt;something&lt;/div&gt; &lt;div class="item"&gt;something else&lt;/div&gt; </code></pre> <p>css:</p> <pre><code>div.item { float: left...
how to determine if a record in every source, represents the same person <p>I have several sources of tables with personal data, like this:</p> <pre><code>SOURCE 1 ID, FIRST_NAME, LAST_NAME, FIELD1, ... 1, jhon, gates ... SOURCE 2 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 1, jon, gate ... SOURCE 3 ID, FIRST_NAM...
<p>This sounds like a <a href="http://en.wikipedia.org/wiki/Customer_Data_Integration" rel="nofollow">Customer Data Integration</a> problem. Search on that term and you might find some more information. Also, have a poke around inside <a href="http://www.tdwi.org/" rel="nofollow">The Data Warehousing Institude</a>, and...
opening links in the same window or in a new (tab) <p>It has always been best practice to open links in the same window. Should that still be the rule now that most common browsers use tabs? Personally i prefer closing a tab/window over hitting the backbutton. What are your thoughts?</p>
<p>If you prefer closing a tab/window over hitting the back button, then by all means, click links with your middle mouse button. But please don't force your surfing preferences on others. Tabs don't change this principle in the slightest.</p>
Naming a "core" Assembly <p>I know that this is somewhat subjective, but I wonder if there is a generally accepted standard for naming assemblies which contain some "core" functions.</p> <p>Let's say you got a larger Projects, with Assemblies like</p> <ul> <li>Company.Product.WebControls.dll</li> <li>Company.Product....
<p>All these "root", "core", "common" and so on are really <strong>bad naming-conventions</strong>.</p> <p>Common stuff should lie in the root namespace, like in .NET, <code>string</code>, <code>int</code> and other things that are "core" or "common" lies in the root <code>System</code>-namespace.</p> <p><strong>Don'...
Code analysis <p>Does anyone know where to find an explanation to the warnings in vs 2005 codeanalysis tool. I would like some documentation, explainning why it creates the warnings it does and what course of action one should take.</p>
<p>You should be able to right click the warnings it gives you in the Error List and view Error Help, right from within Visual Studio. There's also a <a href="http://msdn.microsoft.com/en-us/library/ee1hzekz(VS.80).aspx" rel="nofollow">section of MSDN articles</a>, if you'd prefer.</p>
Installing TFS 2008 Workgroup Edition on Windows Server 2003 with SQL Server 2008 <p>I ran into an issue when installing Team Foundation Server 2008 Workgroup Edition. I have a Windows Server 2003 SP2 machine that's practically new. I have installed SQL Server 2008 with almost all of the options. When I run through the...
<p>To install Team Foundation Server 2008 against SQL Server 2008, you must use TFS 2008 Service Pack 1. However, currently Microsoft do not provide a "TFS with SP1" download - you must created your own slipstreamed installation by downloading the TFS 2008 media and then applying the service pack to the media before r...
Zabbix: is it possible to monitor arbitrary string variable? <p>We are using Zabbix for services monitoring.</p> <p>There are some essential monitoring configured. I want to have timeline of version strings of my service along with this monitorings. That would give me opportunity to see that upgrading to this version ...
<p>Yes, it's possible.</p> <p>You can pass arbitrary data from your Zabbix agent to the Zabbix server by using "UserParameter" fields in zabbix_server.conf, i.e. agent configuration file. </p> <p>General syntax is:</p> <blockquote> <p>UserParameter=section[id], command</p> </blockquote> <p>For example, let's assu...
Modifying Existing .NET Assemblies <p>Is there a way to modify existing .NET assemblies without resorting to 3rd party tools? I know that <a href="http://www.postsharp.org/">PostSharp</a> makes this possible but I find it incredibly wasteful that the developler of PostSharp basically had to rewrite the functionality of...
<p>Mono.Cecil also allows you to remove the strong name from a given assembly and save it back as an unsigned assembly. Once you remove the strong name from the assembly, you can just modify the IL of your target method and use the assembly as you would any other assembly. Here's the link for removing the strong name w...
What CLR/.NET bytecode tools exist? <p>I'm well aware of Java tools for manipulating, generating, decompiling JVM bytecode (ASM, cglib, jad, etc). What similar tools exist for the CLR bytecode? Do people do bytecode manipulation for the CLR? </p>
<p>Reflector is always good, but Mono.Cecil is the best tool you can possibly ask for overall. It's invaluable for manipulating CIL in any way.</p>
Ways to do "related searches" functionality <p>I've seen a few sites that list related searches when you perform a search, namely they suggest other search queries you may be interested in.</p> <p>I'm wondering the best way to model this in a medium-sized site (not enough traffic to rely on visitor stats to infer rela...
<p>I've tried a number of different approaches to this, with various degrees of success. In the end, I think the best approach is highly dependent on the domain/topics being searched, and how the users form queries.</p> <p>Your thought about storing previous searches seems reasonable to me. I'd be curious to see how...
Automatic newlines and formatting for blogging software <p>I'm writing by own blogging engine in PHP with a MYSQL backend database. MY question is: How would you go about making user comments and blog posts include newlines wherever they are appropriate?</p> <p>For example, if a user hits the return key in the message...
<p>PHP has a function: nl2br which turns new lines into <code>&lt;br /&gt;</code></p> <p><a href="http://us2.php.net/nl2br" rel="nofollow">www.php.net/nl2br</a></p>
Is MEF a replacement for System.Addin? <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/835182/choosing-between-mef-and-maf-system-addin">Choosing between MEF and MAF (System.AddIn)</a> </p> </blockquote> <p>Is the Managed Extensibility Framework a replacement...
<p>Short answer no it is not. System.Addin allows you to isolate add-ins in to a seprate app-domain / process. It also provides facilities for versioning. These capabilities are critical for many customers particularly large ISVs. MEF on the other hand is designed to be simple programming model for extensibility. The t...
A Delphi/FreePascal lib or function that emulates the PHP's function parse_url <p>I'm doing a sitemap producer in Object Pascal and need a good function or lib to emulate the <a href="http://php.net/manual/en/function.parse-url.php" rel="nofollow">parse_url</a> function on PHP.</p> <p>Does anyone know of any good ones...
<p>I am not familiar with the parse_url function on PHP, but you might try the <a href="http://www.indyproject.org/docsite/html/TIdURI.html" rel="nofollow" title="Online documentation for TIdURI class">TIdURI</a> class that is included with <a href="http://www.indyproject.org/" rel="nofollow" title="Indy Project home p...
Best Practices of Test Driven Development Using C# and RhinoMocks <p>In order to help my team write testable code, I came up with this simple list of best practices for making our C# code base more testable. (Some of the points refer to limitations of Rhino Mocks, a mocking framework for C#, but the rules may apply mor...
<p>Definitely a good list. Here are a few thoughts on it:</p> <blockquote> <p><strong>Write the test first, then the code.</strong></p> </blockquote> <p>I agree, at a high level. But, I'd be more specific: "Write a test first, then write <em>just enough</em> code to pass the test, and repeat." Otherwise, I'd be af...
Mysql results in PHP - arrays or objects? <p>Been using <strong>PHP/MySQL</strong> for a little while now, and I'm wondering if there are any specific advantages (performance or otherwise) to using <code>mysql_fetch_object()</code> vs <code>mysql_fetch_assoc()</code> / <code>mysql_fetch_array()</code>.</p>
<p>Performance-wise it doesn't matter what you use. The difference is that mysql_fetch_object returns object:</p> <pre><code>while ($row = mysql_fetch_object($result)) { echo $row-&gt;user_id; echo $row-&gt;fullname; } </code></pre> <p>mysql_fetch_assoc() returns associative array:</p> <pre><code>while ($row...
How to do a rolling restart of a cluster of mongrels <p>Anybody know a nice way to restart a mongrel cluster via capistrano in a "rolling" style, eg, one mongrel at a time. Would be great to have a bit of wait time in there as well for each, to let the mongrel load the rails app up as well. </p> <p>I've done some sear...
<p>I agree with the seesaw approach more than the rolling approach you are seeking. The problem is that you end up in situations where load balancing can throw users back and forth between different versions of the application while you are transitioning.</p> <p>The solutions we came up with (before finding SeeSaw, wh...
Is there any way to use XmlSiteMapProvider within WinForm/Console/VSTest application? <p>I wonder whether there is a workaround for using the standard XmlSiteMapProvider within a non asp.net application, like WinForm/Console or, in my case, VS Unit Test one.</p> <p>The following code fails, because it cannot create a ...
<p>I do not see why not. It is just a provider that implements an interface. You may not need many of the features, but you can access the API for what it provides you. Your WinForms screens can simply use the Urls for identification so that you can determine your place in the hierarchy.</p> <p>What you may have to do...
What is the best way to run asynchronous jobs in a Rails application? <p>I know there are several plugins that do asynchronous processing. Which one is the best one and why?</p> <p>The ones I know about are:</p> <ul> <li><a href="http://backgroundrb.rubyforge.org/">BackgrounDRb</a></li> </ul>
<p>I'll add DJ (Delayed Job) to the list - <a href="http://blog.leetsoft.com/2008/2/17/delayed-job-dj">http://blog.leetsoft.com/2008/2/17/delayed-job-dj</a></p> <p>The github guys recently gave it a great review: <a href="http://github.com/blog/197-the-new-queue">http://github.com/blog/197-the-new-queue</a></p>
WPF Diagramming Library <p>What free or open source WPF diagramming libraries have you used before? I'm working on my thesis and have no money to pay for the commercial alternatives.</p> <p>Valid answers should support undo/redo, exporting to XML and hopefully good documentation.</p> <p>I'm building an open source UM...
<p>sukram has a excellent series on CodeProject... it's a MUST READ!</p> <ul> <li><a href="http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part1.aspx">Part 1</a></li> <li><a href="http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part2.aspx">Part 2</a></li> <li><a href="http://www.codeproject.com/KB/WPF/WPFDia...
Turn an array of pixels into an Image object with Java's ImageIO? <p>I'm currently turning an array of pixel values (originally created with a java.awt.image.PixelGrabber object) into an Image object using the following code:</p> <pre><code>public Image getImageFromArray(int[] pixels, int width, int height) { Memo...
<p>You can create the image without using ImageIO. Just create a BufferedImage using an image type matching the contents of the pixel array.</p> <pre><code>public static Image getImageFromArray(int[] pixels, int width, int height) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_...
Have you integrated Mantis and Subversion? <p>I do mostly Windows development. We use <a href="http://www.mantisbt.org/">Mantis</a> and <a href="http://subversion.tigris.org/">Subversion</a> for our development but they aren't integrated together, in fact they are on different servers.</p> <p>I did a little googling ...
<p>I use Mantis with SVN. Pretty much as that link says, though I put the regexp in the post-commit so it doesn't try to update the bug if the commit message is not relevant, that makes non-bug-updating commits respond slightly faster.</p> <p>My Mantis install is on a different server too. I use <a href="http://curl.h...
What do you use to deploy your Web Applications? <p>We're looking to automate our deployment of Web Applications, particularly when going from local development to a remote server.</p> <p>Our current stack is LAMP remotely, MAMP locally, but I'm interested in general what people are using for this task regardless of t...
<p>When and where possible, <strong>I prefer an automated deployment</strong> such as with Ant, even FTP deployment can be fairly easily handled. Automating the deployment, much like an automated build, takes the guess work and error out of the process and by definition provides at least the bare minimum documentation...
Is it possible to prevent stack allocation of an object and only allow it to be instantiated with 'new'? <p>Is it possible to prevent stack allocation of an object and only allow it to be instiated with 'new' on the heap?</p>
<p>One way you could do this would be to make the constructors private and only allow construction through a static method that returns a pointer. For example:</p> <pre><code>class Foo { public: ~Foo(); static Foo* createFoo() { return new Foo(); } private: Foo(); Foo(const Foo&amp;); ...
What's the difference between Polymorphism and Multiple Dispatch? <p>...or are they the same thing? I notice that each has its own Wikipedia entry: <a href="http://en.wikipedia.org/wiki/Polymorphism_(computer_science)">[1]</a> <a href="http://en.wikipedia.org/wiki/Multiple_dispatch">[2]</a>, but I'm having trouble seei...
<p>Polymorphism is the facility that allows a language/program to make decisions during runtime on which method to invoke based on the types of the parameters sent to that method. </p> <p>The number of parameters used by the language/runtime determines the 'type' of polymorphism supported by a language. </p> <p>Singl...
Free/Open Source Test Generator for Java? <p>Are there any libraries for Java that can generate unit tests or unit test skeletons for existing code? I'm looking for something similar to <a href="http://pythoscope.org/">pythoscope</a>. Ideally it would generate code that follows JUnit4 or TestNG conventions.</p> <p>It ...
<p>Most IDEs will generate test method stubs for any class. I know Eclipse will.</p> <p>New->JUnit Class then you tell it which class you're testing and what methods you want to test.</p>
Any quirks I should be aware of in Drupal's XML-RPC and BlogAPI implementations? <p>I'm beginning work on a project that will access a <code>Drupal</code> site to create (and eventually edit) nodes on the site, via the <code>XML-RPC</code> facility and <code>BlogAPI</code> module shipped with <code>Drupal</code>. This ...
<p>While the XML-RPC facility is pretty stable and works well, the BlogAPI module has various issues, especially with discovery, that make using it for anything but regular blogs painful. Currently, there is no use of blogIds in the generated Really Simple Discovery document (of which only one exists for a site) or for...
MySQL search and replace some text in a field <p>What MySQL query will do a text search and replace in one particular field in a table?</p> <p>ie search for 'foo' and replace with 'bar' so a record with a field with the value : 'hello foo' becomes: 'hello bar'.</p>
<p>Change <code>table_name</code> and <code>field</code> to match your table name and field in question:</p> <pre><code>UPDATE table_name SET field = REPLACE(field, 'foo', 'bar') WHERE INSTR(field, 'foo') &gt; 0; </code></pre>
Generic LINQ query predicate? <p>Not sure if this is possible or if I'm expressing correctly what I'm looking for, but I have the following piece of code in my library repeatedly and would like to practice some DRY. I have set of SQL Server tables that I'm querying based on a simple user-supplied search field ala Goog...
<p>It sounds like you're looking for Dynamic Linq. Take a look <a href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx" rel="nofollow">here</a>. This allows you to pass strings as arguments to the query methods, like:</p> <pre><code>var query = dataSourc...
Need to create a dynamic ConfigurationSection that also holds the type <p>I need to create a configuration section, that is able to store key-value pairs in an app.config file and the key-value pairs can be added runtime regardless of their type. It is also important that the value keeps its original type. I need to ex...
<p>Phil Haack has a great article on <a href="http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx" rel="nofollow">Creating Custom Configuration Sections</a></p>
Deploy multiple instance of reporting services or connect to multiple versions of DLLs <p>Is there any way in SSRS2008 to deploy multiple instances of the ReportServer running separate code sets?</p> <p>I'm developing a very specific deployment of reporting services where I have a number of custom extensions plugged i...
<p>You can install multiple RS front ends onto one DB backend.</p> <p>It works well. We use it to have 2 primary RS boxes (load balanced) with 3rd BCP/DR hot standby box. They are all in the farm.</p> <p>You can have multiple instances on the same box too.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms15...
SQL Job Status <p>I am actually working on SP in SQL 2005. Using SP i am creating a job and am scheduling it for a particular time. These jobs take atleast 5 to 10 min to complete as the database is very huge. But I am not aware of how to check the status of the Job. I want to know if it has got completed successfully ...
<p>This is what I could find, maybe it solves your problem:</p> <ol> <li>SP to get the current job activiity.</li> </ol> <blockquote> <pre><code> exec msdb.dbo.sp_help_jobactivity @job_id = (your job_id here) </code></pre> </blockquote> <p>You can execute this SP and place the result in a temp table and get the req...
What are the advantages of using the C++ Boost libraries? <p>So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful? </p>
<p><a href="http://www.boost.org/">Boost</a> is used so extensively because:</p> <ul> <li>It is open-source and peer-reviewed. </li> <li>It provides a <a href="http://www.boost.org/doc/libs">wide range</a> of platform agnostic functionality that STL missed.</li> <li>It is a complement to STL rather than a replacement...
How can I hyperlink to a file that is not in my Web Application? <p>Ok, my web application is at <strong>C:\inetpub\wwwroot\website</strong></p> <p>The files I want to link to are in <strong>S:\someFolder</strong></p> <p>Can I make a link in the webapp that will direct to the file in <strong>someFolder</strong>?</p>
<p>If its on a different drive on the server, you will need to make a <a href="http://www.zerog.com/ianetmanual/IISVDirs_O.html" rel="nofollow">virtual directory</a> in IIS. You would then link to "<code>/virtdirect/somefolder/</code>"</p>
Piece together several images into one big image <p>I'm trying to put several images together into one big image, and am looking for an algorithm which determines the placing most optimally. The images can't be rotated or resized, but the position in the resulting image is not important.</p> <p>edit: added no resize c...
<p>Possibly you are looking for something like this: <a href="http://www.alistapart.com/articles/magazinelayout" rel="nofollow">Automatic Magazine Layout</a>.</p>
How can I programatically manipulate any Windows application's common dialog box? <p>My ultimate goal here is to write a utility that lets me quickly set the folder on <em>any</em> dialog box, choosing from a preset list of 'favorites'. As I'm just a hobbyist, not a pro, I'd prefer to use .NET as that's what I know bes...
<p>Sounds like a job for <a href="http://www.autohotkey.com">AutoHotkey</a> to me.</p> <p>I am a "pro" (at least I get paid to program), but I would first look at using AutoHotkeys' many well tested functions to access windows, rather then delving into C#/.NET and most likey the WinAPI via PInvoke.</p> <p>AutoHotkey ...
Why do I get an error when starting ruby on rails app with mongrel_rails <p>Why do I get following error when trying to start a ruby on rails application with <pre>mongrel_rails start</pre>?</p> <pre> C:\RailsTest\cookbook2>mongrel_rails start ** WARNING: Win32 does not support daemon mode. ** Daemonized, any open fi...
<p>I don't use mongrel on windows myself, but I guess that error is the equivalent of Linux' "port in use" error. Are you trying to bind the server to a port where something else is already listening?</p>
Adapt an Apache mod_rewrite RewriteRule not to act on physical directories <p>I have this RewriteRule that works too well :-)</p> <pre><code>RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] </code></pre> <p>The bad thing about this rule is that it also matches physical directories which I don't want.</p> <p>How can I t...
<p>Take a look at <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond" rel="nofollow">RewriteCond</a>. Put the following before your rule to exempt out directories and files</p> <pre><code>RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f </code></pre>
Can anyone recommend a C++ std::map replacement container? <p>Maps are great to get things done easily, but they are memory hogs and suffer from caching issues. And when you have a map in a critical loop that can be bad.</p> <p>So I was wondering if anyone can recommend another container that has the same API but uses...
<p>You can use std::tr1::unordered_map, which is already present in most STL implementations, and is part of the C++0x standard.</p> <p>Here is it's current signature :</p> <pre><code>template &lt;class Key, class T, class Hash = std::tr1::hash&lt;Key&gt;, class Pred = std::equal_to&lt;K...
UML connector Direction <p>When modelling an architecture in UML component diagrams, how do you show various attributes of connectors simultaneously? Like </p> <ul> <li>business object information flow (A->B, B->A, A&lt;->B)</li> <li>request/response direction</li> <li>synchronous/asynchronous behaviour</li> </ul> <p...
<p>For a start, <strong>don't</strong> try to explain these dynamic collaborations using the connectors on your class diagram. </p> <p>The direction of the arrow connectors on the class diagram just specifies the <em>who knows who</em>. That means, the dependencies between classes. With those arrows you can communicat...
Decode an UTF8 email header <p>I have an email subject of the form:</p> <pre><code>=?utf-8?B?T3.....?= </code></pre> <p>The body of the email is utf-8 base64 encoded - and has decoded fine. I am current using Perl's Email::MIME module to decode the email.</p> <p>What is the meaning of the =?utf-8 delimiter and how d...
<p>The <a href="http://en.wikipedia.org/wiki/MIME#Encoded-Word"><code>encoded-word</code></a> tokens (as per <a href="http://www.faqs.org/rfcs/rfc2047.html">RFC 2047</a>) can occur in values of some headers. They are parsed as follows:</p> <pre><code>=?&lt;charset&gt;?&lt;encoding&gt;?&lt;data&gt;?= </code></pre> <...
How to efficiently count the number of keys/properties of an object in JavaScript? <p>What's the fastest way to count the number of keys/properties of an object? It it possible to do this without iterating over the object? i.e. without doing</p> <pre><code>var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k))...
<p>To do this in any ES5-compatible environment, such as <a href="http://nodejs.org">Node</a>, Chrome, IE 9+, FF 4+, or Safari 5+:</p> <pre class="lang-js prettyprint-override"><code>Object.keys(obj).length </code></pre> <ul> <li><a href="http://kangax.github.com/es5-compat-table/">Browser compatibility</a></li> <li>...
The Clean programming language in the real world? <p>Are there any real world applications written in the <a href="http://clean.cs.ru.nl/" rel="nofollow">Clean</a> programming language? Either open source or proprietary.</p>
<p>This is not a direct answer, but when I checked last time (and I find the language very interesting) I didn't find anything ready for real-world.</p> <p>The idealist in myself always wants to try out new languagages, very hot on my list (apart from the aforementioned very cool Clean Language) is currently (random o...
Resources and guides to UI virtualization in WPF <p>UI Virtualization is an awkward terminology that describes WPF UI controls that load and and dispose child elements on demand (based on their visibility) to reduce memory footprint. ListBox and ListView use a class called VirtualizingStackPanel by default to achieve h...
<p>Dan Crevier has a small tutorial on building a <a href="http://blogs.msdn.com/dancre/archive/tags/VirtualizingTilePanel/default.aspx">VirtualisingTilePanel</a>.</p> <p>Ben Constable has written a tutorial on IScrollInfo, which is an essential part of the virtualisation: <a href="http://blogs.msdn.com/bencon/archive...
Objections against Java Webstart? <p>Since the release of Adobe AIR I am wondering why Java Web Start has not gained more attention in the past as to me it seems to be very similar, but web start is available for a much longer time.</p> <p>Is it mainly because of bad marketing from Sun, or are there more technical con...
<p>In my company we used Java Web Start to deploy Eclipse RCP applications. It was a pain to setup, but it works very well once in place. So the only recommendation I could make is to start small, to get the hang of it. Deploying one simple application first. Trying to deploy a complete product that is already made...
Undoing specific revisions in Subversion <p>Suppose I have a set of commits in a repository folder...</p> <pre><code>123 (250 new files, 137 changed files, 14 deleted files) 122 (150 changed files) 121 (renamed folder) 120 (90 changed files) 119 (115 changed files, 14 deleted files, 12 added files) 118 (113 changed fi...
<p>To undo revisions 118 and 120:</p> <pre><code>svn up -r HEAD # get latest revision svn merge -c -120 . # undo revision 120 svn merge -c -118 . # undo revision 118 svn commit # after solving problems (if any) </code></pre> <p>Also see the description in <a href="http://svnbook.red-bean.com/en/1.5/...
How to secure MS SSAS 2005 for HTTP remote access via Internet? <p>We are building an hosted application that uses MS SQL Server Analysis Services 2005 for some of the reporting, specifically OLAP cube browsing. Since it is designed to be used by very large global organizations, security is important.</p> <p>It seems...
<p>Basic authentication will work with local user accounts (non-domain) and even support passthrough authentication if the local accounts exist on different machines, however you should force SSL as basic authentication sends passwords in plaintext. </p> <p>You can use non-windows accounts with basic authentication in...