Apple, Computers, Linux, Open-source, Personal, Ruby, Software, Thoughts, Web, Windows

Have You Had Your Daily Dose of Editors?

The Boss decided to purchase a license to RubyMine for me to use, and the rest of the office to evaluate. I wanted to share my experiences, since there doesn’t seem to be a lot of real-world experience on developing Ruby on Rails in a corporate setting using RubyMine. Also, some of my new (and past) coworkers might be curiously looking over their screens with TextMate to see what else is out there.

First, a bit about the Ruby on Rails culture. It is a very Mac OS X oriented, and the preferred editor of choice is TextMate. I really try and stay away from tools that only run on one operating system, and TextMate falls into that category. Ruby is a very terse, dynamic and simple language. Rails developers will tell you that you don’t need an IDE to do Rails work. While this is true, I find not using anything more than a text editor is like using a screwdriver instead of a power tool. If you are a good developer, and you understand Ruby a good editor will only make you more productive. RubyMine isn’t meant to be relied on like IDEs are for other strongly typed languages including C# and Java. It makes a best effort to provide its features without getting in your way when it fails.

RubyMine offers full support on Windows, Mac and Linux. RubyMine also strives very hard to make the Windows version as strong as the *nix versions. It does this by including an IRB console, and commands to run many rake tasks, and Rails generators. While these tools are a very good solution on Windows, people with the ability to run a native terminal will probably find the offerings lacking in comparison. This review will skip these Windows-audience features, since I don’t feel it represents the majority.

Auto-Completion

RubyMine does a very good job at trying to autocomplete its code. It will look inside Class definitions, and can find methods, attributes, and associations. If you are using gems that extend classes, such as ActiveRecord, RubyMine will do a fairly robust job at reading these methods from the gem files once they are attached to the project. “Attached” just means that RubyMine is inspecting these gems. It was not able to locate gems provided via Bundler, but this is supposed to be coming. Also, the auto-complete can be slow at times and freeze the editor from further input.

Inline Documentation

When you place the caret over a method, or class, RubyMine will fetch the documentation for that method and show it in the editor. This is doesn’t always locate the documentation however, in cases where the method is defined in a gem that is unattached.

Command+Click Following

You can click class names, and method names to jump straight to the definition. Also useful is clicking on associations, and named scopes. You can also jump to route definitions, and partials.

Cucumber Integration

There is auto-complete provided for your Cucumber tests, however also nice is the Command + mouse over action of displaying the definition of a scenario step. These can be Command + clicked to follow to where the step is defined. Also, if your step does not match a definition, you will be notified in the editor.

Safe Refactoring

Refactoring in this sense is renaming a variable, or a filename. The nice part about RubyMine is the ability to optionally search your project for usages of the current variable, or filename and update those references, or just notify you about them.

Spelling

Not a big selling point, however many editors don’t offer strong spelling support. It checks your comments, and your variable names, but stays out of the way of your code.

Find By Filename / Class

You can pull up a dialog that will allow you to type a filename and it will return all matches regardless of directory level. Filenames can be regular expressions, and can include paths, and even line numbers. RubyMine will find them, and in the case of the line number, it will open the file and jump to that location. Searching by a class name is very similar.

Copy Buffer

Only having a clipboard with one item in it can be frustrating at times. Using the copy buffer feature, I can copy multiple sections of a file, then paste them individually later.

Code Formatting

RubyMine allows for manual formatting, or formatting on paste. You can also auto-format a complete document with a keystroke, based on your auto-format settings. It even works on HTML/ERB, HAML, Javascript, and CSS.

RubyMine isn’t a perfect tool however, and there are things about it that are less than ideal. Specifically, the footprint of RubyMine can be quite large. This seems to be a sin it shares with many of its Java IDE brothers. After watching it creep (unnecessarily) up to 400+ MB, I decided to do something about it. The solution turned out to be very simple.  On OS X, look for the file “Info.plist” in the /Applications/RubyMine 2.0.2.app/Contents/ directory. On Linux, change the file in the rubymine/bin/rubymine.vmoptions file. Change the value for Xmx to be 128m. This is the memory cap in which RubyMine will run. Runs like a charm now, and for days too.

Other annoyances include the default editor settings. Changing to soft tabs was more confusing than it should have been. Allowing “virtual space” after then of a line leads to a lot of accidental whitespace. The right gutter line isn’t helpful for Rails development. The font face was terrible. I had to customize the default theme to make it use the Apple default font. And finally, I don’t like the “Project” oriented state. I would rather open from within a directory in the terminal and work from there. I also don’t care for it generating a work folder within my Rails project – its just one more thing I have to pay attention to when using version control.

All in all, this is certainty one of the best editors I have seen yet for Ruby and Rails work, while I am sure I haven’t even scratched the surface of what this editor is capable of doing. It beats Netbeans 6.x, and RadRails. It will be interesting to see how Aptana Studio 3 turns out as the Aptana folks seem to really be putting some love into it. These editors felt like Ruby support was tacked onto what was intended to be a Java editor. The other end of the editor spectrum are hundreds of weak text-editors. I wanted something in-between. RubyMine has a clear focus, and all of its options center around Ruby and Rails work. So, if you are using TextMate as your first, and only Ruby on Rails editor, give yourself some perspective try out RubyMine’s free trial.

Advertisements
Apple, Computers, Events, Family, Open-source, Personal, Ruby, Software, Thoughts, Web

Darkness Warshed Over the Dude

We moved into our new office this week. It is really nice inside – very professional. I got to construct a cabinet from IKEA and I thought my head was going to explode. There were points in the instruction booklet where instead of describing something, there would be an arrow and the noise some action would make like “snap!”. I have never seen modular furniture that was so – modular. We are finally setup at the new place, and the overhead lighting is making everyone hate the stupid high-gloss iMac screens. Someone made the comment that it was “like being stabbed repeatedly in the eyes”, and another “could count the hairs on his face”. Now that we have more space, I will be getting a second monitor which I know will be much less frustrating. Along with our move is the mandatory male interior decorator that is stylishly unshaven, wearing a sweater under a brown corduroy jacket, and designer jeans. He was walking around the room talking about how “powerful” the color scheme felt. At least we got some new chairs out of it.

I finally got to the Registry of Motor Vehicles this week after dropping Kristin off at the airport to go back to Atlanta. Of course her being gone threw me out of my barely comfortable routine. The RMV made me surrender my Georgia license without giving me a Massachusetts license. Go figure. So with Kristin gone, the beer gone, and me without a license for the last week I think I went a little crazy. Now that Kristin is back, I asked her to do a beer run with my sad “help me” eyes. No license yet.

I figured I could go park the car at the train station this week, and ride in as usual. Kristin usually drops me off in front, so it shouldn’t have been that different. I got there around 9am the first day I tried it and the damn lot was full. I thought I was going to be clever and drive a block and park in another parking lot and walk back to the station. Apparently everyone tries that because the signs all said “T station parking illegal. Vehicle will be towed at owner’s expense”. The last thing I needed was a pending accident investigation, no license, and a towed car. I ended up just driving in the whole way which I have come to increasingly dislike. The rest of the week worked out better. I just got there earlier and the lot had spaces. The office is right across the street from the train station, so without the bus, it takes about 45 minutes to get to work from the house.

Work has been a mixed bag. Some days I really feel independent enough to feel like I am churning out good, usable code. Other days it is a lot of waiting, or some silly thing that I get hung up on for hours. We moved our project through my first “iteration”. Development on this project is done through “User stories”. A user story (either real, or fictitious) outlines what is a problem, and what needs to be changed to resolve it. A developer can read the user story, make the revisions to the code, and then write a “feature” that demonstrates that it is resolved. The cool thing about features is that it is all natural language thanks to Cucumber. For example,

  Scenario: Search by title
    Given that I am a common user
    And I have a topic with a "title" of "test topic"
    And I am on the Topic Search page
    And I search for "test"
    Then I should see "Results"
    And I should see the topic "test topic"

You can see that it is very easy to follow, and it allows our limited-technical people to read User Stories features without worrying about understanding Ruby tests.  Also, making a change, then seeing your entire test suite pass is a very reassuring feeling. Testing is so important here, that we actually write the feature first, and then change the code to make it pass.

It has been quite a bit to adjust to. I haven’t really had the opportunity to do Ruby development full time, and I am unfamiliar with Git, and OS X. I have already gone through the O’Reilly book on Git with my time on the train, and I am a few chapters into the Ruby 1.8 Pickaxe book. Textmate has been decent, and I could get used to it, however it definitely lacks some of the things Rubymine has. I do like the speed and lightness of Textmate. Case in point is when switching a branch in Git, it applies a bunch of deltas to files in your path, and Textmate just detects that files have changed and reloads them in your tabs. I anticipate that Rubymine would shit bricks and try to re-index your project. Rubymine has some impressive features for speeding up Cucumber development, and showing code coverage though, so I may use it yet again. My co-workers have all been very supportive of me using the tools that I am most comfortable with.

I am getting adjusted to life is adjusting here, but I miss everyone very much. My weekends are just a lot of downtime, with Kristin at work, and me trying to occupy my time. I’ll try and get out of my funk today with a car wash, and a haircut. Hope everyone is having fun down in the Atl!

Apple, Computers, Events, Hardware, Open-source, Personal, Ruby, Software, Thoughts, Web, Windows

3 Days Down, 40 Years to Go

Yesterday at 5:00pm marked the end of my first week at Beacon Interactive Systems. My coworkers are all really nice, and there is a surprising geographic mix between them. Some folks have lived in Massachusetts their whole lives, while others come from Maryland, and Michigan. The cultural differences between “down South” and here are pretty minimal, unless you just feel like having a good laugh. There have been two big adjustments however: Snow is really not a big deal up here – people hardly notice it outside. The second is restaurants don’t have sweet tea. You would have to drink sweet tea to understand why this is a big deal.

In general:

  • The job is much less stressful. Even during crunch times, you hear Southpark and Big Lebowski quotes (“I’m not your pal, guy!”).
  • The environment is a lot less structured. You come in whenever, you leave whenever. If you want to go outside and toss around the football, go for it. Good team-builder by the way.
  • The skill sets of my coworkers are all very impressive. Its the rifle vs shotgun approach.
  • The job area is nice – its next to Harvard. Getting there is rough – I have to cut across the city. My 20 minute commute takes about an hour.
  • Developing on a Mac is an easier transition than I thought. I won’t say that I’m in love with it yet, but its workable. The biggest pain has been this silly bundled keyboard and mouse. No one else uses them. Also, package management on Mac sucks compared to Linux. I think I would actually prefer to use Linux. Time will tell on this one.
  • The coffee isn’t as good.

An interesting collision of viewpoints occurred my second day at the job, while I was shadowing a coworker on a joint project. He was showing me their (complex) system of bug detection, and correction. They write up a use case, file a ticket, branch the code, create a changset, rebase it, merge it into QA, verify it, then push it back upstream. Not coming from anything near that complex (“Hey Ben – login to the production server and change it!”) I was amazed that they spent so much time on this process. I asked if they ever just ignore a bug that would be too minimal to matter. My coworker asked me to clarify what I meant. I replied with “You know, its good enough for government.” He paused and looked at me funny, then reiterated that they address all bugs that are discovered. A bug is a bug. It will take me a while to harden my resolve to be like theirs, and aim for perfection. Perfection wasn’t possible before because we had the typical scenario of overworked, underpaid, and on a deadline.

We are moving into our new building in a few weeks. When we move, there will be a train station across the street from the new building, and I will probably make the transition to riding into work. Its about the same amount of time, but I would have the ability to sleep, read, surf the Internet, etc all without causing an accident.

Wish me luck for next week – its been a difficult adjustment.

Apple, Computers, Hardware, Software, Thoughts, Windows

What Ever Happened to Multi-tasking?

fix-computerToday we take multi-tasking for granted. Right now, as you read this you probably have a browser window open, perhaps email, instant messenger, your music player, perhaps anti-virus software running. If you had to run one, and only one application at a time I think we can agree that it would significantly affect your productivity. I have a difficult time even imagining computing without the ability to multi-task. However, the importance of this core computing concept seems to be called into question with new appliances.

When you look at a computer, it is very different from an appliance, such as your game console, your DVR, or your smartphone. One could argue that each type of electronic device has a purpose, and constraints that interfere with achieving this purpose. In the case of a video game console, the purpose is entertainment. A console’s constraints are the need to be consistent, and offer high performance with limited hardware. With a DVR, its purpose is to manage scheduled shows. A DVR’s constraints are optimal playback quality, and near real-time schedulers. With a smartphone, its purpose is to keep people connected while on the go. A phone’s constraints are probably the most severe with extremely limited hardware, coupled with short battery life.

In devices where performance is a key factor, such as video game consoles, and DVRs, I believe you are likely to see less control given to a user. This is to keep the running environment “pristine” and prevent non-core applications from adversely robbing the limited hardware of CPU cycles, and resources. This is the dreaded scenario of any computing device – some process (that the user may not even be aware of) is affecting the performance of the entire device.

To my knowledge, the iPhone was the first smartphone that really encouraged the installation of applications onto the device by the user. This would mean that since users have choice to modify the software running on the phone, the performance of these applications running  could affect the performance of the entire device. In order to work with the extreme constraints of the device, Apple made the decision to remove multi-tasking from their OS. This has been a controversial decision, however one that has not affected the success of this device.

Now other appliances are following the paradigm of no multi-tasking. Microsoft recently announced the Windows Phone 7 OS, and it is rumored to not have multi-tasking support. While this rumor may be unfounded, the Apple iPad device also offers no multi-tasking. The success of this device, and the market that this device will fill is yet to be determined, but the inroads to daily computing without multi-tasking can be seen. A tablet device has a purpose, and constraints parallel to that of a smartphone.

Video game consoles have never offered multitasking until recently, and even now it is very limited. Coupled with smartphones, and tablet devices, the perspective of multi-tasking on the computer seems to be the exception, and not the norm. It can almost be argued that no multi-tasking is a feature that boosts the performance of a device.

Is this how the world will fix the “slow device” problem? Hardware and batteries are constantly improving, but we never seem to get ahead of the curve, since applications become more complex at roughly the same rate. “What Intel giveth, Microsoft taketh away.” Eliminating multi-tasking sure gives devices an unconventional speed boost, but is it seems like a step backwards? Can the human mind truly multi-task anyways?

One final note: it would seem to me that perhaps a solution lies in the UNIX solution of prioritizing process by “nicing” them.

What are your thoughts?

Apple, Computers, Linux, Open-source, Software, Web, Windows

Stunnel – Just goes to show, anything can be encrypted

Image by Will JacksonToday I got the opportunity to play around with an open-source application named STunnel. Its purpose is simple – some applications are dumb and don’t understand SSL. This program makes it.

Bullying aside, it had a perfect application today when I wanted to move two websites over to use a secure login page. Why didn’t I just Apache, or IIS you might ask? This particular website happens to be a from a 3rd party vendor who made their own web server to… get this… serve websites written in their own custom language. I don’t understand why anyone would do that in this day and age, what with the 10,000+ languages already available, and the 1,000+ web server platforms available. (On top of all that, they use a proprietary database!)

Long story short, the third party had a module ($695) to enable SSL in their webserver, which I will refer to as Peggle from here-out. The recommendation to use STunnel came from this vendor’s website, so it seems to contradict their money making plans. My guess is someone chewed their asses out about not having SSL out of the box. Whatever the reason, I will consider them less cruel by at least dropping the recommendation on their website as a free alternative to their solution. For all I know, their solution is installing STunnel for you for $695.

Back to Peggle . It does one thing – it serves requested pages out on a specific port. Incorporating SSL is really beyond its scope. This is similar to Mongrel. Whereas Mongrel can sit behind Apache (or some other webserver) to redirect to SSL, STunnel just “takes care of it”.

After finding a lack of documentation (and even worse documentation for Windows), I decided to write my own, much briefer, much more straight forward version. Hopefully, some poor soul will wander across this article searching for enlightenment.

STunnel installation:

Make sure that you have OpenSSL available to you in some form or fashion. Watching Certificate Requests getting generated on Windows makes babies cry, so your best bet is to take someone with a Unix machine out to lunch to get some terminal time.

Certificate Request

  1. Locate a machine with OpenSSL (Windows, Mac, Linux – it doesn’t matter)
  2. Run the command: openssl req -new -nodes -keyout server.key -out server.csr
  3. Answer the certificate questions, keeping in mind that the common name is the FQDN for your website
  4. Locate the generated server.csr file and submit this to your Certificate Authority for signing.
  5. Transfer the server.key file to the machine you are installing STunnel to, if it is not the same.

Installing STunnel

  1. Download Stunnel from here – note that Windows binaries are generously provided
  2. Run the STunnel installation – the default path will install to “C:Program Filesstunnel”

Configuring STunnel

  1. Get the signed certificate returned from your Certificate Authority (above), and drop this somewhere safe. You will need to refer to this location in a moment
  2. Locate the path for the server.key file generated earlier
  3. You now need to combine your key file, and your signed certificate into one single file. I named my file “stunnel.pem”
  4. Open up the file stunnel.conf and replace with the following configurations:
#Stunnel server configuration file

#This is the path to your combined key / signed certificate file
key=C:Program Filesstunnelstunnel.pem

#up this number to 7 to get full log details
#leave it at 3 to just get critical error messages
debug=3
output=C:Program Filesstunneloutput.log

#These are definitions for services.
[system1]
accept=443
connect=80

[system2]
accept=8001
connect=8000

Once you have created your configuration file, you can start STunnel by running: stunnel.exe stunnel.conf. Remember that if anything goes wrong, you will probably have to kill it with Task Manager, or by clicking on the system tray icon (in Windows). Additionally, check your server log file – it contains valuable information.

Once you have the STunnel server running, you should be able to go to a URL in your browser such as “https://example.com:8001” and see that SSL is working. Even if there is nothing serving content at this port, and the page times out, you should still see the secure webpage icon in your browser. This SSL indicator should reflect your CA.

Once you have the port encrypted, it is up to the individual application to respond to requests coming in to that port. Data being sent to and from this port will be encrypted using SSL – totally transparent to the web server.

So there we have it – Peggle is now SSL enabled without ever knowing the difference. People’s data (especially login credentials) are secure once again! The crowd goes wild…

Apple, Computers, Linux, Open-source, Personal, Ruby, Software, Thoughts, Windows

Netbeans 6.5 Rails Console

I was really excited about the release of Netbeans 6.5. It is the only solid Ruby  / Rails IDE that I know of, and it runs circles around Aptana (aka RadRails). Among the new release features is an integrated Rails console. This means that I can develop and test all in the same app without having to ALT+Tab myself to death.

Let me preface this rant by saying that I have the utmost respect for Netbeans (despite its owner) – it is rock solid, easy to use, and powerful. However, the Rails console leaves much to be desired. Here is my list of issues that I would love to see addressed (by someone with more Java finesse than myself):

  1. The Rails console doesn’t allow pre-typing. The environment may take 1 – 30 seconds to load. In this time, I should be able to start typing in my command and have it fill-in correctly once the prompt is available. It will fill in all the stuff I type before it is ready in a random order instead.
  2. The “Up” arrow on the keyboard moves the caret to the previous line, unlike in IRB / console / Bash where it should autocomplete the previously run command
  3. Ctl + L will clear the screen, just like in the development logs, and console on Linux / OS X, but it actually renders the console useless. It removes your prompt, and stops accepting keyboard input

While someone is at this, here are some of my dream features:

  1. The same code-completion that is provided by the IDE itself. If I type in a model name, and hit “.”, it should show me a list of instance methods on that model.
  2. Syntax highlight the output just like in the IDE

Please Netbeans community, Christmas is coming – consider it a gift to the world!

Apple, Computers, Linux, Open-source, Software, Thoughts, Web, Windows

The Rich-Internet-Application Bubble

It doesn’t seem to be a question of if, but when we will see the Rich-Internet Application (RIA) bubble burst. Adobe’s Flex platform, and Microsoft’s Silverlight platform promise the world, but their implementation seems to be flawed. The entire discussion seems to always remind me of the story of Java. Consider the following advantages and disadvantages of an RIA system over traditional HTML / Javascript / CSS:

Advantages:

  • RIA platforms promise “rapid application development” (so cliche in the development world). A developer can create a visually rich and interactive application inside the comfort and power of an IDE.
  • RIA platforms can consume data at a level that is not currently possible with current existing web technologies. SOAP, XML and other services can be consumed in a stateless web application.
  • Web applications are treated like traditional applications, offering added benefits like running offline

Disadvantages:

  • RIA platforms are specific to an IDE – in short controlled. Adobe’s Flex promises to be open source, but only on the client end. The “black box” will probably remain just that.
  • If open-source specifications are achieved (unlikely with Microsoft Silverlight) It will take years for alternate IDEs, and editors to support its functionality on a level comparible to what is currently offered
  • RIA platforms add another layer of complexity to an increasingly growing software stack with the need for web services to interact with database sources as the RIAs ironically are not able to.
  • HTML, Javascript and CSS are all free, standardized, open-source, cross platform, and ubiquitous. Microsoft’s Silverlight and Adobe’s Flex are both controlled and shaped by a single company.
  • RIA platforms require a browser plugin, since the technologies generate data that is not directly consumed by any current browser.

Hopefully we remember the failed promises of Sun’s Java VM. The marketing term “write once, deploy everywhere” has become something of an inside joke in the technology industry, as this is hardly ever the case. It should be more appropriately named “write once, deploy anywhere that supports platform ‘x’. This is made worse by the fact that as closed-spec platforms, the RIA browser plugin development is left to the companies pushing the platform. How well do you think Microsoft will support a Silverlight client on Linux, or iPhone?

Performance in RIA platforms has also historically been a sore subject. Java code runs by creating a host-specific virtual machine that abstracts all of an operating system’s details. This works against performance, as the virtual machine will always be the limiting factor – there is simply too much overhead involved.

What each of these companies are pitching to developers is the idea that HTML, Javascript, and CSS are old, and cumbersome to work with. Further, browser inconsistencies make truly agnostic client-side scripting, or styling very limited in implementation. Solutions like Prototype.js, or the CSS browser reset are needed to write agnostic code.

I just don’t buy into it.

First, HTML, Javascript, and CSS are made cumbersome by the fact that no browser (except possibly Safari) adhere to the standards agreed upon by the W3C consortium. Microsoft in particular is selling a tool to abstract browser development, while their browser consistently remains one of the least compliant available.

Second, I think that the success (undeniable when looking at their ubiquity) of HTML, Javascript, and CSS are due to the fact they are free, accessible, open-source, and standardized. Anyone who wants to be a web developer can start right now without ever spending a penny. Developers wishing to use RIA platforms must purchase a developer license to use the IDEs to generate the code.

I hope that the developers of the Internet don’t fall prey to the seduction of RIA offerings. RIA is simply a product being pushed soley on the basis of profit – not with the promise to make the web a better place tomorrow. Instead, I encourage everyone to ride out this wave, and let the technology’s bubble burst.