instruction stringlengths 0 30k ⌀ |
|---|
Resource hacker does the job of swapping application icons in Windows (up to XP, not tested with Vista yet).
Available at:
http://www.angusj.com/resourcehacker/
|
It you're looking to be able to share chunks of memory between processes, you should check out shm_open(2) and mmap(2). It's pretty easy to allocate a chunk of memory in one process and pass the path (for shm_open) to another and both can then go crazy together. This is a lot safer than poking around in another process... |
You can also achieve this via the command line:
> C:\>net share share-name /d
|
How to force my ASP.net 2.0 app to recompile |
|asp.net| |
I have a ASP.net 2.0 app and I have made some changes the the source file ( cs files ). I uploaded the changes with the belief that it would auto-recompile. I also have the compiled dll in MY_APP/bin. I checked it and noticed that it did not recompile. Please understand I am new to this. |
|asp.net|.net-2.0| |
I would suggest not going to such troubles ... if you really want to unit test your "internal" classes, just hide them away in a namespace that only your internal code would end up using. Unless you're writing a framework on the scale of the .NET framework, you don't **really** need that level of hiding. |
I use CC.Net along with SubVersion and MSBuild to accomplish this. [Here][1] is a great guide for implementing this which I followed on found very helpful.
[1]: http://dotnet.org.za/cjlotz/archive/2008/01/15/continuous-integration-from-theory-to-practice-2nd-edition.aspx |
Delphi
function IsPalindrome(const s: string): boolean;
var
i, j: integer;
begin
Result := false;
j := Length(s);
for i := 1 to Length(s) div 2 do begin
if s[i] <> s[j] then
Exit;
Dec(j);
end;
Result := true;
end; |
Getting a list of assemblies needed by application |
|.net|reflection|dependencies|nsis|assemblies| |
Is there a way of getting all required assemblies (excluding the .net framework) for a .net project into a folder ready to be packaged into an [nsis][1] as setup file?
I've tried writing a small console app that uses reflection to get a list of dlls but have got stuck with finding a foolproof way of determining if a... |
Unoptimized Python:
>>> def is_palindrome(s):
... return s == s[::-1] |
I use it all the time when someone sends me a list of patient visit numbers in a column (say 100-200) and I need them in a '0000000444','000000004445' format. works wonders for me!
I also use it to pull out email addresses in an email. I send out group emails often and all the bounced returns come back in one emai... |
Here's a python way. Note: this isn't really that "pythonic" but it demonstrates the algorithm.
def IsPalindromeString(n):
myLen = len(n)
i = 0
while i <= myLen/2:
if n[i] != n[myLen-1-i]:
return False
i += 1
return True |
Using the [Glass Pane][1] will do the trick.
[Here's a tutorial][2] on how to use the glass pane to get the right click button and redispatch it to the right component.
Cheers
[1]: http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html
[2]: http://weblogs.java.net/blog/joshy/archive/20... |
Using the [Glass Pane][1] will do the trick.
[Here's a tutorial][2] on how to use the glass pane to get the right click button and redispatch it to the right component.
---
As the glass pane is not a solution in this case, I suggest you take a look at the [Toolkit][3] class. Specificaly the addAWTEventListener... |
What is the best implementation for DB Audit Trail? |
|sql-server|audit| |
A DB Audit Trail captures the User Last Modified, Modified Date, and Created Date.
There are several possible implementations:
- SQL Server Triggers
- Add UserModified, ModifiedDate, CreatedDate columns to the database and include logic in Stored Procedures or Insert, Update statements accordingly.
It wo... |
If you have two network cards on the machine, then there shouldn't be a problem. Normal IP behaviour should ensure that traffic for your 'private' network (embedded systems in this case) is separate from your public network, without you having to do anything in your code. All that is required is for the two networks to... |
It's called the Windows Error Reporting Dialog. You can disable it by following these instructions:
<a href="http://www.windowsnetworking.com/articles_tutorials/Disable-Error-Reporting-Windows-XP-Server-2003.html">http://www.windowsnetworking.com/articles_tutorials/Disable-Error-Reporting-Windows-XP-Server-2003.html... |
CTRL + b: to build the project under c++
CTRL + SHIFT + f: to format your code (c++) |
This is a lot larger, but I think it looks a little more comprehensive:
http://www.obviex.com/Samples/Password.aspx
|
_Since I see three different people posted instructions on how to disable the dialog on their own machine, I'll post this again as an answer instead of just a comment:_
They don't want to do that on their customer's machines, because that will disable _any_ application from using the dialog. They just want to preven... |
public string CreatePassword(int length)
{
string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
string res = "";
Random rnd = new Random();
while (0 < length--)
res += valid[rnd.Next(val... |
How Scalable is Sqlite? |
|sqlite|scalability| |
I recently read this Question about [Sqlite Vs MySql][1] and the answer pointed out that Sqlite doesn't scale well and the official website [sort-of confirms this][2], however.
How scalable is Sqlite and what are its upper most limits?
[1]: http://beta.stackoverflow.com/questions/3630/sqlite-vs-mysql
[2]: ht... |
There is no platform-neutral way of doing this. In the 1.6 release of Java, a "[Desktop][1]" class was added the allows portable ways of browsing, editing, mailing, opening, and printing URI's. It is possible this class may someday be extended to support processes, but I doubt it.
If you are only curious in Java pro... |
I don't know of a command to do this, but you could do it in VBScript or something similar.
Somthing like:
sNewName = "put new name here"
Set oShell = CreateObject ("WSCript.shell" )
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
... |
MySQL: "lock wait timeout exceeded" |
|database|mysql| |
I am trying to delete several rows from a MySQL 5.0.45 database:
delete from bundle_inclusions;
The client works for a while and then returns the error:
Lock wait timeout exceeded; try restarting transaction
It's possible there is some uncommitted transaction out there that has a lock on this table,... |
The IFormatProvider argument can be null. |
Assuming you also want to do something with the other name=value pairs this is how I would do it ( using Perl version 5.10 ):
use 5.10;
use strict;
use warnings;
my %hash;
while(
$string =~ m{
(?: ^ | \G ) # start of string or previous match
\s*
... |
Assuming you also want to do something with the other name=value pairs this is how I would do it ( using Perl version 5.10 ):
use 5.10;
use strict;
use warnings;
my %hash;
while(
$string =~ m{
(?: ^ | \G ) # start of string or previous match
\s*
... |
Assuming you also want to do something with the other name=value pairs this is how I would do it ( using Perl version 5.10 ):
use 5.10.0;
use strict;
use warnings;
my %hash;
while(
$string =~ m{
(?: ^ | \G ) # start of string or previous match
\s*
... |
Depending on what you're doing, you might want to move the audit out of the data layer into the data access layer. It give you more control.
I asked a similar question wrt NHibernate and SqlServer [here][1].
[1]: http://stackoverflow.com/questions/15917/data-auditing-in-nhibernate-and-sqlserver |
We try not to create message strings by program manipulation because the loc. team can't see them.
The loc. team actually prefer separate but nearly duplicate messages.
However they will accept parameterized messages.
E.g., "The %(appliance)% is %(on\_or\_off)%."
The parameters can break down but at least it... |
Isn't it w3wp.exe? |
What about setting up your CDPATH variable? |
Did you actually mean PIMPL? I think most people refer to this as the Handle Body idiom. See James Coplien's book Advanced C++ Programming Styles and Idioms ([Amazon link][1]). It's also known as the [Cheshire Cat][2] because of Lewis Caroll's character that fades away until only the grin remains.
Basically the idea... |
I think most people refer to this as the Handle Body idiom. See James Coplien's book Advanced C++ Programming Styles and Idioms ([Amazon link][1]). It's also known as the [Cheshire Cat][2] because of Lewis Caroll's character that fades away until only the grin remains.
Basically the idea is to hide as much as possib... |
I think most people refer to this as the Handle Body idiom. See James Coplien's book Advanced C++ Programming Styles and Idioms ([Amazon link][1]). It's also known as the [Cheshire Cat][2] because of Lewis Caroll's character that fades away until only the grin remains.
The example code should be distributed across t... |
You can also embed C/C++ scripts using [Ch][1]. I've been using it for a game project I'm working on, and it does well. Nice blend of power and adaptability.
[1]: http://softintegration.com/ |
How do you tell IIS 6 to set the .NET version to 2.0 (not 1.1) When New sites are created? |
|asp.net|iis-6|windows-server-2003| |
We create new sites in IIS 6 (Windows Server 2003) using IIS Manager. When these sites are created in IIS 6, the ASP.NET version defaults to ASP.NET 1.1. We would like it to default to ASP.NET 2.0. The reason this is a problem for us is that when you take any site on the server and switch the ASP.NET version from AS... |
If I understand correctly your users can select different dates but each selection can only be the last business day of any month. So it could be start:29-JAN-2008 and end:30-MAR-2008 or same date start:29-JAN-2008 and end:29-JAN-2008.
Why have days at all? Could you model your data to include a month/year field e.g... |
Based on the error looks like the code is attempting to connect using named pipes, rather than TCPIP. You may actually need to specifically indicate in your connection string that the sql provider should connect using tcpip, so your connection string would look like the below.
Using Integrated Authentication (windo... |
Apart from the apparent diff of
- having to declare the value at the time of a definition for a const VS readonly values can be computed dynamically but need to be assigned before the ctor exits.. after that it is frozen.
- 'const's are implicitly static. You use a ClassName.ConstantName notation to access the... |
I also found the following links to be interesting:
- [Literally make history with Firefox 3][1]
- [SQLite on .NET - Get up and running in 3 minutes.][2]
- [SQLite Manager Firefox Addon][3]
After adding a reference to System.Data.Sqlite in my .Net project, all I had to do to create a connection was:
... |
You can use .next()
>Get a set of elements containing the unique next siblings of each of the given set of elements.
So your js becomes:
$("#somediv > ul").after("<div id='xxx'></div>").next().append($("#someotherdiv").clone()); |
You can use .nextAll([expr])
>Find all sibling elements after the current element.
Use an optional expression to filter the matched set.
So your js becomes:
$("#somediv > ul").after("<div id='xxx'></div>").nextAll('#xxx').append($("#someotherdiv").clone()); |
>How can I most efficiently select that intermediate div that I added with the "after" and put my "#someotherdiv" into it?
@Vincent's solution is probably the fastest way to get the same result. However if for whatever reason you need add the div with `after()` then need to select it and operate on it you can use
... |
Alt-Shift-Up Arrow does escalating selection. Alt-Shift-Down does the opposite. |
I just figureed it out. I just needed to put count() around my xpath, like so:
count(//my/node) |
Sqlite is a _desktop_ or _in-process_ database. SQL Server, MySQL, Oracle, and their brethren are _servers_.
Desktop databases are by their nature not a good choices for _any_ application that needs to support concurrent access to the data store. This includes pretty much every web site ever created. |
The only way I can think of doing it is by invoking a command line application that does the job for you and then screenscraping the output (like Linux's top and Window's tasklist).
Unfortunately, that'll mean you'll have to write some parsing routines to read the data from both.
Process proc = Runtime.getRu... |
The only way I can think of doing it is by invoking a command line application that does the job for you and then screenscraping the output (like Linux's top and Window's tasklist).
Unfortunately, that'll mean you'll have to write some parsing routines to read the data from both.
Process proc = Runtime.getRu... |
The only way I can think of doing it is by invoking a command line application that does the job for you and then screenscraping the output (like Linux's ps and Window's tasklist).
Unfortunately, that'll mean you'll have to write some parsing routines to read the data from both.
Process proc = Runtime.getRun... |
Take a look at this: <http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net/75369/Enforcing-https>
Edit: This shows solutions from an IIS point of view, but you should be able to configure about any web server for this. |
Once you find a solution, you start forcing it in code reviews. If it's not implemented in new code, tell them, sorry, but you have to go back and do it again. If you already have standards and reviews in place, this is a lot easier to implement. |
Not sure if this will help you much... I use java 1.5+'s [ProcessBuilder][1] to launch external shell scripts in a java program. Basically I do the following: ( although this may not apply because you don't want to capture the commands output; you actually wanna fire up the document - but, maybe this will spark somet... |
jquery: JFrame plugin fails in IE 7 |
|jquery|coldfusion| |
I'm using the JFrame plugin with jquery 1.2.6.
It works fine in FF3, however it won't display the requested pages in IE 7
the jquery library and the JFrame plugin are called in the included header.cfm
page code is here (note: ignore the ColdFusion calls, I don't think they're generating the problem) [http://cf... |
Parsing exact dates in C# shouldn't force you to create an IFormatProvider |
|c#|globalization|dotnet|parsing|datetime| |
Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific formats) dates in C# **should** be as easy as
DateTime.ParseExact(theDate, "yyyy/MM/dd");
but no, C# forces you to create an IFormatProvider. Is there an app.config friendly way of setting this so I don't need to do this eac... |
|c#|.net|parsing|datetime|globalization| |
Google "Pysical to virtual conversion" or P2V. There are several solutions available. Unfortunately it sounds as though not many have had success with Microsoft's solution.
Try the following:
1. Download and install the VMWare Converter and follow the instructions to convert the physical machine.
2. Download t... |
Double.Parse("1.234567E-06", System.Globalization.NumberStyles.Float); |
find . -name "*.ear" -exec ls -l {} \; |
Make sure you don't have any firewalls blocking SMTP. The first time I tried to send an email, it was blocked both by Windows Firewall and McAfee - took forever to find them both. |
My first thought is this. I don't know if it would work but it would only take a few minutes to try.
Create **two** IIS web sites on the same server. The first site is bound to the public IP, but the second site is bound to the private IP. Both point to the same folder on the file system.
Your VPN users will be a... |
My first thought is this. I don't know if it would work but it would only take a few minutes to try.
Create **two** IIS web sites on the same server. The first site is bound to the public IP, but the second site is bound to the private IP. Both point to the same folder on the file system.
Your VPN users will be a... |
Based on the error looks like the code is attempting to connect using named pipes, rather than TCPIP. You may actually need to specifically indicate in your connection string that the sql provider should connect using tcpip, so your connection string would look like the below.
Using Integrated Authentication (windo... |
XNA encourages the use of interfaces, events and delegates to drive something written with it. Take a look at the GameComponent related classes which set this up for you.
The answer is, "As much as you feel comfortable with".
|
XNA encourages the use of interfaces, events and delegates to drive something written with it. Take a look at the GameComponent related classes which set this up for you.
The answer is, "As much as you feel comfortable with".
To elaborate a little bit, If for example you take and inherit from the gamecomponent cl... |
[Paul Stovell][1] posted some examples of [Reporting Services automation][2] that might get you going.
[1]: http://www.paulstovell.com/blog/
[2]: http://www.paulstovell.com/blog/reporting-services-automation |
[Paul Stovell][1] posted some examples of [Reporting Services automation][2] that might get you going.
[1]: http://www.paulstovell.com/blog/
[2]: http://svn.paulstovell.net/Projects/ReportingServicesAutomation/trunk/src/
EDIT: The link to the Subversion repository has been updated and is now working |
[Zenburn][1] color scheme and good fonts - [Droid Sans Mono](http://en.wikipedia.org/wiki/Droid_(font\)) on Linux, [Consolas][2] on Windows.
[1]: http://slinky.imukuppi.org/zenburnpage/
[2]: http://en.wikipedia.org/wiki/Consolas
|
I'm with [Will][1]:
* Double quotes for text
* Single quotes for anything that behaves like an identifier
* Double quoted raw string literals for regexps
* Tripled double quotes for docstrings
I'll stick with that even if it means a lot of escaping.
I get the most value out of single quoted identifiers st... |
One possible solution would be to write a script that you check in with the rest of your code and which is run as the first step of your build process.
This script runs through your copy of the codebase and sets read permissions on certain files.
Ideally the script would read the list of files from a simple input... |
As said previously, [The Mono Project][1] is your best bet given it's community support.
If you're in Visual Basic then [REALbasic][2] could also be worth a look, as it has cross compiler that creates native executables. They have a trial edition you can [download too][3]
[1]: http://www.mono-project.com/
... |
Graham, `svn` doesn't store permissions. Your only option is to wrap your call to `svn` in a script. The script should call `svn` with its arguments, then set the permissions afterward. Depending on your environment, you might need to call your script `svn` and tweak your `PATH` to ensure it gets called.
I quite li... |
I don't see the difference between your call and simply calling the method within the switch statement.
No, there is no semantic or readability difference.
The only difference I see is that you are taking a pointer to a method and so forbis the compiler to inline it or optimizes any call to that method. |
I don't see the difference between your call and simply calling the method within the switch statement.
No, there is no semantic or readability difference.
The only difference I see is that you are taking a pointer to a method and so forbids to the compiler to inline it or optimizes any call to that method. |
I think most people refer to this as the Handle Body idiom. See James Coplien's book Advanced C++ Programming Styles and Idioms ([Amazon link][1]). It's also known as the [Cheshire Cat][2] because of Lewis Caroll's character that fades away until only the grin remains.
The example code should be distributed across t... |
Hash the username and the password _together_. That way, if two users have the same password, the hashes will still be different. |
No, Disposing of the Command will not effect the Connection. A better approach would be to also wrap the SqlCommand in a using block as well
using (SqlConnection conn = new SqlConnection(connstring))
{
conn.Open();
using (SqlCommand cmd new SqlCommand(cmdstring, conn))
{
... |
No, Disposing of the Command will not effect the Connection. A better approach would be to also wrap the SqlCommand in a using block as well
using (SqlConnection conn = new SqlConnection(connstring))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(cmdstring, conn))
{
... |
No, Disposing of the Command will not effect the Connection. A better approach would be to also wrap the SqlCommand in a using block as well
using (SqlConnection conn = new SqlConnection(connstring))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(cmdstring, conn))
{
... |
If you add up the ASCII values of each character, you'd get the same result regardless of order.
(This may be a bit too simplified, but perhaps it sparks an idea for you.
See Programming Pearls, section 2.8, for an interesting back story.)
|
You can access Notes Documents relatively easily using DIIOP, would be a lot easier than going down the C Api road... |
bash: Only one process
\#!/bin/bash<br>
of() { of; }<br>
of |
Does emacs have something like vi's "set number" |