Why Google Sucks…


‘cos they have no UI experience.

Take a look at Gmail - almost unusable with bizarre icons whose purpose you’re supposed to guess at. Like the Stop sign with the exclamation mark - how on earth is that supposed to mean Spam?!!!

Or the fact they put the adverts in between the Check box that you use to select emails and the actual emails themselves. Which makes you think that they’re unrelated.

I could go on for hours about Gmail. Like the fact that when you click on an email to copy it the entire email from that person collapses!

Anyway, let’s move on.

How about Google+? Another disaster.

How do you add someone to a circle?!

By Searching Google+ using their email address? Wrong!

No, I’ve still to figure it out. And another bunch of bizarre icons.

So, perhaps you decide to click on someone. So, then you end up at someone’s profile but there’s no Help link - wtf?!

That’s just the start.  A Google Circle is some sort of Xmas pudding thing on the screen with another bunch of incomprehensible icon squiggles. I had to add 9 people earlier today and almost gave up after 6 people. The process should not take almost an hour to simply add 9 people - disgraceful. Utterly disgraceful.

A complete and utter train wreck.

Attempting to install Ruby on Rails on OS X Lion with Xcode 4.2.1


First of all, don’t. Just use the system ruby.


Here’s my experience so far. Note, I had set aside a full day on Feb 16th for this job. I had nothing else to do that day other than this install. However, I started ahead of time on Feb 15th.

Please note, towards the end of day 3 so much had gone wrong I was struggling to keep track of the various threads. I.e. whether a certain process was correct or incorrect and likely to lead to a successful install of that particular piece of software.

Also, the #rvm channel on Freenode was pretty much useless. Very rarely got a useful response.

[NB: shortcut - go down to the very end of this post for the latest.]

15 Feb 2012
Helpful links:

http://www.ruby-lang.org/en/documentation/quickstart/3/

http://www.rubyinside.com/advent2006/10-gserver.html

Install JSON via:
sudo gem install json

Tutorial on hashes:
http://www.troubleshooters.com/codecorn/ruby/basictutorial.htm#_Hashes

Guide to JSON implementation for Ruby:
http://flori.github.com/json/doc/index.html


Deploying an app to Dreamhost:
1. Create a subdomain specially for this RoR app
2. Enable Passenger
3. Create a test config.ru above public/
E.g.
app = proc do |env|
    [200, { “Content-Type” => “text/html” }, [“hello <b>world</b>”]]
end
run app

4. Create a tmp/restart.txt file (above public/). This notifies Rails when you’ve made changes and a restart is required.

5. And came to a full stop here as RoR would not work other than the “hello world” script!

Attempt 2 at deploying a Ruby app: Deploying to Google App Engine using JRuby:
http://code.google.com/p/appengine-jruby/wiki/GettingStarted
Very easy instructions. Worked perfectly.
Experience:
- immensely slow initially! (like 20 seconds. now better, around 5 seconds).
- also, other people have seemed to struggle: https://groups.google.com/forum/?fromgroups#!topic/appengine-jruby/185J8uKFDOk

Deploying on Heroku:
http://devcenter.heroku.com/articles/ruby
Installed perfectly.

Notes when making changes.
Adding:
require ‘json’
did not work when starting foreman.
Needed to add the gem to the Gemfile.
Then, interestingly, when I did a push to Heroku I got:
“Installing json (1.6.5) with native extensions”.

So far, so good.

16 Feb 2012
Install Rails locally:
See Rails installation screencast here: http://ruby.railstutorial.org/
Note, added this useful bit of bashrc magic:

PS1=’[\W$(__git_ps1 ” (%s)”)]\$ ‘
export PROMPT_COMMAND=’echo -ne “\033]0;{PWD/#$HOME/~}\007”’

Also, note that “source ~/.bashrc” can be written as “. ~/.bashrc”. Handy shortcut!
Need to do this every time we want to use it.
UPDATE: entered this into .bash_profile so we don’t have to keep doing it.

git completion:
http://lifeon.biggerplanet.com/git-flow-and-git-completion-on-mac-os-x

Sidenote: that this “make && make install” means that “make install” will not be run if “make” does not run successfully.

Re-install rvm
Note, had to delete existing references to rvm everywhere!
Handy commands:
rvm reload
and
rvm notes


Ensure rvm is loadable as a function by adding this to my .bash_profile:
[[ -s “/Users/user/.rvm/scripts/rvm” ]] && source “/Users/user/.rvm/scripts/rvm” # Load RVM into a shell session *as a function*
and then logout / login (rather than sourcing .bash_profile.

Check rvm is installed correctly:
type rvm | head -1
should give:
“rvm is a function” if installed correctly.
 
Note, gems are packages.
Rails is supplied as a gem.

Ruby is version 1.8.7
So, to manage ruby versions (if necessary in future), we’ll use rbenv
To start, install Homebrew (“Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X.”)
But see also “Homebrew vs MacPorts”: http://tedwise.com/2010/08/28/homebrew-vs-macports/
/usr/bin/ruby -e “$(curl -fsSL https://raw.github.com/gist/323731)”

Then rbenv ‘cos was suggested by someone in #RubyOnRails. Also, Dreamhost Wiki said Passenger and rvm did not work together.
Note, rbenv is incompatible with rvm.
So, uninstall rvm using:
rvm implode
http://stackoverflow.com/questions/3950260/howto-uninstall-rvm
and remove any rvm references from .bash_profile
And install rbenv
https://github.com/sstephenson/rbenv#section_2

Sidenote: “exec $SHELL” to restart your shell.

NB: to upgrade rbenv, use:
cd ~/.rbenv; git pull

However, after going back to the #RubyOnRails IRC channel, got a negative comment about rbenv. And Passenger doesn’t support multiple ruby versions. Does support rvm.

So, installing rvm again!
Note, this only takes a couple of minutes.
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
(http://beginrescueend.com/)
and
source ~/.bash_profile

Install ruby via rvm
rvm install 1.9.2

Sidenote:
This gets YAML which is a data serialisation language (NB it forbids tabs as they are treated differently by different editors and tools).
YAML is like XML or JSON. But unlike XML, it’s easier to read, faster to encode and decode, takes less memory than XML when decoding.
See: http://webignition.net/articles/xml-vs-yaml-vs-json-a-study-to-find-answers/

Ruby install was trivial.

Then a gemset:
rvm —create use 1.9.2@rails3tutorial
rvm —default use 1.9.2@rails3tutorial

And finally rails:
gem install rails 3.0.0

BUT this did not work so smoothly! Errors with zlib, e.g.
ERROR:  Loading command: update (LoadError)
    no such file to load — zlib
ERROR:  While executing gem … (NameError)
    uninitialized constant Gem::Commands::UpdateCommand

So, from here: https://rvm.beginrescueend.com/packages/zlib/
$ rvm pkg install zlib
$ rvm reinstall 1.9.2 —with-zlib-dir=$rvm_path/usr

BUT same error.
Not much help from IRC other than another post on installing rails:
http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/

Stackoverflow post:
http://stackoverflow.com/questions/2441248/rvm-ruby-1-9-1-install-cant-locate-zlib-but-its-runtime-and-dev-library-are-the
rvm pkg install zlib
rvm remove 1.9.1
rvm install 1.9.1 -C —with-zlib-dir=$rvm_path/usr
(note: “rvm package” was renamed “rvm pkg” in 1.6.25)

Still no joy.
However, we’re getting an expanded error message. I.e.
Error loading gem paths on load path in gem_prelude
can’t modify frozen string
<internal:gem_prelude>:69:in `force_encoding’

and then the zlib error.

No idea if this was the fix but it seems to be working after this:
rvm pkg install zlib
rvm remove 1.9.1
rvm install 1.9.3 -C —with-zlib-dir=$rvm_path/usr


Day 3 of Ruby / Rails install
17th Feb 2011
Following http://www.christopherirish.com/2011/09/02/ruby-1-9-2-segmentation-fault-and-openssl/
and also mentioned by mpapis on IRC (i.e. that it might be openssl).
Note, also handy: http://root2linux.com/2011/12/how-to-upgrade-ruby-1-8-7-into-ruby-1-9-2-using-rvm-on-ubuntu-10-10/
So:
which openssl
rvm use system
ruby -v
» ruby 1.8.7
rvm —default system
rvm remove 1.9.3
rvm pkg install zlib
rvm install 1.9.3 —with-openssl-dir=/opt/local/bin/openssl —with-zlib-dir=$rvm_path/usr
rvm requirements

Which says to do:
brew install libksba
rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems

Then:
rvm use 1.9.3
rvm —default 1.9.3

And:
rvm pkg install zlib

rails new todos
/Users/user/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — zlib (LoadError)

From here:
http://stackoverflow.com/questions/2441248/rvm-ruby-1-9-1-install-cant-locate-zlib-but-its-runtime-and-dev-library-are-the
rvm install 1.9.3 —with-openssl-dir=/opt/local/bin/openssl -C —with-zlib-dir=$rvm_path/usr



STARTING ALL OVER AGAIN:
Delete rvm with
rvm implode
and then remove from .bash_profile
http://stackoverflow.com/questions/3558656/how-to-remove-rvm-ruby-version-manager-from-my-system

Reinstall rvm.

Download and install standalone gcc as mentioned for Xcode 4.2.1 here:
http://rocksolidwebdesign.com/notes-and-fixes/ruby-xcode/

Then:
rvm pkg install readline
rvm pkg install iconv
(http://rocksolidwebdesign.com/notes-and-fixes/mac-rvm/)

Note: rvm will automatically use gcc-4.2 (i.e. the standalone gcc we’ve just downloaded and installed) if it’s available.
rvm pkg install zlib
rvm install 1.9.3-p125 —with-openssl-dir=/opt/local/bin/openssl -C —with-zlib-dir=$rvm_path/usr —with-opt-dir=$HOME/.rvm/usr
Runs into this problem:
curl: (7) Failed to connect to 221.186.184.68: Host is down

BUT, trying with web browser and FTP and can login fine.
So, try using netcat:
http://www.linuxquestions.org/questions/linux-newbie-8/curl-7-couldnt-connect-to-host-wget-failed-connection-refused-728866/
But no net cat.
Install via brew.
brew install netcat
Installs net cat BUT have this warning:
/usr/local/bin/brew:74: warning: Insecure world writable dir /usr/local/Library in PATH, mode 040777
Google turns up this: http://stackoverflow.com/questions/4574927/running-brew-generates-warnings
which recommends:
sudo chmod 755 /usr/local/bin

Also fixed:
sudo chmod 755 /usr/local/Library




rvm requirements
brew install libksba
rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems

Got these errors:

====

[~]$ rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems
Exporting current environments gemset to system.gems

Installing gems listed in system.gems file…

installing abstract 1.0.0…
Error running ‘GEM_HOME=’/Users/user/.rvm/gems/ruby-1.9.3-p125’ GEM_PATH=’/Users/user/.rvm/gems/ruby-1.9.3-p125’  gem install —remote abstract -v1.0.0    ‘, please read /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log
abstract 1.0.0 failed to install ( output logged to: /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log )
installing actionmailer 3.0.5…
Error running ‘GEM_HOME=’/Users/user/.rvm/gems/ruby-1.9.3-p125’ GEM_PATH=’/Users/user/.rvm/gems/ruby-1.9.3-p125’  gem install —remote actionmailer -v3.0.5    ‘, please read /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log
actionmailer 3.0.5 failed to install ( output logged to: /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log )
installing actionpack 3.0.5…
Error running ‘GEM_HOME=’/Users/user/.rvm/gems/ruby-1.9.3-p125’ GEM_PATH=’/Users/user/.rvm/gems/ruby-1.9.3-p125’  gem install —remote actionpack -v3.0.5    ‘, please read /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log
actionpack 3.0.5 failed to install ( output logged to: /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log )
installing activemodel 3.0.5…
Error running ‘GEM_HOME=’/Users/user/.rvm/gems/ruby-1.9.3-p125’ GEM_PATH=’/Users/user/.rvm/gems/ruby-1.9.3-p125’  gem install —remote activemodel -v3.0.5    ‘, please read /Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log





==== log file ====
[2012-02-17 14:29:12] GEM_HOME=’/Users/user/.rvm/gems/ruby-1.9.3-p125’ GEM_PATH=’/Users/user/.rvm/gems/ruby-1.9.3-p125’  gem install —remote capistrano -v2.5.19   
/Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: Interrupt
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:8:in `<top (required)>’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:7:in `<top (required)>’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:8:in `<top (required)>’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
        from /Users/user/.rvm/rubies/ruby-1.9.3-p125/bin/gem:13:in `<main>’
/Users/user/.rvm/log/ruby-1.9.3-p125/gem.install.log (END)

====

End of Day 3.

Gave up on rvm, rbenv. Made sure I was using the system version of ruby (ruby 1.8.7):

rvm use system

Then just did this:

sudo gem install rails

And:

rails new todos

Then:

rails g scaffold todo name:string due_on:date completed:boolean

rake db:migrate

And:

rails s

Point your web browser at http://localhost:3000 and you should see a page welcoming you to Rails. To start managing your todos, go to http://localhost:3000/todos.

When you’re done, you can stop the Rails app by typing CTRL-C in the command prompt where you started the app.

Courtesy of: http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

Dealing with poor In App Reviews…


Inevitably, users will leave 1 star reviews, no matter what the quality of your app.

Here are a few steps on how to deal with them.

  1. Take a good long look at your app. Resolve any issues or rough edges asap
  2. Charge for your app - there is significant evidence that people will rate a free app up to 1 or 2 stars less than the same app if it has a price
  3. Report your concern about the 1 star review to Apple. If you think it has been written by a competitor then mention that. However, Apple do not tend to respond to these
  4. One step we found particularly effective was to do some in-house marketing and PR getting the app in to the hands of people who had an affinity with your app segment
  5. Secret sauce - there are a few other ways that can significantly improve your app reviews. Contact us for details.

Adding Box2D to a Cocos2D project


This is a pain.

It turned out to be easier to just create a new project using the Cocos With Box2D template and then copy the code over.

Unless anyone can suggest an easier way!

Revert to your last good version in git - method 2


So, you’re on a branch you’ve been testing and it’s all gone pear-shaped and you’d like to revert to your master copy?

Here’s how:

Stash your cruft:

git stash save —keep-index

Drop it (never to be seen again):

git stash drop

And checkout master:

git checkout master

Or, if you’re brave:

git stash save —keep-index; git stash drop; git checkout master

Autorotation in Cocos2d


Check out GameConfig.h

There you’ll see what’s controlling autorotation.

For example, the default is:

#define GAME_AUTOROTATION kGameAutorotationUIViewController

in which case you need to go to your root view controller and make your updates in the method:

- (BOOL)shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)interfaceOrientation {

E.g. if you want the button on the right:

    if( interfaceOrientation == UIInterfaceOrientationLandscapeRight

        return YES;

Why iPhone?


Someone asked why we primarily develop for the iPhone.

The main reason is we earn substantially more on this platform.

This might be because Android is very fragmented.

HTC and Motorola create different user interfaces to differentiate themselves. This leaves the user trying to figure out how to use their handset.

TwitterDeck had to contend with over 100 different OS versions with 244 handsets. This results in thousands of different configurations including hardware capabilities such as screen size.

There are now hundreds of App Stores on Android. So, developers need to distribute their app amongst all these stores and users have to search to find their app amongst all these App Stores.

Restore iPhone to 3.1.3 from 4.x


Need to restore your iPhone to 3.1.3 from 4.x?
Here’s How:

1. Put your iPhone in DFU mode:
i) Turn off iPhone
ii) Hold down power and home button
iii) When Apple logo appears, release power button but continue holding home button
iv) Connect iPhone to your laptop running iTunes
v) iTunes will tell you it has detected a device in DFU mode and prompt you to restore

http://isource.com/2010/04/09/quick-tip-downgrading-4-0-beta-to-3-1-3/

3.1.3 Firmware: http://www.felixbruns.de/iPod/firmware/

SVN Notes


Sometimes you still have to use SVN:

SVN version number

/usr/bin/svn —version —quiet

How to tell SVN to ignore a file or directory

svn propedit svn:ignore .git/

Using Open Source Static Libraries in Xcode 4


This blog post is very comprehensive:

http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/

Note there are 3 key steps:

  1. Add your projects to a workspace
  2. Add the build target dependencies (App > Target > Build Phases > Link Binary With Libraries). Note - a quick way to do this is to click the file in your main project then, in the File Inspector (Alt-Cmd-0 and top left icon in the panel) tick the Target Membership box
  3. Add the static library’s headers by adding $(BUILT_PRODUCTS_DIR) to the User Header Search Paths (App > Target > Build Settings > User Header Search Paths). Make sure the “Recursive” check box is checked (you can see the value by double-clicking the “User Header Search Paths” Setting Value)

For more on Xcode and Schemes see the Xcode 4 Transition Guide.

And the difference between <> and “” when importing headers: http://stackoverflow.com/questions/1044360/obj-c-import-and

Finally see this re global includes and using USER_HEADER_SEARCH_PATHS and HEADER_SEARCH_PATHS: http://stackoverflow.com/questions/749027/how-to-add-a-global-include-path-for-xcode