Tuesday, 15 January 2008
Get the Free Visual Studio 2008 e-Book Offer
"The offer includes the entire contents of Introducing Microsoft LINQ, as well as sample chapters on related technologies from Introducing Microsoft ASP.NET AJAX for Web Developers and Introducing Silverlight 1.0."
Oddly enough the link seems to be to the SDK from last August...
Wednesday, 9 January 2008
My domain name registrar (Planet Domain) allows me to assign name servers and create child domains pointing to an IP address—basically an A record. As I wasn’t using Planet Domain for hosting the mediawhole.com site that’s all they would allow me to do, aside from renew my domain and update my registration details. A query to their helpdesk suggested my web host would be the best place to create CNAME record.
I was previously using atspace.com to host mediawhole.com. atspace provides free web hosting with no ads, FTP access, and POP3 email. Apart from those goodies, they also limit the size of file uploads to something ridiculous like 200KB. At any rate, the atspace interface allowed me to create the blog.mediawhole.com sub domain (what that resulted in at the DNS level, I’m not quite sure—I never checked).
While reading up on DNS and CNAME records, I came across a help page from Google Apps; little did I know my web master world would soon change instantly. What on earth is Google Apps, I asked myself, and proceeded to do what I could to find out. In typical Google fashion, the Google Apps homepage is a little blah and at first glance I figured it was a paid for service (a paid for service from Google? Isn’t everything from Google free?!?). Digging deeper, I discovered there is a free version and the major differences between the free version and the paid for version is the support on offer and the rather large limits on what you get (users, storage capacity, etc).
I signed up to have a looksee and soon realised Google Apps integrates a basic content management system, email via Gmail, calendars, IM, a user management system, a document repository that works with Google’s online document editing suite, and a few other goodies. Most of these features are all beta software. Apart from that, Google Apps gives you the opportunity to create and manage your very own (albeit, web-based) enterprise. You can effectively brand Google to a limited degree so it looks at home on your intranet, create user accounts with corresponding email addresses, create email lists and email address aliases, share your calendars, publish a public web site, and manage documents. The fancier offerings even offer a single sign-on feature.
The best feature of all is the option to use your own domain name for all of these services for a unified, professional appearance. Forget the blog, I was going to move my entire Google Apps suite to mediawhole.com! Just like blogger, Google Apps allows you to create various CNAME and MX records pointing to ghs.google.com (in the case of the CNAME records); the individual apps are then assigned to those URLs.
Planet Domain and atspace, I realised, weren’t going to help much with this. Planet Domain was a basic starting point for my name servers but I really needed control over all the DNS records for my domain. Although Google provides all the Apps stuff, they don’t provide any form of DNS management. Many of the Blogger and Google Apps instructions feature Go Daddy so I thought transferring my domain name to Go Daddy might also give me a better control panel for this sort of thing. They were also offering a free year of registration on top the time remaining on my current registration for seven bucks so I thought it might be worth it.
While I waited for Go Daddy support to reply to my email query, I Googled free DNS to see what might be available. I was in luck as I discovered, everyDNS.net, among other free DNS hosts. The web sites for these free DNS providers are atrocious (I’m not joking—they’re all very 1996) so I have no idea how reliable they or how long they’ll be around. Many DNS providers claim to host many thousands of records and offer globally distributed redundant records so I pretty much took a punt on everyDNS.net.
To get up and running, I firstly had to set my name servers to point to the everyDNS.net name servers. I did this through Planet Domain and was surprised to see how quickly the update took hold. Instead of twenty four to forty eight hours, my name server configuration changes were available almost immediately—within half an hour max. That was great as it allowed me to create my CNAME and MX records through the everyDNS.net interface and test my changes in real-time (with the name servers configured, all of my other records are resolved through everyDNS.net so any subsequent additions or modifications are instantaneous because everyDNS.net doesn’t have a waiting period for record propagation). One by one, I walked through the Change URL wizard for each of the Google Apps, creating DNS records as instructed in the very decent Google Apps help section. The mediawhole.com site now looks like this:
http://www.mediawhole.com – the Google-hosted content management system for the site
http://mail.mediawhole.com – the Google-hosted email system for the site
http://calendar.mediawhole.com – the Google-hosted calendar system for the site
http://documents.mediawhole.com – the Google-hosted document repository for the site
http://intranet.mediawhole.com – the Google-hosted, Mediawhole-branded search page for the site
http://blog.mediawhole.com – this Blogspot blog
As I worked, I used a handful of tools from some DNS-oriented sites to verify my changes.
networktools.com - DNS lookup, ping, and other useful tools
hscripts.com - DNS lookup and other bits and bobs
MxToolbox.com - Specific MX record lookup
The ping and tracert commands in Windows also come in handy. At one point I thought I also needed to flush my local DNS cache, for which I used ipconfig /flushdns
With email configured, I also set up a few email accounts for the people involved in mediawhole.com and some generic email aliases (support, helpdesk, info, sales, and a catch-all) delivering mail to my account.
Finally, I jumped into the web page editor, chose a template for the site, and started plugging in some basic content. The editor allows you upload pictures and files, edit the HTML directly, and add gadgets. It’s generally fairly basic (I haven’t come across a way to reuse content—like a footer—between pages) but the templates and three layout options do the trick. Unfortunately Google Apps doesn’t allow you to connect via FTP but in this day and age that’s a minor niggle.
This is a great tool for individuals, small businesses, schools, and community groups that might otherwise struggle to maintain the hardware and software to support a suite of functionality this comprehensive. I had the mediawhole.com site up and running in an evening (around four hours before sitting down to put in any real content). It will be interesting to see what new apps are added to Google Apps over time; the basics are all there now but I’m sure those Google heads will keep pushing.
Incidentally, Microsoft Office Live has also been rolled out in the US. The online marketing material suggests it’s a very similar offering but I haven’t been able to test it out as the beta is only open to residents of the US. If there are any other similar suites out there, please let me know.
Thursday, 3 January 2008
As you're no doubt aware, C# is a modern programming language following in the tradition of C, C++, and JAVA. It's full of all the standard control flow operations like for, foreach, while, do...while, if, and switch and it also attempts to remove a number of trouble spots available with its ancestors (automatic fallthrough in switch statements, pointers, memory cleanup). So one must ask, then, why the language retains the lowly goto keyword! I've read examples of using goto in languages that don't support modern control flow constructs; in that context it makes perfect sense to overcome a deficiency of the programming language using the fundamentals provided. So how does it fit in today?
The behaviour of the switch statement in C# may not be what you're expecting if you're coming from a C background because case blocks don't "fall through" by excluding a break statement. Every C# case block must contain a break statement. This is a good thing because if you inadvertently forget a break statement in a language like C, the compiler may not warn you about the omission and case blocks will continue to execute until the switch statement ends or a break statement is reached. The end result: a defect--and potentially a very significant defect. In C# if you omit the break statement compilation will fail.
At first glance this sounds like the C# language doesn't allow fallthrough in a switch statement but that's only partly true: C# doesn't allow automatic fallthrough in a switch statement. If your design requires a case block fall through you can enable this behaviour explicitly using a goto statement. If you control yourself and don't run out and replace all of your existing control flow statements with gotos, you can even use a goto without feeling dirty all over.
I lied above when I said every C# case block must contain a break statement because you can optionally replace the break statement with a goto statement. If you write your goto statement to go to the next case statement, you achieve falthrough. Moreover, if your case statements are later reordered, your gotos will preserve the original fallthrough ordering unless the gotos are also updated--a bit of a pain but worth the extra safety.
Here are two examples switching on ints and strings:
Console.WriteLine ("case 1");
goto case 2;
Console.WriteLine ("case 2");
Console.WriteLine ("case hello");
goto case "world";
Console.WriteLine ("case world");
Wednesday, 2 January 2008
I volunteered when an email from Apress asking for “fresh voices to write about [their] recently published, hot-off-the-press .NET 3.5 titles” was circulated to the members of the Perth .NET Community of Practice late in 2007. In return for reading two electronic books and posting a review of each to the Amazon, Barnes & Noble, and bookpool sites, Apress promised to supply reviewers with the printed versions and an additional ebook. Apart from the freebie, I thought this would be a great opportunity to freshen up my skills and interact with a significant technical publisher. Apress withdrew their offer of the free printed books due to a large response but I’ve got to say this was nonetheless a very cool offer on their part.
That said, I must make two key points:
- My review is entirely unbiased and the free offer was by no means inducement to write a positive review. My favourite titles to date have originated from Microsoft Press, Addison-Wesley, and Wrox and I hate nothing more than wasting my time with a weak book from a publisher that pays little attention to detail.
- I don’t write books about Information Technology and I don’t produce the technology to support the software production process; apart from an undergraduate English Literature degree, a master’s IT degree, and four very intense years on the ground, I’m not an authority on anything, let alone C# and .NET 3.5.
This is the first review of two. The second review will be for Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition and will follow soon (I’m a slow reader).
Accelerated C# 2008 is one of those books you stumble across every so often that answers so many questions you know it will reside on your bookshelf for some time to come. Trey Nash offers an in-depth look at C# 2.0 and 3.0 without the excess material most experienced developers are already familiar with. Although the book is strongly focussed on C#, many of the concepts discussed can also be extracted out and filed under the broader titles of object oriented development and software design. Bringing together a book spanning many of the changes and new features from .NET 1.1, 2.0, 3.0, and 3.5 is a big ask and despite a few minor issues I’d recommend every developer working with C# 2.0 and on read this book.
The book is a mere 510 pages but in my mind that makes a text like this all the better. Nash’s writing style is to the point and meticulous, skimming over concepts with which most experienced developers should already be familiar in early chapters (“this is a book for experienced object-oriented developers”) and diving in to cover some of the great features introduced with C# 2.0 and 3.0 at close range. After years of reading about the superficial aspects of boxing and learning about generics and iterators first hand, for example, I finally understand the underlying mechanics of these issues that simply aren’t covered in the MSDN documentation and high-level technical articles. More importantly, I now feel I have the knowledge to discuss these concepts and put together truly effective designs from the information acquired from this book.
As a fairly advanced, special-topic book, I wouldn’t classify this as an academic text but the author discusses each topic in a fairly “textual” manner. In other words, there is a strong focus on how the C# language embodies specific concepts before delving into the practicalities and code samples. Individual subjects are examined in detail but are also related to the CLR, object oriented and functional programming concepts, best practices, and coding efficiency. This is personally my preferred format but I wonder if it will appeal to a broader audience.
My favourite chapters include the rather lengthy chapter four (“Classes, Structs, and Objects”), chapter eleven (“Generics”), and chapter thirteen (“In Search of C# Canonical Forms”). Chapter thirteen in particular was a great starting point for defining key considerations when designing types in C# and despite its length, I think this chapter could have gone further.
The title of Accelerated C# 2008 sounds to me like a marketing title. I say this because
a) there’s no such thing as C# 2008. There’s C# 3.0 and Visual Studio 2008 but they’re not the same thing; and more importantly
b) while most chapters in the book apply to C# 3.0, all but the final three chapters describe features specified with C# 2.0 and shipped .NET 2.0/Visual Studio 2005.
The first point is just me being nitpicky. The second point stems from a nagging feeling I had while reading this book that it was originally written as Accelerated C# 2005 and jazzed up at the last moment to reflect the changes and improvement brought about by C# 3.0. The structure of the book reflects this assumption as only the last three chapters relate specifically to C# 3.0. If you currently work with C# 2.0 day to day you won’t go wrong with this book—it’s filled with many insights and gems that can only be learned by experience or taught by a great teacher (eg. Nash); as a C# 3.0 book, however, I think there’s room for improvement. To illustrate this gripe, the author frequently indicates many of the language features new to C# 3.0 are there to support LINQ but the final chapter in the book (“LINQ: Language Integrated Query”) barely scratches the surface. Other resources are referenced but this is one subject that should have been examined at greater length at the cost of some detail.
It would have also been helpful to have the various code samples in each section align better with each other. There’s nothing more frustrating than reading about employees in the context of one topic and Bluetooth radios in the next. I think the IT publishers as a whole need to do better at this. I also would have liked to see a few more guiding comments in the code samples covering trickier aspects of the code. Overall, however, the code samples are well formatted and concise and illustrate the discussion very well.
The book in general is formatted and organised very well and despite the heavier material it contains, the book is a pleasant read. The chapter summaries seem to follow the old presentation approach of tell ‘em what you’re gonna tell ‘em, tell ‘em, and then tell ‘em what you told ‘em; as a result, each chapter summary quickly rehashes the chapter content at a very high level where it would be preferable to have a decent summary that makes theses bits worth reading. As Nash is obviously a well read individual, I was also really hoping for an annotated bibliography.
Overall, I loved this book. It was a great refresher on some of the aspects of C# 2.0 I deal with less frequently and tend to forget about, a thorough insight into what it means to think like a really, really good developer, and a good introduction to C# 3.0. I’m looking forward to the next edition when C# 3.0 has matured and the author has some really C# 3.0-specific insights to convey.