Feel the ease of time tracking with NR Time. Log your time expenses in the billing-friendly format with minimal effort.
Posted: May 18th, 2010 | Filed under: Programming, Tips | Tags: rails, ruby | No Comments »
Assuming that you have an object Account like below
class Account < ActiveRecord::Base
has_one :office
end
and you want to create an Office record when you create an account, you could do it in the after_create filter and it would be my way of doing that also. But the funny thing is that if you name the filter create_office, you don’t need to define the method itself. It will create the Office and link it to your Account model automagically. So here’s how the final class definition looks like:
class Account < ActiveRecord::Base
has_one :office
after_create :create_office
end
Amazing!
Posted: January 2nd, 2009 | Filed under: Books, Language, Tips | Tags: book, english, francis fitzgerald, great, great gatsby, learning | No Comments »
Just finished the Great Gatsby by Francis Scott Fitzgerald. Great story, clean and eloquent style, lots of infrequently used words. A must for every language learner and simply an educated man.
You’ve got my recommendation on this.
Posted: October 22nd, 2008 | Filed under: Tips | Tags: 5 stars, award, idiotic, spam | 2 Comments »
Half a year ago we were promoting The Product on many software download sites. By many I mean thousands. Now the time has come and some of them coming back with these idiotic messages notifying of the ratings they awarded after careful reviews of whether it’s the application quality or the absence of viruses, or … you name it. In fact, the smallest and the least known sites show the most activity bombarding us every week. Why are they so kind?
All is very simple as usual. When you put their 5-star award banner on your site, you link to them. So what? So the rating of your pages, combined with ratings of other happy winners, contribute to the rating of their site. They don’t really care about you, forget it. It’s another wave of spam, yet more intelligent and nicely veiled. The page rating builds up and up until finally, they wake up one day being a well-known and highly rated software site. Google knows about them, your users/readers know about them, rating is high, life is good, and all you got is their 5-star banner. Enjoy!
Clever trick, isn’t it?
Posted: October 16th, 2008 | Filed under: Music, Graphics, Video, Tips | Tags: ableton live, layout, music, Tips | No Comments »
Spent a good deal of yesterday’s evening working on another piece for my future live set. Several amusing ideas came in the process.
Analog sounding. Why they still continue to argue about the digital vs analog sound. Where the hell can you still hear it in the original analog form? Almost everything that is recorded these days is distributed on a digital media, which is bits and bytes in its essence. Having that, it all comes down to creating the “correct” analog-sounding sequence of bytes to reproduce that unique sound that you still want to hear on your iPod. Am I right or am I right? What about vinyl records? What about them? I love vinyl and have the collection of my own. Nothing can beat a great grind and especially in techno domain, but… from a producer standpoint, hey, you still need to get the sounds to someone who cuts the plates. Do you use magnetic tapes for that?
During the last few weeks, largely inspired by the banks of sounds concept behind the hardware machines (thanks wesen and 909techno for the monomachine and machinedrum video), I came up with an entirely different setup for my Ableton Live session view when I’m working on a pieces. I now use a couple of Drum Racks that represent some branch of sound (minimalistic, synthesized sounds etc), but never write clips directly for them. Instead I use several MIDI tracks for each individual sample or a group of samples that I route to the channel holding the Drum Rack. This way, I can program patterns for the sounds individually. Let me illustrate it with a picture:


What I have here is the Drum Racks on channels 1 and 5. They are holding my custom kits. The channels 2 through 4 are routed to the first kit (channel 1) and the channel 6 is to the second (channel 5).
If you read attentively, you probably noticed I said I never use the Drum Rack channels. Well, it’s not true. It’s very convenient to create a clip there, play with it and once it’s finished, move it to a separate MIDI track. It’s like a sketch book.
What are the benefits of this layout:
- You keep all your related (kit) samples in one place
- You don’t duplicate kits in multiple channels just to keep things separated
- You do keep things separated, but in more natural way, like how would you do with the hardware
- Thanks to the flexibility of the Drum Rack (and Instrument Rack), you can add effects to each individual sample as well as to the whole channel. In other words, if I need to add some reverb to high hats, I no longer need to take them on a separate channel, I just open the rack and add it. Rarely do I need the same sound with different effects in my tracks. Even if I do, I can easily duplicate the sound in the rack for that.
And by the way, here’s how the piece sounds at the moment:
Posted: September 19th, 2008 | Filed under: Tips | Tags: 10.5.5, mac, mac os x, mouse, odd, touch pad, weird | 1 Comment »
The upgrading to Mac OS X 10.5.5 went fine. Downloading and installing 340Mb update was a breeze and a matter of 20 minutes, but then. Immediately after the restart neither the keyboard nor the touch pad worked. Putting into sleep (it was late night and I postponed the investigation until morning) and getting back to normal unfreezed the keyboard and mouse pointer, but the touch pad button still didn’t work.
Another reboot helped and now everything is working. One thing I noticed though, it was accessing the hard drive a LOT more during the startup. Maybe it was just installing / indexing changed parts, who knows… we’ll see.
Remember
- If you see oddities right after upgrading, don’t panic. The reboot may help.
- If your mouse isn’t working,use the power button (hardware) to call the reboot / sleep / shutdown dialog and the “space” key to select the Reboot option.
- If your keyboard isn’t working, try closing your laptop to sleep.
Posted: September 10th, 2008 | Filed under: Tips | Tags: directory, locate, Plugin, tip, unable, wordpress, wp | 13 Comments »
Automatic plug-in updates are cool, but only when they work. I made attempts to understand what’s wrong with the “update automatically” feature several times, and always hit the same message after entering my FTP details: “Unable to locate WordPress Plugin directory”.
As a computer geek, I know why it needs FTP, but it wasn’t really clear what exactly it was looking for in the root of the FTP directory and why it didn’t find it. I figured that my server setup is a bit different from what they expected, and scanned the sources for clues.
Apparently, they are looking for the wp-settings.php file which is sitting in the root of the WP installation. So when they find the file, they know where to start looking for plug-ins folder. In my case, it was light years away from the FTP root, so here’s what I did:
- Created an FTP user specifically for the blog
- Made the root folder of the blog be the home directory of this user
- Fed the user name and the password to WP when it asked for the FTP again
All went very nicely and hassle-free. Now you know what to do when you see “Unable to locate WordPress Plugin directory” when attempting to update your plug-ins automatically.
Posted: September 10th, 2008 | Filed under: Programming, Tips | Tags: fetch, hash, ruby, Tips | No Comments »
Sometimes you rediscover little features that make your life whole lot easier. Today when reviewing the code of my co-worker I stumbled upon the use of the “fetch” on the Hash object. Check it:
h = { :existing_key => "value" }
h.fetch(:existing_key) # returns "value"
h.fetch(:some_key) # raises exception
h.fetch(:some_key, "default") # returns "default"
h.fetch(:some_key) { ...some math... } # returns some math
One other related technique is:
h[:existing_key] # returns "value"
h[:some_key] # returns nil
h[:some_key] || "default" # returns "default"
Armed and ready!
P.S. Thanks for a great tip, Craig!
Posted: July 23rd, 2008 | Filed under: Tips | Tags: error, publishing, timeout, wp | 1 Comment »
By no means this is a usual thing, but since there’s very little information (in fact only one link that gives no real answers) on what to do when you see the error below upon publishing a post, I decided to share the solution:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/…/public_html/wp-includes/wp-db.php on line 170
The error points to an innocent line that removes single quotes from a database query, and it’s misleading. One of the real causes for this problem may lay in the slug (post name) field. You can see this field in the Permalink line below the Title field in your post editor; it’s emphasized.
In my case, there was an endless attempt to find a unique name for a post having an HTML entity (long dash) in its slug. Even though it was correctly encoded with %NN sequences, the database sever had hard time executing the query correctly. So, the first check on your list is:
Make sure your post slug (that symbolic part of the permalink) has no special symbols, but only letters, digits and dashes.
Posted: April 25th, 2008 | Filed under: Software, Tips | Tags: partition, Tips, ubuntu, upgrade | 4 Comments »
It was Clean Thursday yesterday and hopefully you were cleaning your hard drive for a great new Ubuntu 8.04. It made it to the download sites in the evening and since then they creak under a heaviest load.
Have you ever wondered why they version their releases in that strange way — …, 7.04, 7.10, 8.04? I never mulled over that, but yesterday I was enlightened. Look at the numbers closely: 2007.04, 2007.10, 2008.04. Alright, now it does make perfect sense, doesn’t it?
While we are at it, let me explain briefly how I partition my hard drive to aid quick and painless system upgrades. Keeping in mind that Canonical releases a new version precisely once a half year, it is judicious to keep OS on a separate partition so that it can be easily replaced, while your home directories stay intact. This is how I do it:
- / (root) partition — 5 Gb
- /home partition — 5 Gb
- swap partition — 2 Gb
Every time a new version of Ubuntu comes out, I simply format the root partition and install the release there from a Live CD. Certainly I need to restore all apps later, but it’s not a big deal actually as I maintain a nice list for this matter.
I know Ubuntu has a mechanism to upgrade itself to a newer version through the Updates manager, but, in practice, being upgraded in this fashion, OS doesn’t unveil its full potential, and more like “mimics” the previous version. I compared the two in the past and am inexpressibly happy about the discovery.
Hopefully this information will be valuable in the light of upcoming wave of upgrades.
Posted: April 2nd, 2008 | Filed under: Software, Tips | Tags: subversion, upgrade, wp | No Comments »
Finally upgraded my blog to WP 2.5 today. Looks so sweet that I can’t help sharing it with you.
The administrative part is completely reworked, and it was a stressful experience to see the updated Dashboard, but eventually I’m getting used to it (sort of).
Basically I like the AJAXy Write Post page packed with nice “Add media” section, dynamic tags and categories, improved editor and many other things. It became much lighter and noticeably easier to use.
Give it a spin, it’s worth it!
By the way, I find it a lot easier to maintain and upgrade when WP is installed by checking the code out of the Subversion repository. The whole upgrade process takes counted minutes as it involves running a single command to update sources and opening the database upgrade page in the browser. Check the WP on Subversion page for more details.