Theme Graphic
Theme Graphic

$jonathan.ramble(topic => 'work' & 'play');

My random-ish ramblings about my work at Programmer's Heaven and on the Parrot project, my crazy conference schedule and whatever else I...

Subscribe

Author

I wrote my first computer program when I was 8 years old, and I haven't bothered to stop since! I graduated from the University Of Cambridge, England, in June 2006 having read Computer Science at Emmanuel College. Currently I'm doing consultancy work, a lot of it for this very site. I'm into a whole range of music, including metal, trance, old skool, and industrial. I'm a Christian and have previously been involved in youth and children's work with what was then my local church.

Archive

Tags

Posted on Thursday, May 07, 2009 at 3:50 AM

Open Source Fluent Validation For .Net

I've been working on open source projects for a while, namely Parrot and Perl 6. Recently I've also been hacking on TNValidate, a fluent validation library for .Net. To quote a little code from its synopsis:
// Instantiate validator.
var Validate = new Validator(ValidationLanguageEnum.English);

// Chain rules; automated error generation.
Validate.That(Name, "Name").IsLongerThan(3).IsShorterThan(100);

// Supply a custom error message.
Validate.That(Age, "Age").IsGreaterThanOrEqual(13,
    "You must be older than 13 to sign up");

// Check if validation suceeded.
if (Validate.HasErrors())
{
    // Here you can data-bind the errors, e.g. to a Repeater
    // in ASP.NET.
    ErrorList.DataSource = Validate.ValidatorResults;
    ErrorList.DataBind();
}
else
{
    // Was fine, continue...
    // ...
}
...
Comments: 2 Tags: .NET, C#, Validation

Posted on Monday, January 05, 2009 at 6:01 AM

PH: Forum Reply Changes

First of all, from myself and the rest of the Programmer's Heaven team, Happy New Year!

Today we have rolled out a small change to the forum reply page. Before, we would always automatically quote the post you were replying to. This dates back to when the forums only allowed you to view a thread post by post, however for a while now it's been possible to view the entire thread on a single page. With the reply always being quoted by default, this often just led to the page becoming cluttered - if you were reading through the conversation, you'd end up finding parts of it repeated. The context that used to be provided by always quoting the reply has become less useful.

Therefore, to try and encourage not quoting the entire original message when it's not needed, we now don't quote it by default. There is, however, a button that you can press to have the original post put into the reply box quoted, just as before, if you want to reply to it part by part (which is sometimes the best and clearest way)...
Comments: 4 Tags: Inside PH

Posted on Monday, December 08, 2008 at 10:15 AM

Blogs Get Statistics

If you have a Programmer's Heaven blog, you'll find that you now have a link on your blog start page to view statistics (note that you must be logged in). You can view the total number of hits that each of your blog posts have had, and then drill down to view statistics by the day for a particular blog post.

Note that we only started collecting the data this weekend, so any hits before then will not be included in the data. It should give you an idea of which of your blog posts are the more popular and still picking up search engine hits, however. Happy blogging, and feedback and feature requests welcome.
Comments: 2 Tags: Inside PH

Posted on Friday, October 24, 2008 at 2:53 AM

Back to PH, from a long trip

This morning the overnight train from Brest, a city in Belarus, rolled a few hours late into Bratislava. I jumped off to the platform, happy to be back home again. I have taken the last month away from hacking on PH, Perl 6 and my other smaller projects. Instead, I've been backpacking across Russia - from Vladivostok all the way overland to Moscow - and then spending a little time in Belarus. They're fascinating if sometimes difficult countries to spend time in, and I'll be writing about my trip in an e-book.

While I've been away, PH suffered some nasty SPAM attacks. I'm happy to see on returning that the latest forum posts box on the homepage is now free of them - I did manage to find a net connection and visit the site during the worst of the problems, and was horrified to see the mess the attackers had made of the site, and gave what input I could on the problems. The credit for resolving them goes to Brad, Nicolai and Kent, however. I'd like to thank everyone who stuck with the site during this time; what was meant to be a month of gentle development work while I was gone really didn't end up that way. Its sickening to think that some people make their money out of destroying what others are doing, and irritating that we have to spend time working against them, instead of working to improve the site...
Comments: 3 Tags: Inside PH, SPAM

Posted on Thursday, September 04, 2008 at 6:42 AM

HTML 5.0: Pragmatism at last!

I was at the 2008 European Perl Conference recently and one of the talks I heard was about HTML 5.0. It may seem odd to have such a talk at a Perl conference, but web development is one of the things Perl is used quite heavily for. I went along not really expecting to come away particularly excited. Instead, I came away feeling that they really are going down the right lines.

The thing I like about HTML 5.0 is its pragmatism. It accepts that various things just, well, are the way they are. Whether you think any of the following are points are OK, they are pretty much reality.
  • Most web pages don't specify a document type
  • Of those that do, plenty of pages don't comply with the document type anyway and a validator would say they were invalid
  • Despite this situation, end users expect that web pages that in the eyes of a validator are invalid will still be rendered; any browser that only renders compliant pages will not be able to provide access to much of the web and wouldn't be used by anyone anyway...
Comments: 0 Tags: HTML, Web, HTML 5

Posted on Wednesday, July 23, 2008 at 1:56 PM

Inside PH: Lots of post-launch tweaks

First up, I'd like to thank everyone who has been providing feedback on the PH re-design. As lead developer, I'm trying to factor it all in to our development and prioritize fixes and improvements based on what people are asking for. We went through quite a bit of internal testing before unleashing the new PH for community testing a week prior to launch. Even so, various bugs have been spotted since we launched, both by the PH community and the team. Many are fixed, some are still in our bug tracker.

Some of the more visible things that have been improved in the week or so since the launch include:
  • Restoring printer friendly mode in various articles where it had gone missing
  • The submissions area now lists the status of your resources
  • You can now edit the way that your submissions are tagged, to help make them more findable in the resource directory
  • New resources now show up in "tag feeds", so get more promotion on tag start pages
  • Tag pages now show synonyms for a tag, where we have them available...
Comments: 0 Tags: Inside PH

Posted on Tuesday, February 05, 2008 at 4:23 AM

A love letter to ASP.NET

Dear oh so wonderful ASP.NET,

I know that we programmers are far, far more stupid than your code generator. Clearly, if I write:
<form action="BoardEdit.aspx" method="post" runat="server">
Then actually you might as well assume I'd written:
<form method="post" runat="server">
And left you to figure out what the form action should be, because you can do that perfectly every time, fully accounting for the URL re-writing. If I suggest something different, clearly I would never have a good reason for doing this (for example, in the case that you've got no damm clue how to respect URL re-writing rules, but oh no, that would NEVER happen, would it? Oh, wait...).

Love (the thought of punching) you loads,

Jonathan
Comments: 0 Tags: ASP.NET

Posted on Monday, February 04, 2008 at 8:25 AM

A wish for C# 4.0

OK, OK, so C# 3.0 is only just out of the door. As anyone who has been reading my stuff for a while will have realized, I like what they've done with the language. Here at PH, we have now fully migrated all our solutions to Visual Studio 2008, and can now use C# 3.0 language and .Net 3.5 framework features everywhere they're useful. This makes me happy (though some annoying issues migrating to Web Deployment Projects 2008 decidedly aren't making me happy).

I haven't thought long and hard about what I'd really like in C# 4.0. I think I need C# 3.0 to settle in a bit more. I've used it quite a bit, but it takes a while to fully realize the power of all that is there, and I certainly don't want to start suggesting additions to the language when there is already a perfectly good solution to that problem...
Comments: 2 Tags: C#, Language Design

Posted on Thursday, January 10, 2008 at 1:41 PM

Inside PH: Final Builder

Before now I've talked about our use of the Subversion version control system and Visual Studio.Net 2008. These are two of the most important tools we all use in our day-to-day operations. Today I am going to talk about another one that saves us a lot of time and potential mistakes: Final Builder.

Programmer's Heaven is a large site. To keep the code base modular, we break it up into many libraries. Some of these libraries provide primitives that we use all over the place. On top of this bottom "layer" are another set of modules that relate to specific features. For example, we have the wiki engine, the forum, the blog engine and so on. Finally, there is the web project for the site itself...

Posted on Monday, December 17, 2007 at 1:57 AM

Upgrading from Vista to XP

For a light start to the week, I was amused by this parody review of Windows XP, written as if it was the successor to Vista. It certainly captures a lot of the reasons why I'm still on XP and have no plans to downgrade. Uh. Upgrade.
Comments: 0 Tags: Windows Vista

Posted on Thursday, December 13, 2007 at 9:19 AM

I hate "== true"

If you've asked someone to look for something you left at their house, would you say, "give me a call if it's true that you found it"? No, you'd say "give me a call if you found it". So why do so many people write things like:
if (found == true)
Instead of the shorter, clearer, equivalent:
if (found)
Yes, I know, I shouldn't let refactoring get me so cranky.
Comments: 2 Tags: Programming

Posted on Monday, December 10, 2007 at 6:01 AM

Inside PH: C# 3.0 and Linq

This morning I started working on a new library for a new feature we'll be rolling out in the not too distant future. It is the first production code that we're developing at PH using Visual Studio 2008, which brings us C# 3.0 and Linq.

Just one morning into it, it already feels like a vast improvement. It took all of ten minutes to get the DLinq classes generated in Visual Studio; it would have taken under five if it hadn't been my first time doing it and working it out as I went. Then they were ready to use, which was also trivial. No more writing SQL or stored procedures or calling methods on a data reader to get the data out: just instantiate the DataContext (which represents the database), write the query, and it's done...

Posted on Wednesday, November 28, 2007 at 6:25 AM

When C# bites

So I wanted to do:
private TTo Identity<TFrom,TTo>(TFrom I)
{
    return (TTo)I;
}
Well, actually I didn't. I wanted C# to be smart enough to realize that if S is a subtype of T then List<S> can safely be assumed to be a subtype of List<T>. But anyway, that's not the case, and you have to call ConvertAll on the List to get it to be a List<T> rather than a List<S>. Joy. Anyway, turns out the above fails to compile. Thankfully, this works:
private TTo Identity<TFrom,TTo>(TFrom I)
{
    return (TTo)(object)I;
}
But, argh.
Comments: 0 Tags: C#, types

Posted on Wednesday, November 21, 2007 at 6:01 AM

Splitting CSV with regex

I answered a question on the Perl forum today about splitting CSV. CSV is a comma separated format; for example:
blah,blah,blah
You can put values in quotes:
blah,"blah blah",blah
And those quotes make commas within them meaningless too:
blah,"blah,blah,blah",blah
If we do the naive thing and implement it using split on a comma:
my @fields = split(/,/, $string);
Then we will obviously get the Wrong Answer. The question was, is there a regex we can use with split that will do the Right Thing? And the answer was yes, though it took me a few minutes to come up with it. The thing is that we don't want to match anything more than the commas we are splitting on, but we do need to do some analysis on the string that is up ahead (or behind us) to detect if the comma we are seeing is in quotes...
Comments: 12 Tags: Perl, Regular Expression, CSV

Posted on Monday, November 19, 2007 at 10:40 AM

Perl 5.10 Coming Soon!

I've spent the last few days at the French Perl Workshop. As well as my brand new talk, I gave two re-runs of two that I had given before. One was entirely new to the French audience, and the other one was from quite a while back and given a face lift so it seemed new (in fact, it was the first talk I ever gave to the Perl community; it was on the topic of web security, and from the web code I encounter it is no less relevant today than it was then). That was 100 minutes worth of talks, which was a pleasure thanks to a great audience...
Comments: 0 Tags: Perl, conferences

Posted on Monday, November 12, 2007 at 5:04 AM

Inside PH: Now we're using Subversion

I'm now working as lead developer at Programmer's Heaven. Every so often, I'll be bringing you a little look inside, sharing some of the tools and techniques that we use to build and run the site.

Last week I completed migrating the Programmer's Heaven source tree to the Subversion version control system. Before I arrived, we were using a commercial offering, which I won't name here. I tried to give it plenty of chances to work well, and was patient when I heard a new version was coming out. However, the new version introduced new problems more than resolving the old ones, and I could never track down a pattern to the most serious issue, which led to broken builds a couple of times. It was frustrating knowing there were better tools out there; I had worked with Subversion on numerous projects before and knew that it was simple and Just Worked most of the time. It has its quirks, but nothing as close to annoying as what we were using...

Posted on Monday, October 22, 2007 at 7:05 AM

Catch Me At Conferences!

I've got a brand new talk in the works, which I will be delivering at both the French Perl Workshiop (Lyon, 16th-17th November) and the Israeli Perl Workshiop (Tel Aviv, 31st December). I will be talking on the topic of parallelism - why we need to do it, how (not) to screw it up, what Perl 6 will bring to the table and some of the latest research for future ideas, including lock-free data structures. I hope to announce more European dates for the talk over the coming months, subject to it being accepted at more conferences.
Comments: 0 Tags: Perl, conferences, parallelism

Posted on Wednesday, October 03, 2007 at 9:19 AM

Are Internal DSLs Really Just Well Designed APIs?

Well, I figured I may as well make the first post in my PH blog vaguely controversial. If the title's not enough for you, then let me go on to suggest that the Bible has some useful advice in it for those of us trying to decode the continual stream of acronyms that the computing industry likes to throw at us.
"What has been will be again,
 what has been done will be done again;
 there is nothing new under the sun."
    -- Ecclesiastes 1:9
One of the things that amuses me most about the computing industry is how we seem to keep getting shiny new names for the same old technologies, perhaps just applied in a different problem domain or using a different language...
Comments: 0 Tags: AJAX, Programming, DSL

 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.