Sunday, November 11, 2007

Distributing Visual C++ Applications

In recent years (and recent Visual Studio versions) Microsoft has unintentionally made it much harder to distribute C++ applications.

The reason for all the grief is a new dependency file MSVCR80.dll (Visual Studio 8.0/2005) or MSVCR90.dll (Visual Studio 9.0/2008). The DLL file handles initialization and cleanup of The C++ Standard Libraries among other things. If your swapping applications with another developer then you probably won't have a problem, but if you try to send your app to someone without the latest Visual Studio they're going to run into a nasty error message.

The solution Microsoft suggests for solving the problem they created is to wrap the Visual Studio redistributable in an installer. This is okay, but what if your program is too small to warrant an installer? Running a tutorials site, it doesn't make sense for users to have to install each demo application. My solution was to just compile under Visual C++ 6.0, which is arguably the best in the VC product line anyway.

References:
Deployment (C++)
http://msdn2.microsoft.com/en-us/library/zebw5zk9(VS.80).aspx

Visual Studio 2005+3

Microsoft is releasing the 2008 edition of their software development studio later this month so I decided to take a minute to download and review their public available beta.

There really isn't enough improvements from VS 2005 to warrant a new release. The user interface is the same. Intellisense still doesn't work well. The .Net Framework 3.5 doesn't add anything for a C++ native application programmer. In essence Visual Studio 2008 is nothing more than a Service Pack for Visual 2005.

References:
Release Date Announcement
http://www.microsoft.com/presspass/press/2007/nov07/11-05TechEdDevelopersPR.mspx
Visual Studio 2008 Feature Specifications
http://msdn2.microsoft.com/en-us/vstudio/aa948851.aspx

Saturday, October 07, 2006

Three Books Every Windows Programmer Should Own

Today I'm going to be reviewing some of what I think are the most important books for any aspiring C/C++ Windows programmer.

Programming Windows Fifth Edition
by Charles Petzold
This book is truly the Windows programming bible. Petzold covers all the basics of a Windows application, such as, events and messages, the GDI, and dialog boxes. The book also hits on some advanced Windows programming like multiple-document interfaces, multithreading, and creating and using DLLs.

Advanced Windows Third Edition
by Jeffrey Richter
Jeffrey Richter is in the know when it comes to Windows architecture and programming. The first few chapters cover architecture topics like kernal objects, and memory architecture. The later chapters he moves on to programming topics such as advanced memory management, multithreading, structured exception handling (SEH), and many other advanced topics not covered anywhere else. This book is a must for any serious Windows programmer.
Note: There's a fourth edition of this book titled Programming Applications for Microsoft Windows that covers Windows 2000 and some 64bit programming topics. This book, however; is out of print (though I'm not sure why) and fairly expensive even on auction networks such as Ebay.

Network Programming for Microsoft Windows
by Anthony Jones and Jim Ohlund
Not a part of the Win32 API, but still very much a core part of Windows. Network Programming is the offical reference for the Winsock 2 API (besides MSDN). While I don't compleately agree with the author's writting style, or programming methods, this book provides an excelent overview.

Friday, October 06, 2006

A Year in the Life of CoderTutorials

Today we're celebrating the anniversary of CoderTutorials by rolling out a new look. While it isn't the exact date, it's finally is feeling like we've been around a year. Here are some milestones in the CoderTutorials history:

09/10/05 - Codertutorials hosted at ATSPACE.COM
09/11/05 - Domain name registered at NetworkSolutions
01/07/06 - Changed web host to HostGator and Domain registrar to GoDaddy
03/23/06 - Changed web host again to IX Web Hosting
03/29/06 - Changed web host once more, to Site5


Site5 and GoDaddy have my best regards. Site5 for being honest, fast, and reliable. GoDaddy for being cheap. Here's to another great year.

Cheers,

Thursday, October 05, 2006

Quick Links I - Java

My humblest apologies for not keeping the site more updated. There's a new (cleaner) design in the works as well as several C++ and Java tutorials. Now, from my link collection:

- Get started programming Java with About.com's Quickstart to Java.
- Once you're started, About.com's Java Tutorial Series is a great follow-up.
- Tutorials and articles from novice to professional at Java Coffee Break.
- Borland has a relatively good Sockets Tutorial.
- Check out this collection of Open Source Projects

Tuesday, April 11, 2006

A quick and much needed update.

There are quite a few exciting things in the works at CoderTutorials.

First of all, there are several new tutorials on the way. While I'm not exactly sure when they'll be done, I know the answer is "soon".

Also, I'm in the process of setting up forums that you'll be able to access from the community section on the left side of the main site.

Look forward to more updates soon.

Thursday, February 23, 2006

Those responsible have been sacked

The main page mysteriously was replaced by this blog and it took me till today to realize it. It's back on line, and those responsible have been sacked.

Wednesday, February 22, 2006

Free Development Software From Microsoft

Didn't think Microsoft give anything away for free did you? Neither did I. That is, until I saw that you could download 'Express' versions of all their 2005 development software.

What's the catch? Well, you can only download them for free till November 2006. Also, they have a few small limitations.

So, is it really worth your time? Well, if you don't have a C/C++ Compiler already then maybe Visual C++ 2005 Express is right for you and possibly SQL Server 2005 Express. Regularly, SQL Server will cost you a pretty penny, but SQL 2005 Express is free, for life. You can also download the SQL Server Management Studio Express CTP to go with it. It's biggest limitation is the 4GB database size limit, and the lack of full-text search. Click Here for a full list of features.

To summarize, don't get the express versions unless you need them (or want the feeling of getting something from Microsoft for free at least once in your lifetime). Try out SQL Server 2005 however, because it's not entirely crippled.

Porting Berkeley Sockets

Over the past few days I've had the opportunity to port a program using Berkeley sockets to Winsock. It's actually a lot easier than it sounds.

A large part Winsock was designed based on Berkeley sockets, and for the most part, the only things that have been changed are a few function names. I'll touch on the main one's you'll run into while porting.

read / write The functions used for I/O (Input and output) operations on a socket.
read(socketfd, buf, left);
write(socketfd, buf, left);

In Winsock 2 the functions are nearly the same, except under the name send and recv
int recv(SOCKET s, char* buf, int len, int flags);
int send(SOCKET s, const char* buf, int len, int flags);

The extra parameter flags is for special things like just peeking the recv stream instead of removing from it. If you want to do a direct port, you can just set flags to 0 and keep the other parameters the same.

fcntl Change the I/O mode on a socket, in this case, change the socket to nonblocking.
fcntl(fd, F_SETFL, O_NONBLOCK);

Once again, Winsock 2 is very similar, with a few extra features. To put the socket into nonblocking using Winsock 2 you have to use the following method:
unsigned long nonblocking = 1;
ioctlsocket(fd, FIONBIO, &nonblocking);

By changing the three functions above, you can port most any application that uses Berkeley sockets to one using Winsock 2. Of course, you mustn't forget to take care of all the Winsock specific stuff like including the libraries, header files, calling WSAStartup, and WSACleanup. If your interested in Winsock 2 you can check it out on MSDN

Testing 1... 2... 3...

Hello, bonjor, aloha!

You may be wondering "What is TheCoder Blog?" and "Why it is here?" Well, forunately, I have the answers to both those simi-universal questions.

TheCoder Blog is where you'll find the updates to the site that happen between the actual updates. Here I'll keep you in the "in" on whats coming to www.codertutorials.com, and what tutorials are in progress. If that wasn't enough, I'll also post snipits on API's and functions that I think you might be interested, but don't validate writting a whole tutorial for.

So, TheCoder Blog is here for you. To keep you updated on all the latest (and someone moderately old) CoderTutorials and otherwise coding know how.