Tuesday, December 19, 2006

Visual Studio 2005 SP1 Released

MS has released Visual Studio 2005 SP1. It contains over 70 improvements including:

  • New processor support (e.g., Core Duo) for code generation and profiling
  • Performance and scale improvements in Team Foundation Server
  • Team Foundation Server integration with Excel 2007 and Project 2007
  • Tool support for occasionally connected devices and SQL Server Compact Edition
  • Additional support for project file based Web applications
  • Windows Embedded 6.0 platform and tools support

More info from MS here. Download here. And finally, some suggestions for installing here.

Monday, December 04, 2006

Show the Current Year with Javascript

On a flat HTML site I was working on over the weekend, I had a need to display the current year for copyright information (You know, 'Copyright 2006'). I didn't want to hardcode '2006' in there, and in this instance I was stuck using static HTML, so no ASP or PHP. Javascript was the obvious choice.

I'm not an expert JavaScripter, but I thought this could be done in a single line of code like:

document.write(date.Year());

Not so. I quickly realized you need to instantiate the Date object, and get the current date from that. So my code now was this:

var time = new Date();
document.write(time.getYear());


I found the above code referenced on a few websites and it worked fine in IE6 and IE7. However, when I tested in Firefox and Safari, the year showed as '106'.

A little more Googling and I found that I needed to call the 'getFullYear()' property of the Date object. So my current code, which works in all the browsers I was able to test with is:

var time = new Date();
document.write(time.getFullYear());

Friday, December 01, 2006

Programmers Need Better Business Skills

In a well run development environment, business analysts (BAs) and programmers would communicate with each other to develop applications that can be developed in a timely, cost effective manner. BAs would consult with programmers about what kind of impact their decisions will have on a system, and programmers would ask questions of and offer information the help BAs make better informed decisions. I have not had the pleasure of working in too many well run development environments.

It seems to me that most programmers do not have an interest in the intricacies of the businesses they write code for, and BAs tend to think of programmers as 'doers' and rarely consult with them when making business decisions that involve technology. I don't blame the BAs, I think most programmers have put themselves into this situation.

I am shocked at the lack of normal business analysis skills of most programmers. Programmers need to understand the cost of developing and maintaining their code so they do not spend an exorbitant amount of time coding insignificant features. They also need to fully understand how their code is used once it's out the door so that they can develop apps that can be deployed faster and easier, used better, and just better meet the overall needs of end users.

I've consulted at four companies over the past two years, and while each company has it's own culture, at all four there is a definite line between business and technical units. It's an 'Us versus Them' mentality that I find short sighted and counter productive. It can be seen in the physical layout of most offices. Most offices put technical departments together where common interaction with business related departments is minimized.

I take a great interest in the business models of the businesses I work for. A few of the things that I want to know are:

  • What is the business model for the business?
  • Who uses the product or website I'm working on?
  • Why is the solution I'm working better than what currently exists?
  • Who is the competition?
  • What differentiates the business from it's competition?
  • What are the customers saying?

I feel that knowing about the business helps me write better code. I can scrutinize specs and offer suggestions for better ways to do things. Sometimes my suggestions are ignored or turned down, but sometimes they are accepted and time and money are saved. Lots of code has been written that does what it is supposed to do, but it is of no use if it is written for a company who is unable to turn a profit at the end of the day. My goal is to provide cost effective solutions that help businesses make money, which is much different from a goal of simply writing code that does what it is supposed to do. I don't think my job is secure if I simply write good code. My job is secure when I write good code that contributes to making money.

I've worked with many programmers who look at business specs as if they are written by a higher power. I don't write perfect code, and business analysts do not write perfect specs. I've written code that could be better, and I think it's great when a better way to code something is suggested to me. Likewise, programmers should strive to fully understand business specs and look for potential ways to improve them before jumping into the act of coding.

Finally, I would hope that programmers realize that having good business skills on top of good technical skills is a great way to advance your career. Having business skills is the only way to get out of your cube and advance to the level of project management or above. Business analysts with technical skills are also always in high demand. Who better to design a system than someone who can code one?

Thursday, November 30, 2006

Bad Code = Bad Day

Right now I have a headache. I've been making what should be simple changes to what is over-engineered and over-complicated code. I should not complain, but I often do. I don't think there is a programmer out there who hasn't at some point written code that he wishes he had the chance to rewrite with the knowledge that hindsight offers. Today though, it's not my code I'm forced to fix, so it's a compain day for me.


Simple things should be simple and complex things should be possible.
-Alan Kay


Perfection (in design) is achieved not when there is nothing more
to add, but rather when there is nothing more to take away.
- Antoine de Saint-Exupéry

New Remote Desktop Client (T.S. Client 6.0)

New features include:

  • Network Level Authentication
  • Server Authentication
  • Plug and Play redirection
  • TS Gateway support
  • Monitor Spanning
  • 32-bit color and font smoothing
Download it here.

Tuesday, November 28, 2006

Getting a Website Built on a Budget

I'm often asked by friends or friends what it would cost for them to get a website built. I've designed and built quite a few small websites over the past few years, and I'm always astonished at what people think a decent simple website will cost. Maybe I am overpaid and don't know it, or maybe I just run with a cheap crowd, but a lot of people think they can get what they need for around $1000.

When I was a bit younger, I used to put together lots of small websites more for the enjoyment and experience than for the money. Some of the websites I put together were actually for companies whose previous attempts at a $1000 website went horribly wrong.

I still get a requests from people to do websites in the $1000 range, and from time to time people ask me what they need to know when looking for a company to develop their website. My guess is that most companies that take on projects of this size are themselves small businesses, and many of them may be unqualified and unable to deliver a quality website at any cost, let alone $1000.

Recently a friend told me he had gotten a quote of exactly $1000 to do a website for his just starting business. He needed full design, a logo, he had about 30 pages laid out for his site with each page needing 2-3 images per page, 3 email forms, and he wanted a slide show on his homepage.

I was very skeptical that $1000 could buy all that. So I suggested the following list of questions for him to pose to his web development company. I don't know what their answers were to all these questions, but I know that two days later he decided not to use them. Maybe this list can help another bootstrapping company out there!!

Questions to ask your web development company:

  1. Ask them to document everything included in your price quote. Make sure everything you want and need is in there (logos, slide shows, flash animations, email forms, any possible programming, etc).
  2. Make sure your work is not being outsourced overseas. If it is, ask what kind of quality control they have over their work.
  3. Ask to see some work from the actual people who will be on your project. Speak to them if possible to make sure they seem competent and understand what the goals of your site are. It's important that your developers have a decent business sense for what you do, as well as technical and artistic skills.
  4. Ask about their process...Do you get multiple designs to choose from?
    How do they handle design revisions? If multiple revisions to design are not included in their price, how do they price them. Even if they have a great designer, you are sure to have ideas or suggestions to enhance the design.
  5. Ask how they handle changes and revisions at the end of the project. This is very, very important to you!!! It's the hidden cost in many projects and it's what leads to cost overruns, and failed or abandoned projects.
  6. Ask about their use of stock photography... just about every
    site will need at least a few professional quality photos to enhance the site and
    make it look professional. Will they choose some stock photos for you, or do you need to hunt them down yourself. Are the cost of stock images built into your quote?
  7. Ask one simple question... What might cause this project to cost you more than the stated quote? You should not be charged extra for issues you cannot control. There are, however, lots of things you as the client can control to keep a project on budget, including answering calls and emails in a timely manner, providing materials when you say you will, and thinking things through ahead of time so changes to the specs are minimized.


Finally, I'm sure there are plenty of people out there that can put together a nice website for $1000. I'd like to hear from anyone that can offer this. Can you leave a comment with an example link or two? How much time do you allocate for $1000? How do you keep your development time and costs down?

Sunday, November 26, 2006

Decompiling .Net Code with .Net Reflector

I'm always suprised to hear that a lot of developers that do not know that .Net code can be decompiled into source code. .Net code is compiled into an Itermediate Lanuage, other languages such as C++ compile code into Machine Code. Machine code is not encrypted, but it is not in a format that a human being can easily understand. Reverse engineering apps from machine code is inherently diificult. Intermediate Language code, though is somewhere between source code and machine code and are much easier to reverse engineer.

From the Wikipedia Entry on the .Net Framework:

Programming languages on the .NET Framework compile into an intermediate
language known as the Common Intermediate Language, or CIL; Microsoft's
implementation of CIL is known as Microsoft Intermediate Language, or MSIL. In
Microsoft's implementation, this intermediate language is not interpreted, but
rather compiled in a manner known as just-in-time compilation (JIT) into native
code. The combination of these concepts is called the Common Language
Infrastructure (CLI), a specification; Microsoft's implementation of the CLI is
known as the Common Language Runtime (CLR).


Since all .Net languages compile into the Common Intermediate Language (CIL), it makes sense that you can take the Common Intermediate Language and decompile that into any .Net language.

Lucky for us, Lutz Roeder has put together a great tool for decompiling CIL code called .Net Reflector.
Reflector is the class browser, explorer, analyzer and documentation viewer for
.NET. Reflector allows to easily view, navigate, search, decompile and analyze
.NET assemblies in C#, Visual Basic and IL.

I've used .Net Reflector to recover lost source code, translate VB.Net to C#, and also just to analyze code from assemblies I've downloaded on the internet.

For those of you who don't want to expose your source code to the masses, don't fret, you can always obfuscate your code. More on that in the coming days...

Friday, November 24, 2006

A Good Introduction to Windows Workflow Foundation

Developing workflows in applications is a common task for developers. MS is providing what seems to be a pretty well-rounded workflow framework in .Net 3.0. Here is a nice introduction to the Windows Workflow Foundation, as well as two simple examples.


To bring workflow to the masses and allow for long-running workflows in
applications and servers, Microsoft will introduce the much-anticipated Windows
Workflow Foundation (WinWF) as part of the .NET Framework 3. WinWF provides a workflow engine, a programming model, and a set of tools for rapidly building
workflow-enabled solutions. It offers a single workflow technology for Windows
that serves as a base for Microsoft products as well as ISV and customer
solutions. Microsoft itself will be utilizing WinWF in the near term to
workflow-enable several Microsoft products such as Microsoft Office 2007 and
Microsoft BizTalk Server.


http://www.codeguru.com/columns/dotnet/article.php/c12895__1/

Thursday, November 16, 2006

VB.NET Get Last Day in Month Function

I recently had to ensure that a date in my code was the last day in the month. I know this is a simple thing to do, but I figured I could save myself five minutes by Googling for and getting a function to do this off the internet. Suprisingly, I was not able to find this code easily. So, here is the function I wrote, which hopefully will save a few minutes for another lazy programmer or two:


Private Function GetLastDayInMonth(ByVal dDate As Date) As Date
dDate = DateAdd(DateInterval.Month, 1, dDate)
dDate = Convert.ToDateTime(Month(dDate).ToString() & "/" & "1/" & Year(dDate).ToString())
dDate = DateAdd(DateInterval.Day, -1, dDate)
Return dDate
End Function

Tuesday, November 14, 2006

SQL Server Split Function

Ever needed to pass a comma deliminated string into SQL Server as a parameter and have it split the string so you could then use each value individually? I have, and this function has gotten a lot of use. Unfortunately, I didn't write it, and I cannot exactly remember where on the net I found it, but I think it came from this post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

here is the function I use:

ALTER FUNCTION dbo.func_Split
(
@List nvarchar(2000),
@SplitOn nvarchar(5)
)
RETURNS @RtnValue table
(

Id int identity(1,1),
Value nvarchar(100)
)
AS
BEGIN
While (Charindex(@SplitOn,@List)>0)
Begin
Insert Into @RtnValue (value)
Select Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1)))
Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))
End

Insert Into @RtnValue (Value)
Select Value = ltrim(rtrim(@List))

Return
END