Ksplice Uptrack for Fedora Instantly Updates Kernel Without Having to Reboot
by on Sep.02, 2010, under Server Maintenance
Sorry, the URL you’re looking for cannot be found on TheWHIR.com. Maybe you can find the story you’relooking for by going to our news section, blogs or articles. you may also try searching for the item you wish to read by using our search function:
If you’d like to report a missing URL, please contact us at your convenience. Thank you!
<a href="http://www.thewhir.com/web-hosting-news/090110_Ksplice_Uptrack_for_Fedora_Instantly_Updates_Kernel_Without_Having_to_Reboottag:news.google.com,2005:cluster=http://www.thewhir.com/web-hosting-news/090110_Ksplice_Uptrack_for_Fedora_Instantly_Updates_Kernel_Without_Having_to_RebootWed, 01 Sep 2010 18:43:52 GMT 00:00″>Ksplice Uptrack for Fedora Instantly Updates Kernel Without Having to Reboot
Are these dedicated server specs any good – should I get this hosting plan?
by on Aug.31, 2010, under Server Maintenance
I’m not too good with computer hardware so I would appreciate if you guys can tell me if the following server specs are good enough to host a very popular site (with hundreds of thousands of visits a month).
Dedicated Server Specs:
Processor – Single Processor Dual Core Opteron 1212 – 2.00GHz – 2 x 1MB cache
RAM – 2 GB DDR2 667
Uplink Port Speed – 100 Mbps Public & Private Networks
Bandwidth – 2000 GB Bandwidth
IPV4 Adresses – 4
Hard Drive- 250GB SATA II
Operating system – CentOS 5 (64 bit)
Also should I get the 64 bit CentOS or the 32 bit? I’m looking for speed and security.
Thanks
Are these dedicated server specs any good – should I get this hosting plan?
Chrome for Mac tries graphical tab management
by on Aug.30, 2010, under LAMP
If you got here by typing a URL, please make sure the spelling, capitalization, and punctuation are correct, then try reloading the page.
- Or try one of the following options:
- Check the CNET Site Map
- CNET Help Center
- Start over again at CNET.com
<a href="http://news.cnet.com/8301-30685_3-20014960-264.htmltag:news.google.com,2005:cluster=http://news.cnet.com/8301-30685_3-20014960-264.htmlSat, 28 Aug 2010 06:52:12 GMT 00:00″>Chrome for Mac tries graphical tab management
Soldier’s, you don’t mind a little joke do ya?
by on Aug.29, 2010, under LAMP
The Differential Theory of US Armed Forces (Snake Model) upon
encountering a snake in the Area of Operations or a Diversified
Approach to Military Operations:
Infantry: Snake smells them, leaves area.
Airborne: Lands on and kills the snake.
Armor: Runs over snake, laughs, and looks for more snakes.
Aviation: Has Global Positioning Satellite coordinates to snake.
Can’t find snake. Returns to base for refuel, crew rest and manicures.
Ranger: Plays with snake, then eats it.
Field Artillery: kills snake with massive Time On Target barrage with
three forward Artillery Brigades in support. kills several hundred
civilians as unavoidable collateral damage. Mission is considered a
success and all participants (i.e. cooks, mechanics and clerks) are
awarded Silver Stars.
Special Forces: Makes contact with snake, ignores all State
Department directives and Theater Commander Rules of Engagement by
building rapport with snake and winning its heart and mind. Trains it
to kill other snakes. Files enormous travel voucher upon return.
Combat Engineer: Studies snake. Prepares in-depth doctrinal thesis in
obscure 5-series Field Manual about how to defeat snake using
countermobility assets. Complains that maneuver forces don’t
understand how to properly conduct doctrinal counter-snake ops.
Navy SEAL: Expends all ammunition and calls for naval gunfire support
in failed attempt to kill snake. Snake bites SEAL and retreats to
safety. Hollywood makes fantasy film in which SEALs kill Muslim
extremist snakes.
Navy: Fires off 50 cruise missiles from various types of ships, kills
snake and makes presentation to Senate Appropriations Committee on
how Naval forces are the most cost-effective means of anti-snake
force projection.
Marine: kills snake by accident while looking for souvenirs. Local
civilians demand removal of all US forces from Area of Operations.
Marine Recon: Follows snake, gets lost.
Combat Controllers: Guides snake elsewhere.
Para-Rescue Jumper: Wounds snake in initial encounter, then works
feverishly to save snake’s life.
Supply: (NOTICE: Your anti-snake equipment is on backorder.)
Transport pilot: Receives call for anti-snake equipment, delivers two
weeks after due date.
F-16 pilot: Finds snake, drops two CBU-87 cluster bombs, and misses
target due to weather.
AH-64 Apache pilot: Unable to locate snake, snakes don’t show well on
infra-red.
UH-60 Blackhawk pilot: Finds snake on fourth pass after snake starts
bonfire to mark Landing Zone. Rotor wash blows snake into the fire.
B-52 pilot: Pulls ARCLIGHT mission on snake, kills snake and every
other living thing within two miles of target.
Missile crew: Lays in target coordinates to snake in 20 seconds, but
can’t receive authorization from National Command Authority to use
nuclear weapons.
Intelligence officer: Snake? What snake? only 4 of 35 indicators of
snake activity are currently active. we assess the potential for
snake activity as LOW.
Judge Advocate General (JAG): Snake declines to bite, citing grounds
of professional courtesy.
CH-47 Pilot: Slingleg breaks in flight while slingloading anti-snake
equiptment, pilot cuts slingload. Slingload lands on snake and kills
it. Crew chief uses dead snake to replace broken slingleg.
Navy Pilot: Draped snake around neck at Tail Hook to pick up chicks.
Military Police: Gave snake a sobriety test for not moving in a
straight line.
Signal: Broadcasts 200,000 watt transmissions in support of anti-
snake missions, accidentally electrecuted snake in the process.
Corps of Engineers: Surveyed and researched area for plans on
improving flood plain, can’t do it because snake is on the endangered
species list.
Cooks: Snake sneaks in chow hall. Snake dies of food poisoning.
I hope to make you smile. Love you all! God Bless Ya!
I got the joke from my very good friend who is a Major is the Marines. I love it that she can laugh at herself!
How To Become Instantly Rich: Learn How To Program
by on Aug.28, 2010, under Ruby and Rails
Typically I use this blog to write articles about Facebook, however after hosting the Social Developer Summit earlier this week, I thought I’d take this opportunity to get a single point across: developers are kings of the economy right now. While there are plenty of instances where developers don’t get credit for the work they do, developers are the ones driving innovation and its up to them to build us a new future. Here’s a quick synopsis of my thoughts on the developer kings.
There are a million words to describe a qualified developer. the most critical thing all companies want to avoid is a developer who will drag their feet or simply doesn’t know how to program efficiently. if you are a developer and you can’t program efficiently and keep churning out crappy code, don’t be too hard on yourself, just realize that the key aspect that separates the “developer geniuses” from the rest is that they are constantly learning, everyone else just sucks at life.
Granted, talent is important. if you aren’t the most logical (or intelligent) person on the block, you may want to try another profession and leverage your strengths. however if you are a curious individual, programming may be the profession for you. Best of all, developer salaries are rising quickly. every company I know is looking to hire developers. yes, you need experience. Don’t have experience? Sharpen those swords ninja!! Practice makes perfect so start building the “next hot app” and even if it doesn’t work out, you’ll at least improve your programming skills.
Facebook, Google, Apple, Twitter, are just a few companies looking for talented developers. Don’t want to work at a big name company or one with thousands of employees? every single small startup is looking for you. I want you!! Qualified developers don’t need me to tell them this though because they’re too busy turning down job offers and not replying to half the emails in their inbox. Sounds pretty baller, right? Hell yeah! Learn how to code and you too can become a rockstar! Just make sure you keep learning, otherwise you suck at life (as previously mentioned).
Let’s be honest, any developer that’s talented most likely already has a job and if they don’t, they think they are building the next Facebook, Google, YouTube, or [Insert successful internet startup name here] and turning down job offers left and right while they spend long nights programming. your best bet is those programmers. While they may indeed come up with a great idea, most of them are going to run out of money eventually because 95 percent of startups fail in the first year. however if they were an early Google or Facebook employee, they are probably already funded, CTO of that next hot startup, and really are building the next Google. Sorry!
With so much demand for quality development talent, one has to wonder if there is a lack of logical and intelligent thinkers. Most of the time I find that the only startups that aren’t working or can’t find quality talent is that they have a lack of inspirational leadership. mark Zuckerberg, for example, may not be the most sociable developer, however he did some bad ass shit in college by hacking into some computers and developers respect that.
He’s also a talented developer which is why he has been able to attract other world class software engineers like Bret Taylor, Paul Bucheit, Blake Ross, and Joe Hewitt, just to name a few.
Want to be put on the front cover of Forbes for that sick product you just built (and your billion dollar bank account)? So do I! however programming talent alone will not get you there. Being sociable and confident is also critical. I’m not going to list all the personality traits that will make you attractive to others, however if you spend more time learning how to become a leader and not just a talented developer, you’ll have a chance to rise above the others. It all starts in one place though: learn how to code.
Steve Jobs may not be the best software engineer but he sure as hell tried his hand at it when starting Apple. He also focused heavily on leadership and building culture. anyways, the bottom line is this: if you really want to build that next hot startup your best bet is to learn how to code, everything else will follow.
This public service announcement was brought to you by your friendly next door developer and entrepreneur!
Linux server…?
by on Aug.26, 2010, under LAMP
Hi…
Can anyone tell me the minimum requirements of a Linux server!?
I want to buy one to host all my websites…
Tks,
B.F
Foxconn deliberately sabotaging their BIOS to destroy Linux
by on Aug.25, 2010, under LAMP
Update: I just got off the phone with Foxconn, they called me from China (1 AM in Indiana, heh) and were asking if I would test an improved version of their BIOS based partially on the modifications I’ve made to mine, hopefully this all blows over, and regardless of who’s fault it is or isn’t, we can just go back to using our computers with full functionality.
Thanks to the community for helping me get the message to Foxconn.
Edit: Please tell Foxconn what you think of their behavior:
http://www.foxconnchannel.com/support/online.aspx
You need to put in an email, and then it will bring up a form, choose Complain/Suggest.
FOXCONN PHONE NUMBERS and LOCATIONS OF US-Based facilities
http://maps.google.com/maps?q=foxconn
Edit: welcome Digg, Reddit, and Slashdot.
http://digg.com/linux_unix/Foxconn_d…_destroy_Linux
http://www.reddit.com/comments/6tcv8…their_bios_to/
http://linux.slashdot.org/article.pl…/07/25/1150218
Who is Foxconn and why must we get the message to them?
I’ve heard a lot of people ask, “Who the hell is Foxconn”, if you use a PC, there’s a good chance you have one of their boards, even if it’s branded as MSI or some other brand, if you use a Nintendo Wii, XBOX 360, or Playstation 3, Foxconn made that motherboard, this isn’t some little dodgy hardware maker with no name that we can afford to be quiet about.
————
I have disassembled my BIOS to have a look around, and while I won’t post all the results here, I’ll tell you what I did find.
They have several different tables, a group for Windws XP and Vista, a group for 2000, a group for NT, Me, 95, 98, etc. that just errors out, and one for LINUX.
The one for Linux points to a badly written table that does not correspond to the board’s ACPI implementation, causing weird kernel errors, strange system freezing, no suspend or hibernate, and other problems, using my modifications below, I’ve gotten it down to just crashing on the next reboot after having suspended, the horrible thing about disassembling any program is that you have no commenting, so it’s hard to tell which does what, but I’ll be damned if I’m going to buy a copy of Vista just to get the crashing caused by Foxconn’s BIOS to stop, I am not going to be terrorized.
—–
How to fix:
Get Intel’s BIOS ACPI source compiler:
sudo apt-get install iasl
Dump your DSDT table:
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat
Disassemble it:
Open it in Gedit:
Fix Foxconn sabotage:
Find, the section that starts out with
Go down til you get to the firstPast that you should see Linux alongside Windows NT, which is above another Else that leads to Windows Me.
Should look like:
Change it to:
Copy the section, and remove it and the other characters (CAREFULLY PRESERVING SYNTAX!!!!)
Then move the Linux section to right underneath Windows 2006 section.
It will look about like this now:
Name (OSVR, Ones) Method (OSFL, 0, NotSerialized) { If (LNotEqual (OSVR, Ones)) { Return (OSVR) } If (LEqual (PICM, Zero)) { Store (0xAC, DBG8) } Store (One, OSVR) If (CondRefOf (_OSI, Local1)) { If (_OSI (“Windows 2000″)) { Store (0×04, OSVR) } If (_OSI (“Windows 2001″)) { Store (Zero, OSVR) } If (_OSI (“Windows 2001 SP1″)) { Store (Zero, OSVR) } If (_OSI (“Windows 2001 SP2″)) { Store (Zero, OSVR) } If (_OSI (“Windows 2001.1″)) { Store (Zero, OSVR) } If (_OSI (“Windows 2001.1 SP1″)) { Store (Zero, OSVR) } If (_OSI (“Windows 2006″)) { Store (Zero, OSVR) } If (_OSI (“Linux”)) { Store (Zero, OSVR) } } Else { If (MCTH (_OS, “Microsoft Windows NT”)) { Store (0×04, OSVR) } Else { If (MCTH (_OS, “Microsoft WindowsME: Millennium Edition”)) { Store (0×02, OSVR) } } } Return (OSVR) }Don’t recompile it yet, or this will happen: dsdt.dsl 6379: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6393: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6408: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6423: Acquire (MUTE, 0×0FFF)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6437: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6452: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoreddsdt.dsl 6467: Acquire (MUTE, 0×03E8)Warning 1103 – ^ Possible operator timeout is ignoredCompilation complete. 0 Errors, 7 Warnings, 0 Remarks, 77 OptimizationsThese are bogus mutes that are harmless to Windows (it ignores them), but crash Linux sporadically, soooo….
Find and replace all seven occurences of Acquire (MUTE, 0×03E8) and replace with Acquire (MUTE, 0xFFFF), it appears they’re trying to crash the kernel by locking a region of memory that shouldn’t be locked, but without access to their source code comments, I can only speculate, this tells it to lock a memory address that is always reserved instead.
Now compile it
(You shouldn’t get any warnings,there are any warnings or ERRORS, go find out what you did wrong!)
And install it and configure the kernel to use it:
sudo cp dsdt.aml /etc/initramfs-tools/DSDT.aml
sudo update-initramfs -c -k all
All future kernels should automatically find it there and build it.
REBOOT
————–
This doesn’t seem to help get rid of the suspend/resume and then reboot issue, but it appears to fix the rest, their BIOS is damned sloppy it’s hard to really even tell what you’re doing in there.
Use this advice at your own risk.
So there you have it!
Edit: Complained to the Federal Trade Commission
Foxconn
458 E. Lambert Road Fullerton
Fullerton, CA
92835
FOXCONN PHONE NUMBER: 714-871-9968
Company sold me a computer motherboard, model G33M-S, claiming that it was compliant with ACPI versions 1.0, 2.0, and 3.0.
Linux and FreeBSD do not work with this motherboard due to it’s ACPI configuration, using a disassembler program, I have found that it detects Linux specifically and points it to bad DSDT tables, thereby corrupting it’s hardware support, changing this and setting the system to override the BIOS ACPI DSDT tables with a customized version that passes the Windows versions to Linux gives Linux ACPI support stated on the box, I am complaining because I feel this violates an anti-trust provision in the Microsoft settlement, I further believe that Microsoft is giving Foxconn incentives to cripple their motherboards if you try to boot to a non-Windows OS.
We have received your complaint.
Thank you for contacting the FTC. Your complaint has been entered into Consumer Sentinel, a secure online database available to thousands of civil and criminal law enforcement agencies worldwide. Your reference number is:
19642372
Edit: full correspondence with Foxconn
ACPI issues, cannot reboot after having used suspend
Jul 22 08:37:53 ryan-pc kernel: ACPI: FACS 7FFBE000, 0040
Jul 22 08:37:53 ryan-pc kernel: ACPI: FACS 7FFBE000, 0040
Jul 22 08:37:53 ryan-pc kernel: ACPI: FACS 7FFBE000, 0040
Jul 22 08:37:53 ryan-pc kernel: ACPI: FACS 7FFBE000, 0040
Jul 22 08:37:53 ryan-pc kernel: ACPI Warning (tbutils-0217): Incorrect checksum in table [OEMB] – 70, should be 69 [20070126]
I get these messages in my system log at boot, I also fail to reboot after having used suspend in a session, it hangs and plays a continued beep on the PC speaker.
Dear Ryan:
Do you get the same beep codes if you were to remove all RAM out and then turn the system ON again?
No, because then I wouldn’t be able to boot into Linux, suspend to RAM, to get the ACPI failure, have syslogd pollute my /var/log/messages file with it, or read about it in my system log.
In particular, the number of quirks that the kernel has to use, and this invalid checksum are what has me nervous.
If you need me to attach the full contents of /var/log/messages, I can do so.
Dear Ryan:
This board was never certified for Linux. it is only certified for Vista. See URL below. so please test under Vista. Does this issue also occured under Vista or Winxp?
http://www.foxconnchannel.com/produc…ification.aspx
Well, this is a replacement for a dead Intel board (a 945g that fully supported ACPI), Vista was never really up for consideration, and I’m not about to go buy a copy to find out.
The ACPI specs are there for a reason, and broken BIOS’s like what is in this motherboard are the reason standard ACPI does not work, I’ve taken the liberty of filing the report in kernel.org, Red Hat, and Canonical’s Ubuntu bug tracking systems, and posting the contents of my kernel error log on my blog, which is in the first several results if you Google search “Foxconn G33M” or “Foxconn G33M-s”, “Foxconn Linux”, etc, as well as prominently in other search formats, so hopefully this will save other people from a bad purchase, and hopefully kernel.org can work around your broken BIOS in 2.6.26, as I understand that kernel is more forgiving of poorly written BIOSes built for Windows.
I’ve already gotten several dozen hits on those pages, so you guys are only hurting yourselves in the long run, by using bad BIOS ROMs, as people like me are quite vocal when dealing with a bad product.
Dear Ryan,
Making idle treats is not going to solve anything.
As already stated this model has not been certified under Linux nor supported.
As you are unhappy with the product- using a non-support operating system nor certified, please contact your reseller for a refund.
Yeah, well, I allege that you guys thoroughly suck.
Learn how to write a BIOS before you go selling hardware with falsified specs.
I’ve been debugging your AMI BIOS, and the ACPI support on it is far from within compliance with the standards, I’ve dumped out the debugging data into Canonical’s Launchpad bug tracking system so that we may be able to support some sort of a workaround for the bad ACPI tables in your BIOS, I would hope that you will be part of the solution instead of the problem, alienating customers and telling them to go buy a copy of Windows Vista is not service, your product claims to be ACPI compliant and is not, therefore you are falsely advertising it with features it isn’t capable of.
I would ask that you issue an update that doesn’t make it dependent upon Windows Hardware Error Architecture, but that decision is up to you.
Please find all relevant data here:
Bug #251338 in Ubuntu: “Bad ACPI support on Foxconn G33M/G33M-S motherboards with AMI BIOS”
https://bugs.launchpad.net/ubuntu/+s…ux/+bug/251338
I appreciate your consideration in this matter.
Dear Ryan,
You are incorrect in that the motherboard is not ACPI complaint. If it were not, then it would not have received Microsoft Certification for WHQL.
Refer to:
http://winqual.microsoft.com/HCL/Pro…33M-S&oid=3179
As already stated, this model has not been certified under Linux nor supported.
It has been marketed as a Microsoft Certified Motherboard for their operating systems.
I’ve found separate DSDT tables that the BIOS hands to Linux specifically, changing it to point to the DSDT tables Vista gets fixes all Linux issues with this board.
So while I accept that you’ve gotten some kind of Microsoft Certification (doesn’t surprise me), that does not make your board ACPI capable, just that Windows is better at coping with glitches custom tailored to it, for this purpose.
Dear Ryan,
Stop sending us these!!!
Your BIOS is actually pretty shoddy, I’ve taken the liberty of posting everything that’s wrong with the DSDT lookup tables and how to fix some of it so the community that has already purchased your filth can make do with it, also, it’s now pretty much impossible to google Foxconn and Linux in the same sentence without getting hit by the truth, that your boards aren’t good enough to handle it.
Have a very nice day.
Dear Ryan,
Surely this is the way to ask for us to attempt to fix something that is not supported in the first place.
Would it be so difficult? I mean really? I suppose you’ve never heard of building a happy customer base vs. just angering everyone that deals with your products to the point they make sure others don’t make the mistake of buying them.
You know, I have several computers, and they all support any OS I want to put there, as well they should, if you can’t fix the damaged BIOS you put there intentionally, can you at least put a big thing on the site that says no LInux support so people won’t make the mistake of buying your stuff?
Your DSDT table looks like it was written by a first year computer science student, it is scary, I will not just shut up and go away until I feel like I’ve been done right, this can end up on Digg, Slashdot, filed with the FTC that you are passing bad ACPI data on to Linux specifically.
I saw you targeting Linux with an intentionally broken ACPI table, you also have one for NT and ME, a separate one for newer NT variants like 2000, XP, Vista, and 2003/2008 Server, I’m sure that if you actually wrote to Intel ACPI specs instead of whatever quirks you can get away with for 8 versions of Windows and then go to the trouble of giving a botched table to Linux (How much *is* Microsoft paying you?) it would end up working a lot better, but I have this idea you don’t want it to.
can I create a basic game and host it on my own computer using linux with no additional hardware and hosting?
by on Aug.25, 2010, under Server Maintenance
I was wondering if I created a game using python, if I could create a login shell for non local guests on the web to visit, login and play without subscribing to a hosting plan or buying any additional hardware other than my PC with a ton of storage space?
I am using Debian by the way
Thanks
How to reinstall windows xp without harming centos preinstalled?
by on Aug.25, 2010, under Server Maintenance
I have installed windows xp and centos on my computer . windows xp is corrupt and is unrepairable and I am planning to reinstall it but I dont know how to do it without damaging centos. Last time when I did it, centos was gone. Please give me the complete instructions to reinstall xp without damaging centos
How to reinstall windows xp without harming centos preinstalled?
Ruby on Rails Rake Tutorial (aka. How Rake turned me into an alchoholic)
by on Aug.24, 2010, under Ruby and Rails

If you’re developing with Rails you’ve probably encountered rake once or twice. This blog post aims to walk you through where rake came from and an introduction on how to use it effectively in your Rails apps.
A Little Bit of History
Rake is the project of Jim Weirich. It’s a build tool. for a good laugh and an even more in depth history check out the “rational.rdoc” from the Rake documentation. Essentially, rake started as an idea for using Ruby inside of a Makefile. though Jim doesn’t sound convinced from the tone in that document, it is a good idea.
What’s the need for an automated build system at all? as usual, Wikipedia has the answer:
Historically, developers used build automation to call compilers and linkers from inside a build script versus attempting to make the compiler calls from the command line. it is simple to use the command line to pass a single source module to a compiler and then to a linker to create the final deployable object. however, when attempting to compile and link many source code modules, in a particular order, using the command line process is not a reasonable solution. [sic]
as the build process grew more complex, developers began adding pre and post actions around the calls to the compilers such as a check-out from version control to the copying of deployable objects to a test location. the term “build automation” now includes managing the pre and post compile and link activities as well as the compile and link activities.
It’s about Dependencies
This may be a bit of a stretch to say but build tools are about dependencies. One file or set of files depends on another set to get compiled, linked, or other fun things before the next set can be processed. the same idea exists in rake with tasks and task dependencies. Let’s look at a simple rake task. Save the following as “Rakefile” in any directory:
What we’re saying here is that the file named “hello.tmp” depends on the directory “tmp”. when rake runs across this, it’s going to create the directory “tmp” first before running the “hello.tmp” task. when you run it, you’ll see something like the following:
If you were to look at the “hello.tmp” file you would see the phrase “Hello”. What happens if you run it again? You’ll see the same output again. What’s going on? Rake is generating the file again. It’s doing this because it can’t actually find the file tmp/hello.tmp from that definition. Let’s redefine the task:
Now if you were to run it twice you would see something like this:
Rake now knows that the file task has been run.
Running Other Tasks
Rake tasks can take the form of having prerequisites and can depend on another task. Let’s say I wanted to get ready in the morning. My process would be something like this:
- Turn off alarm clock.
- Groom myself.
- Make coffee.
- Walk dog.
Let’s further assume that I have OCD and have to do all of these in order. In rake I might express my morning as follows:
If I were to run this as is I would type rake ready_for_the_day and I’d see the following:
Namespaces
Rake supports the concept of namespaces which essentially lets you group together similar tasks inside of one namespace. You’d then specify the namespace when you call a task inside it. it keeps things tidy while still being quite effective. In Rails, you might notice the db:migrate task. In that example, db is the namespace and migrate is the task. Using the above example, we might put everything in to the morning namespace:
Now if you were to run rake COFFEE_CUPS=3 morning:ready_for_the_day you would have the same output as above, only it only took 3 cups of coffee today. Score!
The Default Task
Rake has the concept of a default task. This is essentially the task that will be run if you type rake without any arguments. If we wanted our default task to be turning off the alarm from the example above, we’d do this:
Running rake now produces the following:
Describing Your Tasks
You can use the desc method to describe your tasks. This is done on the line right above the task definition. It’s also what gives you that nice output when you run rake -T to get a list of tasks. Tasks are displayed in alphabetical order. We’ll define some descriptions in our Rakefile (abbreviated for brevity):
Now when we run rake -T for our list of tasks we get the following output:
You can add in a string to get tasks matching that displayed. Running rake -T af would show just the afternoon task.
Redefining Tasks
Let’s say you want to add on to an existing task. Perhaps you have another item in your grooming routine like styling your hair. You could write another task and slip it in as a dependency for groom_myself but you could also redefine groom_myself later on (shortened for brevity but you get the idea):

Invoking Tasks
You may at some point want to invoke a task from inside another task. Let’s say, for example, you wanted to make coffee in the afternoon, too. If you need an extra upper after lunch you could do that the following way:
A real world example of this is the rcov:all task. I use this in Genius Pool for aggregate rcov data. It’s shamelessly stolen from Clayton Lengel-Zigich. Go check out that post for a good example of invoking other tasks from rake.
Refactoring
You’ll notice in the example above we’re delegating most of the work to already defined methods and tasks in the RSpec and Cucumber classes. as a general rule, try to keep your methods already defined other places and call them from rake with your specific options and use cases. Let’s say I had a Rails application that e-mailed all accounts in the system that their account was expiring in a certain number of days. Here’s one way to write it:
A better way, that would let you test it more thoroughly would be to do the following:
This lets you unit test your notify_expiring method on the account class and make sure that it’s doing what it’s supposed to do. This is a small, made up example, but you get the idea. Here’s an example from Resque:
Notice the delegation to the RedisRunner class methods? This is a great rake task
Rails
You can get access to your models, and in fact, your whole environment by making tasks dependent on the environment task. This lets you do things like run rake RAILS_ENV=staging db:migrate. Rails will autmatically pick up tasks in lib/tasks. any files named with the .rake extension will get picked up when you do rake -T.
Scheduling Rake Tasks
You can use cron to schedule rake tasks. Let’s say you wanted to run the account email expiration task every night at 12:15 on your production server, you might have something like this:
Misc
Rake.original_dir gives you the directory that the original rake task was run from.
Derivatives
- Thor is a more class based approach to solving some of the things rake does as far as actual tasks go.
- Capistrano is the de facto standard for deploying rails apps. Its syntax is inspired pretty heavily by Rake, but it is definitely not rake.
Further Reading
- “Testing Rake Tasks” by Jay Fields
- “On Rake” by John Barnette
- How To: Setup RSpec, Cucumber, Webrat, RCov and Autotest on Leopard | Clayton Lengel-Zigich
- Custom Rake Tasks Railscast
Useful Rake Examples
- Sample Rakefile from this article.
- redis.rake from Resque.
If you have any more useful rake examples, please let me know and I’ll add them here.
Photo Credits:
Shaker rake by dicktay2000 on Flickr.
Toy sampling megaphone by altemark on Flickr.
Delicious
Digg This Post
Facebook
Reddit This Post
Ruby on Rails Rake Tutorial (aka. How Rake turned me into an alchoholic)