input
stringlengths
51
42.3k
output
stringlengths
18
55k
Give DROP PROCEDURE a parameter <p>I'm using SqlServer for the first time, and in every single one of our create procedure scripts there is a block of code like below to remove the procedure if it already exists:</p> <pre><code>IF EXISTS (SELECT * FROM information_schema.routines WHERE routine_na...
<p>The full answer is: <PRE> DECLARE @SQL VARCHAR(8000) SELECT @SQL = 'USE ' + DB_NAME() + CHAR(10) SET @SQL = @SQL + 'DROP PROCEDURE ' + @procName --PRINT @SQL EXEC(@SQL) </PRE></p> <p>The one given by Andrew will only work if the default database for your login is set to the database you want. When using dynamic sq...
C# Generics won't allow Delegate Type Constraints <p>Is it possible to define a class in C# such that</p> <pre><code>class GenericCollection&lt;T&gt; : SomeBaseCollection&lt;T&gt; where T : Delegate </code></pre> <p>I couldn't for the life of me accomplish this last night in .NET 3.5. I tried using</p> <p><code>dele...
<p>A number of classes are unavailable as generic contraints - Enum being another.</p> <p>For delegates, the closest you can get is ": class", perhaps using reflection to check (for example, in the static constructor) that the T <em>is</em> a delegate:</p> <pre><code> static GenericCollection() { if (!...
How to resolve incorrect "Ambiguous reference" from ReSharper on class inheritance? <p>In my project I have a class that is inherited by many other classes. We'll call it ClassBase.</p> <pre><code>public class ClassInheritFromBase : ClassBase </code></pre> <p>When ClassBase is being inherited, <a href="http://en.wiki...
<p>For those who still have a problem with this, (I still get it from time to time) here's the steps I did to get rid of the ambiguous reference warning in ReSharper.</p> <ol> <li>First I went to all my class libraries and made sure that all references to my other class libraries had the <em>Copy Local</em> property s...
NT AUTHORITY\NETWORK SERVICE issue when deploying on remote server SQL 2005 <p>I am getting a very non specific error when trying to connect to SQL server on remote server. I feel like I have made all the correct settings, allow TCP/IP, restarted the service, added rights to NT AUTHORITY\NETWORK SERVICE and other relat...
<p>on the remote server, create an alias for the server instance that forces TCP/IP and the port, and use that alias in the connection string. That way it wont even try to use DBNMP</p> <p>Also you can try forcing the issue int he connection string. <a href="http://connectionstrings.com/article.aspx?article=howtodefin...
In an MFC application, what's the easiest way to copy a file from one directory to another? <p>Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me?</p>
<p>I would just use the <a href="http://msdn.microsoft.com/en-us/library/aa363851(VS.85).aspx">CopyFile</a> Win32 API function, but the example code in the <a href="http://msdn.microsoft.com/en-us/library/hwbccf8z(VS.71).aspx">CFile::Open</a> documentation shows how to copy files with CFile (using pretty much the metho...
Firefox Links to local or network pages do not work <p>I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked the image should ...
<p>This is the default Firefox behavior designed for security .The assumption is probably that most web sites don't know what and where are you local files (including UNC paths).</p> <p>This could be turned off in firefox:</p> <ul> <li>type "about:config" in the address bar and accept "i'll be careful"</li> <li>find ...
How do you design a functional program? <p>From day 1 of my programming career, I started with object-oriented programming. However, I'm interested in learning other paradigms (something which I've said here on SO a number of times is a good thing, but I haven't had the time to do). I think I'm not only ready, but have...
<p>Read the <a href="http://mitpress.mit.edu/sicp/">SICP</a>.</p> <p>Also, there is a <a href="http://deptinfo.unice.fr/~roy/sicp.pdf">PDF Version</a> available.</p>
Is there a way to extract .NET 2.0 from the .NET 3.5? <p>.NET Framework 3.5 SP1 installs the .NET Framework 2.0 SP2 and the .NET Framework 3.0 SP2 behind the scenes. These installation packages (especially .NET Framework 2.0 SP2) are not available directly from Microsoft.</p> <p>Is there a way to extract them from the...
<p>Take a look on <a href="http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx</a> or download <a href="http://go.microsoft.com/fwlink/?LinkID=127832" rel="nofollow">.NET Frameworks 2.0 SP2 and 3.0 SP2 bootstrapper packages</a>. These packages give y...
Are there caveats to dynamicly creating a form with javascript? <p>I have to do a cross site POST (with a redirection, so not using a XMLHTTPRequest), and the base platform is ASP.NET. I don't want to POST all of the controls in the ASP.NET FORM to this other site, so I was considering dynamicly creating a new form ele...
<p>I do this all the time. Works really well. You will have to look through the Request's parameters manually, though, unless you get creative with what you pass as the parameters won't map onto controls on that page. You could also do this in a REST way by passing the parameters in the query string, but I prefer th...
What is the most efficient/elegant way to parse a flat table into a tree? <p>Assume you have a flat table that stores an ordered tree hierarchy:</p> <pre><code>Id Name ParentId Order 1 'Node 1' 0 10 2 'Node 1.1' 1 10 3 'Node 2' 0 20 4 'Node 1.1.1' ...
<p>There are several ways to store tree-structured data in a relational database. What you show in your example uses two methods: </p> <ul> <li><strong>Adjacency List</strong> (the "parent" column) and </li> <li><strong>Path Enumeration</strong> (the dotted-numbers in your name column). </li> </ul> <p>Another solu...
Calculating a date around working days/hours? <p>I am currently working on a website to track projects. In it, it is possible to create Service Level Agreements (SLAs). These are configurable with days of the week that a project can be worked on and also the timespan on each of those days. Eg. on Monday it might be bet...
<p>Here's some C# code which might help, it could be much cleaner, but it's a quick first draft.</p> <pre><code> class Program { static void Main(string[] args) { // Test DateTime deadline = DeadlineManager.CalculateDeadline(DateTime.Now, new TimeSpan(4, 0, 0)); Console.WriteLine(dea...
Firefox 'Error loading script' loading Google Analytics in FF2 <p>The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, ...
<p>This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.</p> <p>You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the al...
SVN checkout filtered by file extension? <p>I have a home-grown automated build script in the form of a DOS batch file. In part of that script, I check out (with "svn checkout") a section of our SVN repository that includes a bunch of third-party stuff that's used in our projects. This batch file performed pretty wel...
<p>This is possible: you can <code>svn checkout</code> an empty directory, and then <code>svn update filename</code> for each file that you <em>do</em> want.</p> <p>Your script can do something like:</p> <ol> <li><code>svn checkout svn://path/to/repos/directory --depth empty</code></li> <li><code>svn list --recursive...
Wait cursor over entire html page <p>Is it possible to set the cursor to 'wait' on the entire html page in a simple way? The idea is to show the user that something is going on while an ajax call is being completed. The code below shows a simplified version of what I tried and also demonstrate the problems I run into:<...
<p>If you use this slightly modified version of the CSS you posted from Dorward,</p> <pre><code>html.wait, html.wait * { cursor: wait !important; } </code></pre> <p>you can then add some really simple <a href="http://api.jquery.com/" rel="nofollow">jQuery</a> to work for all ajax calls:</p> <pre><code>$(document).re...
Generating a globally unique identifier in Java <p><strong>Summary:</strong> I'm developing a persistent Java web application, and I need to make sure that all resources I persist have globally unique identifiers to prevent duplicates.</p> <p><strong>The Fine Print:</strong></p> <ol> <li>I'm not using an RDBMS, so I ...
<p>Pretty sure UUIDs are "good enough". There are 340,282,366,920,938,463,463,374,607,431,770,000,000 UUIDs available.</p> <p><a href="http://www.wilybeagle.com/guid_store/guid_explain.htm">http://www.wilybeagle.com/guid_store/guid_explain.htm</a></p> <p>"To put these numbers into perspective, one's annual risk of be...
Storing PCRE compiled regexes in C/C++ <p>Is there an efficient way to store the compiled regexes (compiled via regcomp(), PCRE) in a binary file, so that later I can just read from the file and call regexec()?</p> <p>Or is it just a matter of dumping the compiled regex_t structs to the file and reading them back when...
<p>Unless you have a <a href="http://phi.lho.free.fr/programming/RETutorial.en.html" rel="nofollow" title="e-mail address">super-complex regex</a>, I hardly see an advantage of serializing the compiled regex, the compilation time shouldn't be that big. Unless you are on a super-tight embed system?</p> <p>In any case, ...
TListBox Drag and Drop problems with MultiSelect enabled <p>I have a TListBox with multiselect and ExtendedSelect both set to true. I need to be able to drag multiple items in the list box to re-arrange them. My problem is what happens when the user clicks on an item that is already selected without holding down the C...
<p>I have played with this for a while. And observe the same effects.</p> <p>I would use Case2 and add a (Select All/Deselect All) button to the list. It even adds extra functionality and solves the most annoying part of the problem.</p>
Boiler plate code replacement - is there anything bad about this code? <p>I've recently created these two (unrelated) methods to replace lots of boiler-plate code in my winforms application. As far as I can tell, they work ok, but I need some reassurance/advice on whether there are some problems I might be missing.</p>...
<p>This is good stuff. Make them extension methods though to clean up your code a little more. For example:</p> <pre><code>//Replaces OnMyEventRaised boiler-plate code //Usage: SafeInvoker.RaiseEvent(this, MyEventRaised) public static void Raise(this EventHandler eventToRaise, object sender) { EventHandler...
How do I use constants from a Perl module? <p>If I define a constant in a Perl module, how do I use that constant in my main program? (Or how do I call that constant in the main program?)</p>
<p>Constants can be exported just like other package symbols. Using the standard <a href="http://search.cpan.org/~ferreira/Exporter-5.63/lib/Exporter.pm">Exporter</a> module, you can export constants from a package like this:</p> <pre><code>package Foo; use strict; use warnings; use base 'Exporter'; use constant CON...
HOWTO: specify in app.config to call a function before Main() is called? <p>I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?</p>
<p>Not sure what you're trying to accomplish...but, I'm not aware of anyway you can have a console application run any other method before Main(). Why not do something like this:</p> <pre><code>static void Main(string[] args) { //read your app.config variable callAlternate = GetConfigSettings(); if(callA...
How do I share a javascript object between different pages in Adobe AIR? <p>I'd like to have a custom object attached to the application so I can preserve state in it between different html pages in adobe air. Is this possible?</p> <p><hr /></p> <p>I was asking for a fullblown solution to store a custom js object in ...
<p>Perhaps you could try attaching the object on the user's machine. There is a tutorial online that seems like it could help:</p> <p><a href="http://corlan.org/2008/09/02/storing-data-locally-in-air/" rel="nofollow">http://corlan.org/2008/09/02/storing-data-locally-in-air/</a></p> <p>Example from the site:</p> <pre...
Apache htaccess on Win2k is not being processed <p>I am trying to rewrite URLs using mod_rewrite. It is enabled in httpd.conf and url rewriting works if the lines are in the httpd.conf file. However, I would like the rules to be in the .htaccess file. It doesn't appear that .htaccess is being processed at all by Apac...
<p>Check that <code>AllowOverride FileInfo</code> is enabled in <code>httpd.conf</code> for the directories affected; see also <a href="http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride" rel="nofollow">http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride</a>. You might also check permissions on the <...
Subversion & switching between tags <p>My automated deployment system updates a latest version of my site trough subversion. Instead of having my live site point to the trunk (which is always almost a work in progress version), I have my live site point to a tag.</p> <p>E.g. I work on trunk and when my v1.0 is finishe...
<p>There actually is a switch function that does just that. I use TortiseSVN which is a windows shell/gui for Subversion, so I'm not familiar with how to do it manually, but this looks like it should help:</p> <p><a href="http://svnbook.red-bean.com/en/1.1/ch04s05.html">http://svnbook.red-bean.com/en/1.1/ch04s05.html...
Good examples or documentation of XIFF implementation? <p><a href="http://www.igniterealtime.org/projects/xiff/" rel="nofollow">XIFF</a> is an implemenation of the <a href="http://en.wikipedia.org/wiki/Jabber" rel="nofollow">XMPP</a> protocol in actionscript.</p> <p>So far, all the examples and documentation I have se...
<p>Yeah, there are not a ton of good examples / docs online.</p> <p>Check out:</p> <p><a href="http://www.mikechambers.com/blog/index.php?s=xiff" rel="nofollow">http://www.mikechambers.com/blog/index.php?s=xiff</a></p> <p>for a couple of examples that show how to get started.</p> <p>mike</p>
Simplifying VisualSVN Server's URLs <p>We're currently running an <code>svnserve</code> instance as NT service. While this works, it's needlessly cumbersome to administer, and I'd like to move on to the much simpler VisualSVN Server. (Bonus side benefits include Windows-integrated authentication and, thanks to HTTP/Web...
<p>You can configure the apache location to use <strong>SVNPath</strong> instead of <strong>SVNParentPath</strong>. It is inside the &lt;Location>-Block of your httpd.conf you also should rename this block to the name of your repository. Then the ../svn/.. part of your URL is gone.</p>
What will the pNext pointer be in the following case using C? <pre><code>func() { Object* pNext; func1(pNext); } func1(Object* pNext) { pNext = Segement-&gt;GetFirstPara(0); } </code></pre> <p>I was expecting it to be pointer to firstpara returned from func1() but I'm seeing NULL can some explain and how ...
<p>For C++ only, you can make the parameter a reference</p> <pre><code>func() { Object* pNext; func1(pNext); } func1(Object*&amp; pNext) { pNext = Segement-&gt;GetFirstPara(0); } </code></pre> <p>What is going on here is the difference between passing parameters by value and passing by reference. C alway...
Has anyone used/created "fisheye" table columns? <p>Has anyone ever given table columns the "fisheye" effect? Im talking about an expanding effect of the table columns when hovering the mouse over them. I'd love to see some code if anyone has tried this.</p> <p>EDIT: ...or an accordian effect</p>
<p>It's not for a table, but here is the effect:</p> <p><a href="http://safalra.com/web-design/javascript/mac-style-dock/" rel="nofollow">http://safalra.com/web-design/javascript/mac-style-dock/</a></p>
Writing a compiler in its own language <p>Intuitively, it would seems that a compiler for language Foo, cannot itself be written in Foo. More specifically, the <em>first</em> compiler for language Foo cannot be written in Foo, but any subsequent compiler could be written for Foo.</p> <p>But is this actually true? I ha...
<p>This is called "bootstrapping". You must first build a compiler (or interpreter) for your language in some other language (usually Java or C). Once that is done, you can write a new version of the compiler in language Foo. You use the first bootstrap compiler to compile the compiler, and then use this compiled co...
Best approach for using AJAX loaders? <p>I've implemented a few poor solutions for bringing up an AJAX loader before dynamically updating a content DIV, but none seem to be "universal", and I find each time I do it I'm reworking it. If I have a DIV with content that updates depending on what a user clicks on the page, ...
<p>Some JavaScript libraries allow listening to opening and closing requests. Check out Prototype's request Responder <a href="http://www.prototypejs.org/api/ajax/responders" rel="nofollow">http://www.prototypejs.org/api/ajax/responders</a>.</p> <p>You would do something like this:</p> <pre><code>Ajax.Responders.regi...
IIS 6 Tuning Guide? <p>I have been a developer for 10+ years and so far my IIS knowledge is just enough for deploying stuff on it and get it running. Recently I have been playing with IIS 6 and realize the huge difference on the worker process model. I think I would need some good guide to update my knowledge in this a...
<p><a href="http://iistuner.codeplex.com" rel="nofollow">IIS Tuner</a> is an open source tool for tuning IIS 6, 7 and 7.5 </p>
How to find all the tables in MySQL with specific column names in them? <p>I have 2-3 different column names that I want to look up in the entire DB and list out all tables which have those columns. Any easy script?</p>
<p>To get all tables with columns <code>columnA</code> or <code>ColumnB</code> in the database <code>YourDatabase</code>:</p> <pre><code>SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('columnA','ColumnB') AND TABLE_SCHEMA='YourDatabase'; </code></pre>
How can I upload files without using an HTML <form>? <p>in a web application I am building I need to upload photos without using a form, otherwise it will come up with form embedded in an outer from which is not permitted in XHTML.</p> <p>I think uploading files is what jQuery.post should be able to do, but I currentl...
<p>take a look at <a href="http://swfupload.org/" rel="nofollow">swfupload</a>, it's a pretty nifty little app that should accomplish what you want. otherwise, you could separate out the forms, and just use css/javascript to reposition them if necessary.</p>
Flexibility in the project scope? <p>How flexible should a programmer be if a client requests requirements that is not in the project scope?</p>
<p>General perspective:</p> <p>You need to earn a living; the client needs a computing solution: the client has the right to make sure that the solution you will supply fits his needs. Changes and additions after and agreement has been reached, reflects on your ability to analyze the user's requirements into a system ...
Check if SoundChannel is playing sound <p>How to check reliably if a SoundChannel is still playing a sound? </p> <p>For example,</p> <pre><code>[Embed(source="song.mp3")] var Song: Class; var s: Song = new Song(); var ch: SoundChannel = s.play(); // how to check if ch is playing? </code></pre>
<p>I've done a little research and I can't find a way to query any object to determine if a sound is playing. You'll have to write a wrapper class and manage it yourself it seems.</p> <pre><code> package { import flash.events.Event; import flash.media.Sound; import flash.media.SoundChannel; public cla...
How do I properly store and retrieve internationalized Strings in properties files? <p>I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings.</p> <p>Specifically, I have a file "messages_en_US.properties" that stores "hello.worl...
<p>I realized that native2ascii was assuming (surprise) that it was converting from my operating system's default encoding each time, and as such not producing the correct escaped Unicode string.</p> <p>Running native2ascii with the "-encoding <em>encoding_name</em>" option where <em>encoding_name</em> was the name of...
"suggest" feature for textboxes in a rails app <p>I'm looking for an easiest way how to implement the "suggest" feature for a text entry field in a Rails application. The idea is to complete names stored in a database column, giving the user a drop-down menu of possible matches as he types.</p> <p>Thanks for any sugge...
<p>Rails makes 'suggest'-style auto completion on text fields really easy using the <code>text_field_with_auto_complete</code> method.</p> <p>In Rails 1.x this method was built into <a href="http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptMacrosHelper.html"><code>ActionView::Helpers::JavaScriptMacrosHe...
How to parse a .xfa file <p>Hoping that someone has some info on how to parse a xfa file. I can parse csv or xml files just fine, but an xfa one has come along and I'm not familar with the format. Looks like tab delimited body with column metadata at the top.</p> <p>Anyone dealt with these before or can give me a stee...
<p>Mmm, looks like nobody has a clue. The problem is that .xfa doesn't look like a "standard" extension: after all, anybody can create its own extension names, from .xyz to .something...</p> <p>I looked around a bit, found, unsurprisingly (the 'x') an XML format with this extension, not much more.</p> <p>Indicating w...
Creating standalone Lua executables <p>Is there an easy way to create standalone .exe files from Lua scripts? Basically this would involve linking the Lua interpreter and the scripts.</p> <p>I believe it is possible (PLT Scheme allows the creation of standalone executables in the same way), but how, exactly?</p>
<p>Check out for <a href="http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#srlua">srlua</a>. It does what you need. </p> <p>It's from one of the Lua authors. On this address there is also pre-compiled Windows binaries, so that would be even easier for you I think.</p>
2D Javascript array <p>Simply put, is there a way to create a 2D javascript array using similar syntax to this?</p> <pre><code>var newArray = [ [0, 1, 2], [3, 4, 5], [6, 7, 8] ] </code></pre>
<p>You can create any n-dimensional arrays using <em>exactly</em> the format you suggest as in the following sample:</p> <pre><code>&lt;script&gt; var newArray = [ [0, 1, 2], [3, 4, 5], [6, 7, 8] ] var newArray3d = [[[ 0, 1, 2],[ 3, 4, 5],[ 6, 7, 8]], [[10, 11...
HTML in an ASP.NET Dynamic Data MultilineText Control <p>I'm trying to enter a little bit of HTML into an ASP.NET Dynamic Data MultilineText_Edit control, just a couple of <code>&lt;br&gt;</code> tags to have line breaks when I output the value of the column on a web page. </p> <p>However, when I try to click the "Up...
<p>Input validation is a built in feature in ASP.NET 2.0 or later. I don't know why you are not getting an error, but check this out to see if it helps:</p> <p><a href="http://www.asp.net/learn/whitepapers/request-validation/" rel="nofollow">http://www.asp.net/learn/whitepapers/request-validation/</a></p> <p>Check t...
In agile like development, who should write test cases? <p>Our team has a task system where we post small incremental tasks assigned to each developer. </p> <p>Each task is developed in its own branch, and then each branch is tested before being merged to the trunk.</p> <p>My question is: Once the task is done, who s...
<h2>The Team.</h2> <p>If a defect gets to a customer, it is <strong><em>the team's</em></strong> fault, therefore <strong><em>the team</em></strong> should be writing test cases to assure that defects don't reach the customer.</p> <ol> <li><p><strong>The Project Manager (PM)</strong> should understand the domain bett...
Show file tree in visual studio 2005? <p>I have a large project that I want to start using visual studio 2005 to edit. I want to tell it "Here are all the files I want you to track, now get on with it" and have them displayed as a directory tree, for example:</p> <pre><code>Folder 1 - File A - File B - File C Folde...
<p>click on the 'show all files' icon in the solution explorer, then select the folders you want to include, right click and select 'include in project'.</p>
How do I use LINQ Contains(string[]) instead of Contains(string) <p>I got one big question.</p> <p>I got a linq query to put it simply looks like this:</p> <pre><code>from xx in table where xx.uid.ToString().Contains(string[]) select xx </code></pre> <p>The values of the <code>string[]</code> array would be numbers ...
<p>spoulson has it nearly right, but you need to create a <code>List&lt;string&gt;</code> from <code>string[]</code> first. Actually a <code>List&lt;int&gt;</code> would be better if uid is also <code>int</code>. <code>List&lt;T&gt;</code> supports <code>Contains()</code>. Doing <code>uid.ToString().Contains(string...
How can I split multiple joined words? <p>I have an array of 1000 or so entries, with examples below:</p> <pre><code>wickedweather liquidweather driveourtrucks gocompact slimprojector </code></pre> <p>I would like to be able to split these into their respective words, as:</p> <pre><code>wicked weather liquid weather...
<p>The <a href="http://en.wikipedia.org/wiki/Viterbi_algorithm">Viterbi algorithm</a> is much faster. It computes the same scores as the recursive search in Dmitry's answer above, but in O(n) time. (Dmitry's search takes exponential time; Viterbi does it by dynamic programming.)</p> <pre><code>import re from itertools...
What is the best way to use JavaDoc to document a Java enum? <p>I've just started using Java's enums in my own projects (I have to use JDK 1.4 at work) and I am confused as to the best practice of using JavaDoc for an enum.</p> <p>I have found that this method works, but the resultant code is a little unrefined:</p> ...
<p>To answer the first part of your question, you do have to separate each enum value with a comma. As far as I know, there's no way around that.</p> <p>Personally I don't have a problem with the code the way you've presented it. Seems like a perfectly reasonable way to document an enum to me.</p>
What is the quickest way to detect an unreachable host in Java? <p>I would like the fastest and most accurate function <code>boolean isReachable(String host, int port)</code> that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered "u...
<p>Firstly you need to recognise that you have <em>potentially</em> conflicting requirements; IP sockets are not time deterministic. The quickest you can ever detect unreachability is after your elapsed timeout. You can only detect reachability quicker.</p> <p>Assuming reachability/isReachable is your real objective...
How to raise an event from a SWF in a SWFLoader to a parent Flex application? <p>How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)?</p> <p>I want to be able to detect</p> <pre><code>a) when a button is pressed b) when the animation ends </code></pre>
<p>You'll need to do 2 things:</p> <ol> <li>Dispatch an event from the loaded swf. Make sure the event bubbles if you sent it from nested views. Bubbling can be set through the bubbles property of the event.</li> <li><p>Listen to the event from your main application. I think you should be able to do that on the conten...
How do I check if a tag exists in XSLT? <p>I have the following template</p> <pre><code>&lt;h2&gt;one&lt;/h2&gt; &lt;xsl:apply-templates select="one"/&gt; &lt;h2&gt;two&lt;/h2&gt; &lt;xsl:apply-templates select="two"/&gt; &lt;h2&gt;three&lt;/h2&gt; &lt;xsl:apply-templates select="three"/&gt; </code></pre> <p>I would ...
<pre><code>&lt;xsl:if test="one"&gt; &lt;h2&gt;one&lt;/h2&gt; &lt;xsl:apply-templates select="one"/&gt; &lt;/xsl:if&gt; &lt;!-- etc --&gt; </code></pre> <p>Alternatively, you could create a named template,</p> <pre><code>&lt;xsl:template name="WriteWithHeader"&gt; &lt;xsl:param name="header"/&gt; &lt;xsl:pa...
Professional jQuery based Combobox control? <p>Are there any <strong>professional</strong> Combobox controls (dropdown list with autosuggestion) based on the jQuery library?</p> <p>It should be able to handle <strong>large datasets</strong> and have some <strong>skinning</strong> options. A <strong>multi-column result...
<p>Here's one that looks very promising. It's a true combo - you see what you type. Has a cool feature I haven't seen elsewhere: paging results. </p> <p><a href="http://www.codeplex.com/flexbox">FlexBox</a></p>
ASP.NET, XSLT and dynamic controls <p>I wish to use xml and xsl to generate controls on an asp.net page.</p> <p>I currently have a asp.net content page that contains a xml control. When the page is loaded, an xml file is loaded and the required element is extracted and set as the xml control's DocumentContent and the ...
<p>Register a namespace in your XSL so that you can put .NET server-side tags into it. Run your XSL transform against your XML. Run the result of your transform through Page.ParseControls(). This will give you a nice control hierarchy. Add the output of that function to your Controls collection (or the controls col...
How to log in an Oracle database? <p>I am interested in what methods of logging is frequent in an Oracle database. Our method is the following:</p> <p>We create a log table for the table to be logged. The log table contains all the columns of the original table plus some special fields including timestamp, modificatio...
<p>It sounds like you are after 'auditing'. Oracle has a built-in feature called Fine Grain Auditing (FGA). In a nutshell you can audit everything or specific conditions. What is really cool is you can 'audit' selects as well as transactions. Simple command to get started with auditing:</p> <pre><code>audit UPDATE...
TransactionScope bug in .NET? More information? <p>I have read (or perhaps heard from a colleague) that in .NET, TransactionScope can hit its timeout and then VoteCommit (as opposed to VoteRollback). Is this accurate or hearsay? I couldn't track down information on the web that talked about this issue (if it IS an is...
<p>The behaviour that Marc Gravell described has been changed in .Net 4.0. Instead of the operation being autocommitted, it will now throw an InvalidOperationException. So in 4.0 you no longer need to use Explicit Unbind.</p>
Do you use the 'My' namespace in VB.NET? <p>VB.NET has the "my" namespace, but how many VB.NET developers actually use it?</p> <ul> <li>if you don't, why? </li> <li>if you are using it, why?</li> </ul> <p>I'm considering building a framework for VB.NET, and using the My namespace to plug it into VB seems like a r...
<p>The purpose of My, as I understand it, is to be an easy shortcut to certain API tasks that are common but hard-to-find or hard-to-use. You probably shouldn't completely subsume your framework under My. (For one thing, C# people using your framework may get grouchy.)</p> <p>Instead, you should design it as a norma...
Unit testing a module that checks internet connectivity <p>I have a C# module responsible for acquiring the list of network adapters that are "connected to the internet" on a windows Vista machine. The module uses the "<a href="http://msdn.microsoft.com/en-us/library/aa370803(VS.85).aspx" rel="nofollow">Network List Ma...
<p>I can only answer your question about the unit test.</p> <p>The code you're testing is, in your own words, "a C# module responsible for acquiring the list of network adapters that are 'connected to the internet' on a windows Vista machine. The module uses the 'Network List Manager API' (or NLM API) to iterate over ...
History data from IE <p>Where does Internet Explorer store the history data, i.e. the list of URL that have been visited? I am using Windows XP SP3 and IE7. Basically I would like to read the list of URL and make some statistics on how often what pages are visited.</p>
<p>Internet Explorer seems to keep its history in hidden directories under C:\Documents and Settings\USERNAME\Local Settings\History\History.IE5. Note that some directories in this path are also marked hidden or system. The history's format is opaque, but <a href="http://www.codeproject.com/KB/system/IECache.aspx" re...
What is spaghetti code? <p>Can you post a short example of real, overdone spaghetti code, possibly saying what it does? Can you show me a little debugger's nightmare?</p> <p>I don't mean <a href="http://www0.us.ioccc.org/main.html" rel="nofollow">IOCCC</a> code, that is science fiction. I mean real life examples that ...
<p>To me, a more <strong>modern</strong> example of spaghetti code is when you have 20 dlls and every DLL references each other in one way or another. Your dependency graph looks like a huge blob, and your code hops all over the place with no real order. Everything is inter-dependent.</p>
What is a SQL "pseudocolumn"? <p>I accidentally coded <code>SELECT $FOO..</code> and got the error "Invalid pseudocolumn "$FOO".</p> <p>I can't find any documentation for them. Is it something I should know?</p> <p>Edit: this is a MS SQL Server specific question.</p>
<p>Pseudocolumns are symbolic aliases for actual columns, that have special properties, for example, $IDENTITY is an alias for the column that has the IDENTITY assigned, $ROWGUID for the column with ROWGUIDCOL assigned. It's used for the internal plumbing scripts.</p>
Locating a file on the path <p>Does anybody know how to determine the location of a file that's in one of the folders specified by the PATH environmental variable other than doing a dir filename.exe /s from the root folder?</p> <p>I know this is stretching the bounds of a programming question but this is useful for de...
<p>You can use the <code>where.exe</code> utility in the <code>C:\Windows\System32</code> directory.</p>
How do you do relative time in Rails? <p>I'm writing a Rails application, but can't seem to find how to do relative time, i.e. if given a certain Time class, it can calculate "30 seconds ago" or "2 days ago" or if it's longer than a month "9/1/2008", etc.</p>
<p>Sounds like you're looking for the <a href="http://apidock.com/rails/ActionView/Helpers/DateHelper/time_ago_in_words"><code>time_ago_in_words</code></a> method (or <a href="http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words"><code>distance_of_time_in_words</code></a>), from ActiveSuppor...
Test Driven Design for iPhone Native apps <p>I'm experimenting with the iPhone SDK and doing some TDD ala Dr. Nic's rbiPhoneTest project. I'm wondering how many, if any, have been successful using this or any other testing framework for iPhone/Cocoa? More important, I'd like to know how to best assert a proprietary bin...
<p>I don’t know much about Ruby or binary protocols, but if You’re interested in unit testing on iPhone, You might want to check out the <a href="http://code.google.com/p/google-toolbox-for-mac/" rel="nofollow">Google Toolbox for Mac</a>. I am having great success testing my OpenGL ES application with it.</p>
What are the main differences between XHTML and HTML? <p>What are the main differences between XHTML and HTML? Which one is better in your opinion, and why? Do most browsers support both?</p>
<p>This is probably the best article I've read on the differences and relative merits of each:</p> <h2><a href="http://www.webstandards.org/learn/articles/askw3c/oct2003/">HTML Versus XHTML</a><br></h2> <p><em>Which should we use, HTML or XHTML, and why?</em></p> <p>There is also a rather technical comparison on the...
JavaScript slider <p>I need to create a 'slider' for a client's site. The slider should allow people to select how many items they want of x item, and show what the price will be based on that. The weird(ish) part is that the ratio of the price increase will go down as the amount of items goes up:</p> <ul> <li>1 item:...
<p>Check out Yahoo! UI. they have a slider widget: <a href="http://developer.yahoo.com/yui/slider/">http://developer.yahoo.com/yui/slider/</a></p> <p>The following example should get you started: <a href="http://developer.yahoo.com/yui/examples/slider/slider-ticks.html">http://developer.yahoo.com/yui/examples/slider/s...
Programmatically send keystrokes to GLUT application <p>I have an OpenGL/GLUT program running on my linux machine that views a 3D model from various angles and can take screenshots, and everything is controlled from the keyboard. I want to write a script that moves around the model in a particular way, taking screensh...
<p>Take the GLUT source-code and make it remote controllable. One way to do this is to remove the function that polls the keyboard and let it poll a socket instead. Link the program with the existing program with the new library.</p> <p>Afterwards you can establish a connection to the now remote-controllable program a...
Is there a way I can retrieve sa password in sql server 2005 <p>I just forgot the password. Can anyone help me how to get back the password.</p>
<p>There is no way to get the old password back. Log into the SQL server management console as a machine or domain admin using integrated authentication, you can then change any password (including sa).</p> <p>Start the SQL service again and use the new created login (recovery in my example) Go via the security panel ...
Java version names in Sun's bug database <p>In <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150</a> it says Release Fixed 7(b14), 6u2(b01) (Bug ID:2147561)</p> <p>What does 6u2 mean? (Am I right in assuming it as 1.6.0_02 ?) ...
<p>yes, release 6 update 2. Also, (b01) is build 01</p>
Should I only store fixed-size data elements in a database? <p>If the amount of data stored within a given field of a database is unknown, and could be very large, should I store it in an external file rather than within a field in the database?</p>
<p>Do you need transactional semantics (commit, rollback) for the data? If so, then using the external file system greatly complicates life -- use the DBMS. If you don't need transactional semantics, then the file system may make sense.</p>
Can you write a block of c++ code inside C#? <p>I heard somewhere that you can drop down to C++ directly inside C# code. How is this done? Or did I hear wrong?</p> <p>Note: I do not mean C++ / CLI.</p>
<p>You might be thinking of <a href="http://msdn.microsoft.com/en-us/library/chfa2zb8(VS.71).aspx" rel="nofollow"><code>unsafe</code> blocks</a> where you can write code that looks a lot like C++, since you can use pointers.</p>
What's the best way to use SqlBulkCopy to fill a really large table? <p>Nightly, I need to fill a SQL Server 2005 table from an ODBC source with over 8 million records. Currently I am using an insert statement from linked server with syntax select similar to this:</p> <pre><code>Insert Into SQLStagingTable from Select...
<p>The easiest way would be to use ExecuteReader() against your odbc data source and pass the <a href="http://msdn.microsoft.com/en-us/library/system.data.idatareader.aspx" rel="nofollow">IDataReader</a> to the <a href="http://msdn.microsoft.com/en-us/library/434atets.aspx" rel="nofollow">WriteToServer(IDataReader)</a>...
Identify full vs half yearly datasets in SQL <p>I have a table with two fields of interest for this particular exercise: a CHAR(3) ID and a DATETIME. The ID identifies the submitter of the data - several thousand rows. The DATETIME is not necessarily unique, either. (The primary keys are other fields of the table.)<...
<p>from your description, i wouldn't worry about the efficiency of the query since apparently it only needs to run twice a year!</p> <p>there are a few ways to do this, which one is 'best' depends on the data that you have. the datediff (on max/min date values) you suggested should work, another option is to just coun...
Configuring WordPress .htaccess to view subfolders <p>I have a WordPress installation with an <code>.htaccess</code> file that looks like this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteR...
<p>For future reference, you may want to try this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /blog2/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog2/index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre>
PHP: Best way to extract text within parenthesis? <p>What's the best/most efficient way to extract text set between parenthesis? Say I wanted to get the string "text" from the string "ignore everything except this (text)" in the most efficient manner possible.</p> <p>So far, the best I've come up with is this:</p> <p...
<p>i'd just do a regex and get it over with. unless you are doing enough iterations that it becomes a huge performance issue, it's just easier to code (and understand when you look back on it)</p> <pre><code>$text = 'ignore everything except this (text)'; preg_match('#\((.*?)\)#', $text, $match); print $match[1]; </co...
Java: Triple Curly Bracing <p>I've been given some code with commenting unlike anything I've come across before:</p> <pre><code>//{{{ Imports import imports; //}}} </code></pre> <p>It is the same for each method block, </p> <pre><code>//{{{ above the code block //}}} below the code block </code></pre> <p><br> <s...
<p>A quick search for <em>"triple curly" comment</em> suggests it's "<a href="http://www.emacswiki.org/cgi-bin/wiki/FoldingMode" rel="nofollow">Emacs folding mode</a>".</p> <p>Or some other code folding marker in any case.</p>
Best way to extract the second level domain from the HTTP_Host Variable in VBScript <p>I need to extract only the 2nd level part of the domain from request.servervariables("HTTP_HOST") what is the best way to do this?</p>
<pre><code>If Len(strHostDomain) &gt; 0 Then aryDomain = Split(strHostDomain,".") If uBound(aryDomain) &gt;= 1 Then str2ndLevel = aryDomain(uBound(aryDomain)-1) strTopLevel = aryDomain(uBound(aryDomain)) strDomainOnly = str2ndLevel &amp; "." &amp; strTopLevel End If End If </code></pre...
How to add NUnit in Visual Studio <p>I need to write test cases for my application. I've chosen NUnit. Please let me know how to add NUnit to my Visual Studio IDE. where can I download them?</p>
<p>Best place to start would probably be: <a href="http://testdriven.net/">http://testdriven.net/</a></p> <p>They have NUnit, and a host of other unit testing suites that can integrate with various versions of Visual Studio, as well as some documentation on them.</p>
Cross-platform editor control <p>I need a cross-platform editor control to use as GUI-part in an in-house tool. The control may be commercial, but with reasonable price.</p> <p>Required features:</p> <ul> <li>Platforms: Win32, OS X, Linux</li> <li>UTF-8 support</li> <li>Fine-grained run-time control to the text style...
<p>As John wrote, Scintilla is known to run on OS X.<br /> Now, it is not a rich text component, if that's what you are looking for. It is a source code editor: you can't apply arbitrary colors to arbitrary segments of text, it uses a lexer to style the content.</p> <p>You didn't tell us what is your use case.</p> <p...
What is the easiest/best/most correct way to iterate through the characters of a string in Java? <p><code>StringTokenizer</code>? Convert the <code>String</code> to a <code>char[]</code> and iterate over that? Something else?</p>
<p>I use a for loop to iterate the string and use <code>charAt()</code> to get each character to examine it. Since the String is implemented with an array, the <code>charAt()</code> method is a constant time operation.</p> <pre><code>String s = "...stuff..."; for (int i = 0; i &lt; s.length(); i++){ char c = s.c...
Drop Down List with WPF Menu Controls <p>I am looking for a way to add a drop down list in WPF to a menu. This used to be really easy in winforms and so I am expecting you experts to know just now to do it in WPF. Thanks.</p> <p>Sorry if this is a bad question, it is late and I don't want to think.</p>
<p>It is very easy to add any UIElement to any control, You can just add Combobox to a Menu control and create menu as bellow</p> <pre><code> &lt;Menu &gt; &lt;MenuItem Header="File"&gt; &lt;MenuItem Header="Open"/&gt; &lt;MenuItem Header="Close"/&gt; &lt;Separator/&gt; ...
Java2D Performance Issues <p>I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to enable 3D acceleration for 2D, but even using that has some weird issues. </p> <p>Here are results of tests I ran:</p> <p>Drawing a 25x18 map with 32x32 pixel tiles on a JComponent<br> Image 1 = ....
<p>I think I found a solution by researching and putting bits and pieces together from too many Google searches. </p> <p>Here it is, comments and all:</p> <pre><code>private BufferedImage toCompatibleImage(BufferedImage image) { // obtain the current system graphical settings GraphicsConfiguration gfx_config = Grap...
How do I change OutDir variable in Visual C++? <p>In the linker the binary destination is specified as:</p> <p>$(OutDir)\$(ProjectName).exe</p> <p>I've looked through every setting and I can't see where OutDir is defined. How do I change this?</p>
<p>First option in the "General" section underneath "Configuration Properties".</p>
How to check if OS is Vista in Python? <p>How, in the simplest possible way, distinguish between Windows XP and Windows Vista, using Python and <a href="http://python.net/crew/mhammond/win32/Downloads.html">pywin32</a> or <a href="http://www.wxpython.org/">wxPython</a>?</p> <p>Essentially, I need a function that calle...
<p>Python has the lovely 'platform' module to help you out.</p> <pre><code>&gt;&gt;&gt; import platform &gt;&gt;&gt; platform.win32_ver() ('XP', '5.1.2600', 'SP2', 'Multiprocessor Free') &gt;&gt;&gt; platform.system() 'Windows' &gt;&gt;&gt; platform.version() '5.1.2600' &gt;&gt;&gt; platform.release() 'XP' </code></pr...
Can you list the keyword arguments a Python function receives? <p>I have a dict, which I need to pass key/values as keyword arguments.. For example..</p> <pre><code>d_args = {'kw1': 'value1', 'kw2': 'value2'} example(**d_args) </code></pre> <p>This works fine, <em>but</em> if there are values in the d_args dict that ...
<p>A little nicer than inspecting the code object directly and working out the variables is to use the inspect module.</p> <pre><code>&gt;&gt;&gt; import inspect &gt;&gt;&gt; def func(a,b,c=42, *args, **kwargs): pass &gt;&gt;&gt; inspect.getargspec(func) (['a', 'b', 'c'], 'args', 'kwargs', (42,)) </code></pre> <p>If ...
Can anyone recommend a Java rich text editor? <p>The rich text editor must be implemented in Java, provide Swing support, and preferably be open source.</p> <p>I'm looking to integrate it into an existing Java/Swing application. </p> <p>Thanks.</p>
<p>This is probably not as drop-in-place as what you were after... but JTextPane supports rich text and HTML. Its trivial to get it to <em>display</em> rtf or html, just set the encoding type before you fill it with content. </p> <p>As for making the little "B" and "<em>I</em>" etc style-modifying buttons, well if it...
Eclipse Abstract Syntax Tree Programmatic Access <p>Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code?</p> <p>eg getting the AST for:</p> <p><hr /></p> <h2>Class1.java</h2> <pre><code>package parseable; public class Class1 { /** * @param args *...
<p>It is not an <em>exact</em> answer, that may give you a place where to start:</p> <p>As said in this <a href="http://stackoverflow.com/questions/160382/extract-all-string-from-a-java-project#161145">question</a>, </p> <p>A full example is available in this <a href="http://www.eclipse.org/articles/article.php?file=...
What is the best implementation of STL for VS2005? <p>I'm currently using default implementation of STL for VS2005 and I'm <a href="http://stackoverflow.com/questions/186494/ifstr1str2-versus-ifstr1lengthstr2length-str1str2">not really satisfied</a> with it. Perhaps there is something better?</p>
<p>The Dinkumware STL implementation (supplied with VS2005) is actually quite good. The STL is a general purpose library and so it is almost always possible to write something better for very specific use cases.</p> <p>I'm aware of the following alternative implementations, but I've never used them with VS2005:</p> <...
Skip file lines until a match is found, then output the rest <p>I can write a trivial script to do this but in my ongoing quest to get more familliar with unix I'd like to learn efficient methods using built in commands instead.</p> <p>I need to deal with very large files that have a variable number of header lines. t...
<p>Similar to the answer of <a href="http://stackoverflow.com/questions/197150/skip-file-lines-until-a-match-is-found-then-output-the-rest#197169">Avi</a>, but without including the line with "LastHeaderLine".</p> <pre><code>sed -e '1,/LastHeaderLine/d' </code></pre>
How do you optimise your Javascript? <p>Well... simple question, right? But with no so simple answers. In firefox i use firebug console (profile) but... what to do in other browsers? Like Internet Explorer / Opera / Safari (on windows)</p>
<p>This particular problem solves itself over time. ;-)</p> <p>Version 8 of the Internet Explorer (currently in beta 2) ships with a built-in JavaScript profiler. The next Safari version will probably also include one since its rendering engine, WebKit, now has one as part of its <a href="http://webkit.org/blog/148/we...
VMWare ctrl-z key binding, how to remove <p>When I <kbd>Alt</kbd>+<kbd>Tab</kbd> to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has th...
<p>This will not remove the key binding from VmWare, but you could set the option to "Grab keyboard and mouse intput on key press" in the VmWare preferences. VmWare help explicitly states that this will disable the system accelerator key sequences.</p>
Why can't I use a type argument in a type parameter with multiple bounds? <p>So, I understand <i>that</i> the following doesn't work, but <i>why</i> doesn't it work?</p> <pre><code>interface Adapter&lt;E&gt; {} class Adaptulator&lt;I&gt; { &lt;E, A extends I &amp; Adapter&lt;E&gt;&gt; void add(Class&lt;E&gt; extl...
<p>I'm also not sure why the restriction is there. You could try sending a friendly e-mail to the designers of Java 5 Generics (chiefly Gilad Bracha and Neal Gafter).</p> <p>My guess is that they wanted to support only an absolute minimum of <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.9...
SqlDataReader.HasRows returns false since SQL 2008 upgrade <p>I've got an ASP.NET 2.0 website that connects to a SQL database. I've upgraded the SQL server from 2000 to 2008 and since then, one page refuses to work. </p> <p>I've worked out the problem is that the call to SqlDataReader.HasRows is returning false even t...
<p>Does the stored procedure work if you invoke it in directly, say in SSMS? I'd start by making sure that it does.</p>
Virtual 360º, stitching and presentation software, for use on PHP driven website? <p><strong>EDITED (after 1st answer):</strong></p> <p>Can anyone help by pointing to some good references for the creation and presentation of a 3D environment (a real room) on a website.</p> <p>Ideally it will not involve too much exp...
<p><a href="http://en.wikipedia.org/wiki/VRML" rel="nofollow">VRML</a>, <a href="https://java3d.dev.java.net/" rel="nofollow">Java3D</a>, or Flash depending on how adventurous you are.</p> <p>See <a href="http://www.papervision3d.org/" rel="nofollow">Papervision3D</a> (<a href="http://www.papervision3d.org/demos/panor...
Design question: How can I access an IPC mechanism transparently? <p>I want to do this (no particular language):</p> <pre><code>print(foo.objects.bookdb.books[12].title); </code></pre> <p>or this:</p> <pre><code>book = foo.objects.bookdb.book.new(); book.title = 'RPC for Dummies'; book.save(); </code></pre> <p>Wher...
<p>I think the way to do what you are requesting is to have all object communication regarded as message passing. This is how object methods are handled in ruby and smalltalk, among others. </p> <p>With message passing (rather than method calling) as your object communication mechanism, then operations such as calling...
Enterprise Library Database Trace Listener? <p>I'm using EntLib v4 for Logging and currently I'm saving the events to the default text file listener.</p> <p>I would like to use MS SQL database as my event sink and I saw that the database listener is already provided, but I don't know how to create logging database and...
<p>I just checked and its in the installation for the source. On my machine its in <code>C:\EntLib4Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts</code>. </p> <p>You can use the createloggingdb.cmd file or parse loggingdatabase.sql yourself for the relevant commands.</p>
What navigation control would you choose to use in your application? <p>ToolStrip with MenuStrip or RibbonBar? </p> <hr> <p>It combines both of the controls. It also have a TabPages navigation, contextual tabs, etc. However the RibbonBar is a very complex control and when you open a new document in for example Word20...
<p>Ribbon Bar</p>
Instantiating a C++ class in C# using P/Invoke via a pointer <p>I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object <a href="http://msdn.microsoft.com/en-us/library/ms404463.aspx" rel="n...
<p>You need a wrapper library to be able to use the class from C#. </p> <p>The best bet would be to create the wrapper using C++/CLI, which can directly call the unmanaged function and expose the details with a managed class. This will eliminate the need to use P/Invoke for anything.</p> <p>(Well, technically if yo...
Beanstalk like Functionality <p>I'm finally getting my team to embrace source code management now that we're working on projects where more than one dev is touching the same codebase, and I setup a free/trial account on Beanstalk for hosted Subversion so people could get a taste of how it works.</p> <p>That said, we'v...
<p>There are probably a lot of people on Stack Overflow who know lots about Subversion, but have never heard of Beanstalk and therefore can't help you. Specifically what web front-end functionality are you looking for?</p> <p>My team only ever needs to browse our SVN repositories via a web browser (and compare revisio...
Windows workflow <p>Just want to learn 'Windows workflow' designer in .net right from the basics, can anyone suggest a good link please</p> <p>thanks sandeep</p>
<p>OdeToCode has several in depth articles on WWF written by Scott Allen, and in particular a good discussion of the instances where you should use <a href="http://www.odetocode.com/Articles/460.aspx" rel="nofollow">a state machine</a> to simply complex workflow logic.</p>
What is the best way to display one value and store another on .net comboboxes? <p>I can't seem to find an easy to use, .net native way to get Comboboxes on .net winforms to display one value and return another based on the selection without creating my own helper class, with the knowledge that winforms is going to dis...
<p>This is a bit of a hack, but it means you don't have to write your own Name-Value pair class - not a big deal (could be there's something better already in the framework). But what you could do is use the DictionaryEntry class - which is effectively a name value pair. Add the items to a list, then use the DataMember...
Are there problems with rendering WPF over Remote Desktop under Windows XP? <p>I have heard that WPF primitives will not be supported by remote desktop on windows XP. The implication of this is that if you run a WPF application on a vista machine and display it on an XP machine (via remote desktop) the display will be...
<p>As of .NET 3.5 SP1, all WPF graphics are remoted as bitmaps, even on Vista-to-Vista communication. From <a href="http://blogs.msdn.com/jgoldb/archive/2008/05/15/what-s-new-for-performance-in-wpf-in-net-3-5-sp1.aspx" rel="nofollow">http://blogs.msdn.com/jgoldb/archive/2008/05/15/what-s-new-for-performance-in-wpf-in-n...
How to Parsing "Event XML" in Java? <p>I'm looking to use Java to parse an ongoing stream of event drive XML generated by a remote device. Here's a simplified sample of two events:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;Event&gt; DeviceEventMsg &lt;Param1&gt;SomeParmValue&lt;/Param1&gt; &lt;/Event&gt; &lt;?xm...
<p>Try to use <a href="http://en.wikipedia.org/wiki/StAX" rel="nofollow">StAX</a> instead of SAX. StAX allows much more flexibility and it is a better solution for streaming XML. There are few implementations of StAX, I am very happy with the <a href="http://stax.codehaus.org/Download" rel="nofollow">codehaus</a> one, ...
Linq to SQL class lifespan <p>As far as I can understand, when I new up a <em>Linq to SQL class</em>, it is the equivalent of new'ing up a <em>SqlConnection object</em>.</p> <p>Suppose I have an object with two methods: <code>Delete()</code> and <code>SubmitChanges()</code>. Would it be wise of me to new up the <em>Li...
<p>Depends on to what you refer by a "LINQ-to-SQL class", and what the code in question looks like.<br /> If you're talking about the DataContext object, and your code is a class with a long lifetime or your program itself, I believe it would be best to initialize it in the constructor. It's not really like creating a...