Creating Twilio Subaccounts in Ruby

May 25th, 2012
require ‘rubygems’
require ‘twilio-ruby’
require ‘pp’
# examples version 3
@account_sid = ”
@auth_token = ”
# set up a client, without any http requests
@client = Twilio::REST::Client.new(@account_sid, @auth_token)
@client.accounts.create(:friendly_name=>”Customer Numbers”)
To get the new sid and auth_token
@client.accounts.list.first.sid
@client.accounts.list.first.auth_token

Filter images requested from google in WireShark

June 15th, 2011

http && http.request.method == “GET” && http.request.uri contains “.gif”

Wireshark permissions on OSX

June 15th, 2011

Run
sudo chown {your account name} /dev/bpf*

Howto: restore a deleted file with git / zsh with one line

April 6th, 2011

git checkout $(git rev-list -n 1 HEAD — “app/views/file.txt”)\^ — “app/views/file.txt”


				

Test from mac journal

May 31st, 2010

Just a test ignore, blog in full screenThe OS X Shell explained.

Running Google Test on Snow Leopard, C++ TDD

February 25th, 2010

A quick post from a coffee shop in Laos, I’m installing the Google Test framework on my OS X machine to do some TDD C++ work,

I’m using Make, and when I got to the instructions in the README explaining the how to run the sample tests …
### Using GNU Make ###
I ran into a problem ..


myosxmachine:make joe$ make clean && make
rm -f sample1_unittest gtest.a gtest_main.a *.o
g++ -I.. -I../include -g -Wall -Wextra -c ../samples/sample1.cc
g++ -I.. -I../include -g -Wall -Wextra -c ../samples/sample1_unittest.cc
g++ -I.. -I../include -g -Wall -Wextra -c ../src/gtest-all.cc
g++ -I.. -I../include -g -Wall -Wextra -c ../src/gtest_main.cc
ar rv gtest_main.a gtest-all.o gtest_main.o
ar: creating archive gtest_main.a
a - gtest-all.o
a - gtest_main.o
g++ -I.. -I../include -g -Wall -Wextra sample1.o sample1_unittest.o gtest_main.a -o sample1_unittest
ld: in gtest_main.a, archive has no table of contents
collect2: ld returned 1 exit status
make: *** [sample1_unittest] Error 1

Turns out there is an issue with ld and ar on OSX 10.6 .

Adding the ARFLAGS =-q -s to the sample makefile fixes the issue

Localising Rails

October 14th, 2009

I’m currently working on the  DIGITAL LIBRARY OF LAO MANUSCRIPTS which has been insteresting dealing with Fonts and various localisation issues. More later.

Getting started writting Flex based AIR applications from the command line

March 9th, 2009

There are couple or gotchas installing the latest  Open Source Flex and AIR SDKs.  Here are instructions to get started

Download the AIR and Flex SDKS

Get Flex from : http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK

Get Air from http://www.adobe.com/products/air/tools/sdk/

I installed them into /usr/local/flex_sdk and /usr/local/air_sdk

Add their bin directories to your path, in .profile or .bash_profile e.g.

export PATH=/usr/local/mysql/bin:$PATH:~/bin:/usr/local/flex_sdk/bin:/usr/local/air_sdk/bin

Make the compliers executable

sudo chmod +x mxmlc

sudo chmod +x amxmlc

It turns out the lastest version of the compiles scripts are dos terminated lines so you need to do

dos2unix mxmlc

dos2unix amxmlc

You can get dos2unix from macports , sudo port install dos2unix

(bug here :http://bugs.adobe.com/jira/browse/SDK-16699)

Next issue is the samples won’t compile, you will get an error “error while loading initial content”.

You need to update the namespace in your AIR project’s AppName-app.xml file to reflect the new AIR version 1.5:

<application xmlns="http://ns.adobe.com/air/application/1.5">

(from http://blog.sunild.com/2008/12/error-while-loading-initial-content.html)

Making autotest and growl a snap

January 25th, 2009


sudo gem install growl-glue

In .autotest

require 'growl_glue'
GrowlGlue::Autotest.initialize

Easy

JRuby 1.1.4 & getPlatformMBeanServer error on linux

September 13th, 2008

I was getting an error on a new install of JRuby on a Linux

jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-08-28 rev 7570) [i386-java]
Created MBeanServer with ID: -vsnele:fl2bg1bd.0:mandlebrot:1
java.lang.management.ManagementFactory:-1:in `getPlatformMBeanServer’: java.lang.InternalError: One of the management beans is not compliant.
from org.jruby.management.BeanManager:59:in `register’
from org.jruby.management.BeanManager:29:in `register’
from org.jruby.compiler.JITCompiler:68:in `<init>’
from org.jruby.Ruby:207:in `<init>’
from org.jruby.Ruby:160:in `newInstance’
from org.jruby.Main:184:in `run’
from org.jruby.Main:100:in `run’
from org.jruby.Main:84:in `main’

It turned out that remove the following packages solved that problemRemoved the following packages:
java-gcj-compat
java-gcj-compat-headless