Showing posts with label Likes. Show all posts
Showing posts with label Likes. Show all posts

Tuesday, October 28, 2008

Tuesday, October 21, 2008

Being Lean

Here's an interesting article I'd like to share. It's about keeping your company fast and light:

http://venturehacks.com/articles/lean-startups


W

Monday, October 20, 2008

Interesting Ideas

Check out this talk by Jason Fried from 37signals. Definitely some very good ideas and insight.

http://www.balsamiq.com/blog/?p=375


W

Saturday, October 18, 2008

Ruby: Time made easy

Here's another example of how Ruby just makes things simple. Imagine you're working with time and you have to figure out the difference between 2 times and whether they fall within a certain range. In most languages, you have to figure out how many seconds exist in your time range. For example, 1 minute would have 60 seconds and 1 day would have 86,400 seconds. That's not too hard to figure out, but imagine the readability!

t2 - t1 < 86400

That just begs the question, "Where does 86400 come from?". Imagine you had to explicitly put down the number for 1 week?

Well, Ruby is awesome in that it concentrates on readability. Since everything in Ruby is an object, numbers are just Fixnum (or Bignum). Either way, that means we can use certain methods associated with the object. Check this out:

t2 - t1 < 1.second
t2 - t1 < 1.minute
t2 - t1 < 1.hour
t2 - t1 < 1.day
t2 - t1 < 1.week
t2 - t1 < 1.month
t2 - t1 < 1.year

Now how readable is that?


W

Saturday, September 27, 2008

RoR Generate + SVN

We all know about RoR's ability to generate controllers, models, migrations, etc. However, if you're using a repository, you have to manually add these newly created files. This could be a pain in the ass!

Here's a tip. If you're using SVN, you'll love this. Simply add the flag --svn and the generator will automatically add the newly created files to SVN. Simple!


W

Tuesday, September 23, 2008

Shuffling an Array

I just found a very interesting article about shuffling an array correctly!

http://adrianquark.blogspot.com/2008/09/how-to-shuffle-array-correctly.html

Enjoy!


W

Thursday, September 18, 2008

Dropbox

Recently, there has been a lot of buzz around Dropbox. It is now open to beta testing, and many people say it's awesome.

In short, Dropbox can be thought of as storage that you can access from anywhere you have an internet connection. It'll automatically sync your local and remote files, and also work on PCs, Macs, and *nix machines.

For those of you that move around a lot and need your files reliably without the hassle, check out Dropbox.


W

Sunday, September 14, 2008

Saturday, September 13, 2008

Y Combinator

Y Combinator is a venture firm that specializes in funding startups in their early stages. I recently discovered their news section, which, as a technical person, I find very interesting. It is a Digg type site that gives links to interesting articles. Every so often, I will also see RoR articles on there. Check it out:

http://news.ycombinator.com/


W

Tuesday, May 27, 2008

Comma Separated Numbers

I found a neat little function that will separate large numbers by thousands using a comma or any specified delimiter:

http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M000997

Gotta love RoR... they simplify everything!


W

Saturday, May 17, 2008

Time Ago

Ever wanted to show the user that something happened so many minutes/hours/days/etc ago? Apparently, RoR makes it super simple to do this. There is a method called:

time_ago_in_words

Simply include the time (from now) that you want to calculate - perhaps a created_at/updated_at field.

Easy!


W

Wednesday, May 14, 2008

Alternating Table Row Colours

When listing data out in a table, it's always nice to have alternating row colours. This makes it infinitely easier to scan the table and much more enjoyable.

RoR makes it really simple to alternate row colours. A cycle function is given to aid in this task, and it simply cycles between the values given. By using this, you can specify your alternating class names here.

If you have more than one table, remember to call the reset_cycle function to reset the cycle.

Easy!


W

Friday, May 9, 2008

Ubuntu + Compiz Fusion plugins

Gutsy Gibbon already has Compiz Fusion packaged with it, but apparently, there are numerous plugins that can be added on as well!

This guy has written a lovely script to get you started:

http://ubuntuforums.org/showthread.php?t=620000

Enjoy!


W

Thursday, May 8, 2008

Support ODF

I've recently been reading more and more material about open formats. Apparently, there's been a ripple in the pond, as Microsoft is trying to push through their own format, which is obviously inferior and not much of a standard at all (again, the usual Microsoft bullying antics).

I found an interesting link I'd like to share if anyone is passionate about this fight. It's to get your government to support the OpenDocument Format. I'd just like to share this with you guys:

http://www.fsf.org/campaigns/odf-letter-template


W

Thursday, April 17, 2008

Pluralize

Have you ever had to write some sort of if/else condition to display a sentence involving an object count? Something like 1 person, 2 people, etc.

Well, RoR has a nifty little method called pluralize. All you do is feed it the number and a string, and it will attempt to figure out exactly what you want.

For example:

pluralize(1, 'person') # '1 person'
pluralize(2, 'person') # '2 people'

I thought this was pretty neat and wanted to share with you guys. There are a lot of little methods tucked away in the RoR API, and I encourage you to look through them to help minimize your development time on mundane things like this. Enjoy!


W

Wednesday, April 16, 2008

respond_to + render :partial

RoR has a very quick way to turn your web application into a web service that supports API hooks into your application. It does this using the respond_to method. It's as simple as doing something like:

respond_to do |format|
format.html # automatically calls the corresponding view
format.js #automatically calls the corresponding rjs
format.xml { render :xml => @user.to_xml # or other XML stuff }
end

It's that simple!

Well, there's one odd thing that got me for a little bit. I'm not sure if it's a bug, but when I tried to render a partial in the format.js block, I got an error that it could not find the corresponding template:

respond_to do |format|
format.js { render :partial => 'my_partial' }
end

I found that very odd, but not fixable... I tried adding '.html.erb' to the end of my_partial:

format.js { render :partial => 'my_partial.html.erb' }

And magic! It worked! I'm almost sure this isn't the way RoR is suppose to handle this, but in the meantime, it works! Small hack, but I'm happy :D If any one else runs into this problem, drop a comment, or even better, if you know why or how to solve this, let me know!


W

Friday, April 4, 2008

Gedit

So after playing around with Gedit for a while, I'm loving it. It's super fast and there are so many nice plugins to make it very similar to an IDE. There are some things that aren't present, such as refactoring, but that never worked properly in RadRails anyways!

Before, I mentioned that there was no SVN or debugging support. As I continue to develop using Gedit, I have not encountered any problems with this. I'm currently using SVN from the terminal and it's perfectly fine. Lucky I've had experience with using CVS in the terminal ;) Also, I installed a graphical diff program called Meld so that I don't have to look through the classic diff. I haven't had to do too much diffing, so I can't say too much about it.

As for debugging, I realized that for RadRails, I was already using ruby-debug, which runs straight off the terminal! So far, for what little debugging that I have had to do, I found the terminal easier to work with. It requires a bit more typing though (compared to the mouse clicking in RadRails). However, it works... unlike RadRails. The debugger in RadRails was very unpredictable and I could never access the variables without some sort of error popping up. It was so annoying! I'm quite happy with the terminal, so for now, I'm sticking with it.

Apparently, there are new plugins still being developed for Gedit as it gets more popular. Perhaps someone, in time, will come out with an SVN plugin or a debugger plugin. We'll just have to wait and see ;)

In the meantime, I'm super happy with my current setup. There are little things here and there that are bugging me, such as when I hit the home button, it jumps to the beginning of the line, rather than the beginning of the words. I'm hoping there's a configuration that I just haven't found yet.

After playing with it some more, I'll post up the plugins I have installed.


W

Tuesday, April 1, 2008

BackgrounDRb

There are often times when you want to perform scheduled tasks, such as email reminders. These tasks are usually triggered at a specific time, and not necessarily by a user action.

On a unix machine, cron jobs do exactly this. They are triggered at a particular time, do their work, then go away. I looked around for a bit to see if there was a rails plugin to handle jobs like these.

Behold: backgrounDRb. This is a rails plugin that runs its own server to do a multitude of jobs. It supports cron jobs, but at the same time, it handles jobs in the background. For instance, if you are generating a large document, you don't want the user to wait for a long time. Instead, it will spawn a job in the background, allow the user to continue doing his/her stuff, and periodically check when the job is done.

For my purposes, I only needed the simple ability to create cron jobs, so I have yet to experiment with the background tasks. However, I found it to be super easy to use and everything is very straightforward.

If you're looking for a scheduler type plugin, look no further. This baby is amazing!


W

Monday, March 31, 2008

Textmate: Ubuntu style!

If you've ever watched any railscasts, most of them use something called Textmate to edit their files on a Mac. Apparently, it's suppose to be really good.

Well, recently, I've been getting really fed up with Aptana and RadRails. There are lots of things that bug me, like the wait time to save a file and especially the wait time to copy/paste things. It's just horrible. Furthermore, RadRails decides to crap out on me every so often. There are so many errors in the background that I run out of memory. So far, there doesn't seem to be a fix.

Enough of that... I'm moving on to better things, like a Textmate clone: a revved up version of Gedit! Apparently, you can easily make Gedit behave very similarly to Textmate! I followed this guide and so far, everything is smooth.

I haven't tried developing yet. I just installed everything. I'll let you guys know how it goes... but I'm anticipating I'll like this more than RadRails. Only downside is the loss of the SVN plugin and a debugger... I wonder...


W

Sunday, March 30, 2008

Ubuntu beats out Mac and Vista

The results are final from the 3-day-long hack-fest and guess who came out on top? Yup, that would be Ubuntu!

A hacking contest was held in Vancouver recently which featured 3 laptops, 1 was a MacBook Air, the other a Vista, and the 3rd was an Ubuntu.

The first to be compromised was the MacBook Air. Amazingly, Vista held its ground until the 3rd day, where it was finally pwned.

More details can be found here:

http://dvlabs.tippingpoint.com/blog/2008/03/28/pwn-to-own-final-day-and-wrap-up


W