Tuesday, 4 December 2012

Whats more exciting than an Arduino

Whats more exciting is getting one in the post and thinking of what to build with it. I have wanted to build something with electronics for a long time but electrical diagrams and believing it a bit hard have put me off. But I went to the Build Brighton hack space last week where they did an evening on RaspberryPi, and Python. Python I can do and the stuff some people were building with trail and error excited me again. Looking at the two systems RaspberryPi is more a full computer but small, and Arduino is much smaller but better to interface with. Even better you can stick an Arduino on a Pi for greater flexibility. So though I would like to program it in python I think starting with an Arduino will be better as I'll have to work my way round 32k rather than a high celling of power. So on my christmas list is lots of electrical tools and kit. Hope I can get my son interested in pressing buttons and lighting LEDs too. http://www.ebay.co.uk/itm/120948981096?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649 This is the kit im starting with A new world of Sketch and soldering awaits. (Interested if you are also doing the same?) :)

Monday, 11 June 2012

Top Chef Chris Bailey first Popup Restaurant in Brighton

My favorite Chef Chris Bailey starts his first Popup Restaurant in Hove, Brighton. He is calling it "Chris Bailey's ‘Taste of cheese’ Menu" Looking forward to the cheese inspired menu taken from the host Cheese Shop La Cave in Hove.
He is doing a 6 course amazing menu for just £35 a head. From talking with him the tickets are going fast and it should be great night.
I hope I can squeeze in to this one but am looking forward to making it to the next one he puts on in a few weeks too.
p.s. he is my brother but I did not get him a Michelin Star his great cooking did ;)

Tuesday, 8 May 2012

Learning to make vim fast and lovable editor

.. Or settings and tips I have learnt to make vim nicer, but are not on by default. ( I will keep adding to this )

I am using vim as my main editor for a few years but since freelancing I am learning to use it even more.

Vimrc settings

My changes to vim at the moment look like this

syntax on
set bg=dark 
" indent
set cindent
set smartindent
set autoindent 
" tabs
set expandtab
set shiftwidth=2
set tabstop=4
set showmatch " Show matching brackets.
" auto complete + C-n
set showcmd " Show (partial) command in status line.
" case search
set ignorecase " search ingore case if all lower search
set smartcase " Do smart case matching (flips igonore if use any caps)
set incsearch " search as type
" highlight search
set hlsearch " highlight all searches " :nohlsearch
"set visualbell
"set cinkeys=0{,0},:,0#,!,!^F
set cinkeys=0{,0},:,0#
set cinwords=if,else,while,do,for,switch,case   " Which keywords should indent
imap <C-e> <esc>$a
imap <C-l> <esc>g_
:nmap <C-n> :tabnext<cr>
" Press Space to turn off highlighting and clear any message already displayed.
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Press F4 to toggle highlighting on/off, and show current value.
:noremap <F4> :set hlsearch! hlsearch?<CR>

Outside of the config you can open files in tabs inside vim and then tab between them
vim -p file1 file2 file3
then use 'tg' to go to the next tab

Open a grep search of files as tabs in vim
vim -p `fgrep -l cust_function core/*.php`
This would search for 'cust_function' in the dir core for php files

Vimdiff - visual character level diff from cmd line

vimdiff is much nicer to look at if you have to understand merging files on the cmd line.
if you migrate from

line by line without checking white space (so ignore tabs/spaces which can change with editors and versioning)
diff -w filea.php fileb.php
 files side by side if you need to see context of more than a couple of changes
diff -wy filea.php fileb.php
In this view you can scroll up and down but right edge gets cut, you can see marks in middle of page
| different
> change to right version
< change to left version

But those two show only lines. Vimdiff shows colours to show character changes and move around in a visual way
 vimdiff filea.php fileb.php
And if you add this to ~/.vimrc you dont see the white space changes which is nice.
set diffopt+=iwhite
When in vimdiff you can move between windows and also which is nice, push and pull changes between versions.
So move to change "dp" pushes change from left to right side. The other way "do" pulls it from right to left

To switch windows in vimdiff or to navigate windows in vimdiff or to change windows in vimdiff try the following: The ":vertical" command can be inserted before another command that splits a window. 
CTRL-W h        move to the window on the left         CTRL-W j        move to the window below
CTRL-W k        move to the window above 
CTRL-W l        move to the window on the right         CTRL-W t        move to the TOP window      
CTRL-W b        move to the BOTTOM window 
Moving windows  
CTRL-W K        move window to the upper 
CTRL-W H        move window to the far left
CTRL-W J        move window to the bottom         CTRL-W L        move window to the far right 

Have Vim jump to the last position when reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
      \| exe "normal! g'\"" | endif

Auto complete comment block lines.
" In edit mode
" #b<return>
" type text
" #e<return>
:ab #b /************************************************
:ab #e ************************************************/
:ab #l /*----------------------------------------------*/

Show hidden characters, leading and tailing white space with
:set list
Then you can see if you have lots of white space as $ will be on end of lines
Next you can run a zap trailing white space
:1,$s/[ <tab>]*$//
and off with
:set nolist

source: http://www.oualline.com/vim-cook.html

Not quite vim but useful

You can get a sort of auto complete from your history file. So for example
cd PageUp
changes to
cd /file/path/i/used/earlier

or if your jumping around
cd /file/path/PageUpPageUp
becomes the last bit
cd /file/path/i/used/before/that

Change it here:
vim /etc/inputrc
Then uncomment the lines for using PageUp and PageDown to fill the rest of your cmd propt from your history
# alternate mappings for “page up” and “page down” to search the history
#”e[5~”: history-search-backward
#”e[6~”: history-search-forward

Friday, 27 April 2012

Freelance project work in Brighton or Remote from home

As we come into May 2012 I am looking for Freelance Web Development project work in Brighton or Remote from home from end May and June onwards.
Any sort of updating websites or maintaining them or building them new. I am a PHP web developer and also to project strategy and Social Media and SEO supported by Web Analytics.

So you could be anywhere in the world but I live in Brighton so will be talking to you from here or meeting you near by.