Vincent Toms

iOS programmer living in Boston MA.

Shave of the Day April 15th

This post is coming from a place of some personal confusion. My wife and I have been in Boston now since January. The city is great, but some sick animal decided to set off a bomb, at the 4 hour mark of the marathon, right at the finish line. This really disturbed me first off it is a new city, we have a little one on the way and now bombs are going off mere blocks from where we are starting put down roots. I will wrestle with this and should arrive at some conclusion in my mind. The political sewer talk is starting to appear, put that shit down for now let’s find the dirt bag that did this take care of them then you can bring up your horse dung.

Any way, yesterday was time for a shave. As I mentioned in passing before the wife is with child, as a part of this experience she is having all kinds of weird cravings. Most recently with the long awaited return of her appetite she has been eating grapefruit. I would say at least 1 a day on average. I have never been a big fan myself, but after being around it for these past few weeks I have started to really enjoy the smell. By chance TOBS which all of you who use a straight razor probably know and loved recently came out with a grapefruit scented cream. So last week while in NYC I went to Pastuer’s Pharmacy and picked up a can.

As of late I have been really putting an effort into working on my shaving. The razor is a Hart “not a replica” I picked up from Baxter of California a while back. This blade took a fair amount of work to get into a shave ready state and I feel like only now is it in good shape. It is not forgiving in the least and if you are unexperienced or just starting out do not try this razor. I am by no means an expert but I feel like I am getting much better. Where I have seen the biggest help is in my preparation. Before I would simply lather up and get to work, the result was lots of dragging of the blade a substantial amount of razor but and not much in the way of a good shave. Recently everyone has been spouting about using glycerin soap, I have yet to adopt this b/c I can’t get to the store to get milk let alone soap because of the traffic and the disruption in the city. However, I took a shower, washed my face while in there and got out and prepped my lather and went to work. I was able to accomplish two things in this shave. First I was able to trim my side burns into the shape I wanted. Before I had just cut them up to my ear now I was to get them to the jaw line and get a width that I liked. Then I was able really use the tip of the razor for some precision work without going into the side of my face. The square point is challenging to say the least and I feel like I was able to use it to my advantage. By no means am I an expert, but it certainly was much better.

Have a good night every one!

Experimenting With a New Development Stack

I recently made the switch from Wordpress to Octopress as my blogging tool of choice. The transition for me was painless because I had just installed wordpress as a place holder and had made a few posts calling for user feed back from an app I built. Which by the way if you have the Betterman app rest assured it is being worked on and a new release is in the works. If you want to contact me about it, please don’t hesitate to email me vincent@vincenttoms.com.

In any event, I am perpetually searching for more optimal web stacks. Initially, this meant moving away from Linux to FreeBSD. My reasons are many but frankly I find that the BSDs are more along the lines of work horses where as Linux feels like a bit of a toy. I am sure this will get a lot of people up in arms, but the point isn’t to stir the pot it is just my observation and after having worked on various UNIXs over the last 18 years I think it is safe for me to state my personal preference. Truth be told I better know how to admin the system and so for me this is a matter of comfort.

My next choice was to drop MySQL in favor of MariaDB. The reason behind this one is because I am a bit concerned that in the next few years out buddies at Oracle are going to put the hurt on all the companies that have built applications based on MySQL. This might be just an irrational fear but I don’t want to take any chances. I know postgres exists as an alternative as well, but presently I would rather go for something that is going to drop in rather than rebuilding reconfiguring and migrating. I have some applications in the pipeline that will probably lead me down a road towards psotgres but I’ll cross that bridge when I get there.

My next choice was to move from Apache to Nginx. My good friend Ricky had been preaching to me about the power of nginx, and I never really listened. Simply put I know how to turn up an apache server almost with my eyes closed and in the past it worked. However, when I moved to Octopress I was given a unique opportunity. My blog went from this dynamic thing to a site that was all static pages, not only that I moved it from my beast server to a little experimental machine I had setup but never really used. This computer was resource strapped both in CPU and memory and simply put trying to fit apache in there was going to be a nightmare. I debated between lighttpd and nginx, and arrived at the conclusion to go with nginx because there was phusion integration. So far I have not been let down. This simple little server rips through requests and all the while hardly touching my CPU or memory. I have since then added more ram to this machine, installed phusion and frankly I think with a little more tinkering I’ll have php going via FPM. With this stack I’ll have no problem deploying pretty much 99% or what I’ll ever need it for.

I opted to go with phusion in lieu of unicorn for running my ruby apps because it will allow me to run multiple apps with much less resources. With unicorn you preallocate instance to run your app, and you have to do some additional scripting to ensure you process are running. With phusion you simply point to the directory where the app lives and it will take care of the rest. Additionally, it will reclaim resources as utilization goes down and ramp up as needed, it may not be perfect but in the production rails apps I have deployed it works quite nicely and hasn’t given me any fits.

I am additionally, going to skip php for my quick and dirty apps and start using Sinatra & Datamapper. Datamapper is a nice little ORM that frankly makes my life a bit easier I can skip writing SQL and get good performance. As for Sinatra this nice little tool lets me work in Ruby and build easy web apps. With the ngnix stack I can still toss my php files in the public folder and they’ll execute right along side of the Sinatra over all making this a nice little stack with a lot of flexability.

At Home in Boston Now

As of today my wife and I have fully relocated to the lovely city of Boston MA. In the brief time we have been here I am convinced it is going to be a great fit for us. I am really looking forward to starting to play hockey again, and getting to see what this city has to offer.


I am looking to get heavily involved in the local cocoa users group. I used to participate in local Kansas City users group, but never really got the chance to get involved in NYC. I would also like to find some people to jam with on the guitar.

Playing With Node.js

Node.js is a cool little tool for creating web services with high throughput. The idea from what I can gather is you do little bits of processing with the javascript language, typically you listen on a socket and respond. This works as long as your scripts do small things. I have read a fair number of discussions where you can easily break this by doing intense processing etc and kill the whole things, but if you get to that point then node is probably not the right solution.

In the past I would just write an apache module in C that would push back data quickly with out a full stack, but frankly that is a lot of coding and adds a lot of overhead that can be bypassed.

As you can see below from my AB run node is fast. The first output is from hitting my node.js code, the second a static page request to nginx. Some of this speed difference could be due to the fact we’re passing more data back in the static page but I didn’t have time to do an apples to apples comparison here to be sure.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ ab -n 10000 -c 100 http://10.77.77.2:8080/
...
...
Concurrency Level:      100
Time taken for tests:   9.293587 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      2050000 bytes
HTML transferred:       980000 bytes
Requests per second:    1076.01 [#/sec] (mean)
Time per request:       92.936 [ms] (mean)
Time per request:       0.929 [ms] (mean, across all concurrent requests)
Transfer rate:          215.31 [Kbytes/sec] received

$ ab -n 10000 -c 100 http://10.77.77.2/
...
...
Concurrency Level:      100
Time taken for tests:   14.793172 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      199140000 bytes
HTML transferred:       197020000 bytes
Requests per second:    675.99 [#/sec] (mean)
Time per request:       147.932 [ms] (mean)
Time per request:       1.479 [ms] (mean, across all concurrent requests)
Transfer rate:          13146.07 [Kbytes/sec] received

Below is a message that comes out of band from my Node.js service.

 

This is the code I use to query my service.

Load jQuery and call my node.js service
1
2
3
4
5
6
7
8
9
10
11
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
  jQuery.noConflict();
  jQuery(document).ready(function(){
  
    jQuery.getJSON("http://vincenttoms.com:8080", "jsoncallback=?",
        function(json){
          jQuery("#holder").html(json.str);
        });
  });
</script>

This is the code for my Node.js service this is a trivial example. My guess is there is a better more codey way to write out the JSON data.

(nodeserver.js) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// load in http and url libraries
var http = require('http');
var url = require('url');

// start up a server listening on all IP's on port 8080
http.createServer(
  function (req, res) {
      // get the date
      var now = new Date();
      
      // send back a 200 and the content type
      res.writeHead(200, {'Content-Type': 'application/json'});
      
      // build my JSON string by hand would like to do this all code but not sure at the moment  
      var output = "{\"str\":\"Hello from my Node.js server today is " + now.toString("dddd, mmmm dS, yyyy, h:MM:ss TT")+"\"}";
      
      // parse the url query
      var url_parts = url.parse(req.url, true);
      var query = url_parts.query;

      // write the response
      res.end(query.jsoncallback+"("+output+")");
}).listen(8080, '0.0.0.0');

// log out something to the console
console.log('Server running at http://0.0.0.0:8080/');

It was puking when trying to parse the JSON and some googling lead me to this as the solution.

Ugly hack
1
res.end(query.jsoncallback+"("+output+")");

Then to have your node service running all the time you use the nohup command.

Ugly hack
1
$ nohup node nodeserver.js > outfile.log &

I suspect there is probably a much cleaner way to implement this so any thoughts would be greatly appreciated.

Married Life

In October 2012 I was married. The wedding took place in Colombo Sri Lanka. The event was an amazing experience and one that I will never forget. Because of the great distance some of my family was unable to attend. My sister and brother took it upon themselves to compile a video with briefs words from many of the family and friends back home that couldn’t make it. You can see more about the wedding at NiroandVincent.info

Take a peek below to see the fruits of her labor.