theKindOfMe

May 17, 2011

My RedDotRubyConf Experience

Filed under: Uncategorized — Tags: , — yasi8h @ 7:42 am

Introduction

It have been sometime since i last blogged about anything. I have a long queue of things that i want to blog about in my head and in my todo lists. However i find my self tired and distracted to do any blogging most of the time. However today i am going to write about the RedDotRubyConf that was held in Singapore on April 22nd-23rd.

As a programmer and a technology enthuastist i have attended numerous gatherings of developers and like minded people. Back in SriLanka these meet-ups were mostly related to Linux or FOSS and organized by the [LK-LUG][10]. When i moved to Singapore sometime back (as my new position was located there) i started attending a JS meet-up ([beermates.js][11]) that was held in [hackerspace.sg][12]. However i have never attended a technology conference in my life before RedDotRubyConf.

My company ([favoritemedium][13]) sponsored the tickets(thanks! [@5ooyoung][14]). Me together with two other coworkers attended the conf. It was the first time ever a Ruby related conference was organized in the south east asian region (according to many people ;)).

Speakers and Talks

I thought this was the most important thing in a conference. For a conference to be good, it should have good speakers and good talks. However my thoughts about this changed after i attended the conference.

A lot of cool (influential, popular, rich(!), smart) (and not-so-cool => agile, agile, agile, pair programming, agile, agile… 😀 just kidding!) speakers gave talks in the con(short for conference from here on). I think as a whole they were grate. You can see a full list of the Talks and the Speakers here. I am going to write about the talks that got most of my attention/’mind share’.

**These Talks Inspired Me**
– Mikel Lindsaar – Ruby can haz everyone
– Matz – The future of ruby
– Keynote – Dave Thomas, Pragmatic Programmers
– Advanced git techniques – Tom Preston-Werner, Github
– How to be awesome at rails – Ryan Bigg, RubyX

**These were Interesting**
– Agile the pivotal way – Ian McFarland, Pivotal Labs
– Deploying infrastructure with opscode chef – Robert Berger, Runa
– Houseparty, slumlord, or mogul? multi-tenancy with rails – Paul Gallagher, Evendis
– Agile in Real Life – Andras Kristof, ViKi
– Building a financial app in rails – Matt Jacobs, Thoughtsauce
– Flexible & adaptable to change: mongodb – Alex Nguyen, Vinova

I am not the kind of person who tries to learn a lot of new things from a event like this. I feel that if i have enough inspiration and desire i could learn about tech/framework/lang… X in my free time using the resources in the internet and all the helpful people that i can contact. However inspiration is not easy to come by, this event inspired me a hell of a lot!. Thats what its all about. I saw grate people who had awesome careers and contributions to the open source community. Seeing folks like that inspire me to try and do more!

The Crowd

I think the best part of the con was the awesome crowd. They were diverse and they were from different parts of the world. I met people from Singapore, Philippines, India, China, Indonesia and the US. But there were people from all over the world, specially from south east asia and Australia.

Most people i talked to were developers and most others were founders. I see this trend in lot of events. Developers attend events because they are about interesting topics and because they can meet interesting people. Founders attend events to mainly meet interesting people. Who knows may be you can meet your partner in some conference if you were a founder searching for one!

I regret that i didn’t have my ‘business cards’ ready. A lot of other people did though. I met folks from pretty interesting companies in the tech world today. I think events like these are grate to make new contacts and basically get to know interesting hackers. The more hackers that i talk to, the more inspiration i get, to be better at what i does. I felt like i have been waisting my time and energy doing nothing.

Pivotal Labs, ViKi, RubyX, Github and Others

I am grateful that the guys mentioned above and others who sponsored the conf and made it happen. I hope they got back some value out of the event. Most of the companies above talked about how they do things. As in how their developers develop software and spend their days. About doing things the agile way and pair programming. It was very interesting. I think the hacker inside me like how Github works. They seemed to be the most liberal out of the lot. However Github is a special company. So what works for them might not work for everyone else. The most interesting thing to me about Pivotal Labs was the fact that ‘all their developers goes home at 6pm’! Man if this is true… its a huge plus for folks who are working there, i guess.

The Venue and Free flowing sources of Caffeine

The conf was held in the Singapore Management University. I was pretty satisfied with the facilities provided at the venue. However it would have been grate if the corridors were air conditioned. As we spent a significant amount of time talking to folks outside.

Inside the auditorium, they were two screens which mirrored each other. This confused me sometimes. It made it hard to follow the slides as i always tend to scan both screens hoping to find something different. I think its something thats ‘wired’ in to my brain.

I have to say that the coffee was GOOD. I am not a ‘coffee person’ so to say. However the coffee at the conf was good, it had the taste and it had the kick ;). I even had some fun figuring out how to use the coffee machines (never use them before, interesting stuff). There was RedBull, Coke, Water other than coffee. And there was a lot of it almost all the time. Well done organizers! The lunch was pretty good too. I have no complaints what so ever about ‘them’ food.

Swag

I am so happy that i got a ton of stickers specially the Github ones 😉

2011 04 23 23 52 14

…and a neat (target-the-red-dot) tee! 🙂

Links

Obviously enough, i wasn’t the only one to write about this. Here is a list some interesting links relating to the conf.

– [The Official Website][4]
– [A Comprehensive list of links by @cheeaun][2]
– [Google Group/Newsgroup for Attendees][3]
– [A Photo set on fliker][1]

I am eagerly waiting for the next RedDotRubyConf, hope to see you there!

[1]: http://www.flickr.com/photos/jldbasa/sets/72157626433682503/
[2]: https://docs.google.com/document/pub?id=1aWZqJVeTk1T7Ll2SeHchKM8X8Dj7L3kXkWMXb4lBPys&pli=1
[3]: https://groups.google.com/group/reddot-list
[4]: http://reddotrubyconf.com/
[10]: http://www.lug.lk/
[11]: http://www.beermatesjs.com
[12]: http://hackerspace.sg
[13]: http://favoritemedium.com
[14]: https://twitter.com/#!/5ooyoung

Advertisements

April 7, 2011

Git Kung Fu

Filed under: Uncategorized — Tags: — yasi8h @ 1:40 am

These are some git commands that i find useful from time to time, but i forget them too often. So i am writing them down here. As a quick reference point.

Commits that needs to be pushed to remote X repo

git cherry -v origin/master

from: http://justinfrench.com/notebook/git-commits-that-need-to-be-pushed

Push a local branch to a remote branch with a different name

git push origin local_branch:remote_branch

Pull from a remote branch to a local branch with a different name

git checkout local_branch
git pull origin remote_branch

Merging
If you are in the middle of a merge (if you did a git pull and git merged what it can, automatically). You can go back your previous git pull stage by:

git reset --hard HEAD

Take their changes

git pull --strategy=theirs origin master

Take our changes

git pull --strategy=ours origin master

Start a web server to browse a git repository

cd /path/to/repo
git instaweb --httpd=webrick

The server will be running on localhost:1234. You omit the httpd parameter to let it use the default web server (which is lighthttpd btw), if its installed.

To stop it run:

git instaweb --httpd=webrick --stop

View more details about a branch

git show-branch branch_name

Remove and ignore already committed files from git

If you have a folder called .idea committed to your repo, and if you want to remove this from git and untrack it without actually deleting the files locally you could do this.

echo “.idea” >> .gitignore
git rm -r --cached .idea

-r – be recursive and –cached to not delete the actual files but just remove it from git’s index.
From: http://stackoverflow.com/questions/1329291/ignoring-an-already-checked-in-directorys-contents

I will be adding in to this post as i find new and interesting git ‘kung fu’ that i want to remember.

March 22, 2011

Installing Lsync on Ubuntu 9.10 / 10.04

Filed under: Uncategorized — Tags: — yasi8h @ 9:12 am

If you want to seamlessly sync two folders across two machines on the internet, you could use a lot of tools for the like sync. However if you want this syncing to take place whenever a file changes in the master (in a case where you have a master and a slave, where masters changes are propagated to slave), you can use Lsync. You can read more about it here (http://code.google.com/p/lsyncd/).

Here is how to get it installed on Ubuntu. This has been tested on version 9.10 and 10.04.

Download the latest version of synced
wget http://lsyncd.googlecode.com/files/lsyncd-2.0.3.tar.gz

Install the required packages
sudo aptitude install lua5.1 liblua5.1-0-dev pkg-config

Compile and install away
cd lsyncd-2.0.3
./configure
sudo make install

Test whether its installed
lsyncd -version

Thats it!

March 17, 2011

Facebook Connect, Cookies, Nginx and 400 Bad Request Errors

Filed under: Uncategorized — Tags: , — yasi8h @ 10:15 am

One of my colleagues were having a problem with getting Facebook connect to work in one of his rails apps. The strange thing was that it worked fine on his local. But when he uploaded the app to staging (which was a standard nginx/passenger/mysql/ubuntu stack), he would get a weird 400 Bad Request error after authentication and redirection from Facebook.

After googling around for a while it turned out that nginx has a limit on the request header size.

“maximum number and size of buffers for large headers to read from client request.” – from nginx documentation (http://wiki.nginx.org/NginxHttpCoreModule#large_client_header_buffers).

Increasing this solved the problem.

The current setting is at large_client_header_buffers 4 8k and it seems to work fine so far.

March 7, 2011

Basic Ubuntu 10.04 Server Setup Guide

Filed under: Uncategorized — Tags: , — yasi8h @ 2:56 am

There are some basic steps i do when setting up a fresh server (ahh sounds so good! :D). Going to list them out so i can follow them and have no problems forgetting anything in the future.

  • Add a user : adduser foobar
    • answer all the question asked
  • Add your public key to the authorized_keys so you can ssh in without password authentication (with public key authentication).
    • login as the new user
    • mkdir .ssh
    • nano .ssh/authorized_keys
    • put your public key in and save the file (ctrl + o, ctrl + x)
  • Add a entry for the new server in your .ssh/config for easy access to it from your local
    • nano .ssh/config
    • add a entry like this (please ignore the bullet points)
      • Host whatever_fancy_name #you will use this on your local ie: ssh whatever_fancy_name
      • User=foobar #user name on the server
      • Hostname=93.52.23.23 #your server ip
    • save the file (ctrl + o, ctrl + x)
  • Setup sudo without been asked for the password for the new user
    • visudo
    • add this line to the bottom: foobar ALL=(ALL) NOPASSWD:ALL #foobar is the username, while nopassword tells sudo not to ask the user for his password when using sudo
  • Disable remote root logins for sshd
    • sudo nano /etc/ssh/sshd_config
    • find the line ‘PermitRootLogin yes’ and replace it with ‘PermitRootLogin no’
    • save the file (ctrl + o, ctrl + x)
    • restart sshd
      • sudo /etc/init.d/ssh restart
  • Some default packages you might want to setup
    • htop (sudo aptitude install htop)

Done!

February 24, 2011

Git, Unfuddle and How to Use Multiple Key Files with SSH

Filed under: Uncategorized — Tags: , — yasi8h @ 1:16 pm

<rant> Unfuddle is a grate application. I use it daily. But one thing i really hate about it is that it requires you to use unique public keys. So you can’t use the same public key in two user accounts. Its all OK until you get work in a client’s unfuddle project. Where you will have a different account on the client’s unfuddle app. Boom! now you got to use another different key file just to work with any repo hosted in the client’s unfuddle app. This sucks big time. But the solution is not that complicated. </rant>

To use multiple key files with SSH (Git uses ssh internally),

  • Login to the machine/server from where you want to use git/ssh
  • Generate a key file (if you don’t already have one generated. But keep in mind you need a key file per account with unfuddle).
    • ssh-keygen
    • enter a name for the key
    • remember the name you entered!
  • Edit the ssh client config file
    • nano ~/.ssh/config
    • enter in the following lines (without the bullets of course!)
      • Host whatever.the.host.you.want.to.connect.to.here
      • IdentityFile=/path/to/your/key/file
    • The key file you specify in the Identity File directive is the private key (ie: not the key file with .pub extension).
  • Enter you public key to unfuddle
    • you can add your key in “Personal Settings”
    • your public key is the key that has a “pub” extension

Hope this helps. Even if no one else benifit from this i know i will someday 😀

February 23, 2011

Custom Server Density Plugin to Watch Processes on a *nix Server

Filed under: Uncategorized — Tags: , — yasi8h @ 3:42 am

Wrote this down recently to keep a watch on some processors. You can look at a list of running processes in SD without the need for any additional pulgins. However if you need to be alerted when a process goes down you would need to (as David has pointed out in the comments section, you don’t need a custom plugin to do this. However i am keeping this post here… as a sample of a plugin or just because i wrote it :D) write something custom. This plugin will be sending a value of 80 or 0 for a given process. 80 indicates that its running while 0 indicates that its not running.

Source

import sys
import os
import subprocess
import re

class ProcessWatch:
  def __init__(self, agentConfig, checksLogger, rawConfig):
    self.agentConfig = agentConfig
    self.checksLogger = checksLogger
    self.rawConfig = rawConfig

  def run(self):
    data = {}
    for p in ["delayed_job", "thin"]: # put whatever process names you wish to monitor here
      if self.isThisRunning(p) == False:
        data[p] = 0 # not running
      else:
        data[p] = 80 # running!

    return data

  def findThisProcess(self, process_name):
    ps = subprocess.Popen("ps -eaf | grep "+process_name+" | grep -v grep", shell=True, stdout=subprocess.PIPE)
    output = ps.stdout.read()
    ps.stdout.close()
    ps.wait()

    return output

  # This is the function you can use
  def isThisRunning(self, process_name):
    output = self.findThisProcess(process_name)

    if re.search(''+process_name, output) is None:
      return False
    else:
      return True

You can grab the plugin from github at https://github.com/thekindofme/Custom-Server-Density-Plugins/blob/master/ProcessWatch.py

The return output looks like the following. So you can set this up to watch as many processes as you want. Internally it just executes a ps and grep the output. So just keep that it mind.

data = {‘delayed_job’: 80, ‘thin’: 80}

The above output is when the plugin is watching two processes (thin and delayed_job).

Customize the array in the 14th line of the plugin to include whatever processes you need to watch

["delayed_job", "thin"] # for watching delayed_job and thin

Just keep in mind that this is the first time i am writing something in Python :D. Hope this helps someone.

February 16, 2011

Google TV

Filed under: Uncategorized — Tags: , — yasi8h @ 1:42 pm

image

image

image

image

image

image

image

Google was so generous to send our company a free device. Its awsome!

February 14, 2011

Honeycomb

Filed under: Uncategorized — Tags: — yasi8h @ 3:47 pm

This is a post that i wrote for my company blog. It was originally posted on Tropical Software Observation Blog on 04 Feb 2011.

Google is getting ready to launch Android 3.0, aka Honeycomb, the latest version of the Android OS that is aimed at tablets. It has a lot of new goodies that will radically change the way we will design and develop applications, especially user interfaces.

After going through some articles and documents that were sourced from the Internet, I am compiling this blog post as an overview of the main UI changes introduced in the 3.0 API. And to see how this might help application developers like you and me write applications that could potentially (nobody knows for sure whether honeycomb will run on smartphones or not. But it seems to support smaller screen sizes as well. I am been optimistic here! ) run on smart phone and tablet devices. Even if this is possible it might not be a reality in the near future. As google is yet to announce any smartphones with the new branch of the OS.

Ouch! it seems that is not going to be true anytime soon: Google Says Honeycomb Will Not Come To Smartphones.

Honeycomb is the first release of the 3.x branch. Right now, Google seems to be reserving the 3.x branch for tablets and the 2.x branch for smartphones. As for the 2.x branch, Android 2.4 (Ice Cream) will be the next release. Given that maintaining two platform-specific versions of the OS doesn’t seem like a long-term strategy, convergence will probably happen at some point in the future.

Fragments


This seems to be one of the most exciting new features of Honeycomb. The API documentation defines a Fragment as “…a piece of an application’s user interface or behavior that can be placed in an Activity”. Fragments are basically small units or modules that can together make up an Activity. Perhaps the coolest thing is that you can change them dynamically at runtime!

Modularity is almost always good! (caveat: only if used with some common sense). You can create different layouts by mixing up Fragments. An Activity can be broken down into different regions and then designed separately. It also allows developers to create interfaces that let users choose among different layouts at runtime. Because Fragments can be added in or removed dynamically, this should be fairly easy to do.

Google has cited another use for Fragments: changing the layout of an application depending on the orientation of the screen. So you can create UIs that will make maximum use of screen space depending on the screen orientation. For example, if a given device has a lower resolution than a tablet, a developer can decide to use a Fragment (or a set of Fragments) that are designed to better fit a smaller screen size and resolution. Or, if the device that you are using has a larger, higher resolution screen, you can conditionally use a different set of Fragments or simply a different mix of Fragments to optimize the interface. I have not really tried using Fragments in a real world application, but I think they could be very helpful in making applications more adaptable to different device form factors and somewhat independent of hardware platforms. However, we should not expect this to be a perfect solution to make apps device and resolution independent, as it will involve many other considerations such as sizing and resolution of embedded image assets and other content types.

Back Stack

Fragments that are displayed one after another can be added to a stack by modifying the Fragment inside a transaction. This will help users go back to whatever Fragment they came from by using the standard back button. Such UI statefulness can greatly improve user experience.

ActionBar


One can argue that the space taken by the title bar is a waste on small handheld devices like tablets or smartphones. The action bar replaces the title bar and displays the title for a window while harbouring various other widgets, menus, and tool buttons.

Browsing through the API documentation for ActionBar, you can see some interesting classes and constants like ActionBar.Tab andNAVIGATION_MODE_LIST that suggest the ActionBar can be used for navigation and can contain embedded menus, buttons, and tabs. When used with methods such as setCustomView() to set a custom view to appear inside the ActionBar, this can be used to implement things like a search function for an eBook reader app.

A breakdown of some other highlights:

  • Multi-select, clipboard, and drag-and-drop
  • Richer notifications
  • Live HTTP streaming
  • New APIs for Bluetooth A2DP and HSP
  • Hardware accelerated rendering
    • New animation framework (new android.animation package)
    • Hardware-accelerated OpenGL renderer for 2D graphics
    • A new 3D rendering engine called Renderscript (new android.renderscript package)
  • Ability to leverage multi-core processors
  • DRM framework (new android.drm package)

Playing with the SDK
There is no substitute for playing with the SDK yourself. You can get it here.If you already have a previous version of an Android SDK installed, you can install Honeycomb via the Android SDK manager. Look for Android ‘Honeycomb’ Preview SDK along with the documentation bits. Have fun!

Sources

  • Android 3 Highlights – Google
  • First look: Honeycomb APIs power tablet-friendly Android apps –Ars Technica
  • Google posts Android 3.0 Honeycomb SDK preview – intomobile

 

Fixing: /irb/completion.rb:9:in `require’: no such file to load — readline (LoadError) on rvm

Filed under: Uncategorized — Tags: , , , , , — yasi8h @ 10:25 am

Got this error to in one of the staging servers:

$ rails c production

/home/jooolaesa/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/irb/completion.rb:9:in `require’: no such file to load — readline (LoadError)
from /home/jooolaesa/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/irb/completion.rb:9:in `’
from /home/jooolaesa/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.0/lib/rails/commands/console.rb:3:in `require’
from /home/jooolaesa/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.0/lib/rails/commands/console.rb:3:in `’
from /home/jooolaesa/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.0/lib/rails/commands.rb:20:in `require’
from /home/jooolaesa/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.0/lib/rails/commands.rb:20:in `’
from script/rails:6:in `require’
from script/rails:6:in `’

It will appear if your ruby installation is not compiled with readline library. The solution is to recompile it with readline. If you are using RVM to manage your ruby installations you would go about doing it like this.

rvm package install readline

rvm remove 1.9.2 # note that 1.9.2 must be replaced with whatever ruby installation that you are going to recompile with readline support

rvm install 1.9.2 –with-readline-dir=$rvm_path/usr

Thats it!

Sources:

http://rbjl.net/20-rubybuntu-2-troubleshooting-common-ruby-ubuntu-problems
http://rvm.beginrescueend.com/packages/readline/

« Newer PostsOlder Posts »

Blog at WordPress.com.