Technical Interview Question #1

Interview Series

I need you to build a fuzzy clock. When asked by others, "What time is it?" do you answer precisely, "7:34 AM"? I don’t. Many would instead answer, "About seven-thirty". Write the code necessary to provide the fuzzy clock response. Consider a few of the valid responses to be, "quarter-past", "half-past", "quarter-till", "about N-o’clock", etc. Be creative.

Write a function which returns a string with the properly formatted current fuzzy time. Your function is provided the current Date and Time (in the appropriate format for your environment and language choice).

Technical Interview Question Series Starting

I’m going to begin posting weekly a technical interview question. Generally, each question should be solvable in less than 30 minutes time. Often, much less. Some amount of coding is typically necessary to solve the problem (either actual code or pseudo-code), but occasionally, just a plan or discussion-style response is expected.

I’d consider these questions to be of the Microsoft technical interview style questions (having worked there, I both was interviewed and interviewed others, so I have some experience with them). If nothing else, you might find them interesting problems to think about for a couple of moments during your day. That’s my primary reason for posting them: a little brain teaser during your day.

I’d really like to see who can answer them first, BUT, given the nature of the Internet and time zones — it’s not really practical. If you have an answer that you’d like to show off and you have a blog, put the answer on your blog, and link to the question and post a comment (if trackbacks aren’t working). Otherwise, feel free to post the answer in the comment. There often will be more than one answer!

Code it in any language you’re comfortable with! There’s no right or wrong language for these questions (unlike many interviews at Microsoft that have historically considered C/C++ the "only" language you should use).

By the way, a long answer isn’t necessarily a "wrong" answer, but it’s probably not the best answer. :)

(I’ll go as long as I can with the series … if you have questions you’d like to see added, feel free to contact me using the contact form in the header, or send an e-mail to coder at this website).

LINQPad – More than just a LINQ editor

I stumbled across this .NET 3.5+ utility today, LINQPad. I think I’ll be putting this on every development machine I control — it’s been very handy today.

image

At first I thought it was just a live LINQ viewer/editor (which is useful on it’s own!). But, in order to support that type of functionality, it supports a wide variety of code snippets that you might want to experiment with, without the hassle of starting Visual Studio.

The syntax coloring editor (no Intellisense yet, sorry) makes editing code a decent experience. Once you’ve typed in your code snippet or LINQ statement, hit F5 to test it. The results appear in the bottom half of the application. I believe through extension methods, it adds a "Dump" method to IEnumerable objects so that they become nicely formatted in the resulting display (see the screen shot for an example).

Here was the C# code I used in the screen shot above:

Console.WriteLine("WiredPrairie");
var website = new { Href = "www.wiredprairie.us", 
    Topics="Coding,Usability,Software,Photography,Java" };

IEnumerable<string> topics = from topic in website.Topics.Split(',') 
    where topic.IndexOf("Java") == -1 select topic;
topics.Dump();

Results:

image

It’s free. Oddly, there’s no installer, or click once for the application (given it’s part of a book on C#, I would have thought a click-once installer would have made sense … but I won’t complain loudly since it’s free.)

I’m not sure what to do with this button:

image

I can’t get it to display anything … if someone figures it out, post a comment or send me a link if you don’t mind!

I looked up one of the snippet compilers I used to install, "Snippet Compiler" (here). There’s an "alpha" release for .NET 3.5. I stopped using that tool a few years ago when it started to "bloat" and do too much. It looks like a full editor now…

Can Java compete?

An interesting blog post discussing the merits of trying to simplify the Java web server runtime.

The first real issue is the overhead to develop and then start hosting java applications. It is difficult for host providers to support allowing each user the ability to run their own JVM processes in a sustained fashion. I remember the days when using PostgresSQL required you to have a dedicated server whereas you could use mysql easily by just setting up yourself for a small multi-tenant plan on a web server out there. Today Java is like PostgreSQL of those days. There is no easy way to simply set yourself up to run a small Java application in a shared tenant environment. Even if you did set yourself up chances are that you would be far less than satisfied with the performance in a multi tenant situation even though Java is actually a really really fast language.

When I had a passing fancy recently regarding Java recently — I couldn’t find a hosting provider for any price I was comfortable paying. The problem is summed up nicely above — it’s too hard to host. Java on the web — mainstream web — is never going to catch on if it can’t overcome at least this hurdle.

The only web platforms that are going to survive the long haul must adapt to the new web development model of shared hosting and inexpensive hosting, easy scaling …, simple and convenient programming; all things that the traditional Java web platforms does poorly.