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…

The Mobile Web is dead?

Geesh — one company dies and industry pundits (here for example) are declaring that the mobile web is finally dead.

What? Although my phone finally supports 3G in those areas of the country that have 3G service — I’d hardly say that my Windows Mobile 6 phone web browsing experience is anything but barely adequate. I was never bothered by AT&T EDGE speeds — mainly because the web pages rendered so poorly as to be barely useable. I don’t fault web sites for not considering my use to be a prime candidate for optimization and development. It’s a lot of work just to make a web page work on the various full-sized browsers such as IE, Firefox, and Safari. Then, they must consider the actual frequency of mobile users — near 0.1% I’m sure before deciding to create an optimized mobile web version.

Amazon has a mobile site though — and it’s perfect for my needs. Fast, simple, and renders perfectly. The other day in a local store, I did some price comparison’s with Amazon to verify that I should buy some of the stuff locally and wait to buy a few items when I got home from Amazon (I didn’t feel the need to try to buy something from Amazon while in a physical store).

I frequently use mobile versions of news (CNN, MSNBC), weather (weather.com), and Google Reader.

Why do we still need mobile then?

I hear people talking about the ideal experience that is available on the iPhone/iPod touch for browsing the web. I’m using a beta of SkyFire which attempts to emulate some of the experience of the iPhone browser on my WM6 phone. It’s not bad — but what I really don’t care for is all the zooming in and out and panning. It’s slow and sloppy. I’m disappointed when I need to use it. It’s solving a problem that we ideally shouldn’t have to deal with.

I’d be skeptical that you’d ever find a piece of PC/Mac software that emulated that zooming and panning experience on your monitor/LCD and enjoy it (imagine if your current web browser worked that way). (And no, mapping software doesn’t count!) Instead, you’d want something optimized for the computer and display. Lots of the better web designers and web sites get this and create optimized web sites for phones (I’ve seen mention of quite a few for the iPhone for example). I for one, hope they continue and don’t declare mobile web to be dead. For most applications, it’s a reasonable experience that is zero-install and "good enough." It also targets the most phones — whereas doing custom development for the various phone platforms takes time, effort, etc.

Do you have a data plan? Do you use your mobile phone’s web browser? What are your thoughts?

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.