Deprecating Functions in Visual C++ 2005

I was recently trying to modify an open source FTP client in Visual C++ 2005. The software was written for an earlier version of VC++ so it had to be imported into the 2005 version. The import process generated hundreds of warnings of deprecated functions. This is not really something you want to see when compiling a program.

The warnings were the result of Microsoft deprecating many standard C functions. The complete list can be found on MSDN. These functions are being removed due to security concerns that Microsoft has. The new function has “_s” appended to it’s name, for example, printf becomes printf_s.

One might think that all you have to do is a global search and replace throughout your project to change the function names, but this won’t work. The updated functions have different parameter lists and return types.

So you can spend hours or days manually updating all of your code, or you can tell the compiler to use the deprecated functions instead. This can be done by placing the following at the start of your program:

#define _CRT_SECURE_NO_DEPRECATE

Keep in mind that this is a temporary solution. There may come a time when Microsoft removes these deprecated functions completely but at least you have time to gradually update the functions to their more secure counterparts.

Hiding Affiliate Links

There may be certain situations when you need to hide a URL on your web site. This is useful, for example, in changing the display URL for affiliate links. While there are several good techniques for accomplishing this, I prefer using the refresh metatag to redirect users entering that page to another location.

This is how it works. When you open a URL, such as www.cyprich.com, it will automatically look for a page called index.htm, index.html, or index.php (if you have PHP installed on your web server). An ASP.NET server will try to open a page called index.asp, index.aspx, or Default.aspx. These default pages can be defined by the web server settings for that URL.

The defaults also work for subfolders. For example, if you open www.cyprich.com/richmond/ and there is a file called index.php in that folder, it would be opened just as if you would had entered www.cyprich.com/richmond/index.php.

You can redirect a user that opens a web page with the refresh metatag as the following example shows.

====[ index.php ]===============

<html>

<head>
<meta http-equiv=”refresh” content=”0; url=http://www.advertiser.com/id=57912″>
</head>

<body>
</body>

</html>

=============================

So now when someone moves the mouse over the linked ad, they will see http://www.cyprich.com/richmond/ and when they click on it, they will be directed to www.advertiser.com/id=57912.

This technique for hiding affiliate links is very easy to do because all you have to do is define the url in the refresh tag. However, in order to hide links this way you need to be able to log into your web site by FTP or SSH and create these subfolders. I’m not sure if you can do this sort of thing in Blogger or similar sites.

Domino PC’s

If you’ve ever wondered what to do with your old computers, watch the following video.

 

Douglas Crockford: The JavaScript Programming Language

This video is an outstanding presentation on the history, the language itself, advanced features, available platforms, the state of the standards, and programming styles of JavaScript. It’s presented by the Douglas Crockford. He is the Yahoo! JavaScript Architect.

The video is good for people learning JavaScript and also for experienced developers who would like a greater insight in this language.

What’s interesting here is that Crawford claims that JavaScript is one of the most misunderstood languages and that all books on it are bad, except for one that he recommends that is the “least bad” of the JavaScript books.

The presentation is in 4 parts and lasts about 2 hours.

Part 1 (30:58)

Part 2 (29:08)

Part 3 (19:47)

Part 4 (31:08)

Customizing DFS Reports with Visual Studio

Adenium Systems is switching the reporting engine in DFS from Crystal Reports to Active Reports, but this transition won’t be complete for some time still. We have the option of converting the current reports to Active Reports but it requires a great deal of additional to work to make the report fully functional. It’s easier keeping it as Crystal until Adenium provides the converted reports themselves.

The problem here is that the current version of DFS does not have a Crystal Reports editor like the previous versions did. So, unless you purchase the full version of Crystal, you can’t edit the reports.

Fortunately, Visual Studio has the ability to open and modify Crystal Reports. You’ll need Visual Studio 2005 Professional (or higher) to create or edit reports. I’ve created a Visual Studio project which has all of the reports used in DFS available for editing. It was created as a C# project, but this doesn’t matter for report editing.

Once you edit a report, you’ll need to copy it to the Reports folder in the DFSHost folder on your DFS server. The default location for this is C:\Inetpub\wwwroot\DFSHost\Reports, but it can of course vary depending on where your IIS virtual directory for DFS is. In the Visual Studio project, Crystal reports are the files with an .RPT extension and are located in the Crystal Reports folder. Ignore the files with the .CS extension

You can download the Visual Studio project by clicking here.