The following is an example of a simple programming "challenge":
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
Below I've thrown together a solution in less than 5 minutes, BUT, I thought to myself, experimentally, what would the code look like if I needed something more "Best Practice"...
Building a program properly requires a lot of discipline:
1. define goals (what functionality will be achieved?)
2. write up a high level flow/state chart
3. create modular parts from the flow chart (e.g. functions)
4. create tests - e.g. know what input goes in and what should come out
5. fill in the functions with dummy information (e.g. always return constants)
6. integrate and ensure that your "demo" version achieves your goal
Note that all of this ignores the tools to be used, estimating time and cost, scheduling, etc.
Win CE uses a subset of the win32 API which is neat because technically anything written for it can be compiled for a "full" windows as well.
It seems I've bitten off more than I thought with regularly updating a Window every second...
I need to go back and learn more about how WM_PAINT works in windows because my current version is very funky... though it does work!
A couple of obvious other things: WM_TIMER and perhaps strcpy instead of get_current_time again...
The reason I've chosen the awkward system of getting the system time over and over instead of the "convenient" windows timer is that I'm trying to learn and understand what I can do with programming, not how to copy and paste someone else's function.
My windows clock is slowly progressing...
Now I can create a window with a QUIT button and display the current system time (only once)...
If you want to know more about the project from the beginning search the site for winclock (or click on the time.h tag).
I've stripped out most of the project header stuff - perhaps in the future I'll just have it as an "include" so that it's in the project but since it doesn't change much I only have to look at it when I refer back to it (instead of at the top of the file ALL THE TIME!)
Ok, enough planning and review, here's the code:
I've again used some "empty" time in the London Tube to stretch my brain a little bit by doing some more WinCE Windows Programming.
While it may not seem like much of an accomplishment, using my fingernail on the screen keyboard to eke out code on a moving underground train requires a certain zen attitude... wait... wait... hit the key... oh... the wrong thing showed up (because obviously I pressed the right key)...
ok, backspace and do it again... oh, that wasn't backspace, that was ]... and sometimes it looks like ]]]]].
On the 26th I missed my 365 entry because I was being Mr. Corporate IT Hero at our annual Company Meeting but I actually have a number of things from the past that I can comment on and insert...
Everybody who has an HTML form would like some software "intelligence" to guide the User to fill in the "required" fields, or help direct the User if they've not entered a valid email address, etc...
Programming isn't always fun and games. Here's an example from me putting in extra time on a weekend...
At my work We use Microsoft Dynamics CRM 4.0 which is a customizable CRM web interface on top of MS SQL Server. While the built in functionality is pretty good a business always needs some more customization to get things "just right"...
Windows Programming has a steep curve in the beginning as there are many things to memorize (oops I mean learn and understand) as theoretically they've created the data structures and functions to get stuff on the screen.
Again I've used gcc 2.95 windows port with the special command on my wndclass-hello.c source code.
gcc.exe -o %1.exe %1 -Iinclude -Llib -Wall -ansi -mwindows
The code is extra commented as this is the foundation (of understanding) for future programs.
PHP is similar to C which makes it easy for me to do interesting things. The php manual webpage is brilliant! Don't you wish everybody had a full public API, easy menus, working examples, searchable and with the best user comments that really flesh out the bugs?
CSS is so much better than HTML tables - it really revolutionizes the simplicity, maintainability, and power of displaying things on the web.
Put them together and you have miracles like Drupal.
The following project took a little more time than usual and it might even be useful one day, but I what I really like about it is that it's FUN...