Wednesday 20 November 2013

My thoughts on the PS4 vs XBox One

Reviews have begun to land for both the PS4 (1, 2) and the XBox One (1, 2). So far I'm not hugely impressed with how launch of either console has been met.

Below I offer my thoughts from these reviews.

The PS4

The PS4 is a very pretty console, smaller than the 2nd gen PS3 slim which is very impressive considering it contains an internal PSU. It really looks the business and I can see it selling extremely well in markets like Japan where a small form factor is really important. So from a hardware perspective Sony really nailed it. One gripe I have is there is still no USB port at the back of the console although the PS Eye camera has its own proprietary port (what was wrong with USB I wonder?).

The redesigned dual shock controller looks good fixing some of the complaints in the PS3 controller such introducing inverted stick nubs. I wonder how some of the functionality like touch, microphone, speaker and light will work in practice and affect battery life. I doubt 3rd parties will put it to any more use than they did with the six axis stuff in the PS3. What is certain is that these controllers are going to cost a lot more money than the SixAxis / Dualshock 3 did so I hope that functionality DOES get used.

But while the hardware is getting high praise the firmware certainly isn't. Reviews have been somewhat confused because Sony dropped a day 0 firmware update on reviewers and sometimes it is hard to tell if the bulk of their review was using 1.0 or 1.5. But even 1.5 seems to lack DLNA playback, local file playback and other functionality which people take for granted on the PS3. In fact media support seems almost deprecated which is a shame - the console is quite capable of serving as a media player and it should do so. I have no doubt the media story will improve in time (the PS3 only got stuff like DLNA after a few major updates) but the important point is it doesn't exist right now.

The 1.5 firmware update does enable remote play on the Vita which could prove a sales boost to that platform - it definitely needs it. I read that remote play support is mandatory now and the burden to support it is relatively low (just a different control scheme) so the Vita could prove to be a really useful thing to buy. I wonder if games can use the Vita like a smart controller (like the Wii U) since that would be useful too.

As for launch games, the only one which piques my interest is Resogun. I LOVED Super Stardust HD and this looks like its spiritual successor. SSHD was the best value for money I ever spent on game on the PS3. The remainder of release titles are mostly some play-it-safe exclusives and 3rd party ports. Knack is the runt of the litter. Killzone looks like a technically proficient but unimaginative shooter. The 3rd party titles like Battlefield 4, Assassin's Creed 4, Call of Duty: Ghosts, Need for Speed: Rivals are basically the same as the PS3 version with a higher resolution and minor improvements to shaders and antialiasing. It's all very safe and not very compelling.

The XBox One


The XBox One console could be charitably described as bland, less charitably as fugly. It's even bigger than the original XBox 360 which is in stark contrast with the PS4. It is strange that Microsoft would make so little effort to make the console smaller, more attractive or integrate the PSU which is a giant brick just like the 360. As I mentioned in the PS4 section, some regions such as Japan high regard good design and there is none in evidence in the console.

Just look at the difference in size between these consoles:
(from ars technica)


The main curiosity of the hardware is the HDMI-in. The idea is that you could plug your satellite or cable box into XBox One via the HDMI in and use the XBox for reminders and EPG and to change channels. The Kinect can apparently blast out IR pulses so that even IR controlled set top boxes can be controlled this way. But I question why anyone would want to run up a power bills by running the XBox One in addition to the set top box. I hope it will act as a pass thru when the console is in standby. I suppose it lets someone watch TV while playing a game. Beyond that I don't see much point. It is unlikely that Microsoft could add trickplay, live tv pause or recording since content is likely protected with HDCP.

Reviews do complement the controller which is almost identical to the 360 controller. It looks very nice, although the controllers still use replaceable batteries. Somewhat bizarrely there are stories that Microsoft spent $100 million developing their controller, trying out all kinds of strange ideas and eventually incorporating none of it. http://venturebeat.com/2013/11/18/the-xbox-one-controller-projectors-smells-and-other-stuff-that-didnt-make-it-in-part-1-exclusive/

Microsoft doesn't have remote play but it does have a SmartGlass app which allows smart phones and tablets to control the console. Presumably some games could make use of it to add soft keys, maps, inventories etc.

The firmware seems a lot better and more rounded than the PS4's. It offers some DLNA support out of the gate and stuff like Skype which is really neat. Every XBox One has Kinect so it means a lot of households can benefit from video calls (assuming you want to make video calls). What I think is less useful is all the Kinect integration and the relatively unintuitive layout that hides functions that require voice control to access. Some reviews describe the accuracy of voice control as only 80-90% which I think would prove very annoying. I think voice control will also lead to some epic arguments in some households where people shout "xbox off" or similar. I wonder how they will stop people in team chat / video calls, or even on pranksters on TV from griefing somebody through the voice control.

The XBox One doesn't seem to have fared better in its launch line up than the PS4. The exclusives are getting some mediocre reviews. LocoCycle and Ryse are the XBox's runts. The exclusives Dead Rising 3 and Zoo Tycoon are drawing the better reviews but not great. The 3rd parties fare the best and largely the same as their PS4 counterparts.

Conclusion

I think it's too early to be enthused about either console. Both were clearly pushed out the door on a hard deadline and are missing a lot of functionality. There is a question mark over their reliability, the functionality out of the box, or the quality of games in the near future.

Monday 18 November 2013

Understanding the nuances of Git's squash and commit merge commands can save you a lot of grief

I support a fairly large project maintained in Git. At any given time there will be half a dozen feature branches going on at once with their own schedules for merging back into our development branch.

A developer recently showed me a very disturbing problem that they had encountered. They were attempting to merge from the development branch into their feature and changes that had only been made on their branch were being backed out without obvious root cause. There was no reason that any other branch should have worked on those files and Git wasn't exactly forthcoming with answers either.

Even worse, when I did finally find the cause, I discovered that it was caused by the standard behaviour of a commit merges and didn't happen when doing the equivalent squash merge.

Lets talk about merging

Git supports two kinds of merging called squash and commit. Each kind has its uses and a camp of supporters who argue how it should be applied to feature development branches.

So let's explain these two kinds of merges and the reasons people would favour one or the other.

Squash merge

A squash merge compares two branches (the checked out branch and the incoming branch), and applies the difference to the working directory and commits it. If you were to look at the git log after a squash merge you would see a big commit on the checked out branch containing all incoming differences. You would not see any join between the checked out branch or the incoming branch.

So essentially a squash is just a regular commit.

A squash is useful for landing a feature branch because it does not disrupt the mainline's history with merge points. The feature lands as a single commit and if necessary it can be reverted with a single commit.

The downside / counterargument is that by munging all the commits together as a single commit, that developers lose the history of the feature branch. The feature branch would have to be preserved in perpetuity if someone wished to reference the reason a particular line was changed in context.

Commit merge

A commit merge explicitly joins two branches together with a merge point. Various strategies exist to construct this point but the default recursive strategy essentially wends its way down each branch to order the commits in time and figure out which files (if any) are in conflict.

Once conflicts are resolved, the merge point then becomes part of the history of the checked out branch. If any files were in conflict and fixed by the developer then those files are committed as blobs and the merge point contains a reference to them.

The advantage of a commit merge is that if you were to look at the log, or the blame annotation, you will see the history from both branches. You could even delete the feature branch once it is merged without losing the merge point.
 
The downside / counter argument is that feature branches pollute the history with a lot of noise. There are extra branches to visualize and a branches may contain a lot of junk comments, particularly early in the feature life cycle when people are moving things around, less rigorous with their commit comments and so on.

Reverting a commit merge is also more difficult. Command line git has a special revert syntax to produce a revert commit that nullifies the changes brought in by one parent.


But they produce the same result don't they?

You would think so but you would be WRONG. They usually produce the same results but not always. It was such a scenario which prompted me to write this blog.

Here is the scenario:
  1. A new branch f1 is created from master
  2. A new branch f2 is created from master
  3. f2 commits a change A
  4. f1 accidentally commit merges from f2 instead of master (by using the wrong tag or hash). We shall call this botched merge A+
  5. f1 developer realises his mistake and pushes a revert commit which we shall call A-. So now A- cancels A+ right?
  6. Time passes and f1 and f2 receive more commits and lead their separate lives
  7. f1 commit merges to master with no issue using a commit merge
  8. f2 commit merges from master and suddenly commit A in their branch has disappeared!
If f1 had chosen a squash in 7) it would have gotten the correct result but they did not. If f1 had created a new branch from the previous commit and continued using that, it would have worked. But by polluting their branch with a merge and a revert they caused grief for f2 down the road.



Here is a command line script to simulate the issue:
rm -rf test; mkdir test; cd test
git initecho master1 > t.txt
git add t.txt
git commit -a -m "Master branch"

# f1 changes the file
git checkout -b f1
echo f1 > t.txt
git commit -a -m "f1 branch"

# f2 changes the file
git checkout master
git checkout -b f2
echo f2 > t.txt
git commit -a -m "f2 branch"

# Simulate an accidental merge
git checkout f1
git merge --no-ff f2
git checkout --theirs t.txt
git commit -a --no-edit
# Now revert the botched merge
git revert -m 1 --no-edit HEAD

git checkout master
# CHOOSE THE MERGE, squash or commit
git merge --no-ff f1

git checkout f2
git merge --no-ff master
echo The contents of the file is:
less t.txt
Run this script once, inspect t.txt and you will see it contains "f1". If you change the line below "CHOOSE THE MERGE" to this i.e.. "git merge --squash f1; git commit -a -m Merge" the script will properly detect a merge conflict and warn the user. It would then be apparent there was an issue and give the developer a chance to fix it.

What is going on?

The botched merge is what is going on. The developers of f1 screwed up when they merged from f2 by mistake and then corrected the error. You would think a history which contains A+ and A- should cancel itself out. And if f1 had been squash merged when it went into master it would have.

But git doesn't work off deltas. It works off an index file. When A+ was reverted to A-, it instructed Git to update the branch index to use older versions of those files.
When f1 was commit merged into master, the index of master was also reflected to use the older version of those files.

And finally when f2 next merged from master, its index was also "infected" with older versions of those files and the changes that were originally on the branch just seemed to disappear.

The same scenario could be reproduced with a cherry pick. e.g. f1 cherry picks a commit from master (or another branch) and then decides to revert it. That's fine until it commit merges to master and now master gets the revert too!

Squash merge is simply safer

I hope I have demonstrated a very nasty side effect of using commit merges. If your commit merge contains reverts of inadvertent merges or cherry picks then you can easily spread a bad commit to other branches.

In my opinion squash is definitely a preferred option when landing a feature. It is obvious, atomic, simple and easy to revert. It doesn't contain any nasty "surprises" like the scenario above and it cuts out a lot of noise when you are visualising your branches.

A commit merge is still useful when merging from the master to the feature branch since it provides an obvious merge point and is likely to be periodic and increasing as the feature nears completion. Just don't do it going back the other way.

But what if I really want a commit merge for landing a feature?

Then I can think of several suggestions but they all involve a bit of process to ensure that any mistakes in the branch's history are neutralized by the time of a merge and don't rear up to hurt another branch.

All of these suggestions assume you are working in a team with a branch which is pushed to a server.

If you botch a merge, create a new branch


If you've pushed up something bad then don't try and patch up the damage. Create a new branch immediately prior to the bad commit and tell people to move to the clean branch instead. Yes this is a bit of a pain, but the lesson here is don't push bad stuff.

If necessary other developers can cherry pick any commits they have made since on the old branch. The old branch can be junked when everyone has moved over.

If you have pushed the change to a server, DO NOT attempt to reset the HEAD of the branch.

Rebase the feature branch periodically


Don't use just one branch for your feature, use a series of them and get your developers used to the workflow.

Create an initial branch called featureX/0, and then periodically rebase it as your development progresses, e.g. featureX/1, featureX/2 etc. Uniquely naming your rebased branches is essential if you push them to a server.

Rebasing means you can interactively strip out empty operations. So if you screwed up with a merge, just interactive rebase to a featureX/1 and carry on. Or squash up the changes in featureX/0 (A+ and A- would cancel each other out). Then you have a nice clean, linear string of commits. Squashing is a useful way to eliminate some of the noise that might occur during feature development where things get moved around, reverted, and committed with less than useful comments.

Finally when you are ready to land the feature, you can merge featureX/n (where n is the last rebase iteration) to develop as a no-fastforward merge. Even if there is a dangerous commit left in the middle of your log which you later reverted, it does not matter because you brought everything in as a stack.

Conclusion

Squash and commit merges usually result in the same changes but not always. If you encounter weird merge issues with files changing for no obvious reason then it is probably due to a merge or a cherry pick which was reverted somewhere in the past. Prevention is the best cure, so favour squash merges or rebased commit merges when landing features.

Friday 23 August 2013

Welcome to the meat market (you're the meat)

I sometimes wonder how LinkedIn makes money off of members. 5 or 6 times in a month I'll get invites from people working for job agencies trying to get me into their network. Why I need to be in their network is never explained, but I think I've figured it out and it's all to do with that money question.

LinkedIn offers basic (free) accounts and various premium subscriptions. The basic account is fine for people hooking up with colleagues but gets vague if you search for people outside of your network, blocking information, names, companies and other info. The premium subscriptions provide various tools that let users see more information and also allows them to send messages (InMail) to people not in their network. But it still has limits on some info and how many InMails can be sent. So there is an incentive to connect to a person to get all the info, particularly stuff like phone and email address. I also suspect it unlocks my connections for them to plunder as well.

This article talks about the world from the other side of the free/premium fence, and how best to use the tools and harvest the results. Clearly agencies are seeing LinkedIn as a way to seek out talent through skill matching and search tools. Perhaps it's even transformed the way they work and they use the site far more than they might use the likes of Monster.com.

If I was job hunting I would accept these invites. After all, I am trying to get a job. But experience has taught me that accepting the invitation at other times can be pretty toxic. The main thing I get from accepting is lots of spam. It isn't even relevant spam, just some dumb keyword match thrown out at everyone with a matching resume. My resume has words like Java, C++ etc. so I would receive for jobs in Belgium, Sheffield, and basically anywhere in Europe. There is no way in Linked in to say "I am looking for work", or "I am looking for work within 25 miles of point X" though I doubt it would bother agencies to honour those settings even if they were there.

I don't mind when individual companies looking to fill roles reach out to me - that's fair enough and indicates a level of interest which goes beyond tossing out invites to some search results. But my policy now is to ignore all invites from agencies.

My attitude might change if I'm looking for work again but for the time being I appreciate the lack of spam. And besides if I want to find out about jobs then sites like Monster.com have tools to send out customised search results that I control.

Monday 19 August 2013

Begone ye ad pushers

I have some android apps published on Google Play. One downside of doing this is my email address is published alongside my app. In an average week I receive 2 or 3 unsolicited emails from websites trying to sell me on their ad network.

Invariably these emails all sound alike:

Hi I'm [random-american-sounding-name]

I'm account manager for AdStringOfLetters which is an exciting new way to earn revenue in your app.

Would you like to earn up to $10 CPM? We have advertisers lined up to pay you a small fortune. Just install our sleazy ad software and your app will be infested with interstitials and worse - the ads will literally escape from your app and infect a user's home page and notifications area. Which will totally NOT make your users hate you, down rate and uninstall the app you spent so long writing! Interested? Great! Click this tracking link.

Thanks

Random American Sounding Name


Oh how I hate them. Which is why every time I get one I flag it as spam.

Tuesday 11 June 2013

Rooting the Nook Simple Touch

I snagged a Nook Simple Touch for £29 and I've already given my thoughts on it. I was very impressed by the user friendliness of the software but less than impressed by the limitations in it. In particular I thought the library view was badly designed for large collections of books. I also thought the PDF reader was very poor since I could not zoom into a page rendering it mostly useless.

Fortunately the device is running Android 2.1 underneath so with the aid of rooting the Nook can be made to do a lot more than it does out of the box.

What does rooting mean? It means unlocking the device from its factory settings and installing a new launcher on the device. It also allows the device to install some apps from the Android marketplace, in particular different e-reading apps, PDF viewers and so on.

And don't worry. The original Nook reader software still works after rooting. I have also successfully used Adobe Digital editions protected content on the device after rooting.

The standard disclaimer applies though. These instructions worked for me but I provide no guarantees that they will work for you. If you are in any doubt, then do not proceed.

What you need to root:

  1. Nook Simple Touch, fully charged. My Nook was running 1.2.1 of the firmware which is the latest.
  2. Windows 7
  3. MicroSD card, in my case 8GB with a SD adapter so I could plug it into my PC.
  4. NookManager
  5. Win32 Disk Imager
  6. NGTAppsAttack for the Android Market & GMail apps
  7. A GMail address
The steps to root the Nook were simple:
  1. Download the NookManager image to a PC
  2. Use Win32 Disk Imager to flash it to the MicroSD card
  3. Install NGTAppsAttack as per instructions to MicroSD card
  4. Insert MicroSD into Nook
  5. Reboot Nook
  6. Back up existing Nook firmware from the menu
  7. Install root from the menu
  8. Reboot
  9. Install NGTAppsAttack from Custom Install
  10. Reboot
  11. Follow through the Google Market registration steps
NookManager is a tool that can backup and root your device with a few clicks. It's very easy to use - your Nook boots straight into the Menu and from there you can root. To use the market you have to install NGTAppsAttack.

The only downside of this process is that Android 2.1 is pretty ancient and the Google apps are slightly broken. For example the search function in Android Market does not work. The workaround is to log onto the Android Market from a PC and use the PC to initiate the installation to the device. The device shows up as "phone" for me. Some sites suggest installing an app called SearchMarket which does the same but I didn't feel the need to do this.

After rebooting some things become apparent. First, the standard Nook library is no longer the standard home launcher. Instead you have a launcher which looks a bit like a file explorer. This shows your books arranged by folders. It's more compact so it's an immediate improvement. You also have a button at the bottom which leads to an Apps screen where you can run any apps you have installed. If you prefer you can configure the launcher to show the apps first instead of the books or vice versa. There is also a handy app which lets you re-program the page turning buttons on either side of the screen as Android actions. I programmed the left side buttons as Back and Menu respectively. There are soft buttons for these functions in the title bar but some apps want to be full screen so it's best to set some buttons.

So now you have a rooted Nook, what should you do with it? Consider installing:
  • CoolReader (a free e-reader)
  • Kindle for Amazon books
  • Opera Mini or Opera (a web browser)
  • EBookDroid (a free e-reader with PDF and Comic support)
  • Calculator (choose from the millions on offer!)
  • DropBox for easy file transfer
So now you have a device which can read multiple book formats, including Kindle, PDF and comics, and can read email, act as a calculator or any other simple task. Obviously the Nook will never be much use for playing Angry Birds or anything like that, but it can be a lot more than it is out of the box.

And if you haven't done so, install Calibre on a PC to manage your collection of books and to transfer books back and forth with the device. There is even a de-DRM plugin for Calibre which will strip out DRM which makes it a lot easier to transfer your collection between devices without messing around with third party software.

Monday 20 May 2013

Review - Nook Simple Touch

The Nook Simple Touch went on fire sale recently dropping from £69 RRP to a mere £29. Was it a clever ruse to increase market share, a way to clean out their inventory or the prelude to B&N selling Nook.com? Whatever, it was too good a bargain to pass by.

I confess that I don't actually read e-books that much except when I am on holiday so I bought the device primarily for that. Being able to store a library of books on something the size of a paperback is hugely appealing. I already have a 5" Sony Touch reader for this purpose but the screen is a little on the small side. A 6" Nook doesn't sound like a huge increase over a 5" screen but it's an extra 44% surface area.

The Simple Touch also benefits from supporting EPUB format and Adobe Digital Editions so it's relatively simple to share a collection from one to the other, especially with a tool like Calibre.

First impressions

First impressions were mixed. The Nook arrived in a tidy box containing the device, small manual and charge cable. The Nook's e-ink display showed some instructions to fully charge the device and where the power button was. Most devices have some charge so I hit the power button and nothing happened. I held the power button down for much longer seconds and still nothing happened.

So I plugged it in and left it to charge for 20 minutes, tried again and still nothing happened. I went searching to see if this was a known issue. One site advised holding power down and the Nook n symbol for 20 seconds to revive it. So I did that and was greeted by an error that charge was too low to start and come back in 15 minutes. That message never went away but after an hour I held power and n down again and finally it booted.

So not a good start. I would not be surprised if these devices have been sitting in warehouses for over a year and are run down. It took an inordinately long time to charge it fully - 3 and 1/2 hours.

Once I was over this hump I was able to power it up and complete the registration process. I wish I could have used the device without registering, but it's unavoidable.

The hardware

The hardware itself is quite nondescript. It has a black plastic shell with a rubberised front and back. There is a micro sd slot under a hatch on the side. The back has a large power button at the top, there is a n (home) button at the bottom. Each side of the screen has a vertical ridges which act as page turning buttons. There is a large bezel around the edge and the IR touch technology means the screen is recessed by about 3mm. In the hand it feels about the same as a paperback book.

The device actually sits in the hand extremely well thanks to the curved edges and a hollow in the back to grip it with. The rubber back does attract smudges and grease but it would stop the reader from flying off a table.

The e-ink screen is a second generation 800x600 pearl screen and so the Nook responds pretty much like other readers that use it. The screen has a matt finish and the background is a light grey - not paper white but readable. Like most e-ink screens it looks brighter in strong sunlight. Refresh times are also similar to other e-ink devices and nothing to write home about. Basically you put up with it for the long battery life.

The screen is IR touch sensitive, with sensors around the edge which use a break in the beam to simulate a touch. This is similar to the Sony Touch and it works very well. I had no trouble navigating the device's UI or using the keyboard. I would actually argue that the page turning buttons are so redundant that they should have been done away with entirely.

The software

The software is simple to use and attractive but quite sparse. Pushing the n button offers a small navigation bar with destinations for Home, Library, Shop, Search and Settings.
  • Home is mostly redundant, summarising the last book you read with a link to Nook.com's top 100 books at the bottom.
  • Library shows all the books found on the device shown in thumbnail or as a list. The library is easy to navigate but it's perplexing at the same time. If you have 200-300 books, you would be could be tapping through 60 pages of books because the font used to list them is so large.
  • Shop takes you to the Nook.com shop which is very easy to navigate. But it has the same problem as Library - the font is too big. Search for something the results appear a handful per page. While it's just annoying in the library screen, I could see Nook.com losing money just by presenting so few results at a time.
  • Search is a generic search page
  • Settings is settings
Every screen features a "back to book" icon at the top but it's jammed up against the top edge of the screen and its a little fiddly. So you can jump to a screen and jump back to the book but I would not be surprised if some people failed to see the icon or understand what it did. I am surprised that the n menu doesn't feature a prominent icon for the same purpose.

As a reader

The reader software is very straightforward to use and perfectly acceptable for EPUB format books. Books can be read in a range of fonts, sizes and margin widths and there is note taking, dictionary and bookmarking.

Page turning is accomplished with the rubbery buttons, a tap on the left or right of the screen or a swipe gesture. I thought the buttons are dire because they need too much pressure and often don't click even when they respond. Fortunately the gestures work just fine.
Holding down on a word triggers a menu where the word or phrase can be hilighted, a note added, shared or looked up. Bookmarks can be added by tapping the n tab that appears at the top of a page. Just like the "back to book" option, it's jammed up against the top and fiddly to tap on it and again there is enough space in the reader settings menu that it could be displayed more prominently.

The reader settings such as font and font size are reached by tapping the centre of the screen or on the page number at the bottom. However these seem to be global settings which might not suit all books. It would have been nice to remember the settings on a per book basis.

What isn't so good is the PDF format. You get a full page view with no way that I can tell to zoom in or pan around. This makes it essentially useless for technical documents, or comics or anything else which might have reason to use the format.

Loading books

The Nook presents itself as a storage device so installing EPUBs or PDFs is as simple as attaching it to a computer, waiting for the NOOK volume to be mounted and then dragging and dropping files. If you have Calibre, it works perfectly with the device.

Rooting Potential

Lots of tutorials exist such as this one on how to root the device. Given the limitations in the software I think I will be doing this sooner or later. This is another example of B&N shooting themselves in the foot. If the software were more advanced, there may be less reason for users to root around the limitations.

Verdict

The Nook Simple Touch is a decent enough device and lives up to its name - it is simple to use. But that could be a problem if you want advanced functionality like PDF reading, or have a lot of books because it lacks a degree of configuration which could make it more powerful.

But for £29 it's a bargain and as a reader it works really well. And if you don't like the software, rooting is possible with little effort.