Featured Project Scotranslate iPhone App Scotranslate iPhone App
Latest Blog Posts

Thoughts on QR codes

For those not in the know, QR codes are the black and white squares you see plastered over marketing materials.

If you have a compatible smart phone, just locate an app for your mobile OS, open it, scan the code, wait a while and you'll be taken to a website. Hang on... was that really worth it?

QR codes gets quite a lot of bad press, however negativity around the technology itself is definitely undeserved. The codes are simply modern-day barcodes, nothing more.  The bad press should lie with the growing number of awful implementations of QR codes.

I wouldn't stick a barcode on my marketing material to advertise a promotion or product, so why would I use a QR code?  From a consumer point of view, I think the barrier to entry is still too high due to the fact that QR recognition isn't native on the on many popular devices and by the time you open the app, the moment has gone.

A few years ago, QR codes were a marketeer's dream.  Phones had keyboards and people hated predictive text. Now we have smartphones designed for web browsing, is scanning a QR code any easier than typing a URL in or searching?

View Post (12) or Add Comments (0)


Scotland for sale on eBay

For anybody who missed it...

Scotland for sale on eBay

View Post (153) or Add Comments (5)


Getting started with github

I've just started using git/github and have summarised below (for my own reference) a few of the commonly used git commands. I haven't included setting up your git client as this is well documented on github's help portal.

Setting up a git repository for an existing project

To initialise the git repository in the current directory

$ git init

Create a new file named README

$ touch README

Add README file to the repository

$ git add README

Add all files in the directory to the repository

$ git add *

Commit to your local repository

$ git commit -m 'first commit'

Commiting changes locally

Summarise changes since your last commit

$ git diff

Commit your changes to your local git repository

$ git commit -m "whatever"

Commiting to github (First time)

Add the remote origin to the local git repository. Do this once per repository.

$ git remote add origin git@github.com:username/repo.git

Commiting to github (Subsequent Commits)

Send your commit to GitHub

$ git push origin master

New files to add?

Add any new files since your last update

$ git add *

Getting changes from your remote repository

To update any changed files from the server to your local repository, if you are working from more than one machine, for example

$ git pull

Deleting

To delete a local branch

$ git branch -d 2012.1-stable

To delete a remote branch

$ git push origin :branch

Checking out a branch

To check out a branch

$ git checkout branch

Cloning

Checking out a project when you don't have a local copy

$ git clone http://github.com/user/repo.git
$ git checkout -b 2012.1-stable origin/2012.1-stable 

Two great sites are Git - SVN Crash Course or an alternative and github help resourses. I'm using Git for Windows.

View Post (428) or Add Comments (26)


Design pattern for ASP.NET MVC 3 application using repository pattern

Below is an example of how I typically implement the repository pattern in an ASP.NET MVC 3 project when using Entity Framework.

Model (Address.cs)

  [Bind(Include = "Id,Address")]
  [MetadataType(typeof(Address_Validation))]
  public partial class Address {}
  public class Address_Validation
{ //validation here }

Repository Interface (IAddressRepository.cs)

public interface IAddressRepository
  {
void Delete(Address u);
void Save();
void Add(Address b);
Address GetAddressById(int intAddressId);
}

Repository class (AddressRepository.cs)

public class AddressRepository : IAddressRepository 
{
private myEntities db = new myEntities();
public Address GetAddressById(int intAddressId)
{
return db.Addresses.FirstOrDefault(d => ((d.Address_ID == intAddressId)))
}
public void Delete(Address u)
{
db.Addresses.DeleteObject(u);
}
public void Save()
{
db.SaveChanges();
}
public void Add(Address b)
{
db.AddToAddresses(b);
db.SaveChanges();
}
}

Controller (AddressController.cs)

  public class AddressController : Controller
{ private IAddressRepository _addressRepository { get; set; } protected override void Initialize(RequestContext requestContext) {

if (_addressRepository == null)
{
_addressRepository = new AddressRepository();
}
base.Initialize(requestContext);
}
[AcceptVerbs(HttpVerbs.Post)] // Example..
public ActionResult _AddressInsert(AddressPartial objItem)
{
try
{ var objAddress = new Address
{
AddressTypeID = objItem.AddressTypeID,
...
} _addressRepository.Add(objAddress); _addressRepository.Save(); } }

Moving IContactRepository to a IRepository<T> interface would avoid code repetition and allow you to share the interface between all your repositories.

View Post (302) or Add Comments (2)


Apple iPhone 4S Siri with a Scottish accent

Bad news for tech loving Scots—the iPhone 4S doesn't always understand what you're saying. Siri, Apple's personal assistant, can recognise accents everywhere from Australia to London. But live in Glasgow and you're out of luck!

View Post (623) or Add Comments (36)


You can manage your Kewney.com account by logging in. [ Log On ]