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

Terminal Server has Exceeded Maximum Number of Allowed Connections

"Error message: The terminal server has exceeded the maximum number of allowed connections. The system cannot log you on (1B8E). Please try again or consult your system administrator."

This is an annoying error that any of us who regularly use Terminal Services encounter. Some of the obvious ways to fix this problem are to reboot the server, thus ending all current Remote Desktop Connection sessions, or if you are able to get in front of the server, manually disconnect any RDC sessions no longer in use.

There is a third option, though, which I find comes in very handy. You can remotely log into the 'Console' session. Logging into the console session will boot any user currently logged into the console session (as long as you have admin rights), so you can log in and clear up and hung RDC sessions. After clearing up RDC sessions, I suggest logging out of the console session and using your normal RDC connection to connect to the server.

Here is how you access the console session:

start run - mstsc -v:5.5.5.5 /f -console
-just change 5.5.5.5 to your IP address