Scott Hanselman

Rescuing the Tiny OS in C#

April 02, 2007 Comment on this post [15] Posted in Learning .NET | Programming
Sponsored By

About four years ago (in the middle of the last fifteen years of writing software for money) I graduated from college. I took a round-about way through school at OIT - my four-year degree took eleven years (I actually had to make deals with four different deans to allow me to keep my credits from expiring) but it turned out OK.

Some where in the middle of going to school at night we were asked in an Operating Systems class to write a "Virtual CPU and OS." More of an interpreter, we were given a description of the OS, some op-codes and an ASM-like machine language. We were to write the OS, and feed test programs into the system. It was a fun exercise and a good way to teach folks how virtual memory and memory mapping works, threads vs. processes, etc. I was the only student who chose to write it in managed code. Quite the coup for 2002.

I turned in the project and threw it up on GotDotNet (this link will be dead in July of 2007), but of course, GDN will be gone soon. Just so it wouldn't be lost, it's now available here in C#. It's actually kind of fun, I think, as I put in some "jokes" - funny to me at least. For example, the OS pages it's virtual memory to XML files when it runs out of "physical" memory. It behaves like a real little OS. It'll thrash with low memory, and get fragmented if a lot is going on.

A tiny virtual CPU and OS written entirely in C#. The TinyOS simulates the scheduling, memory management (including paging and virtual memory) and other operations of theoretical Operating System. You’ll see many Framework classes and techniques in use including Regular Expressions, XML Serialization, generated Strongly Typed Collections, XML Comments and a generated Help file. You won’t get much useful work out of the TinyOS itself, but the techniques you’ll learn can be applied to real life.

Since this little ditty, others who really know what they are doing have written more serious OS's in C# that are worth looking at.

I presented on my little CPU/OS at TechEd Malaysia 2002, and the PPT slides are available as well. I also did it again in VB.NET if you like with a little trouble.

I looked at this code in 2005 and was shocked and offended with myself - well, not really, but it was enlightening to say the least. 

Go find some code that you wrote at LEAST FIVE years ago and tell me how it looks today...

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 57 - Polita Paulus and The Minutes on Nine #1

April 02, 2007 Comment on this post [1] Posted in ASP.NET | Podcast
Sponsored By

My fifty-seventh podcast is up. This episode is the audio portion of the Channel 9 cooperative cross-over video with Rory.

(Disclaimer: To be clear, no one at C9 is paying anyone anything. There's no money involved, but Microsoft DOES have free Diet Coke, and I did take some home with me.)

This podcast is, ahem, audibly-improved (Carl's audio team did the magic) and is the interview we had with actual-ASP.NET developer Polita Paulus from Building 42, along with her boss Matt Gibbs. We literally wandered into their office unplanned and unscripted and had a fine chat. They were both very good sports considering that we pounced on them.

ACTION: Please vote for us on Podcast Alley! Digg us at Digg Podcasts!

Subscribe: Feed-icon-16x16 Subscribe to my Podcast in iTunes

Do also remember the archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Our sponsors are Telerik and /n software.

Telerik is a new sponsor. Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

  • The basic MP3 feed is here, and the iPod friendly one is here. There's a number of other ways you can get it (streaming, straight download, etc) that are all up on the site just below the fold. I use iTunes, myself, to listen to most podcasts, but I also use FeedDemon and it's built in support.
  • Note that for now, because of bandwidth constraints, the feeds always have just the current show. If you want to get an old show (and because many Podcasting Clients aren't smart enough to not download the file more than once) you can always find them at http://www.hanselminutes.com.
  • I have, and will, also include the enclosures to this feed you're reading, so if you're already subscribed to ComputerZen and you're not interested in cluttering your life with another feed, you have the choice to get the 'cast as well.
  • If there's a topic you'd like to hear, perhaps one that is better spoken than presented on a blog, or a great tool you can't live without, contact me and I'll get it in the queue!

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

A better automatic translation system - one that learns

March 29, 2007 Comment on this post [9] Posted in Internationalization
Sponsored By

Google gets more and more clever. I've used Babelfish for years to machine-translate other languages into English. It's always been a little stilted, to say the least.

Google's been updating their translation software - a lot - lately, and has introduced some new stuff for Arabic, Chinese, Korean, Russian and Japanese.  Google was #1 three years ago, so you can pretty much count on this problem being 95% solved in our lifetimes.

My knowledge of Arabic is completely gone. I took it in college, but those braincells have been overwritten with Zulu (Ndebele) and Amharic and most recently, sign language (ASL).

I used this new tool to read the Arabic version of Al Jazeera today. It's not bad, much better than the usual broken English you are used to. The brilliant part is that you can hover over some text and teach it by suggesting a better translation. What a wonderful "mechanical turk" way of learning colloquialisms.

Just for fun, take a look at my recent post On Losing Data, machine translated into Arabic by Google. Google messes up my stylesheet, but you get the idea.

My buddy Wessam in Lebanon says via IM:

Well, its better than the other translators I used before, but still has lots of mistakes. Actually if you don't read the english version, you won't understand half of it.

Interestingly it's WAY better turning Arabic into English than it is turning English into Arabic.

One final note - "If you prefer not have your page translated by Google Translate, just insert the following meta tag into your html file..."

<meta name="google" value="notranslate">

Slick. هذا رائع!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Life Beyond Pie Charts: The right visualization for the right job

March 29, 2007 Comment on this post [14] Posted in ASP.NET | Musings | Programming | Speaking
Sponsored By

I deal with a lot of data in my day job. We're always trying to figure out the right way to visualize some chunk of data. Being able to think about the visualization of quantitative information start with thinking beyond basic bar and line charts.

We're looking into schools for Z, and we have some specific categories that we're using to rank the schools, like for example:

  • Cost
  • Spanish
  • Sign Language
  • Teachers
  • Recommended
  • Location
  • Curriculum
  • Vibe
  • Schedule

We're going to look at many schools, so we're looking at a grid here, with each category ranked, say, 1 to 10, where 10 is awesome, and 0 sucks.

We could make a bunch of line/bar charts...

...and it kind of works if force ourselves to remember that a straight line all the way across the top means "good."

We could view the data as a pie chart if we introduce a gap in the pie that indicates that missing "goodness." The fuller the pie, the better the daycare:

If we didn't like the pie because it doesn't really characterize the information enough where we could actually make a decision, we could try a closed donut that includes all the choice:

The donut really doesn't work because there's an implication that the ordering of the rings indicates a qualitative (actually quantitative) judgement. The order in this case is meaningless.

This particular dataset lends itself to being a Radar Graph. You can think of a Radar Graph as just a Line Chart wrapped around a single point so that left-right presentation of data on the horizontal of the x-axis (as is in a Line Chart) doesn't get misinterpreted as being meaningful.

We can present the data into two ways, either all mushed together...

...but the Z-ordering again has the same problem as the donut - it implies that the one on top is better. If the data is solid, then one covers the next, but if it's transparent, the color turns to brown. This data really wants to have each series next to each other.

There we go. Now it becomes clear that "Babies babies babies" is the most balanced of the four.

If you're a UI programmer, or a UX designer, you should be a connoisseur of this kind of stuff. Don't fall into the trap of throwing your data into a simple grid. The data "wants" to be presented in a certain way. It's your job to find that appropriate visualization.

Be sure to remember that axes lie. If you're using logarithmic or adjusted axes, you should know what the psychological ramifications are of these changes. You can inadvertently bias the data and lead you viewer to non-objective conclusions. The US Today "info-graphic" is notorious for this kind of things.

Above all, remember there's more available to you than just Pie Charts and Bar Charts.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes on Channel 9 - Video #1

March 28, 2007 Comment on this post [8] Posted in ASP.NET | Podcast
Sponsored By

Rory and I did a few videos together a while back to promote TechEd 2005. (Baby Carrots, Designing Software) They kind of worked, but were perhaps a bit forced. We thought they'd be cool at the time because when Rory and I hang out and just riff, we're a hoot. A hoot and a half, even. So, the Rawdawg got the idea for he and I to wander around Microsoft's Building 42 (Developer Division or "DevDiv") and simply pop in to folks offices and ask them "What are you working on?"

For me, I wanted to get back into the "Roots of Channel 9" - raw discussions, preferably with folks who know what they are talking about.

As Rory says:

Rory: In this first series (yes: first - if you like it, we might do more), we walked around building 42 and surprised people with impromptu requests for interviews. Most accepted.
A typical Channel 9 interview is booked anywhere from days to months in advance, so this is a different sort of thing.

We planned nothing and had no agenda. We ended up with a few hours of footage and if you like them, Rory will post them, and we might do more, perhaps even ask we approach the Mix conference.

In this first video we got lucky and bumped into an actual Dev on the ASP.NET team, Polita Paulus.

Sticking with my personal ongoing interest of not wasting your time, Rory and I changed the format even more:

Rory: Let us know what you think about this format. Another thing to note is that it's shorter than recent 9 videos. We've been seeing a lot of comments from viewers asking that we shorten them up. This one is just under 15 minutes long, so tell us what you think of that as well.

If you want more Channel 9 videos like this, forward the link around and say so in the comments of the video. So, we present for your consumption, Hanselminutes on 9 - #1. I hope it doesn't suck.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.