Saturday, April 30, 2005

How Photoshop and copiers detect currency

Tinotopia: Counterfeiting, Adobe Photoshop, Copyright, and the Future - Part I

If you have a recent version of Photoshop (and I think this applies to PaintShop Pro) and you try to scan in a $20 bill, Photoshop wont let you import the image. It also wont let you open a file of that image scanned by another application. The new digital copier machines will also prevent you from scanning currency.

How do they do that?

On the back of US currency (and other countries too), you'll find little circles in a set pattern. On the $20, it's a pattern of "20". The arrangement of the "0"'s is a set pattern that Photoshop is coded to scan for. If it finds that specific pattern of circles in the image, it considers that image to currency and it wont touch it. The post that I linked to goes into more detail will show you the pattern.

[Edited 5/2/05]
The new CS2 release of Photoshop now lets you open and edit currency images, you just can't print them.

DUI - Dialing under the influence

Virgin Mobile Australia adds 333 prefix to prevent drunk dialing.

The Australians (who know a thing or two about beer) have come up with a way of preventing you from calling your ex at 2am after having a few beverages.

"In space, no one can hear you scream."

"In space, no one can hear you scream."

Ever wonder about the origins of the taglines on a movie poster? The one that I always remember is "In space, no one can hear you scream.", from the movie ALIEN.. The link for this posting is to an interesting blog about movie posters.

Friday, April 29, 2005

'Alcohol makes your brain grow

BBC NEWS | Health | 'Alcohol makes your brain grow'

Drinking alcohol boosts the growth of new nerve cells in the brain, research suggests...

Time to open a bottle of nerve grower!

Total Illusions - The Forums -> Dangerous Hacker!

Total Illusions - The Forums -> Dangerous Hacker!

This is priceless. This link points to a English translation from a German IRC chat session. Some would be hacker claimed that he was kicked out and demanded the IP address of the chatroom moderator so he could attack the moderator's PC. The moderator gives the future Darwin Award winner the address 127.0.0.1. That address always points back to your PC. The transcript of the chat session has the hacker crowing about the files being deleted until his session abruptly ends.

RSS and Atom

This blog offers newsreader syndication using Atom. There's a button labeled "ATOM MYBLOG" on this page that provides the contents in XML format using the Atom format. Why Atom and not RSS? Well, that's what Blogger provides for blogs hosted on their server. If you are using a newsreader program or web site that subscribes to news feeds for you, the odds are that they will support both Atom and RSS.

Thursday, April 28, 2005

The Ten Rules of Performance

The Ten Rules of Performance

Paul Vick wrote a great article some time back about some rules for how to deal with performance issues. Originally written in 1997, they still hold true to day. When I first read this a year ago, I immediately put it on our Intranet site for all of our developers.

The Code Project - Complete Comparison for VB.NET and C# - .NET

The Code Project - Complete Comparison for VB.NET and C# - .NET

This is a pretty good summary of the differences between VB.NET and C#. It was recently updated to include VS .NET 2005.

Wednesday, April 27, 2005

Cliff Yablonski hates you

my name is Cliff Yablonski. I have never met you before, but I hate you
regardless. if I met you in public, I'd still hate you. I probably wouldn't hate
you any more than how much I currently hate you, because I don't think that
would be humanly possible. I would probably punch you in the face though. I hate
everybody and everything I find on the Internet. my site and the "Law and Order"
website are the only places worth visiting.



This site has not been updated in a long time but is very funny in a shallow way.

Everyone has a blog now.

Everyone has a blog now.

Tuesday, April 26, 2005

What's wrong with large values of zero?

We are about to roll out an update to one of our applications and we made some schema changes to the database. A couple of floating point fields were changed to the money data type. And that's when the fun began. QA reported the following error from one of the reports:

Arithmetic overflow error converting numeric to data type numeric.

After tracing through the stored procedure that drives the report, it boiled down to a COALESCE() function. When we used 0.00 as the 2nd parameter in COALESCE, it would throw that error under SQL Server 7. Oddly enough this only happens when the first parameter was not null.

The simple fix was to change 0.00 to 0 (no decimal point). Or use ISNULL() instead of COALESCE. This problem appears to be fixed in SQL Server 2000.

If you have access to SQL Server 7 (or MSDE 1) and you want to see this for yourself, try the following:

create table foo (id int, cur money null)

insert into foo(id, cur) values (1, null)
insert into foo(id, cur) values (2, 0.0)
insert into foo(id, cur) values (3, 4.567)

-- These will work
select id, ISNULL(cur, 0.00) as c from foo
select id, coalesce(cur, 0) as c from foo

-- This one will fail
select id, coalesce(cur, 0.00) as c from foo

Monday, April 25, 2005

...and now a random fact about Vin Diesel:

It takes 14 puppeteers to make Vin Diesel smile, but only 2 to make him destroy an orphanage.


Click here for a random fact about Vin Diesel. Some days, I'm easily amused.

Free AJAX library for the Microsoft .NET Framework

There looks like there is a freeware AJAX library for .NET 1.1. I know this stuff will be in ASP.NET 2.0, but that's not out yet and this one is.

I think I'm going to play with this one a bit....

How to handle unhandled exceptions in Windows Forms

How to handle unhandled exceptions in Windows Forms

Here's some sample code for catching unhandles exceptions in multi-thread Windows Forms application. Pretty cool.

Eric Gunnerson's C# Compendium : Visual Studio Debugging Slowness - Solved

Eric Gunnerson's C# Compendium : Visual Studio Debugging Slowness - Solved
It looks like if you have an invalid directory in the "debug source files" list, the VS.NET debugger may get very sleepy. The work around is to make sure that the list does not have any invalid directories.

Performance of Nullable types

I saw a interesting post by David Kean about the performance of the nullable types in .NET 2.0. The new int? type is about 50% slower than int and the bool? is about 15% than bool. The post is worth reading if only for the great example code for using interfaces.

I'm not concerned over the speed issue. You don't need nullable types everyday and when you do want one, it will be nice to have support for them at the framework. Hopefully the performance issue will be resolved before .NET 2.0 gets out of beta.

Is the handwriting on the wall for Delphi .Net?

I just saw that Xavier Pacheco will not be writing a Delphi 2005 Developer's Guide. His reasons were logical:

First, I simply do not have the time to invest in writing about a product I do not use. While Delphi 7 is my tool of choice for writing Win32 applications, I use VS.NET and C# for developing .NET applications. Secondly, the current book's sales have been very low. No publisher would take on this project as it would be a loss.


His Developer's Guides for previous versions of Delphi are good books to have and I wonder is this part of trend. Borland has always been a niche player, but is their niche getting smaller?

I have Delphi 2005, and while I broke the shrink wrap to see what was inside, I have yet to install it. I use Delphi 5 & Delphi 7 for Win32 apps and they are my tools of choice for Win32. I'm also doing .NET programming and I'm using C# with VS.NET. I've been using Delphi since Delphi 2, but I can't see any reason to use Delphi 2005 over VS.NET for .NET projects.

Friday, April 22, 2005

HOW TO: Download, Install, and Remove the IIS MetaEdit 2.2 Utility

HOW TO: Download, Install, and Remove the IIS MetaEdit 2.2 Utility

Here's a tool that I ended up using quite a bit on the last project. MetaEdit is an IIS Metabase editor that looks and feels like the Registry Editor. It allows you to look at and edit the IIS Metabase.

While developing install projects with the Wise for Windows Installer 6.0, I saw that IIS virtual directories created by were not working correctly. I was able to view the virtual directory definition with MetaEdit to see that Wise had done wrong.

Daring Fireball: Translation From PR-Speak to English of Selected Portions of Adobe's 'FAQ' Regarding Their Acquisition of Macromedia

Daring Fireball: Translation From PR-Speak to English of Selected Portions of Adobe's 'FAQ' Regarding Their Acquisition of Macromedia

This is funny translation of Adobe's statement of their acquisition of Macromedia. This one line forebodes the fate of many Adobemedia employees:

Please also note that PDF is an excellent format for sending out résumés.


Ouch.

The Old New Thing : The Itanium's so-called stack

The Old New Thing : The Itanium's so-called stack: You have to love any sentence that begins with "If the processor runs out of squirrel-space..." I have been following Raymond Chen's blog for a while now. It's pretty technical, but it explains much of the reasons why Windows does it needs to do.

Thursday, April 21, 2005

Download details: Windows Malicious Software Removal Tool

Download details: Windows Malicious Software Removal Tool: "This tool checks your computer for infection by specific, prevalent malicious software (including Blaster, Sasser, and Mydoom) and helps to remove the infection if it is found. Microsoft will release an updated version of this tool on the second Tuesday of each month."

It looks like XP and 2003 can automatically get updates through Windows Update. I have some friends who need to run this one.

Download details: Log Parser 2.2

Download details: Log Parser 2.2

Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

I think I need to get this one...

Wednesday, April 20, 2005

Hit me with your rhythm stick

Ian Dury, NYC 1978

In the deserts of Sudan and the gardens of Japan,
From Milan to Yucatan, ev'ry woman, ev'ry man.
Hit me your rhythm stick, hit me, hit me
Je t'adore, ich liebe dich
Hit me, hit me, hit me
Hit me with your rhythm stick
Hit me slowly, hit me quick
Hit me, hit me, hit me!
In the wilds of Borneo
And the vineyards of Bordeaux
Eskimo, Arapaho
Move their body to and fro
Hit me with your rhythm stick, hit me, hit me
Das ist gut, c'est fantastique
Hit me, hit me, hit me
Hit me with your rhythm stick.
It's nice to be a lunatic
Hit me, hit me, hit me!
Hit me, hit me, hit.... !
In the dock of Tiger Bay
On the road to Mandalay
From Bombay to Santa Fe
O'er the hills and far away
Hit me with your rhythm stick, hit me, hit me
C'est si bon, mm? Ist es nicht?
Hit me, hit me, hit me
Hit me with your rhythm stick.
Two fat persons, click, click, click
Hit me, hit me, hit me!
Hit me, hit me, hit me!
Hit me! (repeat)


It's not always about computers....

Monday, April 18, 2005

Query Analyzer Tips and Tricks

Query Analyzer Tips and Tricks

I never knew about tip #1. Tip #9 looks cool, but I need to install the debugger bits for SQL Server 2000.

Bug Details: Arithmetic operation resulted in an overflow with Int32.

Bug Details: Arithmetic operation resulted in an overflow with Int32.

Here's a bug that Microsoft knows about, but has postponed until "VNext".

This code will blow up in .NET:


public class FDBK23539
{
  public static void Calculate()
  {
   checked
   {
    int ii = int.MinValue;
    int a = ii - ii;
    int b = ii - int.MinValue; //Arithmetic operation resulted in an overflow.
   }
  }
  public static int Main(string[] args)
  {
   System.Console.WriteLine(System.Environment.Version);
   Calculate();
   return 0;
  }
}



Look at the code in the checked() function:

int ii = Int32.MinValue;
int a = ii - ii;
int b = ii - Int32.MinValue;

The values of a and b should be the same and an overflow exception should not be thrown for the b operation.

I loved the responses from MS:
Because the scenario is corner-case and given where we are in the cycle, I'm going to track this as an issue for consideration in VNext. We do appreciate the issue, we're really just ensuring we're looking at critical issues, since we want to get this product to you ASAP.

It's too early on a Monday morning to be reading this.

Friday, April 15, 2005

Acrobat Reader 7 phoning home

Remote Approach is a company that has designed a way to track PDF files using Javascript. Each time a person reads these special designed PDF files, a connection to http://www.remoteapproach.com/remoteapproach/logging.asp is made. This allows the company (and PDF author) to gather information such as IP addresses of those who are reading the PDF.

Some ways on how to block it:

  • Use an Acrobat Reader replacement such as Foxit PDF Reader or DjVuLibre
  • Block connections to http://www.remoteapproach.com through a firewall
  • Add the line "remoteapproach.com 127.0.0.1" to your hosts file
  • Disable Javascript in Acrobat Reader and it can't call home
    1. Click Edit menu
    2. Select Preferences
    3. Select the JavaScript category
    4. Uncheck Enable Acrobat JavaScript
    5. Click OK

"You have no privacy, get over it." - Scott McNealy, Sun Microsystems Inc
courtesy of tech-recipes.com

Why did the multithreaded chicken cross the road?

A. to To other side. get the

I love that joke. I've done enough code with threads to want that one on a t-shirt.

Build numbers

I can never figure out the naming scheme for version numbers. Is it Major, Minor, Build, Release? Or is it Major, Minor, Release, Build? Borland calls the last field "Build", Microsoft calls the last field "Release" (except for the times where it doesn't).

Internally, we always refer to final part of the version number as the build number.

We do development with Borland's Delphi (5 and 7) and Microsoft's Visual Studio .Net and while both can increment build numbers, we prefer to do it manually. In our home grown bug tracking app, we track the build number for when that bug was resolved. Borland's method of bug incrementing is simple. When that feature is enabled, the build number is incremented when you rebuild the project. We prefer to do it manually as part of the build process. One programmer is in charge of the build for any given app, and it's his responsibility to set the build number.

VS.NET can set the build number, but it's a little odd. They don't bump the build number when you rebuild, only when you close and reopen the project. Huh? Their build numbering scheme is also time based. You can VS set just the revision (4th field) or Build, Revision (3rd and 4th field). Build will be equal to the number of days since January 1, 2000 local time and Revision to be equal to the number of seconds since midnight local time, divided by 2.

This means that the final part of the version number is not always increase in value when Microsoft is allowed to set it. So we set it manually before handing over the latest and greatest to QA.

Monday, April 11, 2005

PRB: Access Denied Error When You Make Code Modifications with Index Services Running

PRB: Access Denied Error When You Make Code Modifications with Index Services Running

I was getting an annoying error while writing an ASP.NET app. I would make a change to the code and then run the app. Most of the time, it would run. About 5% of time, I would get an "Access is denied" error message about one of the assemblies in the app. Googling on that message didn't help, but when I searched on some other text from the error page, "Policy not being applied to reference at this time", that eventually took me to the right Microsoft KB article.

Basicly, the Microsoft Indexing Service was trying to index the temporary files that ASP.NET creates. Excluding that directory from the Indexing service appears to eliminate the problem. Of course the real question is: Why was Indexing Service bothering to index a directory that by definition only contains temporary files?

Thursday, April 07, 2005

Convert a string to an enumerated (enum) value.

Another cool tip from Mark Wagner: Convert a string to an enumerated (enum) value.

Using the Enum.Parse method, you can easily convert a string value to an enumerated value. Doing this requires the type of the enum and string value. Adding the true argument will cause the case to be ignored.

Using the following enum for this example:

private enum Aircraft{ Beech, Cessna, Piper}

You can easily convert the string to an enum value like this:

Aircraft air = (Aircraft) Enum.Parse(typeof(Aircraft), "Cessna", true);

Ideally you should wrap a try-catch around the Enum.Parse statement.

I can use with something that I'm working on now...

String Date Validator

String Date Validator

Mark Wagner has a nice helper function for validating a date.

private static bool IsDate(string sDate)
{
DateTime dt;
bool isDate = true;

try
{
dt = DateTime.Parse(sDate);
}
catch
{
isDate = false;
}

return isDate;
}

SqlDataReader performance tips

SqlDataReader performance tips

Some quick and easy performance tips for ADO.NET, courtesy of Adam Machanic.

He talks about calling GetOrdinal before looping through a DataReader. We do the same thing with classic ADO in Delphi when we need to optimize the scrolling through a recordset.

The other tip is to use static cases instead of Get

Roman Rehak commented with the tip to always close the explicitly connection when you are done with the reader.

FBI show how to crack a WLAN in 3 minutes.

At a recent ISSA meeting, a team of FBI agents demonstated how to crack the 128 bit WEP encryption used by wireless routers. They used freely available tools and accomplished their task in about 3 minutes. Over at Tom's networking, they have an article that covers how the FBI did this in great detail.

It time to run the firewalls on the computers behind the router. I want a tool that can tell me if someone is trying to hack into my network.

Wednesday, April 06, 2005

Download details: Microsoft USB Flash Drive Manager (Standard)

Download details: Microsoft USB Flash Drive Manager (Standard)

I haven't had a chance to try this one yet, but it looks interesting. Microsoft now has a utility for creating file sets for your USB Flash Drive. This could be handy if you only have one flash drive and you keep several sets of files that could go on it.

Oddly enough it only works with Windows XP and it requires that the .NET 1.1 runtime installed.