Pennies for Thought

Nov
11

When I was in college we would inadvertently put ourselves into the situation where we would do this a lot; go to the classes during the day, spend some time with our friends and take a nap a little before (or after dinner). Later that night we would stay up until three in the morning either hanging out, writing code or playing video games. Of course at the time we did not know it was called a polyphasic sleep cycle but nevertheless it worked for us.

Earlier this year I joined the working stiffs of New York City and could no longer do this because it just became too much. But yesterday I came across several informational sites which showed some promise in doing this. So after some time calculation the plan is that next week I am going to begin trying this out.

Basically how this works is that as soon as you get home, let’s say around 7:30PM, you hit the sack and take a nap for about an hour and a half. At 9PM you should awake feeling quite refreshed and go on with your business until 2 or 2:30AM. At this point, at least for me, I plan on sleeping until roughly 7AM which will total approximately 6.5 hours of sleep per night. Most people average around the 8 hours per night mark which is a significant time sink when you extrapolate that across your life. Its quite absurd how much time we spend sleeping.

So, that’s the plan. I’ll keep this little “life hack” up-to-date as it progresses. From how it sounds I do not believe it will be much different than what I was doing in college (and in high school) which worked out nearly flawlessly. It may take a few days to get back into the groove of things.

Oct
31

After a long week of tinkering and testing I have finally made the “early access” sign ups for Type Aloud available to the public. Most of this week has been spent fixing some issues with the Ruby Bundler, Nginx and of course Passenger 3. Up until this point I did not make the Type Aloud code available for testing on production and have done most of my development locally. This posed some issues for testing OAuth2 authentication with Facebook, Twitter and other end points, but generally I assumed that it would work as expected. I was ever so slightly wrong.

Passenger itself was quite easy to install. I downloaded it from the website and merely followed the instructions, which downloads nginx and compiles the Passenger module into the nginx executable. This is due to Nginx not supporting loadable modules like Apache, but on my meager Slice Host server this went pretty quick. Within an hour I had a Passenger and Nginx installation up and running. My configuration is a little different than most people: on this particular slice I am running two Rails Rack applications (typealoud.com and thunkbrightly.com) and this WordPress blog which is using the php-fastcgi plugin through Nginx.

The last thing that I did was download Ruby Enterprise Edition which is by the same great cats over at Phusion. This version of Ruby is designed specially to minimize the memory footprint and speed up (as much as possible) the execution. There are some nifty graphs over there on the website so I am not going to gush over any of their stats. The point being: since I am broke and using shared hosting this is the absolute best. The installation went quick and easy.

I install all of my third-party applications into the mounted /opt (optional) directory. This is where Passenger is installed. When it comes to Ruby I decided to install this into the /usr/local because I have several scripts that I wrote which expects this to be in the $PATH environment variable. Because the hardest part of this process was figuring out to correctly configure Passenger 3 for Nginx I am going to post my configuration for my Rails (and php-fastcgi) applications. I hope that this helps some of you.

user  op;
worker_processes  2;
 
error_log  logs/error.log warn;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
pid        logs/nginx.pid;
 
events {
    worker_connections  1024;
}
 
http {
    passenger_root /opt/passenger-3.0.0;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 10;
 
    include       mime.types;
    default_type  application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    access_log  logs/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    #keepalive_timeout  0;
    keepalive_timeout  65;
 
    gzip  on;
    gzip_http_version 1.0;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_buffers 16 8k;
 
    include /etc/nginx/sites-enabled/*;
 
    server {
        listen       80;
        server_name  localhost;
 
        #charset koi8-r;
 
        access_log  logs/host.access.log  main;
 
        location / {
            root   html;
            index  index.html index.htm;
        }
     }
}

sites-available/typealoud.com

server {
 listen 80;
 server_name www.typealoud.com;
 rewrite ^/(.*) http://typealoud.com/$1 permanent;
}
 
server {
 listen 80;
 server_name typealoud.com;
 access_log /var/log/nginx/typealoud.com/access.log;
 error_log /var/log/nginx/typealoud.com/error.log warn;
 
 location / {
  root /var/www/typealoud.com/public;
  passenger_enabled on;
  rack_env production;
  rails_spawn_method smart;
  index index.htm index.html;
 }
}

sites-available/thoughtlessbanter.com

server {
 listen 80;
 server_name www.thoughtlessbanter.com;
 rewrite ^/(.*) http://thoughtlessbanter.com/$1 permanent;
}
 
server {
 listen 80;
 server_name thoughtlessbanter.com;
 access_log /var/log/nginx/thoughtlessbanter.com/access.log;
 error_log /var/log/nginx/thoughtlessbanter.com/error.log warn;
 
 location / {
   root /var/www/thoughtlessbanter.com;
   index index.php index.html index.htm;
 
   if (-f $request_filename) {
    expires 30d;
    break;
   }
 
   if (!-e $request_filename) {
    rewrite ^(.+)$ /index.php?q=$1 last;
   }
 }
 
 location ~ \.php {
  include /etc/nginx/fastcgi_params;
  keepalive_timeout 30;
  proxy_read_timeout 60;
  proxy_connect_timeout 60;
 
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
 
  fastcgi_param PATH_INFO "";
  fastcgi_param SCRIPT_FILENAME /var/www/thoughtlessbanter.com/$fastcgi_script_name;
 
  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;
   if (!-e $request_filename) {
    rewrite ^(.+)$ /index.php?q=$1 last;
   }
 }
 
 location ~ \.php {
  include /etc/nginx/fastcgi_params;
  keepalive_timeout 30;
  proxy_read_timeout 60;
  proxy_connect_timeout 60;
 
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
 
  fastcgi_param PATH_INFO "";
  fastcgi_param SCRIPT_FILENAME /var/www/thoughtlessbanter.com/$fastcgi_script_name;
 
  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;
 
  fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;
 
  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
 
  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;
 
  fastcgi_param  REDIRECT_STATUS    200;
 
  fastcgi_read_timeout 60;
 }
}
Oct
12
Posted by JB at 11:16 pm

Foolish me, I was doing some housekeeping on my web server and managed to remove the mysql daemon from the startup script. It took me a couple of weeks to figure out that this had happened. Well, anyway, luckily now as you can see it is back online and ready to rock.

I will be heading off to the Boston Gameloop 2010 conference at the Microsoft NERD center in Cambridge, MA tomorrow night. I decided to travel by the means of the Bolt Bus which provides both power outlets for laptops as well as free Internet for the trip. I am not quite sure the quality of either, but I expect to at least be online occasionally tomorrow night to chat on and off. I think I am going to take this time to work more on my Ruby on Rails project, Type Aloud, which I am hoping to launch sometime around the beginning of October. I will be sending around some beta invites when the site is ready to rock and roll.

If you are a frequent rider of the PATH system between New Jersey and New York City you may have noticed big brother communicating overhead reminding you that there is no eating or drinking on the PATH. I have been commuting into New York City for three years now and I absolutely understand their point – due to the high volume of people, even if every third person was eating a sandwich the amount of trash left all over the train would be amazing. But only the other day after I had read my complimentary Metro newspaper, dropped it into a puddle of who-the-hell-knows-what, I realized that there are absolutely no trash cans inside of any of the station terminals!

This was a moment I actually had to double take. I looked around the World Trade Center terminal searching for a trash can and I was only able to find some construction worker’s trash bin which should absolutely not need to be used to throw out newspaper. So I walked out of the terminal in search of a trash can on my normal commute on the Lexington avenue line. It was not until the corner of Broadway and Vesey had I actually found a trash can! That is roughly a quarter mile away from the terminal entrance! As you can clearly see below the distance from the World Trade Center, which is not even accurately depicted due to the ongoing construction, is quite surprising. You would think that someone, anyone, might have decided to stick a trash can on one of the busiest commuter walked areas in the city.


View Larger Map

I understand the need to enforce physiologically the fact that you do not want trash inside of the terminals. But should you absolutely remove trash cans completely, even outside of the turn stiles before you even get inside of the terminal? Some people are standing around drinking (or eating) the remnants of their breakfast/lunch/dinner before they decide to step through the gates. Although, I have to say, it seems to be working – the PATH commute is by far the less smelly of any of the lines that I have to take. Just some food for thought.

I have been using WordPress for many years now. I firmly believe that there is no better software available, free or paid, for rolling your own blog. The guys over at Automattic are an amazing bunch of people for giving away free software that might otherwise cost thousands of dollars. But with all of that said I feel that there is a big gap that the blogging community must hurdle in order to become, well, more conjoined. When I am bored I tend to click around the Internet, read some blog posts, and occasionally comment on the ones that I feel are worthy. I have found that there is some great great commenting software out there that allows tracking of comments from site to site, but the same can’t be said for blogging.

Now, I may have missed the memo, but what blogging really needs is a centralized hub where I can easily search, comment and publicize the authors that I think are making strides in the vast online writing community that is the blogosphere. Up until this point I have had to keep a list of bookmarks for the blogs that I want to frequent, but why is that? Just as I am able to log on to Digg.com and given stories that I would like to read, I should be handled blog articles that are automatically aggregated utilizing the XML-RPC ping protocol that WordPress has seemingly kept infamous. I believe that the WordPress.com community is a step in the right direction when it comes to a blog community, but I do not want to be limited to having to open a blog on their host in order to be listed there. Part of the reason I love WordPress (the software) is that I like the freedom I am given when I am able to run my own host.

Well, those are just some thoughts of mine. I am sure that someone, somewhere, has been thinking the same thing that I have and is probably already hard at work on the next big thing when it comes to blogging communities. I just have not found anything that comes close to my vision of what the ideal would be. Someone surprise me.