input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to do effective paging in Classic ASP? <p>I'm trying to page a table, and while I have paging already working, it displays every page in a single line along with Previous/Next links, causing the HTML page to break if there are a lot of results (which often there are).</p> <p>What I'd like to do is display the page...
<p>Wayne I would recommend you have a look at <strong><a href="http://www.ajaxed.org" rel="nofollow">ajaxed asp library</a></strong>. It is a still active classic ASP project which provides generic paging (for all kind of data structures) and also uses the paging mechanism within its <a href="http://www.ajaxed.org/arti...
AS3 - How to do a synchronous load of an asynchronous call? <p>I have a function that loads a user object from a web service asynchronously.</p> <p>I wrap this function call in another function and make it synchronous.</p> <p>For example:</p> <pre><code> private function getUser():User{ var newUser:Us...
<p>This way madness lies. </p> <p>Seriously, you're better off not trying to force an asynchronous call into some kind of synchronous architecture. Learn how the event handling system works in your favour and add a handler for the result event. In fact, here's the advice straight from the <a href="http://tech.groups.y...
The diff between openssl-2 and openssl-3 <p>New to this. </p> <p>How can you tell what the openssl version is and what's the diff?</p>
<p>Find the current <a href="http://openssl.org/" rel="nofollow">OpenSSL</a> version on the <a href="http://openssl.org/" rel="nofollow">OpenSSL webpage</a> (0.9.8k as of 25-Mar-2009 and 1.0.0, third beta as of 15-Jul-2009). OpenSSL is a implementation of the <a href="http://en.wikipedia.org/wiki/Transport%5FLayer%5FSe...
Any free tools for webservice testing with NTLM2 support? <p>What tools are free tools are available for testing WebServices that are behind NTLM2 authentication.</p> <p>SoapUI Is Excellent tool with all functionality that I need, however, it doesn't support NTLMv2. If someone has a way of making that work, please pro...
<p>Throwing up a custom web service testing app ought to be a pretty simple thing to do...</p>
How do I configure authentication between linked servers? <p>I am trying to test a proof of concept that I can run a distributed transaction across two linked SQL Servers, linked using sp_addlinkedserver - their names are Server1 and Server2, both running under default instances. Each server holds a single database, S...
<p>If you're on a domain, then the setting should be "Be made using the login's current security context", but there's one more step - you need to grant an SPN to each of the servers involved in the transaction.</p> <p>Assuming you're running the SQL Services on both servers as a domain user (which you'll need to in o...
MVC frameworks for .NET desktop applications <p>I've been playing a lot with MVC lately in the forms of ASP.NET MVC and Django (MTV actually) and I must say that I love it.</p> <p>Are there any similar frameworks for creating desktop WinForm apps?</p>
<p>Not that I know of.</p> <p>Most of my Winforms apps use the MVC or MVP pattern though. I've noticed that when creating Winforms apps you don't really need much of a framework. There is no routing infrastructure and no view-rendering. I find that I don't have to do much plumbing to use these patterns.</p> <p>That m...
SaveFileDialog blocking removeable drive <p>I'm using a SaveFileDialog to let a user pick a directory and filename on a removeable drive. Afterwards I create that file, write to it, and close it again.</p> <p>By then the file itself is not locked (editable, deleteable), but I can't eject the drive because windows clai...
<p>I found 2 <strong>Solutions</strong>:</p> <p>The Dialog changes the current working directory once the user clicks "save". It's not the file that was blocking the removable drive, but the program itself .</p> <p>So you either need to readjust the working directory once you're done: </p> <pre><code>Stri...
Is there an idiomatic way to listen for changes to the DOM using the Prototype library? <p>I'm trying to add a listener to DOM change events. I was hoping something as simple as 'dom:loaded' was baked into Prototype. I'm not sure of the 'Prototype-way' to handle this.</p> <p>EDIT: I cannot control every case in which ...
<p>There is no standard handler to watch this. However, you can fire custom events in Prototype. Combined with Function.wrap, you should be able to do exactly what you need.</p> <p>Essentially, you take any function that can modify the DOM, such as Element.insert(), and wrap it with a function that fires your change e...
Expose a specific .net object as JSON <p>I'm currently enabling JSON calls to my web services using the ScriptService attribute. The problem is that one of my classes references a second class and .Net is not picking up and writing out the JavaScript for the second class. </p> <p>As a workaround I can write a dummy ...
<p>You need to use <a href="http://msdn.microsoft.com/en-us/library/system.web.script.services.generatescripttypeattribute.aspx" rel="nofollow">System.Web.Script.Services.GenerateScriptTypeAttribute</a>, which specifies that a server type should be included in the generated proxy code. You can apply this attribute to t...
DataTable to JSON <p>I recently needed to serialize a datatable to JSON. Where I'm at we're still on .Net 2.0, so I can't use the JSON serializer in .Net 3.5. I figured this must have been done before, so I went looking online and <a href="http://www.codeproject.com/KB/aspnet/ASPNET_DataTable_to_JSON.aspx" rel="nofol...
<p>Would it help you convince your bosses to install a library if it's Microsoft's <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&amp;displaylang=en">AJAX extensions for .NET 2.0</a>?</p> <p>Included in them is <a href="http://msdn.microsoft.com/en-us/library/sys...
How can i determine which of my product's .net assemblies are registered, when i have several on my pc? <p>I have the code for various versions of a software product I work on on my machine. The product includes one or more assemblies that are registered for com interop. How can I determine which one is currently regis...
<p>If you know the GUID of your assembly, look under <code>HKCR\CLSID\{your guid}\InprocServer32</code>. The <code>Assembly</code> key will have a value including the version.</p> <p>If you only have the ProgId, you can just search the registry for that string which will tell you the GUID.</p>
How do I know what encoding scheme to use when converting a string to a byte array? <p>From my database I am getting a very long string which is basically xml. I need to change it to a byte array.</p> <p>I can't get my head around the potential encoding issues.</p> <p>What do I need to be careful of when doing this c...
<p>If you are dealing with ASCII characters then the result is identical.</p> <p>On the other hand if you have non-ASCII characters in your string (for example π) then: in ASCII encoding these will be replaced by "?".</p> <p>in UTF8 they will be represented by a (possibly several byte character).</p> <p>It is proba...
What's the most efficient way to access sibling dictionary value in a Python dict? <p>In Python, I've got a list of dictionaries that looks like this:</p> <pre><code>matchings = [ {'id': 'someid1', 'domain': 'somedomain1.com'}, {'id': 'someid2', 'domain': 'somedomain2.com'}, {'id': 'someid3', 'domain': 'so...
<p>You can use a <a href="http://docs.python.org/tutorial/datastructures.html#list-comprehensions" rel="nofollow">list comprehension</a>:</p> <pre><code>domains = [matching['domain'] for matching in matchings if matching['id'] == the_id] </code></pre> <p>Which follows the format standard format of:</p> <pre><code>re...
No Process Is on the Other End of the Pipe <p>I receive this error when I try to connect to SQL Server 2005. I have enabled TCP/IP, Named Pipes, and restarted the server but that is not working.</p>
<p>FYI, I've just had the same error.</p> <p>I switched to Windows authentication, disconnected, then tried to login again with SQL authentication. This time I was told my password had expired. I changed the password and it all worked again.</p>
Same module multiple times as TabItems <p>Here's my scenario:</p> <ol> <li>Shell with 1 TabControl and 1 region called MenuRegion</li> <li>MenuRegion contains Buttons for each of the available modules (applications).</li> </ol> <p>I want to achieve the following using Prism (Composite Application Library for WPF): Wh...
<p>I'm new to this PRISM world (1 week experience :)) ) and had the same requirement! First of all you have to get the Regionextensions from <a href="http://blogs.southworks.net/matiasb/2009/07/02/how-to-hide-views-inside-composite-application-guidance-aka-prism-v2-regions/" rel="nofollow">here</a>.</p> <p>The solutio...
Determine if flash OCX is installed? <p>What is the best way to determine if the flash ocx is installed in Innosetup (or any installer for that matter). I don't want to attempt to install it myself, I will simply force the user to go to the flash site and install, I just want to make sure that the flash.ocx (version 9...
<p>Add a function in the code section to check whether you can create an instance of the Flash control, like so:</p> <pre><code>function IsFlashInstalled(): boolean; var V: Variant; begin try V := CreateOleObject('ShockwaveFlash.ShockwaveFlash.9'); Result := True; except Result := False; end; end; ...
How do I efficiently transform a series of strings in powershell? <p>Suppose I have a large number of strings formatted something like:</p> <pre><code>&lt;tag&gt;blah blahXXXXXblah blah&lt;/tag&gt; </code></pre> <p>I want to transform these strings into something like:</p> <pre><code>blah blahZZZZZblah blah </code><...
<p>Well the simplest way that I can think of (assumes your list is held in $foo):</p> <pre><code>$foo | %{$_.Replace("XXXXX", "ZZZZZ")} </code></pre>
Get the XPath to an XElement? <p>I've got an XElement deep within a document. Given the XElement (and XDocument?), is there an extension method to get its full (i.e. absolute, e.g. <code>/root/item/element/child</code>) XPath?</p> <p>E.g. myXElement.GetXPath()?</p> <p><strong>EDIT: Okay, looks like I overlooked somet...
<p>The extensions methods:</p> <pre><code>public static class XExtensions { /// &lt;summary&gt; /// Get the absolute XPath to a given XElement /// (e.g. "/people/person[6]/name[1]/last[1]"). /// &lt;/summary&gt; public static string GetAbsoluteXPath(this XElement element) { if (element ...
Which versions of SQL Server does LINQ to SQL support? <p>Can SQL Server 2000 be used as the database for LINQ to SQL?</p> <p>Does LINQ to SQL rely on a specific version of Microsoft SQL Server?</p>
<p>Yes, LINQ to SQL works with SQL Sever 2000 with one exception: you do need the ROW_NUMBER() function, available only in SQL Server 2005/2008, to support efficient server-side paging. Without it, paging functions (as Mehrdad points out) are delivered using the classic Top N strategy - <em>very</em> inefficient as yo...
Can I programmatically set the object type for a DirectCast command? <p>I'm helping a colleague develop a "catch all" type error handler for some controls his application. What he wants to do is pass the object that has the error, and the type of that object, such a TextBox or ComboBox, and then call the DirectCast met...
<p><code>DirectCast()</code> needs a real type at compile time, so it knows what the result of the call looks like. The best you can hope for here is to cast to a common base type for each of the objects you're expecting. In this case you're lucky have in that you have a fairly useful base type: <code>Control</code>...
How do I make a universal type conversion method <p>What I want to do is:</p> <pre><code>bool Convert( out Object output, Object source) { // find type of output. // convert source to that type if possible // store result in output. return success } </code></pre> <p>Is it possible? </p> <p>Obviously, th...
<p>Here is a sample that I use, you can inject other complex conversions into it by registering other type converters.</p> <pre><code>public static class Converter { public static T Convert&lt;T&gt;(object obj, T defaultValue) { if (obj != null) { if (obj is T) { ...
How do I use a pre-defined CSS style for a programmatically drawn TextField? <p>I have a graphical application that renders text to BitmapData - right now it's hardcoded to use a specific font, and that's fine for testing, but for production I really need it to be style-able.</p> <p>The rest of the application uses sp...
<p>Basically you can just add <code>[style]</code> metadata tags to your custom class to define your custom style properties, specify values for those properties in your css, and use <code>getStyle("myCustomStylePropertyName")</code> in your code to get the values set in the css.</p> <p>See <a href="http://livedocs.ad...
Trying to build an SQL statement for complex search scenario <p>I am trying to build an SQL Statement for the following search scenario:</p> <p>I have trying to return all of the columns for an individual record for Table A based on the value of the status column in Table B. Each record in table A can have multiple r...
<p>As an example for 'Approved':</p> <pre><code>select * from A where (select count(*) from B where B.parent_id = A.id and B.status in (1,6)) &gt; 0 and (select count(*) from B where B.parent_id = A.id and B.status not in (1,6)) = 0 </code></pre> <p>Refactored to use <em>exists</em> and <em>not exists...
How to split on NULs in shell <p>I am using zsh as a shell.</p> <p>I would like to execute the unix find command and put the result into a shell array variable, something like:</p> <pre><code>FILES=($(find . -name '*.bak')) </code></pre> <p>so that I can iterate over the values with something like</p> <pre><code>fo...
<p>I tend to use <code>read</code> for that. A quick google search showed me zsh also seem to support that:</p> <pre><code>find . -name '*.bak' | while read file; do echo "&lt;&lt;$file&gt;&gt;"; done </code></pre> <p>That doesn't split with zero bytes, but it will make it work with file-names containing whitespace o...
Python object.__repr__(self) should be an expression? <p>I was looking at the builtin object methods in the <a href="http://docs.python.org/reference/datamodel.html#objects-values-and-types">Python documentation</a>, and I was interested in the documentation for <code>object.__repr__(self)</code>. Here's what it says:<...
<pre><code>&gt;&gt;&gt; from datetime import date &gt;&gt;&gt; &gt;&gt;&gt; repr(date.today()) # calls date.today().__repr__() 'datetime.date(2009, 1, 16)' &gt;&gt;&gt; eval(_) # _ is the output of the last command datetime.date(2009, 1, 16) </code></pre> <p>The output is a string that can be ...
Best way to organize a class hierarchy including an overridable "Update" function <p>I have a base class "Foo" that has an Update() function, which I want to be called once per frame for every instance of that class. Given an object instance of this class called "foo", then once per frame I will call foo->Update().</p...
<p>Sounds like you want composition instead of inheritance. What if there was an interface IUpdateable, and Foo held a collection of IUpdateable objects, and called an Update method on each one every tick? Then Bar and Baz could just implement Update; your only worry would be how best to register them with Foo.</p> ...
How can I test that I have a Python module successfully installed? <p>I tried to install beautifulsoup. I get such an error:<br> &lt;-- snip --></p> <pre><code>raise MissingSectionHeaderError(fpname, lineno, line) ConfigParser.MissingSectionHeaderError: File contains no section headers. file: /Users/Sam/.pydistutils.c...
<p>You can test if a module is installed like so:</p> <pre><code>$ python &gt;&gt;&gt; import modulename </code></pre>
Is there an algorithm to determine contiguous colored regions in a grid? <p>Given a basic grid (like a piece of graph paper), where each cell has been randomly filled in with one of n colors, is there a tried and true algorithm out there that can tell me what contiguous regions (groups of cells of the same color that a...
<p>The best possible algorithm is O(number of cells), and is not related to the number of colors. </p> <p>This can be achieved by iterating through the cells, and every time you visit one that has not been marked as visited, do a graph traversal to find all the contiguous cells in that region, and then continue itera...
What's your favorite log4 viewer / monitor? <p>We've decided to standardize on log4net and log4cxx for our logging infrastructure. I'd like to give our system administrators and other staff access to the events and information we are logging. So the short is, I'm looking for some a some recommended tools that help yo...
<p>I use <a href="http://www.baremetalsoft.com/baretail/" rel="nofollow">BareTail</a>.</p>
A SuggestBox for wxPython? <p>Is there a widget for wxPython like the <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/index.html" rel="nofollow">SuggestBox</a> in Google Web Toolkit? It is basically a magic text box that can invoke some code to come up with suggestions relevant to whatever the user ha...
<p>You might want to look at <a href="http://wiki.wxpython.org/Combo%20Box%20that%20Suggests%20Options" rel="nofollow">Combo Box that Suggests Options</a>.</p> <p>I hope this is what you were thinking of.</p>
How to tell when a QTMovie starts playing? <p>So <code>QTMovie</code>s have <code>QTMovieDidEndNotification</code>, but no <code>QTMovieDidStartNotification</code>. How can I be notified when a <code>QTMovie</code> starts playing?</p>
<p>Answering my own question: the <code>QTMovieRateDidChangeNotification</code> is activated when the movie starts to play. Of course the documentation doesn't actually document that. Bah.</p>
SSAS cube design, semi-additive measures, and running totals <p>I have what is to me a bit of a tricky design issue in my SSAS cube. The question is related to general accounting practices, I have a fact table containing financial transactions (i.e. a ledger) and each of those transactions is tagged with a transaction...
<p>You can most certainly have more than one time dimension in a cube, and in this case I would actually just create one common time dimension and have it role play as two, transaction date and period close. To role play a dimension, just add it to the cube again in the Dimension Usage tab of the cube designer and rena...
C# enumeration property null vs. 0 <p>I'm using IIS/asmx to support a Flash client. Some of my service layer data transfer objects have properties that are enumeration values. There are cases where these properties should be null. </p> <p>When an object with a null value for such an enumeration property is rendered...
<p>My first inclination was to point you to the <code>Nullable&lt;T&gt;</code> type. However, after looking around for documentation on <code>Nullable&lt;T&gt;</code> and SOAP, it appears that it might not be supported. You might want to explore this further.</p> <p>That said, it is very common for Enums to declare ...
How do I create a list of Python lambdas (in a list comprehension/for loop)? <p>I want to create a list of lambda objects from a list of constants in Python; for instance:</p> <pre><code>listOfNumbers = [1,2,3,4,5] square = lambda x: x * x listOfLambdas = [lambda: square(i) for i in listOfNumbers] </code></pre> <p>Th...
<p>You have:</p> <pre><code>listOfLambdas = [lambda: i*i for i in range(6)] for f in listOfLambdas: print f() </code></pre> <p>Output:</p> <pre><code>25 25 25 25 25 25 </code></pre> <p>You need currying! Aside from being delicious, use this default value "hack".</p> <pre><code>listOfLambdas = [lambda i=i: i*...
Suggest a JPA Unit test framework <p>How to unit test JPA code? is there any way to generate Unit Test case itself? </p> <p>Note: I am lazy and new to Unit Test code.</p>
<p>Check this out, <a href="http://www.unitils.org/summary.html">Unitils</a>. Here is a <a href="http://www.theserverside.com/news/thread.tss?thread_id=50487">related discussion</a>, with some example codes.</p> <p>Here is the example, showing <a href="http://bill.dudney.net/roller/bill/entry/20070428">DBUnit, Spring ...
Implementation of Single Responsibility Principle <p>If I break my Objects down to 'Single Responsibilities', is there a fundamental thought whether like objects should live together or separately, for example if I have</p> <pre><code>class Employee_DataProvider() : IEmployee_DataProvider { ... }; class Employee_Detai...
<p>Go back to OOP basics: the Employee object should have methods that reflect what it does, not what is done to it.</p>
Why the slow WADL uptake? <p>I've been researching WADL and am wondering why it isn't more widely adopted? </p> <p>With the rate at which REST usage seems to be growing, I'm surprised that more development efforts don't use it.</p> <p>Is there are fundamental flaw in its design, is it not a good match for the cultur...
<p>I think the main reason why WADL doesn't gain popularity is that it might bring back to life all those problem we had with SOAP and WSDL. To me, the interoperability aspect is the single most important aspect of web-services.<br> By following the RESTful way of using pure HTTP standards you get interoperability "for...
String altering in Ant <p>Given a property:</p> <pre><code>&lt;property name="classes" value="com.package.Class1,com.package.Class2" /&gt; </code></pre> <p>I'm trying to compile only the classes specified like:</p> <pre><code>&lt;javac srcdir="${src.dir}" destdir="${build.dir}"&gt; &lt;include name="${classes}" ...
<p>I figured it out. After ant-contrib I can do one of these:</p> <pre><code>&lt;propertyregex property="classes.resolved" input="${classes}" regexp="\." replace="\\\\" /&gt; </code></pre>
All the reasons I can't access an instance of SQL 2005 <p>I've installed an instance of SQL 2005 Express on <code>&lt;computername&gt;/SQLEXPRESS</code>. There is only once instance installed. I've allowed remote connections, turned on SQL authentication, enabled TCP/IP, Named Pipes and VIA but I still can't access the...
<p>Is the SQL Server Browser running on the machine? For named instances, like \SQLExpress, the SQL Browser allows client machines to identify which port to connect to. </p> <p>By default, only the default instance runs on TCP 1433. If the client can't connect on the default port, it queries the SQL Browser at UDP 143...
How to add a server image control to html container using innerHTML = <p>I have a td that I want to inject with a server image control (asp.net) using innerHTML = "". The webcontrol's toString is giving the type.</p> <p>Is there a way to extract the generated from the server control? Or, is there a different solution...
<pre><code>StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); img.RenderControl(new HtmlTextWriter(writer)); td.InnerHtml = sb.ToString(); </code></pre> <p>or the more obvious</p> <pre><code>td.Controls.Add(img); </code></pre>
How can I create a product key for my C# application? <p>How can I create a product key for my C# Application?</p> <p>I need to create a product (or license) key that I update annually. Additionally I need to create one for trial versions.</p> <blockquote> <p>Related: </p> <ul> <li><a href="http://stackove...
<p>You can do something like create a record which contains the data you want to authenticate to the application. This could include anything you want - e.g. program features to enable, expiry date, name of the user (if you want to bind it to a user). Then encrypt that using some crypto algorithm with a fixed key or ha...
Using ant to detect os and set property <p>I want to set a property in an ant task differently by os type.</p> <p>The property is a directory, in windows i want it to be "c:\flag" in unix/linux "/opt/flag".</p> <p>My current script only works when i run it with the default target, but why ? </p> <pre><code> &lt;...
<p>Move your condition out of the <code>&lt;target /&gt;</code>, as your target probably isn't invoked.</p> <pre><code> &lt;condition property="isWindows"&gt; &lt;os family="windows" /&gt; &lt;/condition&gt; &lt;condition property="isLinux"&gt; &lt;os family="unix" /&gt; &lt...
Running DOS games under Dosbox 0.72 <p>I am using Windows Vista and with Dosbox 0.72 to load Turbo C for programming a DOS game. My code runs fine (both graphics and sound routines) as long as it runs under DOS shell of Turbo C (Under Dosbox). But when I run the same code under DosBox (outside Turbo C's Dos shell), t...
<p>Maybe your program gets too much memory when run standalone. You can determine how much memory is available with MEM command, and reduce this amount before running your program with LOADFIX command. You can run LOADFIX command several times, each time it will reduce free memory in the system</p>
Process Guidelines Required <p>My company does not follow any well defined process for software development. I want to implement a simple but effective process which will suit my company. </p> <p>We have all sets of resources right from project managers to developers and testers.</p> <p>Please provide some references...
<p>You are really not describing the characteristics of your company or the main challenges you are facing, so it's hard to give good advice. You could try something like <a href="http://en.wikipedia.org/wiki/Scrum_(development)" rel="nofollow">scrum</a> if you want something lightweight, which is probably a good idea ...
To what extent can Version Control help in system administration? <p>I'm currently tinkering at an OpenBSD system with a view to building myself a firewall and some other bits and bobs.</p> <p>As this is fairly experimental (I'm an OpenBSD n00b, and I've already trashed my system 3 or 4 times), I wonder what experienc...
<p><a href="http://bryan-murdock.blogspot.com/2007/07/put-etc-under-revision-control-with-git.html" rel="nofollow">Here</a> you have a detailed revision about putting /etc/ under revision control using git.</p> <p><a href="http://www.jukie.net/~bart/blog/20070312134706" rel="nofollow">Another</a> step by step method. ...
ASP.NET Web application security in VDS hosting <p>We are designing asp.net web application in wcsf. Web application will be deployed to Windows Server 2003 shared <a href="http://en.wikipedia.org/wiki/Virtual_private_server" rel="nofollow">VDS</a> hosting. Web site will be used for b2b, monthly service fee and credit ...
<ol> <li><p>Obfuscation would be sufficient. Code signing doesn't provide any protection from prying eyes. Also most respectable hosters aren't interested in your intellectual property and data. They're in the hosting business at the end of the day.</p></li> <li><p>I work for a hosting company and we have a fast growin...
Shell script for adjusting image size <p>Is there a way to adjust all image sizes in a directory?</p> <p>If I set the max size to 800x600 it will make larger ones smaller and leave smaller ones at their original size.</p>
<pre><code>for img in *.png; do convert "$img" "800x600&gt;" $(basename "$img" .png)_new.png done </code></pre> <p><code>convert</code> is from ImageMagick. ">" says it's only resized if larger. See <a href="http://www.imagemagick.org/script/command-line-options.php#resize">here</a> for its other options.</p>
Help with include function <p>Im trying to make a simple template system in PHP. I'm new to PHP, so it's nothing serious. I have some problems though:</p> <p>A regular include works:</p> <pre><code>$variable = "test"; include("templates/news.html"); </code></pre> <p>But this won't:</p> <p>This says <code>$variable<...
<p>With the <a href="http://php.net/extract" rel="nofollow">extract</a> function, you can define different variables from an array.</p> <p>You can make it like this:</p> <pre><code>$vars = array('var1' =&gt; "value1", 'var2' =&gt; "value2"); function getTemplate($tpl, $vars) { $file = "templates/$tpl.html"; extract...
COM event handling in C++ <p><b>Without</b> the following:</p> <ul> <li>ATL</li> <li>MFC</li> </ul> <p><b>Question:</b></p> <ul> <li>How to get the COM <b>Server</b>, to report back to the COM <b>Client</b>, once a particular event has terminated? </li> </ul> <p>Regards</p>
<p><b>See:</b> <a href="http://www.codeproject.com/KB/COM/TEventHandler.aspx?fid=133954&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=None&amp;select=2755820#xx2755820xx" rel="nofollow"><b>COM</b> event handling - IConnectionPointContainer - illustration</a></p>
Java's Virtual Machine and CLR <p>As a sort of follow up to the question called <a href="http://stackoverflow.com/questions/95163/differences-between-msil-and-java-bytecode">Differences between MSIL and Java bytecode?</a>, what is the (major) differences or similarity in how the Java Virtual Machine works versus how th...
<p>There are a lot of similarities between both implementations (and in my opinion: yes, they're both "virtual machines").</p> <p>For one thing, they're both stack-based VM's, with no notion of "registers" like we're used to seeing in a modern CPU like the x86 or PowerPC. The evaluation of all expressions ((1 + 1) / 2...
Which numerical values do the F-Keys ( F[1-12]) and the Arrow-keys have? <p>I'd like to write an application in C which uses arrow-keys to navigate and F-keys for other functions, such as saving to a file, language selection, etc.</p> <p>Propably the values depend on the platform, so how could I find out which values ...
<p>I think that depends on $TERM, but either way it's going to be a sequence of characters. I get this:</p> <pre><code>% read x; echo $x | od -c -- ^[[15~ 0000000 033 [ 1 5 ~ \n 0000006 </code></pre> <p>That's my F5 key, and apologies for this being a *nix-centric an...
Protocol buffers in C# projects using protobuf-net - best practices for code generation <p>I'm trying to use protobuf in a C# project, using protobuf-net, and am wondering what is the best way to organise this into a Visual Studio project structure.</p> <p>When manually using the protogen tool to generate code into C#...
<p>As an extension of Shaun's code, I am pleased to announce that protobuf-net now has Visual Studio integration by way of a Custom Tool. The msi installer is available from the <a href="http://code.google.com/p/protobuf-net/">project page</a>. More complete information here: <a href="http://marcgravell.blogspot.com/20...
embedding an application within a c# program with gtk# <p>I'd like to embed a movie watching application like VLC into my C# program using the GTK# binding.</p> <p>Googling, I haven't seen many solutions that people have claimed to be easy or that work.</p> <p>Experiences? Help?</p> <p>Please!</p> <p>Thanks, jbu</p...
<p>I'm not sure for VLC but <a href="http://banshee-project.org/" rel="nofollow">Banshee</a>, a C# GTK+ multimedia app, uses <a href="http://gstreamer.freedesktop.org/" rel="nofollow">GStreamer</a> to embed videos in its interface. Maybe their code could help you.</p> <p>GStreamer is cross-platform and has many plugin...
Suggestions for writing a programming language? <p>What tips can you give a person who is looking to write a programming or script language? I am not worried about how to program nor design a compiler but how to develop one quickly using tools and code generators.</p> <p>Last time i tried i coded it in c++ and the sta...
<p>Estimating how long something like that might take is dependent on many different factors. For example, an experienced programmer can easily knock out a simple arithmetic expression evaluator in a couple of hours, with unit tests. But a novice programmer may have to learn about parsing techniques, recursive descent,...
seam-gen, netbeans and completion <p>How can I make <a href="http://docs.jboss.org/seam/1.1BETA2/reference/en/html/gettingstarted.html" rel="nofollow">seam-gen</a> work with <a href="http://www.netbeans.org/" rel="nofollow">NetBeans</a> 6.5 so that completion of tags (s:, ui:, rich:, ...) works? In the free-form projec...
<p>check your netbeans log. it's propobly facelet parser crashing on richaces taglib. i had this problem with RF v3.2.2, older release worked fine. </p>
DSN-less ODBC connect string for legacy Sybase Adaptive Server Anywhere <p>This is a failed response to this article: <a href="http://www.vbrad.com/article.aspx?id=94" rel="nofollow">Sybase, VB and ADO</a></p> <p>I just did a VB6 project connecting to a legacy ASA 7 database. After failing to use ASAProv OLEDB provide...
<p>Wow, I actually wrote that article in the last millennium, I believe.</p> <p>Let me take this point by point. </p> <ol> <li><p>OLEDB provider works fine for it, I remember using them from back in the day. Just follow instructions here: <a href="http://www.vbrad.com/article.aspx?id=81" rel="nofollow">http://www.vb...
Windows 7 MSDN Expiration <p>I have read that the public beta version of Windows 7 has an expiration on it, but does the MSDN Premium also expire on the same date?</p> <p>And if so, do you think that we might see a newer version before the expiration on MSDN?</p> <p>For the speed improvements alone I am contemplating...
<p>As I have done for a while with VStudio 10 CTP, you have the possibility to change the clock on you virtual machine when you start it. In my case, when I lunche VS10, I settle my virtual machine's clock to 11/1/2008 - and it's still running !</p>
Doing a range lookup in C#? <p>I have a list of non-overlaping ranges (ranges of numbers, e.g. 500-1000, 1001-1200 .. etc), is there an elegant and fast way to do lookup by only passing a number? I could use List.BinarySearch() or Array.BinarySearch() but I have to pass the type of the range object (Array.BinarySearch(...
<p>Three options:</p> <ul> <li>Create a dummy Range and suck it up. Urgh.</li> <li>Hand-craft a binary search just for this case. Not too bad.</li> <li>Generalise the binary search for any IList and a TValue, given an IRangeComparer. I'm not wild on the name "TRange" here - we're not necessarily talking about ranges, ...
C# whats best method of saving dynamically created controls <p>I am currently saving a .net ( c# ) usercontrol to the disk as a XML file by saving each property as an element in the xml document. The file is used for later recreation of the controls at runtime. I am wondering if it is possible or better to save the con...
<p>Winforms controls don't serialize especially well, and you might have a lot of difficulty getting the base-classes (i.e. not your code) to play ball. Things like <code>Color</code>, for example, regularly provide surprisingly troublesome to serialize.</p> <p>Xml would be an obvious (if somewhat predictable) choice,...
How to write a Vertical Right-Side IE Explorer Bar <p>I've written explorer bars (band object) before and <strong>AFAIK vertical explorer bars can only be on the left side</strong>. However, I was amazed when I saw this explorer bar by HP that is docked on the right hand side instead:</p> <p><img src="http://farm4.sta...
<p>I've just been digging into how <a href="http://www.kutano.com/" rel="nofollow">Kutano</a>'s right-side bar works as I'd like to do the same. This doesn't directly help your question as I don't have an answer yet, but here's what I know:</p> <p>Kutano doesn't appear to be a normal Explorer Bar, as there's no entry ...
In Batch: Read only the filename from a variable with path and filename <p>I am currently looking for a way to take a variable in batch and only parse out the filename.</p> <p>For example, I pass my batch file a -s parameter from another application which is subsequently set to my source variable. The source file vari...
<p>If its coming in as an argument to the script, i.e. %1, %2, etc, you can extract just the filename and extension into a variable like this:</p> <pre><code>set FILENAME=%~nxN </code></pre> <p>where N is the index of the argument. For example, this script will echo just the filename of the first argument:</p> <pre>...
In Workflow need to listen for multiple events <p>I need a workflow where need to listen for multiple events any event will drive workflow further.</p> <p>some actions --> Call external method --> Here there 3 events any one would be the response.</p> <p>What kind of activity i can use there where i can have three ev...
<p>Whether you use a sequential workflow or state machine workflow activity as your root workflow type, you can still handle events. The state machine is much better for handling events and swapping states as it pretty much forces you to do both. In my opinion, it is much more powerful than sequential workflows and pro...
What are the differences between LLVM and java bytecode? <p>I dont understand the difference between LLVM and the java (bytecode), what are they?</p> <p>-edit- by 'what are they' i mean the differences between LLVM and java (bytecode) not what are LLVM and java.</p>
<p>Assuming you mean JVM rather than Java:</p> <p>The LLVM is a <em>low level</em> register-based virtual machine. It is designed to abstract the underlying hardware and draw a clean line between a compiler back-end (machine code generation) and front-end (parsing, etc.).</p> <p>The JVM is a much higher level stack-b...
PostgreSQL Authentication Under XP <p>I'm using Windows XP and I've installed PostgreSQL 8.3.5-2. I can create databases via pgAdmin but not from Powershell. When I try, I get the following error:</p> <pre>createdb: could not connect to database postgres: FATAL: password authentication failed for user "gvkv"</pre> <...
<p>I think this is because you're connecting via the IP of the computer and not localhost. Most databases make a difference between connections to the local IP address (even if this is from a local application) and localhost: the first is an external connection and has to be enabled and the second is a local connection...
Does the number of projects in a Visual Studio 9 solution impact the solution load and build times? <p>I'm specifically interested in solution load times &amp; build times - does fewer solutions mean better performance?</p> <p>Note that I'm <em>not</em> referring to the performance of the built application.</p> <p>Ar...
<blockquote> <p>(I'm specifically interested in solution load times &amp; build times - does fewer solutions mean better performance?)</p> </blockquote> <p><a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/12/08/advices-on-partitioning-code-through-net-assemblies.aspx">Here is</a> related topic...
How do I disallow clicking on a link while an ajax request is in progress? <p>I have "a" element which servers as button. It has no href attribute.</p> <p>I'm using jQuery to achieve very simple thing: on click start ajax request and prevent further clicks. After ajax completes, enable clicking. I don't use form or in...
<p>You could use something like this:</p> <pre><code>var contact = { inprogress: false, send: function() { if (contact.inprogress) return; contact.inprogress = true; $.ajax({ ... complete: function() { $("#send").text("Send"); contact.inprogress = false; ...
protecting adobe air apps <p>I am about to deliver an Adobe AIR app to a customer. But it's my first delivery of any sort, I.e. I have no experience whatsoever with licensing etc.</p> <p>Users of this app may or may not be online, so can't count on that. In fact it's 99% sure that they will be offline.</p> <p>Nor do...
<p>protect the php api and not the frontend app. have a license key which is bound to an ip address and authenticate the request (which contains the key) is coming from the correct ip.</p>
Restricting T to string and int? <p>I have built myself a generic collection class which is defined like this. </p> <pre><code>public class StatisticItemHits&lt;T&gt;{...} </code></pre> <p>This class can be used with <code>int</code> and <code>string</code> values only. However this</p> <pre><code>public class Stati...
<p>The type restriction is meant to be used with Interfaces. Your sample suggests that you want to allow classes that <strong>inherit from int and string</strong>, which is kinda nonsense. I suggest you design an interface that contains the methods you'll be using in your generic class StatisticItemHits, and use that i...
Which editor would you give your mom to let her edit her own website? <p>I mean this quite literally. A close relative wants to create her own website for her business and asked me for help. I've offered her to set up the website, take care of domain registration and all, but I don't have the time to design the website...
<p>My mom uses vi for this</p>
Eclipse editor plugin: "ERROR" when opening file outside project <p>I'm developing an editor plugin for eclipse. It works fine on files within eclipse projects, but when an external file is opened via the "File -> Open File" menu (which works file with, e.g. Java files), I get a page displaying nothing but a horizontal...
<p>I had the same probleam and finally found solution working for me. You have to provide 2 different document providers - first extending <strong>FileDocumentProvider</strong> for files inside your workbench, and second extending <strong>TextFileDocumentProvider</strong> for other resources outside your workspace. The...
Sending a password to a Windows Service <p>What is the best way to send a password to a Windows Service? Our application needs a password in order to start. I don't care that services are "normally" supposed to run without user interaction. Its good enough for us that an operator can start the application and then lo...
<p>Two main options:</p> <p>You could listen on a socket on startup and wait for the required password to be supplied (maybe embed an SSH server in there, so that the password cannot be snooped over the wire)</p> <p>My preferred option would be to read the password from a configuration file (that can be secured to th...
IE automation: How to determine when a user-initiated navigation is taking place / has taken place? <p>I have an Internet Explorer BHO (in c# .net) and want to identify either when a user initiates a navigation, or when a user-initiated navigation has completed. By user-initiated I mean clicking on a link or similar ac...
<p>You can test whether <em>BeforeNavigate/NavigateComplete/DocumentComplete</em> event came from ineere frame or the topmost one simple by testing <em>pDispParams</em> agruments against pointer to browser object you have stored in <em>SetSite</em> method of your BHO.</p> <p>Here's C++ code to do this, I hope you can ...
How does firefox know when an update is available for an extension (plugin) <p>I am in the process of creating my first firefox extension and am starting to think about deployment.</p> <p>There is a nice discussion about creating an template <a href="http://stackoverflow.com/questions/274639/how-to-create-a-quick-mini...
<p>From <a href="https://developer.mozilla.org/en/Extension_Versioning%2c_Update_and_Compatibility#Automatic_Add-on_Update_Checking" rel="nofollow">developer.mozilla.org</a> :</p> <blockquote> <p>Applications will periodically check for updates to installed add-ons by retrieving the updateURL. The information ...
Can I have a hit-point in VisualStudio that skips lines? <p>I often run into the situation where I want to disable some code while debugging without actually changing the code.</p> <p>What I end up doing is having a break-point (usually conditional) and then when the break-point fires I perform a <em>Set Next Statemen...
<p>DTE.ExecuteCommand("Debug.SetNextStatement")</p>
Detecting WAN radio power off <p>Like most laptops, mine (a Dell Inspiron 1420) has a small button which can be used to turn the wifi card on and off. Is there any way to detect that the radio has been turned off in a Win32 C program or service? I'm looking for a better way than to get the list of the visible access po...
<p>I think it just disables the card in Windows - would this be different than detecting if there's a WLAN card in the the device manager that's currently disabled?</p> <p>I'm a VB programmer, so I can't help with the specifics, but just wanted to give somewhere to start.</p>
Programming Problem - Fax Compression <p>I'm preparing to go to a computer science contest by completing problems from past contests. Most of them are pretty easy, but this one is bugging me...it seems simple but I'm just not being able to do it.</p> <p>If you have a string of ones and zeros:</p> <pre><code>100111010...
<p>This is called Run-Length-Encoding (RLE) and is used in a number of things (such as the Windows Bitmap file-format) to provide very basic compression (especially if the original includes lots of repeated values (like a bitmap or fax) containing a long run of the same colour).</p> <pre><code>int[] array = { ...........
JSON datetime between Python and JavaScript <p>I want to send a datetime.datetime object in serialized form from Python using <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> and de-serialize in JavaScript using JSON. What is the best way to do this?</p>
<p>You can add the 'default' parameter to json.dumps to handle this:</p> <pre><code>date_handler = lambda obj: ( obj.isoformat() if isinstance(obj, datetime.datetime) or isinstance(obj, datetime.date) else None ) json.dumps(datetime.datetime.now(), default=date_handler) '"2010-04-20T20:08:21.634121"' <...
Is it possible to run ASP.NET MVC routes in different AppDomains? <p>I am having problems with thinking up a solution for the following. I got a blog which I recently upgraded from web forms to MVC. The blog is avalible in both swedish and english on two different domains and are running in the same web site in IIS.</p...
<p>The ASP.Net runtime manages AppDomains for you, so its probably not a good idea to create AppDomains in your code.</p> <p>However, if you can, I would suggest creating multiple IIS Applications (one for <a href="http://codeodyssey.com" rel="nofollow">http://codeodyssey.com</a> and one for <a href="http://codeodysse...
What is the best method to merge two PHP objects? <p>We have two PHP5 objects and would like to merge the content of one into the second. There are no notion of subclasses between them so the solutions described in the following topic cannot apply.</p> <p><a href="http://stackoverflow.com/questions/119281/how-do-you-c...
<blockquote> <p>If your objects only contain fields (no methods), this works:</p> </blockquote> <pre><code>$obj_merged = (object) array_merge((array) $obj1, (array) $obj2); </code></pre> <p>This actually also works when objects have methods. (tested with PHP 5.3 and 5.6)</p>
Fast read/write from file in delphi <p>I am loading a file into a array in binary form this seems to take a while is there a better faster more efficent way to do this. i am using a similar method for writing back to the file.</p> <pre><code>procedure openfile(fname:string); var myfile: file; filesizevalue,i:i...
<p>If your really want to read a binary file fast, let windows worry about buffering ;-) by using <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_manamemo.asp">Memory Mapped Files</a>. Using this you can simple map a file to a memory location an read like it's an array.</p> ...
Does PHP feature short hand syntax for objects? <p>In javascript you can easily create objects and Arrays like so:</p> <pre><code>var aObject = { foo:'bla', bar:2 }; var anArray = ['foo', 'bar', 2]; </code></pre> <p>Are simialar things possible in PHP?<br /> I know that you can easily create an array using the array ...
<p>For simple objects, you can use the associative array syntax and casting to get an object:</p> <pre><code>&lt;?php $obj = (object)array('foo' =&gt; 'bar'); echo $obj-&gt;foo; // yields "bar" </code></pre> <p>But looking at that you can easily see how useless it is (you would just leave it as an associative array i...
Android : Getting file name from camera? <p>I have run into a small issue with something that I am probably just overlooking.</p> <p>I want to take a picture from the surface preview of the camera, and save it to the sd_card. This works ALMOST perfectly. I assign it a file name, and for one reason or another, it does ...
<p>This was resolved by implementing PictureCallback via a ImageCaptureCallback class, and Overriding the onPictureTaken where the file was being written via a file output stream. All you had to do was change the fileoutput stream to the filename you want.</p>
How to determine using reflection the generic parameter of the base class <p>I have the following structure</p> <pre><code>public class MyClass : MyBaseClass&lt;System.Int32&gt; { } </code></pre> <p>In a static method and without instantiating a new MyClass instance how do I get the type of the generic parameter used...
<p>Try this</p> <pre><code>public static Type GetBaseTypeGenericArgument(Type type) { return type.BaseType.GetGenericArguments()[0]; } ... GetBaseTypeGenericArgument(typeof(MyClass)); </code></pre>
What is the function __construct used for? <p>I have been noticing <code>__construct</code> a lot with classes. I did a little reading and surfing the web, but I couldn't find an explanation I could understand. I am just beginning with OOP.</p> <p>I was wondering if someone could give me a general idea of what it is, ...
<p>The "__construct" was introduced in PHP5 and it is the right way to define your, well, constructors (in PHP4 you used the name of the class for a constructor). You are not required to define a constructor in your class, but if you wish to pass any parameters on object construction then you need one.</p> <p>An examp...
dynamic allocating array of arrays in C <p>I don't truly understand some basic things in C like dynamically allocating array of arrays. I know you can do:</p> <pre><code>int **m; </code></pre> <p>in order to declare a 2 dimensional array (which subsequently would be allocated using some *alloc function). Also it can ...
<p>The <code>m[line][column] = 12</code> syntax is ok (provided <code>line</code> and <code>column</code> are in range).</p> <p>However, you didn't write the code you use to allocate it, so it's hard to get whether it is wrong or right. It should be something along the lines of</p> <pre><code>m = (int**)malloc(nlines...
C# App.Config location <p>I have a solution with 10 or so projects in it, and have started having issues with SystemConfiguration returning empty configuration instead of locating my App.Config file.</p> <p>Should I have multiple App.Configs, one for each project (I am assuming and hoping not), if not, where is the be...
<p>Choose one of the projects as the one responsible for maintaining the App.config file. Then for the other projects, use "Add existing item" , navigate to the App.config file and click on the "Add as a link" (it is the right side of the Add button).</p>
Usage history of Stored Procedures in SQL Server 2008 <p>I work with legacy systems that have tens of thousand of lines of stored procedure code, where many of the stored procedures are obsolete and not used anymore. There doesn't seem to be a way to check execution history, so my question is if it might be a good idea...
<p>There is a tracing option (SQL Profiler) in SQL server. you could take a trace of a days SQL activity and see which sprocs are executed there. </p> <p>This will give you a good idea of where to focus your optimisations.</p>
SCons problem - dont understand Variables class <p>I'm working on an SConstruct build file for a project and I'm trying to update from Options to Variables, since Options is being deprecated. I don't understand how to use Variables though. I have 0 python experience which is probably contributing to this.</p> <p>For e...
<p>Typically you would store the variables in your environment for later testing.</p> <pre><code>opts = Variables() opts.Add('fcgi',0) env = Environment(variables=opts, ...) </code></pre> <p>Then later you can test:</p> <pre><code>if env['fcgi'] == 0: # do something </code></pre>
Does asp.net remove <script> tags in repeaters and inside the <% for loop %> in mvc <p>I have some <code>&lt;script type="javascript"/script</code> tags inside both a repeater and a for loop in mvc. </p> <p>On page render the script is gone and is not displayed both inside the repeater and the for loop (they are separ...
<p>Based on url: <a href="http://stackoverflow.com/questions/455912/script-script-inside-a-repeater-control-code-not-showing-up-in-the-source-code">http://stackoverflow.com/questions/455912/script-script-inside-a-repeater-control-code-not-showing-up-in-the-source-code</a> you are injecting the javascript into the repea...
Are there compelling reasons not to use Groovy? <p>I'm developing a LoB application in Java after a long absence from the platform (having spent the last 8 years or so entrenched in Fortran, C, a smidgin of C++ and latterly .Net).</p> <p>Java, the language, is not much changed from how I remember it. I like it's stren...
<p>There are two reasons I can think of not to use Groovy (or Jython, or JRuby):</p> <ul> <li>If you really, truly need performance</li> <li>If you will miss static type checking</li> </ul> <p>Those are both big ifs. Performance is probably less of a factor in most apps than people think, and static type checking is ...
Debugging ASP.NET Session State server issues <p>We have an application that runs over load balanced server instances, and therefore is configured to use the ASP.NET session state service, which is running on one of our DB servers. While both instances of our app can successfully connect to the state server, changes in...
<p>Does this help:</p> <p><a href="http://support.microsoft.com/kb/325056">http://support.microsoft.com/kb/325056</a> ?</p> <blockquote> <p>To maintain session state across different Web servers in the Web farm, the application path of the Web site (for example, \LM\W3SVC\2) in the Microsoft Internet Inform...
Recommended website resolution (width and height)? <p>Is there any standard on common website resolution?</p> <p>We are targeting newer monitors, perhaps at least 1280px wide, but the height may varies, and each browser may have different toolbar heights too.</p> <p>Is there any sort of standard to this?</p>
<p>The advice these days is:</p> <p><strong>Optimize for 1024x768</strong>. For most sites this will cover most visitors. Most logs show that 92-99% of your visits will be over 1024 wide. While 1280 is increasingly common, there are still lots at 1024 and some below that. Optimize for this but don't ignore the others....
Destructors of builtin types (int, char etc..) <p>In C++ the following code gives a compiler error:</p> <pre><code>void destruct1 (int * item) { item-&gt;~int(); } </code></pre> <p>This code is nearly the same, I just typedef the int to another type and something magic happens:</p> <pre><code>typedef int myint; v...
<p>It's the reason that makes your code work for generic parameters. Consider a container C:</p> <pre><code>template&lt;typename T&gt; struct C { // ... ~C() { for(size_t i = 0; i&lt;elements; i++) buffer[i].~T(); } }; </code></pre> <p>It would be annoying to introduce special cases fo...
Software visualization for C# <p>Does any of you know a tool for software visualization, or visual code navigation in c#?</p> <p>I found a bunch of tools but they're all for Java for some reason.</p> <p>There's a list of them in wikipedia but none is for the .Net platform.</p> <p><a href="http://en.wikipedia.org/wik...
<p><a href="http://www.red-gate.com/products/reflector/" rel="nofollow">Reflector</a> itself may not offer reasonable visualization of code. But there are addins that can enhance it with such functionality.</p> <p>Try the following addins on <a href="http://www.codeplex.com/reflectoraddins" rel="nofollow">this</a> pag...
Synchronize two databases schema in MySQL <p>I was looking for a portable script or command line program that can synchronize two MySQL databases schema. I am not looking for a GUI based solution because that can't be automated or run with the buid/deployment tool.</p> <p>Basically what it should do is scan database1 ...
<p>Have you considered using <a href="http://dev.mysql.com/doc/refman/5.0/en/replication.html">MySQL replication</a> ?</p>
SQL Queries - How Slow is Too Slow? <p>Do you have any formal or informal standards for reasonably achievable SQL query speed? How do you enforce them? Assume a production OLTP database under full realistic production load of a couple dozen queries per second, properly equipped and configured.</p> <p>Personal example ...
<p>Given that you can't expect deterministic performance on a system that could (at least in theory) be subject to transient load spikes, you want your performance SLA to be probabilistic. An example of this might be:</p> <p>95% of transactions to complete within 2 seconds.<br> 95% of search queries (more appropriate...
Migrate from Subversion to Team Foundation Server <p>We are looking for any proven migration path for moving a Subversion repository to a Team Foundation Server. Seems that there has been a discontinued product named CS-Converter(<a href="http://www.componentsoftware.com/Products/converter/svn2tfs.htm" rel="nofollow">C...
<p>Maybe <a href="http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/dafc9550-1c17-40ae-ad0a-fc463b336507/" rel="nofollow">this discussion</a> is interesting for you.</p> <p>There's another software mentioned from <a href="http://www.kyrosoft.com" rel="nofollow">Krysoft</a> which has been tested an...
How lean do my C++ exception classes really need to be? <p>There are lots of places where guidelines for designing exception classes can be found. Almost everywhere I look, there's this list of things exception objects should never do, which impacts the design of those classes.</p> <p>For instance, the <a href="http:/...
<p>You could use the Boost.Exception library to help define your exception hierarchy. The Boost.Exception library supports the:</p> <blockquote> <p>transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception types.</p> </blockquote> <p>T...
Condition evaluation in loops? <pre><code>string strLine;//not constant int index = 0; while(index &lt; strLine.length()){//strLine is not modified}; </code></pre> <p>how many times <code>strLine.length()</code> is evaluated</p> <p>do we need to put use <code>nLength</code> with <code>nLength</code> assigned to <code...
<p><code>length</code> will be evaluated every time you go via the loop, however since <code>length</code> is constant time (<code>O(1)</code>) it doesn't make much difference and adding a variable for storing this value will probably have a negligible effect with a small hit on code readability (as well as breaking th...
How to display text in system tray icon with win32 API? <p>Trying to create a small monitor application that displays current internet usage as percentage in system tray in C using win32 API. </p> <p>Also wanting to use colour background or colour text based on how much is used relative to days left in month.</p> <p>...
<p>Okay here is my win32 solution:</p> <pre><code>HICON CreateSmallIcon( HWND hWnd ) { static TCHAR *szText = TEXT ( "100" ); HDC hdc, hdcMem; HBITMAP hBitmap = NULL; HBITMAP hOldBitMap = NULL; HBITMAP hBitmapMask = NULL; ICONINFO iconInfo; HFONT hFont; HICON hIcon; hdc = GetDC ( h...