Archive for July 2008

Reflector vs MSDN documentation

imageAccording to the MSDN documentation concerning the Title property of the HtmlHead class (in ASP.NET), this property “Gets the page title”.  But if you look closely at the syntax declaration, you can clearly see a getter and a setter for this property (look at the figure on the right).  In other words, that property description should have been “Gets or sets the page title” (it hasn’t been corrected in the documentation for .NET 3.5).  That being said, I assume more web developers are using the Title property from the Page class instead because its description clearly states that it “Gets or sets the title for the page”.  But if you disassemble that property with Reflector, you will clearly see that Page.Title actually calls Page.Header.Title in its getter and setter.  Therefore you CAN and SHOULD use Page.Header.Title to dynamically set your page title instead of Page.Title to prevent an extra invocation

What did this little “documentation bug” taught me?

  1. Pay attention when writing API documentation; even more if that API will be used by millions of developers.
  2. Reflector should be part of every developer’s toolbox because you just never know what a type, method or property is really doing (unless you coded it yourself)
  3. You should read the disassembled code of a method/property because the documentation associated with Reflector is still that of MSDN, and as we saw, it’s not perfect.

The 10 Great Tech Books (IEEE Spectrum)

In the July 2008 issue of IEEE Spectrum magazine, Newsweek senior editor Steven Levy writes about the “10 Great Tech Books”.  If you’ve read my posts on how to become a more valuable software professional and how to improve as both a professional and an individual through reading, you’ll pretty much guess that I’m a book fanatic.  I praise God that he gave us two little instruments between our nose that can “deserialize” whatever is in front of us so we can visualize it through our brain.  They’re just so wonderfully made and useful that it’s a shame that we don’t exploit them more conveniently through reading, especially us in the tech business.  Therefore, I think it proves right to share with you this list of tech books you might want to ask for Christmas or get a hold of somehow. 

I was very surprised to realize that none of these books were registered in my brain…in fact I’ve never heard of them neither at university nor at work.  That little point alone should suffice to encourage you (especially if you’re a student) to become a member of the IEEE Computer Society in order to receive valuable information related to technology and business that you might not necessarily get through academia or at the job.  All right, enough ranting.  Here’s the list of the 10 great tech books according to Steven Levy, which he starts off with the following thought:

Any great nonfiction book combines education with entertainment.  In drafting my A-list of general-interest books about technology, I considered impact and significance but gave still more weight to the reading experience.  This is a collection where lay readers can appreciate each entry – and engineers, programmers, and other tech professionals can’t afford to miss a single one.

From Amazon’s editorial review:

Like most other human artifacts, the common pencil, made and sold today by the millions, has a long and complex history. Henry Petroski, who combines a talent for fine writing with a deep knowledge of engineering and technological history, examines the story of the pencil, considering it not only as a thing in itself, but also as an exemplar of all things that are designed and manufactured.

Petroski ranges widely in time, discussing the writing technologies of antiquity. But his story really begins in the early modern period, when, in 1565, a Swiss naturalist first described the properties of the mineral that became known as graphite. Petroski traces the evolution of the pencil through the Industrial Revolution, when machine manufacture replaced earlier handwork. Along the way, he looks at some of pencil making’s great innovators–including Henry David Thoreau, the famed writer, who worked in his father’s pencil factory, inventing techniques for grinding graphite and experimenting with blends of lead, clay, and other ingredients to yield pencils of varying hardness and darkness. Petroski closes with a look at how pencils are made today–a still-imperfect technology that may yet evolve with new advances in materials and design. –Gregory McNamee

From Amazon’s editorial review:

Mirror Worlds by David Gelernter, book or media cover image.With evangelical fervor, Gelernter’s book-length essay paints a future where software technology, now isolating people, brings them into impersonal proximity through "mirror worlds." These computer models of reality let users descend to greater depths of detail at will, meet other explorers, and generally get the "big picture" of what’s going on. However, Gelernter’s own appraisal of the value of computers seems inconsistent and extreme: he claims they are valuable just sitting unused on the coffee table but then insists that the uninitiated will be forced to "sink or swim" (i.e., learn to use computers) in the information sea computers create. His casual style gives the book the feel of a lecture transcript, and his metaphors (e.g., "jettisoned floating landscapes in tuple space") demand considerable hardware and software knowledge to link them with reality. For collections emphasizing computer science.

From Amazon’s editorial review:

Physics and computer science genius Stephen Wolfram, whose Mathematica computer language launched a multimillion-dollar company, now sets his sights on a more daunting goal: understanding the universe. Wolfram lets the world see his work in A New Kind of Science, a gorgeous, 1,280-page tome more than a decade in the making. With patience, insight, and self-confidence to spare, Wolfram outlines a fundamental new way of modeling complex systems.

On the frontier of complexity science since he was a boy, Wolfram is a champion of cellular automata–256 "programs" governed by simple nonmathematical rules. He points out that even the most complex equations fail to accurately model biological systems, but the simplest cellular automata can produce results straight out of nature–tree branches, stream eddies, and leopard spots, for instance. The graphics in A New Kind of Science show striking resemblance to the patterns we see in nature every day.

Wolfram wrote the book in a distinct style meant to make it easy to read, even for nontechies; a basic familiarity with logic is helpful but not essential. Readers will find themselves swept away by the elegant simplicity of Wolfram’s ideas and the accidental artistry of the cellular automaton models. Whether or not Wolfram’s revolution ultimately gives us the keys to the universe, his new science is absolutely awe-inspiring. –Therese Littleton

From Amazon’s editorial review:

Twenty years after it topped the bestseller charts, Douglas R. Hofstadter’s Gödel, Escher, Bach: An Eternal Golden Braid is still something of a marvel. Besides being a profound and entertaining meditation on human thought and creativity, this book looks at the surprising points of contact between the music of Bach, the artwork of Escher, and the mathematics of Gödel. It also looks at the prospects for computers and artificial intelligence (AI) for mimicking human thought. For the general reader and the computer techie alike, this book still sets a standard for thinking about the future of computers and their relation to the way we think.

Hofstadter’s great achievement in Gödel, Escher, Bach was making abstruse mathematical topics (like undecidability, recursion, and ’strange loops’) accessible and remarkably entertaining. Borrowing a page from Lewis Carroll (who might well have been a fan of this book), each chapter presents dialogue between the Tortoise and Achilles, as well as other characters who dramatize concepts discussed later in more detail. Allusions to Bach’s music (centering on his Musical Offering) and Escher’s continually paradoxical artwork are plentiful here. This more approachable material lets the author delve into serious number theory (concentrating on the ramifications of Gödel’s Theorem of Incompleteness) while stopping along the way to ponder the work of a host of other mathematicians, artists, and thinkers.

The world has moved on since 1979, of course. The book predicted that computers probably won’t ever beat humans in chess, though Deep Blue beat Garry Kasparov in 1997. And the vinyl record, which serves for some of Hofstadter’s best analogies, is now left to collectors. Sections on recursion and the graphs of certain functions from physics look tantalizing, like the fractals of recent chaos theory. And AI has moved on, of course, with mixed results. Yet Gödel, Escher, Bach remains a remarkable achievement. Its intellectual range and ability to let us visualize difficult mathematical concepts help make it one of this century’s best for anyone who’s interested in computers and their potential for real intelligence. –Richard Dragan

From Amazon’s editorial review:

"The computer world is like an intellectual Wild West, in which you can shoot anyone you wish with your ideas, if you’re willing to risk the consequences." –from "Hackers & Painters: Big Ideas from the Computer Age," by Paul Graham We are living in the computer age, in a world increasingly designed and engineered by computer programmers and software designers, by people who call themselves hackers. Who are these people, what motivates them, and why should you care? Consider these facts: Everything around us is turning into computers. Your typewriter is gone, replaced by a computer. Your phone has turned into a computer. So has your camera. Soon your TV will. Your car was not only designed on computers, but has more processing power in it than a room-sized mainframe did in 1970. Letters, encyclopedias, newspapers, and even your local store are being replaced by the Internet. "Hackers & Painters: Big Ideas from the Computer Age," by Paul Graham, explains this world and the motivations of the people who occupy it. In clear, thoughtful prose that draws on illuminating historical examples, Graham takes readers on an unflinching exploration into what he calls "an intellectual Wild West." The ideas discussed in this book will have a powerful and lasting impact on how we think, how we work, how we develop technology, and how we live. Topics include the importance of beauty in software design, how to make wealth, heresy and free speech, the programming language renaissance, the open-source movement, digital design, internet startups, and more. And here’s a taste of what you’ll find in "Hackers & Painters": "In most fields the great work is done early on. The paintings made between 1430 and1500 are still unsurpassed. Shakespeare appeared just as professional theater was being born, and pushed the medium so far that every playwright since has had to live in his shadow. Albrecht Durer did the same thing with engraving, and Jane Austen with the novel. Over and over we see the same pattern. A new medium appears, and people are so excited about it that they explore most of its possibilities in the first couple generations. Hacking seems to be in this phase now. Painting was not, in Leonardo’s time, as cool as his work helped make it. How cool hacking turns out to be will depend on what we can do with this new medium." Andy Hertzfeld, co-creator of the Macintosh computer, says about "Hackers & Painters": "Paul Graham is a hacker, painter and a terrific writer. His lucid, humorous prose is brimming with contrarian insight and practical wisdom on writing great code at the intersection of art, science and commerce." Paul Graham, designer of the new Arc language, was the creator of Yahoo Store, the first web-based application. In addition to his PhD in Computer Science from Harvard, Graham also studied painting at the Rhode Island School of Design and the Accademia di Belle Arti in Florence.

From Amazon’s editorial review:

With the many recent advances in technology, it seems, there has followed a diminution of quality. Electronic books have several advantages over their print counterparts, for instance. But for the time being, they’re hard to use and unattractive to boot. Computers, which are supposed to make our lives easier, are commonly sources of frustration and wasted time. Movies are wondrously chock-a-block with special effects–but someone forgot the story. And so on.

Donald Norman, a retired professor of cognitive science, is bothered to no end by the fact that grappling with unfriendly objects now takes up so many of our hours. Over the course of several books, of which The Psychology of Everyday Things was the first, he has railed against bad design. He scrutinizes a range of artifacts that are supposed to make our daily living a little easier, and he finds most of them wanting. Why, he asks, does a door need instructions that say "push" or "pull"? A well-designed object, he argues, is self-explanatory. But well-designed objects are increasingly rare, for the present culture places a higher value on aesthetics than utility, even with such items as cordless screwdrivers, dresser drawers, and kitchen cabinets. In their concern for creating "art," many designers don’t seem to consider what people actually do with things. Such disregard, Norman suggests, leads to few objects being standardized: think of all the different kinds of unsynchronized clocks that lurk in microwave ovens, VCRs, coffee makers, and the like–and of all the different kinds of batteries needed to drive them. Why, he wonders, must we reset all those clocks whenever the power goes off? Some designer somewhere, he ventures, ought to develop a master clock that communicates with all other electric clocks in a home–one that, when reset, synchronizes its slave units.

You don’t need to be especially interested in technological matters to enjoy Norman’s arguments. The book’s underlying question is aimed at a global audience: will the design of everyday things improve? If this entertaining and, yes, well-designed book changes even a few minds, perhaps it will.

From Amazon’s editorial review:

The computer revolution brought with it new methods of getting work done–just look at today’s news for reports of hard-driven, highly-motivated young software and online commerce developers who sacrifice evenings and weekends to meet impossible deadlines. Tracy Kidder got a preview of this world in the late 1970s when he observed the engineers of Data General design and build a new 32-bit minicomputer in just one year. His thoughtful, prescient book, The Soul of a New Machine, tells stories of 35-year-old "veteran" engineers hiring recent college graduates and encouraging them to work harder and faster on complex and difficult projects, exploiting the youngsters’ ignorance of normal scheduling processes while engendering a new kind of work ethic.

These days, we are used to the "total commitment" philosophy of managing technical creation, but Kidder was surprised and even a little alarmed at the obsessions and compulsions he found. From in-house political struggles to workers being permitted to tease management to marathon 24-hour work sessions, The Soul of a New Machine explores concepts that already seem familiar, even old-hat, less than 20 years later. Kidder plainly admires his subjects; while he admits to hopeless confusion about their work, he finds their dedication heroic. The reader wonders, though, what will become of it all, now and in the future.

From Amazon’s editorial review:

"Few false ideas have more firmly gripped the minds of so many intelligent men than the one that, if they just tried, they could invent a cipher that no one could break," writes David Kahn in this massive (almost 1,200 pages) volume. Most of The Codebreakers focuses on the 20th century, especially World War II. But its reach is long. Kahn traces cryptology’s origins to the advent of writing. It seems that as soon as people learned how to record their thoughts, they tried to figure out ways of keeping them hidden. Kahn covers everything from the theory of ciphering to the search for "messages" from outer space. He concludes with a few thoughts about encryption on the Internet.

From Amazon’s editorial review:

Anyone alive in the eighteenth century would have known that “the longitude problem” was the thorniest scientific dilemma of the day—and had been for centuries.  Lacking the ability to measure their longitude, sailors throughout the great ages of exploration had been literally lost at sea as soon as they lost sight of land.  Thousands of lives and the increasing fortunes of nations hung on a resolution.  One man, John Harrison, in complete opposition to the scientific community, dared to imagine a mechanical solution—a clock that would keep precise time at sea, something no clock had ever been able to do on land.  Longitude is the dramatic human story of an epic scientific quest and of Harrison’s forty-year obsession with building his perfect timekeeper, known today as the chronometer.  Full of heroism and chicanery, it is also a fascinating brief history of astronomy, navigation, and clockmaking, and opens a new window on our world.

From Amazon’s editorial review:

If the first 270 pages of this book had been published separately, they would have made up a lively, insightful, beautifully written history of theoretical physics and the men and women who plumbed the mysteries of the atom. Along with the following 600 pages, they become a sweeping epic, filled with terror and pity, of the ultimate scientific quest: the development of the ultimate weapon. Rhodes is a peerless explainer of difficult concepts; he is even better at chronicling the personalities who made the discoveries that led to the Bomb. Niels Bohr dominates the first half of the book as J. Robert Oppenheimer does the second; both men were gifted philosophers of science as well as brilliant physicists. The central irony of this book, which won a National Book Critics Circle Award, is that the greatest minds of the century contributed to the greatest destructive force in history.

 

So there they are.  What do you think of this list or of any of these books?  Have you read any of these books already?  Which ones would you recommend to add into this list?  I have a few in my head, but I’ll add them below so to keep this post as it is.

The road towards MCPD-EA: I passed exam 70-529

Three weeks after passing TS 70-536, I sat down again for another two hours at our Prometric test center in order to pass yet another exam that leads towards the MCPD-EA designation.  As a matter of fact, I passed TS 70-529 this morning.  So far, all the TS exams I passed make my thermodynamic and chemistry exams look like a joke.  This exam wasn’t as hard as the 70-536, but the level of difficulty was still pretty high in my opinion.  For this exam, my employer  was once again kind enough to provide me a training book which was of a great help, but also of a great headache.  The book was the MCTS 70-529 Self-Paced Training Kit.  It was of great help because the content is basically a good collection of MSDN documentation categorized by exam objectives and sub-objectives.  As for the “headache” part, well, the book is filled with ugly C# code (some have compilation-error, others have their style so messed up that it’s hard to follow what the code is suppose to do) and mistakes that can lead you to error if you don’t search for the answer yourself on MSDN or elsewhere on the Web.  The funny thing is that the ugliness of the code and most of the mistakes applied only for the C# examples, as I assume most of the authors were more proficient in VB.NET instead.  Hey, nobody’s perfect.  So, two down and three to go.  My objective is to hopefully earn MCPD-EA before September 2008, as I’ll be starting my Master’s at that time.  So, in short, that means taking one exam every three weeks (Lord, help me!).  Next one on the list: 70-528.

Using the “Source Control – Team Foundation” toolbar to perform common TFS operations on the current document within Visual Studio

If you happen to be using Visual Studio with Team Foundation Server (TFS) as the source code repository, you might be wasting your precious time in trying to find the specific file in the Solution Explorer that you want to perform some action against it (check out the file, check in the file, view the file’s history, etc.).  This is especially true for a solution which comprises a multitude of projects and a sea of various files.  FYI, I don’t pin the Solution Explorer when I code because I like to have the widest view on my code rather than to share the screen space on the structure of the solution, so it’s a pain to always display the Solution Explorer or use the File –> Source Control menu to perform a TFS operation on a current file.

Here’s a little trick that’s available for which allows you to perform common TFS operations against the current open document in Visual Studio.

  1. imageRight-click anywhere on the toolbar container and click on the Source Control – Team Foundation item (the list is in alphabetical order).  Peek on the huge screenshot on the right for guidance.
  2. You should now see the TFS toolbar (take a look at Figure 1 below) which allows you to perform common TFS operations to the current document.

Figure 1. The Source Control – Team Foundation toolbar
image

Starting from the left side, these different items allow you to:

  • Change Source Control
  • Get Latest Version (of the current document)
  • Get Specific Version (of the current document)
  • Check Out For Edit (of the current document)
  • Check In (the current document)
  • Undo Pending Changes
  • View History (of the current document)
  • Refresh Status (of the current document)

You shouldn’t need to use the Solution Explorer or use the File->Source Control menu to perform common TFS operations on the current document anymore.

"Copying a file too large for the destination file system"…Yeah, right!

At work, we tend to develop our projects in virtual environments, more precisely with Microsoft Virtual PC.  Given that today’s external hard drives are cheaper ($) to buy, I decided to purchase one and have the virtual machine run on it instead of executing directly on my laptop’s hard drive.  This little scenario allows the host drive to focus entirely on processing OS threads and other kernel and application processes instead of sharing the spinning cycles for the virtual machine.  In other words, your OS runs faster and your virtual machine runs faster.

That being said, I wanted to copy the 20GB+ virtual machine from the laptop’s drive to the external hard drive using Windows Vista SP1, but I kept getting the “File Too Large” error message. 

This was without a doubt a false negative because I clearly had lots of free space available in the external hard drive.  After searching online for some solution, I found out that Scott Hanselman posted a remedy to this problem.  As Scott points out:

This hard drive came formatted as FAT32, which doesn’t support files larger than 4 gigs. You can either Format the drive, by right clicking the Drive in My Computer and using the Tools tab, or, if you already have a bunch of files on it…

The solution is very simple:

  1. If you don’t have any files in your hard drive, then go ahead and simply format it as an NTFS file system.  That’s it, you’re done.  On the other hand, keep reading…
  2. Launch an external command prompt window as an Administrator.
  3. Type the following command: convert <drive:> /fs:ntfs /nosecurity.  You’ll need to make sure that the hard drive is not being used by another process before doing this.  The convert.exe application converts a FAT volume to NTFS.
  4. Th-th-th-that’s all folks! You can now copy your virtual machine to your external hard drive.

The following screenshot gives you an idea of the final output.  The whole process took less than a minute to convert a 250GB hard drive to NTFS file system.

The following is a list of the commands available for convert.exe (you can get this list by typing convert/? on the command prompt):

CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]

volume:  Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:NTFS:  Specifies that the volume will be converted to NTFS.
/V:  Specifies that Convert will be run in verbose mode.
/CvtArea:filename:  Specifies a contiguous file in the root directory that will be the place holder for NTFS system files.
/NoSecurity:  Specifies that the security settings on the converted files and directories allow access by all users.
/X: Forces the volume to dismount first if necessary.All open handles to the volume will not be valid.

NOTE: Think twice before going this route if you’re planning to use the NTFS-converted hard drive on other non-Windows machine.  Make sure those operating systems support the NTFS file system prior to conversion.