Ruby on Rails with and without SSL using WEBrick

I’m currently building a website with Ruby on Rails that requires SSL to secure a few web pages such as the login page while leaving the rest of the site SSL free. It took me a few hours to figure it out and the information on this subject is somewhat sparse. I thought I’d write down the information in case someone needs it.

I’m using WEBrick for my development work because it’s quick and easy. Normally, WEBrick isn’t in ssl mode and it wasn’t obvious to me as to how to run an ssl version of it. After looking around, I found the script mentioned in this mailing list.  Simply save the script as server_ssl in the script directory of your RoR project and then:

chmod +x script/server_ssl

Be sure to change the ‘ip’ in the script.

SSL requires the use of a server certificate. The logical question is then how does one create and install a server certificate? Normally, you would purchase a certificate from a Certificate Authority or create one by using a tool like openssl(see HTTPS Configuration in the Ubuntu Server Guide). However, it seems the server_ssl script tells WEBrick to create a server certificate on-the-fly and so there is no need to create and install a certificate. One side effect is that Firefox will warn you the certificate is not authentic. Another side effect is that if you stop and restart WEBrick without restarting Firefox, Firefox will tell you the certificate has the same serial number as another certificate and will simply refuse to use the certificate. If that happens, just restart Firefox. These are inconveniences but are ok while you’re still in the development phase.

Continue reading

Traveling to your home town gives you new perspectives

Hong Kong ferryHong Kong boatMy family just came back from a 3-week visit to Hong Kong. We spent time with friends and family and it was a lot of fun. As usual, the good times and bad times(mostly good ;)) in Hong Kong got me to think a lot. Before each trip, I would be bombarded with many issues from work and life in general(mostly from work). It was always very important to resolve design issues at work, bug fixes, team management and whatnot. But once I got to Hong Kong and have spent some time with friends and family in this dynamic environment, I would pretty much throw every issue I had from the states out of the window. I would also realize how inconsequential some of the issues are. Traveling to my home town, especially since it’s out of the country always gives me a bigger picture.

Coming back to the Continue reading

Microsoft Expression Studio + WPF /E look very interesting

The announcement of Microsoft Expression Studio product and WPF /E generated a lot of buzz yesterday. The products will give designers an alternative to Adobe’s products for creating rich user interfaces for web applications easily. Designers will also be able to use the products for desktop applications but my guess is that Microsoft’s emphasis for these products will be on the web.

WPF /E (Windows Presentation Foundation/Everywhere) is Microsoft’s answer to Adobe/Macromedia’s Flash Player. I downloaded it from the release site and played with it a bit with the demos which are also available on that site. The installation was fast and smooth on IE7. However, Firefox wasn’t able to locate the plugin. All demos ran pretty smoothly and the UI was very slick and responsive, just like what you’d see in a Flash application.

I’m pretty excited by just playing with the demos. Hopefully, the plug-ins for Firefox and Safari will be available soon. I do wonder how many professional designers will switch to the Microsoft platform when they’re already very comfortable with the Adobe tools. Do you see capabilities that Expression offers that Adobe’s products don’t? If you’re a designer, I’d love to hear your opinions.

Stepping into your Ruby On Rails code with ruby-debug

I’ve been developing a website with Ruby on Rails since August(more on the choice of the technology later). I like Ruby on Rails the framework a lot so far and it has made me very productive. However, the default debugger breakpointer (ruby script/breakpointer) is somewhat primitive. One of the big minuses is that breakpointer does not provide the functionality to step through your code. I didn’t feel that was a big problem because frankly the output from WEBrick and development.log, together with breakpointer allowed me to diagnose any problems I had until now.

The implementation of PayPal payment for my website changed my requirements and I now need to step through the code to have a better understanding of the payment process, to ensure payments are handled correctly. I dug around the net a little and found ruby-debug. The first version of ruby-debug was developed by Kent Sibilev in July. The current version of ruby-debug has very convenient features such as stepping into or over a line of code, viewing the code, saving your breakpoints to a file, etc. It has made my life a lot easier.

I’m currently running Ubuntu Dapper Drake and the installation of ruby-debug is very easy if you install Continue reading

Home builders continue their uptrend

It’s often true that stocks trade 9 to 12 months ahead of their fundamentals. The home builder stocks are showing signs of bottoming. Does that mean that the U.S. housing market is stablizing?

I’ve found that the housing stocks trade in tandem. Let’s take a look at some of their charts. The trend sure looks great.

Home builders

Continue reading

I’m going to meet Warren Buffett and Charlie Munger!

Warren BuffetCNBC had a special program on Warren Buffett yesterday. It was just an hour long of great entertainment as well as education. Among other things, the program talked about the annual shareholder meeting of Berkshire Hathaway. It showed how enthusiastic people were attending the meeting. It reminded me how I’ve always wanted to go to a Berkshire Hathaway shareholder meeting and that I never had the time to go(or I made up an excuse for not going).

Charlie MungerI’ve always admired Warren Buffett and Charlie Munger. Not only they have great business sense, that they can make the most complicated things look so simple, they also have high ethics and integrity. I decided that I did not want to put off meeting these two giants anymore and so Continue reading

Starbucks took a beating with a reverse head-and-shoulder

Starbucks the stock took a beating today. It’s trading down 6% after a “lackluster” earnings report. I continue to like the stock and here’s why.

Technically, the stock is forming a giant reverse head-and-shoulder with a major resistance at $40. I didn’t expect the stock to blow past the resistance as soon as today. If the width of the right shoulder is going to be about the same as the width of the left shoulder, it’ll probably be another month before we have a breakout above $40, that is if we do get a breakout.

sbux-11-17-06


Fundamentally, Continue reading