Archive for category Web Development

Access iOS simulator without using Xcode 4.3

Sometimes you need to tweak a website’s CSS to work with an iOS device. Instead of pulling out your iPhone or iPad, you can just use the iOS simulator without even opening Xcode. That includes Xcode 4.3 which sandboxes the old /Developer location too.

Yeah, of course, this is no revelation – but it does surprise me how many people do think the simulator cannot be run by it’s lonesome. To do this for Xcode 4.3:

1. Go to ~/Applications, and right-click Xcode. Select “Show Package Contents”.

2. Go through to Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications

3. Open “iOS Simulator.app” – in fact, go ahead and drag it to the dock if you so wish.

The simulator will sit there with not much to it – unless you have developed apps and previously run them on the simulator. Either way, you can change between the different devices with the usual application menus, and of course rotate the device.

The ability to Inspect Element would be a VERY welcome bonus to this. Fortunately, a solution does seem to be making headway thanks to iWebInspector - just, at time of writing, it supports Xcode 4.2 (which is no complaint seeing as Xcode 4.3 has only just come out, and has relocated the usual developer resources).

No Comments

Misconceptions about Freelancing

Having freelanced for a while now, one thing that becomes irritatingly clear is that those who don’t freelance have some terrible misconceptions of what it is really like. Here’s a brief hint – freelancers do not have more free time, and it is not stress free, not by a long shot.

…and for the record,  I prefer it that way.

[I know that there are going to be full-time developers who read this and say "I do that too, it's not just freelancers" and depending on the company they are with, they could very well be right. With most companies though, you start at a specific time, and finish at a specific time. The company isn't going to set you homework, or demand you learn x or y. Again, with MOST developer companies, certainly not all.]

 

There is a difference between having flexibility and having freedom – you still have to do many hours of work – sometimes more, sometimes less. If you are late on a project, then it is not a manager above you who will deal with the client, it is you. As easy as it sounds to “just do 8 hours straight and it will be done”, you also have to take into account the fact that clients will phone you at unexpected times. Previous clients may contact you to want quick changes – ones which throw you briefly off course on your current project.

Aside from client work, you also have to keep your skills up to date – what are the new frameworks doing? What are other developers working with? This leads to quality time networking with other developers, even if they are essentially your competitors. I am not saying this (or any of these) is a bad stage, but it does add up to serious amounts of time.

Now let’s assume that you, being the dedicated developer, have your own projects too. You have just set aside maybe 10 hours to finish a client project which had an unexpected twist, and now you really want to get some of your own projects done – ones which are on top of the client work, and on top of tinkering around with new frameworks or concepts. You are likely combining this step with the previous step – developing your own projects and trying out some likely experimental ideas or at least concepts you haven’t done yet – the bonus being that the deadline is decided by you.

On top of that is expected client communication – where you set aside time to contact potential clients and discuss their project, iron out any problems, and negotiate. You could spent a good hour or more doing this with one potential client, and STILL not get the project.

If a freelancer fails someone, then it is at their peril, not a battle-hardened boss who has had decades of communication skills. You are not going to get a “guaranteed” salary and a slap on the back of the hand for letting a company down – if you slow down the work, you earn dramatically less. Simple as.

I am not complaining, or trying to paint a dark cloud over things. I am trying to explain that, as a freelancer, you are not going to have the freedom which most non-freelancers seem to assume.

 

Common Scenarios:

“You could have cleaned the house? – you were home all day!”

“Yes, I was home all day, in my office, working flat out for the last 8 hours, now I am about to go back in there and finish a few things off. Then I might work on my own project for a bit.”

 

“Coming to the gym? At 2pm? Seeing as you can just work later on instead…”

This is where it gets irritating – the “Seeing as you can just work later on instead” as if I would be rude to turn down the offer of dodging out for an hour. I cannot count on fingers how many times someone has added that to the end of a question, implying that I have no good excuse. Just because you are in a job which involves clocking in at set times, doesn’t mean I have it any better off. If I had a dentist or doctors appointment, or some other urgent request, then yes, but not necessarily recreational reasons which typically take hours, especially if you tack other ideas on to it.

 

“Can you do {insert almost pointless errand here}? It will only take you half hour…”

“No I can’t. You see, during the day, I tend to charge people for my time. Things like that throw me off course with whatever I am currently working on. Doing anything else when my mind is set on working, is a very frustrating task that will only get done half-assed.”

 

“I have the day off! Coming to do {something recreational}? Everyone else is in work.”

“Yeah, that ‘everyone else’ also includes me. You having a day off does not make it easy for me to skip a day’s work.”

 

“Coming on holiday for 2 weeks? You don’t have to ask for time off!!”

“No I don’t. But I also stand to lose a small fortune for that time off. I also need to warn clients that they will not likely be able to contact me during that time, unless we go on holiday somewhere with a reliable internet connection. Even then I bet you will moan the moment I have to stop in the hotel for a half a day. Remember, I don’t get a paid holiday entitlement either.”

 

(As a finisher to most of the above) “Yeah, but you can just work longer another day, or two.”

“Yes, let’s turn a typical 9-12 hour work day into a 16 hour day! I’m sure when my eyes are bleeding and my brain has slowed down from overload, then I will look back and smile that I got to sit in your house for 4 hours staring at an Xbox with my mind stuck on work…”

 

So, freelancers are scrooges? No…

I do think about spending time with the people above – just, there is a time and a place for it, and certainly not a week day afternoon. Evenings are much easier to spare, and so are weekends – the flexibility during the standard week day doesn’t mean it’s a good idea to avoid working during it. I can take arbitrary breaks, but not for long, and I still make up the time somewhere, as close as possible to the time taken off.

Even though it may be the “same thing” as working on a client’s project – working on my own projects feels a lot different. There is a certain extra freedom to it, because I decide what goes into them. In my mind, personal projects are more recreational, so they may be a nice evening task. Fact is, it has the side-effect of helping my skillset.

Freelancing is its own unique challenge. It can have some serious pain-inducing episodes where things seem to be going terribly unreasonably. You are going to get clients who will take advantage of you, and make any time spent on their project a serious pain. On the flip-side though, you are going to get mostly very pleasant clients where things go smoothly, and both parties look back and smile at how nicely things went. Getting paid to do the job you love, and seeing the client happy with your personal effort is a very rewarding end.

 

No Comments

My Lean Mean Developer Machine

Earlier in the year I decided to splash out the rather ambitious price for a Macbook Pro. Apple had only just released the new model, so it seemed a good time to get it, without a few months later experiencing the gutted feeling of a new, much better model being released for the same price (which happened with the Mac Mini).

It does give me a horrible sense of guilt for having so many computers, most of which are sat there with no purpose any more. When I think how much money went into those, it’s never a good feeling. I guess I can redeem that by donating all the machines to people in the family, though it seems the desire for desktop machines is waring thin.

So, why a Macbook Pro? Here comes my obligatory list-style summary:

  • It can run anything. Yes, anything. If I want to play games (which is rare these days), then I will install Windows 7 and dual boot. This point alone makes the previous gaming laptop redundant. If I need to test something in IE6, then I put Windows XP into a virtual machine, likewise with any Linux distributions.
  • My workstation is anywhere I need it to be. It is a light machine for carrying around – MUCH lighter, and much more slim than the gaming laptop. Digging it out in Starbucks, or a library is a breeze, likewise with getting it there.
  • Previously I would carry a monitor, a keyboard, and the Mac Mini between the house in London, and the house in Cardiff (I don’t own those houses). Obviously, the portability of a notebook makes that effortless.
  • It runs Ubuntu server edition in a virtual machine, which any machine on the network can access as if it were it’s own standalone machine. No fussing around with MAMP, WAMP, and whatnot (I shut down the virtual machine when connecting to public networks however, but so far any development work done whilst using a public wifi has been iOS development).
  • I don’t have to switch between machines anymore, especially when I can switch between operating systems on the same machine. It does still sound like ‘effort’, but the amount of physical space on my desk, and under it, is drastically reduced, let alone not having 8 different plugs routing through extension cables.
  • If I need to demo something to a client at a meeting, then there is never a case where “ah, I can’t view that file with x or y” – as with before, if I need a certain OS, it will be somewhere on the Macbook Pro.
  • I still have dual monitors when at home. The legacy of the desktop machine is that there are two monitors which would typically be redundant. One is hooked to the Mac Mini, which is in turn a TV set top box, the other is the companion monitor to the Macbook.
  • I don’t use it yet, but because of iTunes’ impressive sharing abilities, if I want to watch a recorded TV program in a different room to the Mac Mini, I only need to sit in front of the Macbook, and stream the recording over.
Now, most of those points aren’t unique the Macbook – if you don’t need OS X, then you don’t need a Mac. But if you are weighing the pro’s and cons when looking for a machine that can handle any desktop-related situation, with any piece of software from the last decade, then this is a winner.

No Comments

Removing the shackles

I have handed in my notice in the current company after thinking about it for over a month. The simple reason is, it is not my goal to work for someone. The only reason I would, in future, is if I have a big say in running things, or I am so desperate for money that it is the only option, which is the reason I went into a typical 9-5 job in the first place.

Instead I will be a freelancer or at least to most of the description of a freelancer – I won’t be chasing up clients or hoping to find more – that is dealt with my someone else – I guess you could call the position an “independent developer”, much like an independent financial adviser working in a firm would have other staff who handle some of the more, “officey” tasks letting him/her get on with the task at hand. One thing that sold me was that, the company’s weekly meeting was down the pub on a friday – what a way to end the week!

The new company boss was also the Technical Manager of the previous company, and from the first day, we got on very well. Having someone extremely technical managing the staff is a plus – at least he knows what can and can’t be done, and knows the best ways of doing things also. When the manager isn’t technical, you will find yourself endlessly repeating things which are obvious to you, protesting against what is blatantly wrong, and being received with rude stares of ignorance, usually to have to do the wrong thing anyway.

This hopefully means the end of the 9-5 routine for me, which I have always believed to be counter-productive. If you have a bad morning, and come in lethargic, then the company will be paying for poor effort from you. If you then wake up during the day, then you would be going home when you could have a few more hours “in the zone”, getting on with work at a good pace. My best time seems to shift every so often too – sometimes I work like a machine at night, sometimes it is during early mornings, but when your routine is the typical bankers office routine, then you can’t maximise on that. There is a reason the biggest developer companies allow their developers to be flexible you know…

Things haven’t ended on a negative note though – just, in an industry so fast paced, it is very bad when you don’t get the time to learn new things. Nothing makes life drag on than a project that never seems to end either, so I am going back to my old roots – the reason I became senior developer after a week of working in the first company, is because I spent so much time doing web development at a much, MUCH faster pace than college or university. Imagine how much further ahead I could be if I carry on with that pace for just another couple of years at least.

In a nutshell, this move allows me to:

  1. Grow my own skills again, which is what got me ahead of the league in the first place
  2. Work in my own time patterns – no more waking up against the natural cycle just to waste a morning over-lethargic, or going home bang on 5:30 when I could easily do a few more hours whilst in the zone
  3. Not bother with any ‘office politics’ or ignorance – the current company was pretty good in this area though, and no one really put others down simply for existing
  4. Make my own money – at least indirectly – freelancing pays the bills allowing me to build my own projects, it makes my friend money, and he, and others prevent me from having to fuss around with hoping someone will pay
  5. Live a cheaper lifestyle, old friends, more freedoms, more income, and new friends in a city where lifestyle is a bit more relaxed

No Comments

MVC and Codeigniter

Codeigniter is a damn good PHP framework. Very quick, and very easy. Great.

The problem though, was getting into it. Examples are typically a tiny blog application with minimal functionality – ok it gets you started, but when it comes to following the MVC structure, one problem very quickly arose - repetitive code.

Lets say you have a site with a more reasonable number of pages. Sticking to the pattern, controller functions do not call other controller functions – just models, and passing results into views (simplified explanation). Now, this quickly lead to masses of repeated code to gather data for the page header, left, and right columns.

Of course they can go into a library, but even then there are contrasting opinions – libraries can make a large task much easier (and of course, stripping out repetitive code), but when it comes to the task which the Controller should handle, then comes the dilemma of an “ugly pattern which breaks the rules” or the same code pasted again and again into various controller functions just to build the common parts.

After trying to be strict with the pattern, the result was a huge mess of similar code everywhere. Not acceptable.

Phil Sturgeon (one of the legends behind the framework) posted on his blog about extending the Core Controller class to handle common tasks such as whether the user can view the page (with admin permissions). I took this further, and implemented another layer – a “layout” controller.

This controller handles the common views – the left column, right column, the header, and footer. Each controller method calls just one function, which in turn calls the left, right, header, footer functions to construct the page, then the controller function itself handles the logic dedicated to the actual page in question.

This approach has shaved off 70% of the code for the controllers. None of the controller code is repeated, so when it does come to making a “quick change”, it is done in one place, not potentially ten or more.

At this point I don’t care if it breaks some strict rule of patterns – it makes the job much more efficient for the development team, and the code is still very predictable. I would rather spend the time creating new functionality than carefully duplicating the same fixes into the same copies of code throughout the controllers – a framework is supposed to handle the typical support code to let the coder get straight into productive development work. Codeigniter does a very good job of this.

Rest assured though, I do not blame Codeigniter for this – nor anyone in particular. It was my dilemma of trying to be strict and follow ‘standards’/rules, vs doing The Right Thing. I fail to see how drastically simplifying the code and improving efficiency dramatically is a bad thing.

No Comments

11 Days

Thank you, royal family, for allowing a bank holiday to be issued for the royal wedding. Personally I won’t sit and watch it – weddings don’t interest me, and i’m sure with all the people obsessing over the lives of two people, they certainly don’t need one more person joining the fray. What does interest me though, is the much needed break.

Taking just a couple days off work means that, this bank holiday weekend, the weekend days itself, and the royal wedding day, means that there is a stretch of 11 days to relax, and do the things I enjoy the most. Coding.

Sounds strange? I get time off from my day job of coding, just to “relax” by doing the same thing? Well the error with the question is the word “same”. Even using the same languages and technologies, it is not the same when you are working on a different project. In fact it is usually more fun, and full of it’s own little challenges.

Work’s Project

The project in work started very early this year – about a week into January. It was released fully featured two months later, and then promoted. All in a fun stretch of coding. The problem now though, is that it is not fun – because the site has gone through a re-design which, to be fair, was required. The problem for me is that I now have to essentially sit there tediously re-arranging a working system, to work for a completely different front end.

That has to be my weakest area of programming. I can blitz through new projects without stopping for breath, but when it comes to re-arranging and dramatically changing a system I spent months getting to work in the first place, that’s when it stops being a creative exercise, and becomes just moving parts around. In a perfect world, it would be  quick job – the programmer filled with the enthusiasm to get it done quickly, but for me, I slow down quite dramatically and lose interest.

The plus side is that, with the extra scrutinising of the code, I pick out and improve on some areas. A small number of parts had been coded specifically for one purpose, or done quickly to fix a bug whilst the site was going through a promotional event – now it’s been fixed properly, and improved. Because I built the system with re-usability in mind (which to be fair, most sane developers would), any mass changes of the core system won’t effect other parts too much because the location of any calling code is so predictable.

Maybe I should think of it more as an in-depth personal code review, than a re-arrange, but when you have just finished developing a system, developing it AGAIN straight after is about as fun as being given 50 maths exercises on the same exact topic.

With all that said though, the re-design of the site is quite exciting, much more flexible, and much more user-friendly and powerful. It will be worth any monotony associated with gruelling over the same code.

No Comments

Big old London, big old start

Moving to London was actually a much smoother process than I thought it would be. I guess it had far less obstacles to deal with than what would be typically expected though.

The quick news – the client I mentioned previously offered me a position as the company’s CTO. We met up in Cardiff to discuss it all, and later all went to London to start the company. There are three of us, and a typical work day sees some serious productivity in the roles we are most suited to. In less than a month we even get our own office premises, bought out, in which we will rent out office space to more than pay the utility bills.

Moving away from home was a huge change for the better. If we want something, we go get it/do it. We have more space, and our own rules. If I want a whiteboard on the wall, I can simply nail it in. If I want to listen to loud music whilst bashing out code, then great. But the best of all is that it is a new area, new people, and in the week i’ve been here, I have never felt more at home. London may be insanely huge, but in the local area alone, there are 8 ‘corner shops’, 5 parks, a few shopping centres, loads of places to eat out, and whatnot. The tube station is a 4 minute walk away, taking us down the Kensington line. One of the people here is a keen cyclist and runner – do you know how long I have wanted to actually go cycling with just one other person? The running is great too, and is of course, far more interesting than using a treadmill.

The job

The director’s vision is simple – whatever we approach, we innovate it. He was looking for someone to deliver this goal. He bought me an iPad without me even asking, with the goal being to research current games for the iPhone/iPad platforms and see what we can come up with. Though the first goal was website development (making our own sites and managing them, rather than building them for other people and only getting a one-off income from it), shortly after was the requirement for an iPhone app to use the most important features of the site suitably on a small device. Then was idea of creating all sorts of games for such devices, especially ones that can use the sites in some way. The response was simple and with eyebrows raised in excitement followed by a huge grin – “no problem!”

I am finally pleased to be able to use what little games programming experience I gained, in a big way. Focussing on the iOS platform seems a good step too – even if, somehow, the iPad and the iPhone fail overnight, the experience of using such sophisticated touch-based systems is a good step for future technologies – PC World alone have started to boast touch screen desktops, which could see an introduction of games which do not require the mouse – heck, the iPad has a Command & Conquer Red Alert game…

Of course iPhone/iPad development cannot go ahead without using a Mac (as strict as I believe Apple is when it comes to using their products, this is one area I won’t hold against them simply because they are not the only ones doing it like this – you cannot develop Windows Mobile software without using Windows). So, solving that obstacle simply meant buying a Mac Mini, and to be fair, I am impressed by the XCode IDE.

After all this time, my goal of starting a business with someone, in some form has come true, at last. With two large, very detailed websites, their corresponding iOS apps, three games in the planning, and the various business set up tasks, the next half a year looks to be very exciting!

No Comments

Xbox Live Achievements – on a webpage?

Xbox Live brought about a way for gamers to prove their individual successes with any game on the console. Some were easy – part of the storyline of the game, some were rewards for going above and beyond – some were rewards for doing something very secretive. The end-result is that some gamers tried to milk every last drop from their game in order to collect all the achievements for a game, and thus, a higher gamerscore for their profile.

In a last minute dash of experiment, I decided to make an Xbox Live Achievements system for a website, starting with a section that hasn’t officially been released yet. The idea is that:

  • Members collect points for contributing to the site
  • Members can see just how much they’ve helped, even compared to other members
  • Members who earn over an X amount of points get rewarded

This provides the user with a few basic reward mechanisms. For completing an achievement, the achievement pops up top centre of the screen for a few seconds, showing how many points it earned them, and which achievement it actually is. Their forum profile lists a table of all their current achievements, and totals.

Achievement Popup

Achievements List

How successful this does is yet to be seen. Aside from the obvious gimmickry, it provides the site’s staff the ability to easily reward members with valuable rewards, and the quick ability to show other members exactly why one of their fellow members are about to receive a brand new iPad, or a £20 iTunes voucher, or something to say thank you in a big way. (for the record though, such rewards haven’t been decided – I am not going to promise an iPad for getting 5000 points just to find out someone Slashdot’s this, and suddenly 200 people qualify. Not that someone would do that anyway).

There are basic rules to define an achievement – an achievement:

  • Must be obtainable by anyone. An achievement to be the author of 50% of the articles on a site is going to be near impossible if there are 200 articles on the site.
  • Must have a value to indicate the effort required for the achievement – reviewing 100 maps just for 5 points is just daft, especially if another member just gained a prize for adding three galleries for 10 points.
  • Can’t be revoked. If someone achieves something, they shouldn’t have it taken away from them, even if they become an aggressive troll.

Now, I certainly don’t think this is going to transform the site overnight, if at all. A lot of members seemed to like the idea, but a lot are also Xbox owners. The system is built in such a way that it is not dominating – if someone doesn’t like the achievements, chances are they won’t see much of the system anyway, but it is there for those who do. Implementation was quick and straightforward, so if this does nothing in the long run, then it’s not the world’s biggest shame.

No Comments

Theming, actually not that bad

Before, I expressed a problem I had with designing a website. Now, I am writing in a better, more confident mood about it.

Actually, the hardest part was finding colours that work together. A problem here is that it is relative. But a counter to that is that if someone is looking for particular content, they won’t sit and review the site’s theme. But again, to counter that, first impressions mean a lot.

The obvious is for the theme to look clear, so that the individual can find what they want as quickly an efficiently as possible. That would be one good first impression. No one likes visiting a site they haven’t been to before, and spending even minutes trying to find what they are looking for.

People who regularly come back to the site also don’t want to sit in front of a theme that makes their eyes bleed. For the background of the site, it was a tough choice – to go against the site’s main use of blue and peach, I tapped into green’s range, ever so slightly. The result was less taxing on the eyes than the same almost-grey-but-purple shade.

I’m also suprised at the detail added by simple drop shadows and rounded rectangles. They are small details, but they make a suprising difference. When using the old theme, the site feels old. The new theme makes it feel fresh, and also more robust, as if the quality of the theme reflects the quality of the functionality.

These are still beginner approaches, but they do make a difference. This has given me an interest in image editing to some degree. Finding my way around GIMP and Photoshop would make things a lot nicer when it comes to editing textures for the game engine.

Can’t Wait for Christmas

Ah yes, Christmas is not too far off. But i’m not looking forward to it for the presents and feasts – my partner in crime and I have decided to set aside a few weeks to work full time on the game engine. The result should be a significant part of a small RPG engine. That is, we should have procedurally generated terrain, with realistic grass, omni-directional shadow maps, a nice particle engine, an inventory system, convincing water, vegetation, and detailed texture mapping on the terrain (with the vegetation following suit). Anything less than the majority of those features would cause a bitter resent for the time and how it was used.

No Comments

Post Launch Day

29th September. Time’s ticking by, and the site has really taken shape. Is it ready for the public? Can it survive the public scrutiny? Are the bugs ironed out?

Time will tell.

Either way, the site has been released at long last.

To give it a nice, memorable date, I spent the remaining 5 hours of Wednesday making sure everything was going smooth. The site was then uploaded, the database cleared of test data, and the countdown began – the idea being to initialise the site as close to midnight as possible. The site’s “birthday” then being 1st October 2009.

As I type, there are now 11 events. After hours of data inputting, I came across a rather serious dilemma. You see, Britain is divided into counties. These counties have changed over the years, some changed during another change. We are now left with some nice large, general counties, some sub-divided counties, some created to help the Post Office, others created to serve lieutenancies. The trouble here is that I don’t know which county sets to use. One idea is to use all of them, but different sources of information provide conflicting data on which county’s serve which purpose.

In the end, I didn’t see much harm in adding all county’s. Except when you try to find all towns/cities in, say, Wales, and the data there is different to how you know it. Take Swansea – it should go in the County of Swansea, yet Yahoo’s directory lists it under West Glamorgan. Which is correct depending on how you look at it, but will someone searching via county get the results they expect?

In an ideal world, people would be fully aware that Swansea (and County of Swansea) is in West Glamorgan, which is in turn, in Glamorgan – the original county. But will people select those? That’s not even the entire point – the point is, this is adding a complication to what should be a very quick way of getting information. If someone is trying to find Singleton Hospital, then one would assume they would select Swansea as a county. But in this case, the user would not find the event, as the event is listed under West Glamorgan.

So here comes the solution – parenting. County of Swansea is added as a child county to Mid Glamorgan, which is in turn a child county of Glamorgan. Selecting either in this relationship shows the necessary events. But this adds a problem that I, as an individual, am not going to know accurately about, say, Scottish county’s. Information online seems rather disagreeable too. A best guess is to take various maps of the county’s from different years, and compare positions.

Towns have also added a problem. Penarth, and Sully were added as towns. Yet an event in Sully is addressed as Penarth. This is apparently, correct. So now, there’s the problem that there is a lot of towns that are part of other towns. As far as I am aware, Sully is a rather small area and cannot really be regarded as a town.

As people add events, hopefully this will filter out which towns can be discarded. All I have learned from this is that Yahoo’s directory could be a bit sharper.

No Comments