Circularspace

vim crashing with ruby on OSX

I started having trouble with vim crashing for me. I’m on OSX with homebrew and rbenv, and it crashed when editing Ruby files. I would get a segmentation fault. After some googling which was not particularly fruitful, the solution I came up with was: switch to the system ruby rbenv shell system uninstall vim completely with homebrew brew uninstall vim reinstall vim from head brew install --HEAD --override-system-vi vim This seems to have fixed the problem, though I do not know if it was switching to the system ruby or installing from head.

Null objects for the win

So I’ve been watching a lot of OO refactoring screencasts and reading posts and I’m able to say I’ve implemented some of the advice I’ve heard. Life’s all about learning eh? So the main example I want to talk about here is Null objects. Null objects In dynamic languages, and Ruby in particular1 the concept of the lack of something needs to be encapsulated. For example: you’re wrapping the database and no entry exists; what to you return?

Ruby is scary

Ok so after my previous post, I was feeling pretty excited about Ruby. I talked about its power and flexibility and the exciting things that could come from it. I also talked of Ruby’s scariness, it’s ability to terrify new programmers and potential for difficulties. I’ve found one particular example which I’m sure shouldn’t be allowed. I can see the intention and how in experienced hands it is amazing, but I can’t unsee it’s potential for misuse.

Ruby: first impressions

So I’ve been trying Ruby recently, partially trying to add some substance to my CV, and partially out of curiosity. I used to be a complete python snob; I didn’t understand why anyone wouldn’t use python. It is a dynamic language so no more manual memory management (though there are plenty of advantages cough cough); duck typing deserves its own special place in hell but it is bloody convenient; the amazing standard library which is great for system administration; and many other things.

cello voice

So Mac OSX has the say command, which reads out some text in the computers voice synthesis functionality. This is old news. The new hotness is switching into the “cello” voice with say -v cello. I’s lyrical and beautiful, though reading out file names is entertaining: say -v cello source/_posts/2013-08-24-cello-voice.markdown This was brought to my attention through the guard-shell gem README.

Using guard with foreman

I’ve been playing with Ruby quite a bit recently and I like the way a custom-looking DSL can be created from the same source language. This means I’ve converted a lot of my tools (e.g. Makefiles) into Rakefiles and I’ve just found foreman which can manage multiple subprocesses and combine their output into a nice looking coloured console result. This is typically used to manage web processes (server, task runner, development database etc.

Function fitting with lmfit

Scipy contains functions for fitting equations with Python, in its scipy.optimize module. The two main ones I’ve used in the past are leastsq and curve_fit, which in itself is a convenience wrapper around leastsq. curve_fit For this operation you require three (four) things: a function to fit of form f(x, *params) x data y data Optionally error data You can also supply an initial guess with the p0 argument.

Conference notes

This is not a blog post as such, it’s the notes that I took during the conference split up into sections. Unfortunately there is no reference to the talk content itself; this is kept in the booklet which I have sitting next to me as I type this. Session 1 Detecting and characterising via direct imaging More than 2Gyr gas giants more than 10^8 times fainter than primary Young stars are 10^4 - 10^7 times better than this Chronograph for increasing contrast Speckle noise a big problem for speckle based data S/N does not increase with time angular differential imaging speckles oscillate while image rotates, but keep similar shape real objects will move in the frame A stars good targets despite being bright higher hosting fraction for giant planets for A stars (not sure about this) high profile detections Nielsen show low host fraction despite this M stars also good targets despite low independent host fraction Typical contrasts - 10^5 at 1 arcsecond (with NICI) Physical properties (atmospheres) Direct photons detected from these objects reflected light and background contaminants surely?

Flight back

I’m currently on the plane back, flying over Canada at about 922km/h as the in-flight computer (android tablet in the back of the seat in front of me) says. I’m sitting next to a nice chinese couple, who don’t speak a word of English. They asked me through vague hand gestures to fill out their immigration card. It was quite an ordeal! Back home now after a good conference, got lots of nice pictures of Vancouver, but am quite tired now.

Last day

The last day has come and gone. I didn’t get time yesterday to write about it so I’m doing it now while I sit in front of the A-team in a Canadian hostel. As a side note this film looks terrible. We had some of the most interesting talks of the day yesterday, talking about planet migration and feasibility studies. Some cool stuff but I still don’t have a disc migration based theory to explain the Rossiter-McLaughlin effect.