P-P-PowerShell Pomodoro

I have some time management issues, don't we all? Lately, I've been trying using the Pomodoro Technique to overcome the little distractions that can easily scupper a good work day.

(Price/piece)Clearance Sale! 60-Minute Tomato Kitchen Timer, Mechanical Counting Timer, Shower Timer The biggest issue I (and many others) have with implementing the technique is also the central focal point; The timer. A timer is essential... preferably a loud, clanky, ticky, tomato shaped kitchen timer. This just isn't an option in a shared office. Now, there are plenty of software timers already out there. (There's even a Google group for sharing the timers you've made). But what kind of software alchemist wouldn't make his own?

In time, I may make a Silverlight timer with some capacity for the lists and notes required by the technique. For now, here's a quick PowerShell script to just do the timer part. $mins = $args[0] $start=$(get-date); $diff=$(get-date)-$start $total=new-object TimeSpan -argumentList 0,$mins,0 while ($diff -lt $total) {   write-progress -activity $diff -PercentComplete (($diff.TotalSeconds/$total.TotalSeconds)*100) -Status "Work!"   sleep 1   $diff=$(get-date)-$start } get-date Download

Read more

Blundering through Silverlight - images

Early in the Silverlight 4 in Action book, there is an example to work through; Creating a Twitter client with Silverlight. Just the fact that the author can use this as a "hello world" style example gives the reader a little indication of how powerful Silverlight is for building web apps. Read more

Blundering through Silverlight – debugging

>I've been reading through Pete Brown's Silverlight 4 in Action. Having only got to the first few chapters, I can't say much about it yet, but it does have a very good introduction to the technology.

Tripping and stumbling my way through the process of learning to write Silverlight applications, I have already come across a couple of sticking points. Here's number one:

"I can't attach the debugger to Silverlight"

I like running programs in a debugger. It's not a crutch - it's just more efficient to develop that way. So there. When I first ran my Silverlight application, the process that Visual Studio embarked upon seemed to be something like this:
  1. The web server starts
  2. The debugger attaches
  3. Firefox starts
  4. The debugger decides that it's had enough, and detaches... goodbye!
The problem is right there in step 3: Firefox. For reasons unknown, the debugger just doesn't seem to get on well with browsers that aren't Internet Explorer. Changing your default browser to IE will fix this. If you don't want to mess with your browser settings, there are alternatives (although these days, with IE 8 and 9, using the blue "e" isn't too bad).
Read more

jQuery and Mootools

Recently, I've taken the time to look into both the jQuery and MooTools Javascript libraries. The similarities and differences between the two have been expanded upon before in some depth, but I think that a more brief summary is in order.
jQuery does a great job of making plain HTML richer, especially if you make use of the accompanying jQuery UI library. If your client-side concerns start and end with providing a better user experience for HTML forms,then jQuery is your go-to guy.
On the other hand, you may plan on doing more intensive work, such as a client side application or browser based game for example. MooTools is great for this, especially if you are used to a different Object Oriented language such as Java or C#. The capability to design classes and methods in a familiar manner is an inestimably huge boon when attempting to build a sophisticated, maintainable program. (I never truly felt 'at home' with prototype based programming). Read more

Streams, encodings and BOMs

The problem

If you ever see this kind of output from your application:
“These are not Joe’s quotesâ€
When you expected to see:
These are not Joe’s quotes
Then you have an issue with Unicode that may be solvable by inserting a byte order mark at the start of your output. See the Wikipedia link there for a full explanation of how the recipient of this text could mangle the bytes.

The solution (for .NET)

One way that this can happen in .NET is through the use of StreamWriter. If no encoding is specified the stream uses Encoding.UTF8 by default. This is a UTF8 encoding without a byte order mark. The solution is to construct your own instance of the Encoding class with the settings you require.

An example

Take the following program:
using System.IO;


        Read more
      

Hiding links that shouldn’t be shown in ASP.NET MVC

Problem

Any web application has pages that should be seen by some users and not by others. At the very least, there are administrative pages and public pages. Read more

Entity Framework 4 CTP and SQL CE 4

Having seen the Scotts' Gu and Hanselman announce the new version of Entity Framework (Magic Unicorn edition, no less), I thought I'd add some of the new 'Code First' goodness to learning / example app.

Read more

Learning MVC 2 – ‘In action’

I've been reading the very informative ASP.NET MVC 2 In Action. This book contains a lot of information to be aware of if you are using (or planning to use) the MVC framework, however, don't expect a gentle introduction to starting out in web applications.

Read more