Posts By kimptoc

Backbone.js on Rails book – for $20 …

Hey you awesome Rails grafter,

Wondering if anyone is interested in getting this ebook/pdf?

http://robots.thoughtbot.com/post/7766484768/backbone-js-on-rails-a-new-dynamic-ebook

Its currently $39 until 1st August, but they have a group (10 copies) option for $199 – which seems to have no restriction on who the 10 are (ie not the same company etc). Hence $20 per person.

So, the point of my post – anyone interested in combining with me on this? Its done via github accounts – the book is being written on there.

My thoughts are I’d pay the $199 and then you pay me $20.

If interested, please mail me direct via chris at kimptoc dot net.

Thanks,
Chris

PS Paypal is fine :)

PPS Names  9 – yay, ordered it!

PPPS +2 extra… wonder if there will enough for another group order :)  … or maybe one of the 9 will change their mind :(

Also thanks to Riccardo for the SD Ruby Backbone presentation link. Also found a Peepcode ($12) screencast too. Obviously there is also the official Backbone site too :)

NOTE – and this book by Giles

 

Installing Heroku client on Ubuntu 10 under rvm

NOTE: If you are not using rvm, this may work more smoothly, but I want to use rvm, hence the pain :(

FIRST – make sure your Ubuntu box is ready for Ruby. If this is not done correctly, you may need to re-install ruby several times, which can get quite frustrating :(

sudo aptitude install build-essential bison openssl libreadline6 
libreadline6-dev curl git zlib1g zlib1g-dev libssl-dev libyaml-dev 
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf 
libc6-dev ncurses-dev subversion

Then install rvm

#Install RVM and ruby 1.9.2 on Ubuntu 
sudo apt-get install curl build-essential libssl-dev libreadline5-dev 
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) 
# Add to end of .bashrc file ... 
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" 
; fi 
# Open a new terminal 
type rvm | head -n1 # Should see "rvm is a function" 
rvm notes # to make sure of a good install 
rvm install 1.9.2 # Installs ruby 1.9.2 
rvm --default ruby-1.9.2 # Makes 1.9.2 the default ruby 
ruby -v # Should see the 1.9.2 message

Now you should be able to follow the quick start guide, and “gem install heroku” should install it and its dependancies…

http://devcenter.heroku.com/articles/quickstart

Gem dependancies:

  1. rest-client
  2. mime-types
  3. launchy
  4. readline (although I thought we’d tried the readline workaround below)

Sources:

  1. Heroku Groups
  2. Ruby openssl issues – http://beginrescueend.com/packages/openssl/
  3. zlib issues – http://beginrescueend.com/packages/zlib/
  4. readline – https://rvm.beginrescueend.com/packages/readline/

What if.. you could deploy a Rails app from Dropbox to Heroku…

[twtpoll id=”13twuv”]

How to test a local gem (when no internet available)

Hi,

I frequently use my laptop on the train with little or no internet connectivity.

Thus, when testing locally developed gems, besides running their own test suites, its good to test them with my/an app that uses the gem.  But I want to do this without pushing the gem onto rubygems/github and then pulling it down again.

These are my notes on how I tried to do it – but I did not get it working…

Firstly, I use RVM and Bundler – so any solution needs to be compatible with that.

From this ascii/rails-cast, it seems there should be a rake task of “rake install” which will install into the current ruby/gem environment.

So, the plan is:

  • to switch to my app’s ruby/gemset
  • rake install my dev gem
  • test the app.

However, even though the gem list showed the new gem version, it was not being used.  Perhaps I need to run bundle update…

~chris

UPDATE:

I have found 2 options since this post:

AirPrint to an Ubuntu shared printer via CUPS

Hi,

I have a printer linked to my Ubuntu server at home (sisko/10-ish), which is used for printing from anywhere in the house. It seems that the new AirPrint stuff in iOS4.2 can work with this, with a little jiggery pokery.

The links I have found on it so far are:

After following the above…

Sisko seems to have an issue with dbus and so is not appearing on the network ok – although it works for network printing from Mac OSX.

I also have a netbook running Ubuntu 10-something too – this seems to run dbus fine and appears on the network ok, but printing is not working…

Most importantly the printer shows up on the iPhone :)

Looks like I need to open up the CUPS security a little more…

Found this link which showed how to make OSX find CUPS printers:

https://bbs.archlinux.org/viewtopic.php?id=76914

Specifically:

cupsctl BrowseRemoteProtocols=cups

This link talks about amending papd config files, but doesnt seem to help:

http://www.zaphu.com/2008/04/29/ubuntu-guide-configure-netatalk-to-share-a-usb-printer/

[still not there yet, work in progress]

Wait a minute – its working!  It takes ages to send it from the iPad/iPhone, but its appearing on the printer – yay!

PS Sisko is mainly used for Time Machine backups – http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/

PPS I found this link with a script for generating the avahi service file, will give it a try.

http://www.sharedknowhow.com/2010/11/share-printer-with-airprint-under-linuxubuntu-10-04/

It seems to work – though just as slowly :(

Ubuntu apt-get upgrades kept back.

I usually use

sudo apt-get update
sudo apt-get upgrade

But sometimes things get “kept back”, like for example kernel upgrades.

You can do these using this command.

sudo aptitude safe-upgrade

And it gives you the option for the other updates.

Playing for Success – at risk?

to steve.bullock@lewisham.gov.uk
cc camerond@parliament.uk,
cleggn@parliament.uk,
effordc@parliament.uk

Hello Mr Bullock,

I understand that given the recent budget cuts that the Playing for Success program in the Lewisham borough is at risk of being closed down.

If this is the case, I would just like to make a plea for it to be kept open.

Every term, around 75 children from the borough, your borough, are taken through a 10 week IT focussed training course, which helps build their confidence in themselves, in these tools and in their education in general. It has been doing this for several years now and the students enjoy it enough that the ones who take the primary version of the course are keen to come back and do the secondary version.

Its not the most perfect training course, its run on a shoestring, largely by volunteers, myself included (sorry, did I disclose I have a personal interest).

It does not solve all problems, for example this term we have had a few of the students drop out of the course because of badgering from their “mates” that it was not “cool” to do the course – but it is something, that some students can attend, can work towards completing – they get certificates presented from the Millwall FC team, at a presentation along with all the other students for that term.

I appreciate these are “tough” and we all need to tighten our belts, but even more so, I feel that closing down programs like this will mean less help for the most at risk in our society.

I look forward to response on this matter.

Regards,
Chris Kimpton

How to setup Xcode to share code across iPhone projects

The long story is here: http://www.clintharris.net/2009/iphone-app-shared-libraries/

The short story is here.

Global Settings, i.e. do this once:

  1. Set up a shared build output directory that will be shared by all Xcode projects.
  2. Add a “Source Tree” variable that Xcode can use to dynamically find the static library project. (for each project to be shared)

Per Project Settings, i.e. for each project that uses the shared code

  1. Add the shared project to this project, DON’T select “Copy items into…”
  2. On linked project properties/General tab, select “Relative to COCOS2D_SRC”
  3. On the Target properties/General tab, add “Direct Dependencies” for the shared libs, e.g. cocos2d
  4. On the Target properties/Build tab, ensure there is no hard coded path in the “Library Search Paths” also add a “User Header Search Path” of $(COCOS2D_SRC)
  5. Drag the required static libraries from the shared project into the “Link Binary with Libraries” folder for your target.

And thats it :)

Git – local uncommitted changes, cannot merge

So you’ve made some changes locally but there are changes on the server that you want – so you want to merge them into your workarea.

Great, git pull… but no, this aborts if there are local uncommitted changes :( .

So, instead, you – you can either throw away the local changes using “git reset –hard”.

Or if you want to keep them, use “git stash”, like this:

git stash – saves your changes away on a branch.
git pull to get the remote changes
git stash apply to apply your local changes to your workarea.

Why couldn’t they just merge, or at least have an option for it? :(

Git – making a local repository remote

You’ve started that funky new project on your PC, done a few bits, checked it into your local Git repository, but now you’ve decided to push it onto your remote repository.

Assumed that you are using ssh to connect to the remote machine.

Firstly, on the remote box, make the directory for your project, cd into it and then set it up as a git repository, like so:
git init --bare --shared
Then back in your project, where you’ve previously done a git init, git add . and git commit -m "comments", do this:
git remote add origin [user]@[git host]:[path to project dir on host]
This tells git where the remote origin is for your local project.
Then you need to push your local code into that repository, with this command:
git push origin master

This will create the repo.

There are 2 other things to be wary of:
– how to use your local repo and push/pull to the remote one.
When you first do a git pull back into your local repo, you may well get an error like this
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either. Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull ').
See git-pull(1) for details.

To fix this, you need to do tweak the local settings … but perhaps its easiest just to clone it again and things will be set as needed.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

branch.master.remote =
branch.master.merge =
remote..url =
remote..fetch =

This does it quite well:

git config branch.master.remote origin && git config branch.master.merge refs/heads/master

– how to clone it, so you can push/pull too. TBD

EDIT:

This link also covers things quite well.