Please ignore some of the weird styles, doing a big HTML5 upgrade, and it's not quite done yet.

Daniel's Blog

The ramblings of a 22 year old guy.

Christchurch, one year on

Today marks a year since the devastating earthquake that took 185 lives hit Christchurch. A day that changed so much, for so many, in Christchurch, around New Zealand, and the world. I still remember the moment I heard the news, and the sinking feeling that ran through me. I had family and friends working in the CBD, right next to the doomed CTV building. Obviously the cell phone networks overloaded instantly, so I sent a text, and waited. A reply came within an hour or so, saying that they were all ok, thankfully. Sadly this wasn't the case for some families. My deepest sympathy and thoughts go out to you today.

Find A Room

That night, whilst sitting at home trying to think of a way that I could help from up here in Wellington, an idea hit me - people will be wanting out, even if it's just for a few days, and there was nothing around that allowed people to offer a room or two, for free.

Find A Room was born. After a can of V, I sat down at my computer, and wrote possibly the quickest (and worst) pieces of code I've ever developed. Rolled it live at 2am on the Wednesday morning, got my cousin in Christchurch to give it a quick test, then Tweeted it out to the world.

The response was beyond anything I could have imagined - the link was retweeted again and again, rooms popped up instantly, even at 2am in the morning. By the next day, a few support sites popped up, and Find A Room was listed on them all. The listings kept coming. Then it got listed on the New Zealand Herald site, which pretty much destroyed my internet connection. By the end of the second day, there were 100's of listings from awesome people who wanted to do nothing more than help.

I want to say thank you again to those people that offered rooms in their homes, you helped a number of people in Christchurch hugely. I would also like to thank the people who made use of the service for emailing in - was an awesome feeling to know that I'd managed to help.

Visiting

A few months after the quake I decided to head down, see my family, and have a look around. After seeing it all over the news, I thought I knew what to expect. Boy was I shocked. The news only showed the major parts of the earthquake, which I guess is fair enough. It was the little things that shocked me the most though. The dust, the differences in damage between suburbs, even streets. It was nothing for one street to be fine, whilst the next one of was destroyed. The roads were bumpy and broken; getting anywhere took a long time. Then it rained, and all the dust on the streets turned to mud. Horrible sticky mud.

We went for a walk around the outside of the red zone, which was both incredible, and sad. Incredible to see what the broken remains of a city looks like, and what something as simple as the ground shaking can do. And sad because I'd been walking down those streets only days before the quake hit. The... strangest... place to visit was the CTV building. Or at least where it was, it had been fully cleared by then. Just knowing so many lives were lost there was a weird feeling.

Where the CTV building was...

I have been back multiple times now, and every time the city is buzzing more, people seem more positive about the future, and it feels like things are happening, finally. I know that people living there still find it tough - and I fully understand why. The constant aftershocks, broken buildings, broken roads, broken lives, all still exist from a year ago, the memories of that day still hang around. Things can only get better though, right? It's a chance to start fresh, a chance to build something amazing, a chance to make a difference.

To the people of Christchurch, stay strong, we're all thinking of you.

Ps. Stuff have an awesome page on the earthquake - check it out.

Petrol price “boycotts"

This is more a rant than a useful, informative post… You’ve been warned. I also originally posted it on Tumblr, so you may have read it before.

Over the last few weeks as petrol prices head up, I’ve noticed a few groups on Facebook claiming that if you don’t buy petrol for one day, the petrol companies will notice, and drop their prices. The latest one claims that it’s not a “don’t buy petrol” boycott (it actually is), and that we can get petrol back to $1 per litre.

I just have one question for all of these groups/boycotts/crazy people - what do you actually think this is going to achieve? I’m sorry, but I just don’t get it. The days of $1-1.50 petrol are over. Oil is a finite resource. They’re not making more of it in a big factory somewhere. They’re not finding huge new reserves of the stuff anymore. And us humans are using more of it than ever before. Cross that with the unrest in Libya (who make some awesome crude) and the weakening New Zealand dollar, and it’s not looking good.

The original boycotts worked by basically saying “Don’t buy petrol on this day”. Uh, yeah, great, what happens when you’re tank’s empty though, say a few days later? You go to the petrol station, and fill up. The petrol companies know this. They also know that the grandma who pops in every week without fail isn’t going to be in on some Facebook shenanigans. So they’re not at all bothered by the original “boycotts”.

In fact, they’re probably laughing at everyone who clicks that ‘Attending’ button.

The latest one (in the first picture) strikes me as the most ambitious (stupid) though.

Boycott one petrol company (BP in this case) in the hope that they will first actually notice, and then lower their prices, which is supposed to bring down the prices of all the other companies. There are currently 6,774 people “attending” this effort, if you can call it that, on Facebook. Now I think it’s safe enough to say that a group of those people don’t actually own cars, so say that 2,000 of them don’t buy petrol from BP for a few weeks (until they forget about it, or get bored and find a new group to join) - BP still has its regulars. And it still has a large number of corporate fuel card holders.

People seem to think that getting oil out of the ground is cheap and easy. Have you ever tried digging a hole thousands of feet into the ground, in the middle of the ocean, in the hope that you might hit oil? Didn’t think so. It takes years of planning, searching and development to find it. And that’s only to get it out of the ground. It still has to be floated around the world on a huge ship, refined into petrol (or diesel, if you swing that way) at a refinery, and then shipped out on another huge ship, to petrol stations. They’re doing this all for $2.20 a litre.

Actually, that’s a lie. The petrol companies only see around half of that. Most of it goes to the government in GST, emission trading schemes and other taxes. The importer gets some of that as well of course, and the shipping company.

I even made a pretty graph (all good “arguments” need graphs, right?)


(Data from here)

So basically, the oil company is doing ALL of that work for you, for around $1.10 a litre. Yes they used to be able to do it for less, but, as I said above, times have changed, and things are a little tougher now.

Don’t want to pay so much for petrol? Catch the bus, ride that bike you’ve had in the shed for years, walk, swim, hop on one leg… So many other options! Why not spend the time you’re wasting arguing on Facebook doing something useful? The world would appreciate it more.

Me? I’m going to fill up with some nice juicy petrol from BP. I might even go a little go a little crazy and splash out on some premium fuel…

It's coming soon...

It's been eight long (and exciting) months of development, and two months of private testing, but Kustom Page will be relauching soon. We are just ironing out the last few major roadblocks, and are expecting to have something out the door very shortly.

We have re-written almost the entire application. It is now more powerful, faster and easier to use than the previous versions. It also allows us to extend the system a lot further than before.

Here's some eye candy of the latest build, enjoy!

 
 

 

Help support people in Christchurch

If you have a spare bedroom and want to help out with the earthquake appael in Christchurch, or are looking for a place to go because you either can't go home, or would rather be in the company of other people, then please check out:

http://findaroom.danielwylie.me/

I'm trying to do my own little bit to help out the good people of Christchurch!

Thank you very much,

Daniel

Simple C# Email Template 'System'

As part of the new email system in Kustom Page, I decided to build a quick little template system, based off models, that could populate email fields, instead of doing a string.Format.

You pass it in a model (C# object), it runs through each of the properties, and applies them to the template file. Simple? Yes.

using System;
using System.Collections.Generic;
using System.Reflection;
using System.IO;

namespace KustomPage.Emailer.Client.TemplateEngine
{
    public class TemplateEngine<T>
    {
        private readonly T _templateModel;
        private readonly string _templateFilePath;

        public TemplateEngine(T templateModel, string templateFilePath)
        {
            _templateModel = templateModel;
            _templateFilePath = templateFilePath;
        }

        /// <summary>
        /// Renders the template.
        /// </summary>
        /// <returns></returns>
        public string Render()
        {
            IEnumerable<KeyValuePair<string, object>> modelProperties = GatherModelPropertiesAndValues();
            var output = LoadTemplate();

            foreach (var modelProperty in modelProperties)
            {
                output = output.Replace("<<" + modelProperty.Key + ">>", ObjectToString(modelProperty.Value));
            }

            return output;
        }

        /// <summary>
        /// Loads the template.
        /// </summary>
        /// <returns></returns>
        private string LoadTemplate()
        {
            return File.ReadAllText(_templateFilePath);
        }

        /// <summary>
        /// Converts the objects to a string.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        private static string ObjectToString(object value)
        {
            if (value == null)
                return string.Empty;

            if (value.GetType() == typeof(string))
                return (string)value;

            if(value.GetType() == typeof(DateTime))
            {
				// Add formatting here at some point
                DateTime dateTime = (DateTime)value;
                return dateTime.ToString();
            }

            return value.ToString();
        }

        /// <summary>
        /// Gathers the model properties and values into a dictionary
        /// </summary>
        /// <returns></returns>
        private IEnumerable<KeyValuePair<string, object>> GatherModelPropertiesAndValues()
        {
            IDictionary<string, object> properties = new Dictionary<string, object>();
            foreach (PropertyInfo propertyInfo in _templateModel.GetType().GetProperties())
            {
                string name = propertyInfo.Name;
                object value = propertyInfo.GetValue(_templateModel, null);

                properties.Add(name, value);
            }

            return properties;
        }
    }
}

Sample usage

Model

using System;
namespace KustomPage.Emailer.Client.Tests.TemplateEngine
{
    public class TemplateModel
    {
        public string Name { get { return "Daniel"; } }
        public string URL { get { return "http://www.kustompage.com/"; } }
        public DateTime Date { get; set; }
    }
}

And using it...

var model = new TemplateModel { Date = DateTime.Now };
TemplateEngine<TemplateModel> templateEngine = new TemplateEngine<TemplateModel>(model, "EmailTemplates/Test.txt");
var output = templateEngine.Render();

Sample template

Hello <<Name>>,


Pelase verify your account by clicking on the link below:

<<URL>>

This message was generated at <<Date>>

New Car

After years of wanting one, I finally decided to take the plunge, and bought an old Corolla. A 1977 KE30, in bright yellow, to be exact. Why? Want a project, something to call my own. I was also sick of paying mechanics to fix my Subaru. With the Corolla, I can do it myself for the most part.

It currently has a 1.3L 4K engine, mated to a T50 5 speed gearbox, which, to be honest, is extremely gutless. Tempted to do a 4AGE conversion at some point, depending on cost, and time.

So far I’ve tidied up the wiring under the dash (previous owner had used cello tape…), installed a new choke cable, replaced the steering wheel and boss kit with something that fits properly and made it run a little smoother.

Still have a long way to go though, currently doesn’t idle properly with the headlights on, there’s a few spots of rust I need to take out over summer, and it could do with a re-paint. Also needs a stereo and alarm, badly.

My biggest complaint with it would be the ride comfort, it’s terrible, especially at motorway speeds, it crashes and bangs around. The tyres rub quite badly on the front as well, may need to put harder springs in the front. The brakes also have no feel to them whatsoever, which can be a little scary.

Photos

Sitting in the sun.

Rhys installing new wiper blades.

Rhys installing new wiper blades.

 

New steering wheel. Can now see speedo, old one blocked it.

   

iPhone 4

As you may have all heard, the iPhone launch in New Zealand was far from… smooth. Both Apple and Vodafone didn’t announce anything in the week leading up to the 30th. The night of the 29th came, and went. Still nothing. Then launch day, and still nothing.

I had pretty much given up on getting one on Friday, but decided to make one last attempt to get some information, so I headed over to Vodafone on Lambton quay with Brett and Brock. And, amazingly, we got told they were going to be on sale at 12, in very low numbers. In his words, “I can’t say how many we have, but we have at least three, so you might want to hang around.”

So we sat down and started the line, on the concrete, on a cold, Wellington winters day.

Sitting in line...

Mojo Old Bank was awesome, and donated some drinks to the first few people waiting in line to keep us warm. Then the news camera’s showed up. The shame. Not something I wanted to be on the news for, not that I’ve ever wanted to be on the news before.

Amazing Vodafone dropped the price of the phone while we were waiting in line. The 16gb model on a $60 a month plan went from $660 to $560. The 32gb on the same plan dropped a large amount as well (wasn’t paying attention to it though, so can’t remember from what/to what).

And then the clock hit 12. And the first four people in line got called into the store, me being the first, which turned out to be a bad thing as the news people wanted to interview me when I got outside, not that they used it in the end.

But I got my phone.

iPhone 4 Box iPhone 4 iPhone 4

 

 

And so far, I love it. It’s a huge step up from my trusty old Nokia N95 (old being the keyword there). The screen is amazing. Seriously. It makes my Nokia, or even mum’s iPhone 3GS, look dim and washed out. And pixel-y. Even the lack of a physical keypad doesn’t annoy me like it did on the LG phone I had a few years back (and sold after 2 weeks).

I’m also not sure what the antenna issue is all about – yes, I can reproduce it if I grip both the sides very tightly, which lets be honest, 99.9% of people wouldn’t do in day to day use. I have yet to have it drop a call. Although, I’m right handed. I can see how it may be slightly more of an issue for left handed people, I’m still not convinced however.

Would I recommend it? Yes. Sure it’s not perfect, but it does what it sets out to do, and it does it very well.

Kustom Page sneak peak

The next release of Kustom Page is still a few weeks off, but I thought I would give you a sneak peak of what's been happening (and to prove Kustom Page is still alive and crankin')

There have been a huge number of performance and code improvements over the last few releases, and this one is no different. We have spent hours and hours working away behind the scenes fixing everything from database speed issues to javascript issues.

But of course, none of that is actually very interesting until you start using it, so here's some "sneak peak" screen shots of the next version of Kustom Page, and a little something else that's on the way.

View draft and deleted page

You can now see pages you have saved as drafts (and edit them) and deleted pages.

New page editor

Designed to make it easier to managed your pages, it allows you to view to do notes, revisions and your drafts all from one easy screen.

Set page names (properly)

You will be able to set your page names properly!

See?

Sneak peak of something else that's coming very soon

.Net 4.0 with MVC 2.0 on IIS 7.5

This one has had me stumped for a while – ASP.NET MVC 2 sites refused to run on IIS 7.5 (Windows 7). It would either complain and break. Or show me the files in the directory. After a bit of Googling around – I found a solution (that works for me at least):

Step 1:

Install the .Net Framework 4 into IIS using:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe –i

You will need to run it as Administrator if you have UAC turned on.

Step 2:

Install the correct IIS component’s (Control Panel > Add/Remove Windows features > Internet Information Services > World Wide Web Services)

  • Common HTTP features
    • HTTP Errors
    • HTTP Redirection
  • Health and Diagnostics
    • Request Monitoring
    • Tracing

Step 3:

Set the app pool to use ASP.NET 4.0

Screen shot 2010-06-07 at 12.32.35 AM

 

Screen shot 2010-06-07 at 12.33.01 AM

You show now be able to browse to your sites. Not sure why it doesn’t install into IIS by default though…