instruction stringlengths 0 30k ⌀ |
|---|
The most elegant solution i found for problems like this is something like this (in pseudocode)
separator = ""
foreach(string in strings)
{
concatenatedString += separator + string
separator = ","
}
You just run the loop and only after the second time around the separator is s... |
It looked for a while like the underscore and angle bracket problem had gone away, but it seems it might not be fixed.
here's a small sample, which should look like this:
____
<br>#include <stdio.h>
____
#include <stdio.h>
<pre>
____
#include <stdio.h>
</pre> |
It looked for a while like the underscore and angle bracket problem had gone away, but it seems it might not be fixed.
here's a small sample, which should look like this:
____
<br>#include <stdio.h>
____
#include <stdio.h>
<pre>
____
#include <stdio.h>
</pre>
Update: it looks like it's fixed in... |
The Objective-C language has had "Categories" since the early 1990s; these are essentially the same thing as .NET Extension Methods. When looking for best practices you might want to see what rules of thumb Objective-C (Cocoa & NeXT) developers have come up with around them.
[Brent Simmons][1] (the author of the Ne... |
There's a good post about this [here][1] and [here][2]. I have also used NPlot in our last project since it's easier to use.
[1]: http://weblogs.asp.net/gbarnett/archive/2008/06/03/visualising-data.aspx
[2]: http://weblogs.asp.net/gbarnett/archive/2008/03/23/free-graphing-libraries-for-net-my-thoughts.aspx |
You might want to take a look at [Open Flash Chart][1]. It's an open source graphing tool built in flash and can be dynamically updated.
Check out the [Ajax example][2] for an idea of what it can do.
[1]: http://teethgrinder.co.uk/open-flash-chart/
[2]: http://teethgrinder.co.uk/open-flash-chart/gallery-js... |
Exit [construct], and intelisense will tell you which one(s) are valid in a particular place. |
A tutorial with a good set of diagrams helps greatly with the understanding of pointers.
Such as this one: [Pointers in C and C++ Tutorial](http://www.augustcouncil.com/~tgibson/tutorial/ptr.html) |
A tutorial with a good set of diagrams helps greatly with the understanding of pointers.
Such as this one: [Pointers in C and C++ Tutorial](http://www.augustcouncil.com/~tgibson/tutorial/ptr.html)
Joel Spolsky makes some good points about understanding pointers in his [Guerrilla Guide to Interviewing](http://www... |
If you need something to display in a WinForms app then you can try out the free [ZedGraph][1]. If it is ASP.NET then I recently have used [Google Charts][2] with some great results.
[1]: http://zedgraph.org/wiki/index.php?title=Main_Page
[2]: http://code.google.com/apis/chart/ |
|excel|ssis|sql-server|connection-manager| |
I have an SSIS package that exports data to a couple of Excel files for transfer to a third party. To get this to run as a scheduled job on a 64 bit server I understand that I need to set the step up as a CmdExec type and call the 32 bit version of DTExec. But I don't seem be able to get the command right to pass in th... |
|sql-server|excel|ssis|connection-manager| |
Query a union table with fields as columns. |
|sql|database-design|stored-procedure| |
I'm not quite sure if this is possible, or falls into the category of Pivot tables, but I figured I'd go to the pros to see.
I have three basic tables: Card, Property, and CardProperty. Since cards do not have the same properties, and often multiple values for the same property, I decided to use the union table appr... |
|sql|database-design|stored-procedures| |
Proportional font IDE |
|fonts|ide|text-editor|tabs|diy| |
I would really like to see a proportional font IDE, even if I have to build it myself (perhaps as an extension to Visual Studio). What I basically mean is MS Word style editing of code that sort of looks like the typographical style in [The C++ Programming Language book](http://www.research.att.com/~bs/3rd.html).
I... |
The most elegant solution i found for problems like this is something like this (in pseudocode)
separator = ""
foreach(item in stringCollection)
{
concatenatedString += separator + item
separator = ","
}
You just run the loop and only after the second time around the separator... |
You simply need to sum the weights of all candiate rows, then choose a random point within that sum, then select the record that coordinates with that chosen point (each record is incrementally carrying an accumlating weight sum with it).
DECLARE @id int, @weight_sum int, @weight_point int
DECLARE @table TA... |
Try http://uche.ogbuji.net/tech/4suite/amara
It is quite complete and has a straight forward set of access tools.
Normal Unicode support etc.
#
#Output the xml entry
#
def genFileOLD(out,label,term,idval):
filename=entryTime() + ".html"
writer=MarkupWriter(out, indent=u"yes")
writer.startDocumen... |
I'd recommend two things:
First up, that other server - what happens if your machine dies? the house burns down? etc. Having it on another machine is a good idea from a redundancy point of view.
The second one is WHAT:
If you are very familiar with visual source(un)safe, think about SourceGearVault. It's VERY ... |
In MySQL, you can't modify the same table which you use in the SELECT part.
This behaviour is documented at:
[http://dev.mysql.com/doc/mysql/en/UPDATE.html][1]
You will need to stop using the nested query and execute the operation in two parts.
[1]: http://dev.mysql.com/doc/mysql/en/UPDATE.html |
In MySQL, you can't modify the same table which you use in the SELECT part.
This behaviour is documented at:
[http://dev.mysql.com/doc/mysql/en/UPDATE.html][1]
You will need to stop using the nested query and execute the operation in two parts, or alternatively use a simple where clause.
From Baron Schwartz, ... |
In MySQL, you can't modify the same table which you use in the SELECT part.
This behaviour is documented at:
[http://dev.mysql.com/doc/mysql/en/UPDATE.html][1]
You will need to stop using the nested subquery and execute the operation in two parts, or alternatively use a simple where clause.
*Below is from Bar... |
It might be worth looking at the prerelease of version 2.0. A lot of stuff has changed:
http://blogs.msdn.com/powershell/archive/2007/11/06/what-s-new-in-ctp-of-powershell-2-0.aspx
|
[Windows Scripting Languages][1]
Also take a look at [PowerShell][2]
[1]: http://www.mvps.org/scripting/languages/
[2]: http://en.wikipedia.org/wiki/Windows_PowerShell |
CScript ? I remember seeing something like that. |
Doh, it looks like this might not be in the Express version (I had just assumed this dialog would be the smae for all version of VB.NET). However, you could try:
> In Visual Basic 2008 Express Edition:
> Build menu > Configuration Manager...
>
> Change Active solution platform: to
> "<New>...", choose "x86", ... |
You could try:
> In Visual Basic 2008 Express Edition:
> Build menu > Configuration Manager...
>
> Change Active solution platform: to
> "<New>...", choose "x86", save the new
> platform.
>
> Now the "x86" option is available in
> the Compile settings.
You may need to enable "Show advanced build confi... |
What is the simplest SQL Query to find the second largest value? |
|sql|puzzle| |
What is the simplest SQL query to find the second largest integer value in a specific column? Of course there may be duplicate values in the column. |
LINQ doesn't prohibit the use of stored procedures. I've used mixed mode with LINQ-SQL and [LINQ-storedproc][1]. Personally, I'm glad I don't have to write the stored procs....pwet-tu.
[1]: http://codebetter.com/blogs/david.hayden/archive/2008/02/19/linq-to-sql-and-stored-procedures-visual-studio-2008-and-reposito... |
How about installing a windows version of [Python][1], [Perl][2] or your favorite language? These should offer all the functionality you need.
[1]: http://www.activestate.com/Products/activepython/index.mhtml
[2]: http://www.activestate.com/Products/activeperl/index.mhtml |
Powershell is nice, but it's an extra thing you have to install. Not standard in almost any windows installation. So, if it's just for your own use, then powershell should be fine. If you need the scripts to run on the computers of the general population, for instance, as part of a piece of software you are producing... |
To summarise the link provided by Codeslayer (in case the page url changes)...
*Change the sql file templates to ANSI encoding by opening with notepad and then saving it as an ANSI file. You can do the same for files already created.
<InstalledPath>\Common7\Tools\Templates\Database Project Items*
You've just mad... |
You could insert the desired rows' ids into a temp table and then delete all the rows that are found in that table.
which may be what @Cheekysoft meant by doing it in two steps. |
Is there a Python library for generating .ico files? |
|python|favicon| |
I'm looking to create `favicon.ico` files programatically from Python, but PIL only has support for reading `ico` files. |
I would also recommend Mercurial. It's command set is much like the one found in Subversion, so the learning curve is not that steep. As mentioned earlier, it's designed to run locally, but it's also easy to share/merge changes across computers, or even just push it to a remote server for backups.
It offers excellen... |
How can I call a .NET DLL from an Inno Setup script? |
|installation|inno-setup| |
I want to call a function from a .NET DLL (coded in C#) from an Inno Setup script.
I have:
1. marked the *Register for COM interop* option in the project properties,
2. changed the *ComVisible* setting in the *AssemblyInfo.cs* file,
3. added these lines to the ISS script:
> [Files]
>
> Source: c:\temp\1\M... |
This is something that annoys me about MSSQL (<a href="http://bizvprog.blogspot.com/2008/04/annoying-fundamental-flaw-with-sql.html">rant on my blog</a>). I wish MSSQL supported `upsert`.
@Dillie-O's code is the best way I know of in Sql2005 (+1 vote), but it still is basically two IO operations (the `exists` and t... |
This is something that annoys me about MSSQL (<a href="http://bizvprog.blogspot.com/2008/04/annoying-fundamental-flaw-with-sql.html">rant on my blog</a>). I wish MSSQL supported `upsert`.
@Dillie-O's code is a good way in older SQL versions (+1 vote), but it still is basically two IO operations (the `exists` and th... |
Here is the pseudocode I came up with. This is not any particular pseudocode dialect, but should be simple enough to follow.
Anyone want to pick this apart.
- [p] is a list of vertices representing the current path.
- [r] is a list of paths where meet the criteria
- [s] is the source vertex
- [d] is the ... |
Implement a non-generic interface and use that:
public class GraphicsItem<T> : IGraphicsItem
{
private T _item;
public void Load(T item)
{
_item = item;
}
public void SomethingWhichIsNotGeneric(int i)
{
// Code goes here... |
Thanks @ima, your answer pointed me in the right direction. I was using an app.config file and it contained this:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" sku="Client"/>
</startup>
<configSections>
<section name="modules" type="Microsoft.Practices.C... |
Assuming your xhtml is in an element YYY
<xsl:template match="YYY">
<xsl:copy>
<xsl:copy-of select="*|@*"/>
</xsl:copy>
</xsl:template>
http://www.dpawson.co.uk/xsl/sect2/N1930.html explains options |
Regardless of the operating system you're actually talking about, it shouldn't matter. Most applications you might write won't need to worry about the differences (if there indeed are any). Only in rare cases might you use some specific functionality that might only be available on a "server" edition of your OS.
The... |
Podcasts from [Dr.Dobbs Journal](http://www.ddj.com/mediaCenter/moreMediaCenter.jhtml?site_article_type=160901008&start=1) |
1. Podcasts from [Dr.Dobbs Journal](http://www.ddj.com/mediaCenter/moreMediaCenter.jhtml?site_article_type=160901008&start=1)
2. [ITConversations](http://itc.conversationsnetwork.org/)
3. [SE-Radio](http://www.se-radio.net/)
4. [Channel 9](http://channel9.msdn.com/Media/Podcasts/) |
I usually use svn through a gui, either my IDE or a client. Because of that, I can never remember the codes when I do have to resort to the command line.
I find this cheat sheet a great help:
<http://www.addedbytes.com/cheat-sheets/subversion-cheat-sheet/> |
C# Tab Escape Character |
|c#| |
A simple question. I'm just in the process of parsing some text and can't remember what the escape character is for a tab in C#? |
Easy one! "\t" |
Easy one! "\t"
Edit: In fact, here's something official: [Escape Sequences][1]
[1]: http://msdn.microsoft.com/en-us/library/h21280bw.aspx |
I was bored so i modified some stuff i wrote. It try's to encapsulate the parsing in an OO manner whle cutting down on the amount of iterations through the file, it only iterates once at the top foreach.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.I... |
I would really like to see a proportional font IDE, even if I have to build it myself (perhaps as an extension to Visual Studio). What I basically mean is MS Word style editing of code that sort of looks like the typographical style in [The C++ Programming Language book](http://www.research.att.com/~bs/3rd.html).
I... |
|ide|fonts|tabs|text-editor|diy| |
I would really like to see a proportional font IDE, even if I have to build it myself (perhaps as an extension to Visual Studio). What I basically mean is MS Word style editing of code that sort of looks like the typographical style in [The C++ Programming Language book](http://www.research.att.com/~bs/3rd.html):
:
![... |
If you don't want to use regular expressions (for example if you need better performance) you could try <a href="http://www.codeproject.com/KB/MCMS/htmlTagStripper.aspx">a small method I wrote a while ago, posted at CodeProject</a>. |
How do I do an Upsert Into Table? |
|sql|sql-server|t-sql| |
I have a view that has a list of jobs in it, with data like who they're assigned to and the stage they are in. I need to write a stored procedure that returns how many jobs each person has at each stage.
So far I have this (simplified):
DECLARE @ResultTable table
(
StaffName nvarchar(100),
... |
This is something that annoys me about MSSQL (<a href="http://bizvprog.blogspot.com/2008/04/annoying-fundamental-flaw-with-sql.html">rant on my blog</a>). I wish MSSQL supported `upsert`.
@Dillie-O's code is a good way in older SQL versions (+1 vote), but it still is basically two IO operations (the `exists` and th... |
On a modern processor, you could use the following when sorting large arrays and see no difference in speed:
void swap (int *a, int *b)
{
for (int i = 1 ; i ; i <<= 1)
{
if ((*a & i) != (*b & i))
{
*a ^= i;
*b ^= i;
}
}
}
The ... |
CREATE TABLE #tmptablename
Use the hash/pound sign prefix |
CREATE TABLE #tmptablename
Use the hash/pound sign prefix
|
Might be a duplication, but check out ollydbg, IDA Pro and <a href="http://www.openrce.org/">this website</a> has a whole bunch of resources with some very sexy images. |
![Visual Paradigm for UML][1]
I'm very fond of [Visual Paradigm for UML][2] It's very powerful and has a free [Community Edition][4] and cheap [Personal Edition][5] as well.
![Agilian][6]
For Agile modeling there's also [Agilian][3] which is a bit more flexible, adds extra features to support smartboards and k... |
How to get SpecUnit to run within a TeamCity CI build |
|c#|nant|teamcity| |
I am trying to get SpecUnit to run in a continuous integration build using Nant. At the moment the files are in the correct place but no output is generated from SpecUnit.Report.exe. Here is the relevant task from the nant build script:
<echo message="**** Starting SpecUnit report generation ****" />
<copy fil... |
It's not a tool, but Ambler and Sadalage's book, [Refactoring Databases: Evolutionary Database Design][1] is quite good.
[1]: http://www.amazon.com/Refactoring-Databases-Evolutionary-Addison-Wesley-Signature/dp/0321293533/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1219753593&sr=8-1 |
Try [doxygen][1]
[1]: http://www.stack.nl/~dimitri/doxygen/ |
Try [doxygen][1]
Example output from [Xerces][2]
[1]: http://www.stack.nl/~dimitri/doxygen/
[2]: http://xerces.apache.org/xerces-c/apiDocs/classXercesDOMParser.html |
@Keith
This is a common misconception: Table variables are NOT necessarily stored in memory. In fact SQL Server decides whether to keep the variable in memory or to spill it to TempDB. There is no reliable way (at least in SQL Server 2005) to ensure that table data is kept in memory. For more detailed info look [her... |
Personally I use Windows Vista but that's because it's what I like and I can use it well. But in all honesty it doesn't matter, your OS should be something you are comfortable in and has the tools you need to be productive.
I would say your test environment is the one you need to have as close to your production ... |
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
This is referred to as the "identity transformation" in the [XSLT specification][1].
[1]: http://www.w3.org/TR/xslt#copying |
> There is a school of though that if you are doing (mostly) web programming (or other server based code), you should use a server OS for your dev machine
I think that applies more to *'system programmers'* rather than web *'application programmers'*. Why? There is definitely great value in knowing the platform in... |
Here is a simple and **very inelegant** way.
1. Backup DB
2. Detach DB
3. Delete Log file
4. Attach DB
5. New log file will be recreated
I'm guessing that you are not doing log backups. (Which truncate the log). My advice is to change recovery mode from full to simple. This will prevent log bloat. |
Here is a simple and **very inelegant** way.
1. Backup DB
2. Detach DB
3. Delete Log file
4. Attach DB
5. New log file will be recreated
I'm guessing that you are not doing log backups. (Which truncate the log). My advice is to change recovery model from [full][1] to [simple][2]. This will prevent log b... |
Here is a simple and **very inelegant** way.
1. Backup DB
2. Detach DB
3. Rename Log file
4. Attach DB
5. New log file will be recreated
6. Delete Renamed Log file.
I'm guessing that you are not doing log backups. (Which truncate the log). My advice is to change recovery model from [full][1] to [simpl... |
I use Windows Server 2003 set up as a workstation.[This is the guide][1] i have used for several years. Really like it.
[1]: http://win2k3.msfn.org/ |
You're on the right track but try working with the Command Name/Argument of the LinkButton. Try something like this:
In the HeaderTemplate of the the TemplateField, add a LinkButton and set the CommandName and CommandArgument
<HeaderTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName... |
It looks like undeliverable messages in Exchange have a content-type of "multipart/report; report-type=delivery-status". Probably because they don't have a body, just a summary of the delivery attempt which can actually all be gathered from the Headers of the message. Perhaps the WebDAV access (I don't have access to a... |
In general, a developer should **never** throw a NullPointerException. This exception is thrown by the runtime when code attempts to dereference a variable who's value is null. Therefore, if your method wants to explicitly disallow null, as opposed to just happening to have a null value raise a NullPointerException, yo... |
Perhaps the following would work:
* Generate your icon image using PIL
* Convert the image to .ico format using the python interface to ImageMagick, [PythonMagick](http://www.imagemagick.org/download/python/)
I have not tried this approach. The ImageMagick <tt>convert</tt> command line program was able to conver... |
Determining members of local groups via C# |
|c#|.net|windows|networking| |