Posts Tagged ‘Tips and Tricks’

Always index your tables. Always

Saturday, August 9th, 2008


This is going to be brief one: iRead.ro, one of the projects I’m working on during my spare time, was giving me major headaches lately – 2 weeks ago, it took like 15 seconds to render a page. In the last couple of days, it was taking somewhere around 100 seconds to render it; obviously too much for the nginx server that was running my two mongrels.

I *had* indexed my tables, by id, url and several other fields. Turns out, they weren’t indexed with the right columns.

(more…)

Cum mi-am upgradat si jailbreak-uit iPhone-ul 2G la firmware 2.0

Tuesday, July 22nd, 2008

Am promis sa povestesc cum mi-am upgradat iPhone-ul de prima generatie, de la firmware 1.1.4 la 2.0 si cum l-am “jailbreak” ca sa-l pot folosi :P

Nu a fost deloc complicat, odata ce am trecut de temerile initiale.
(more…)

10 Ruby programming tips you should already know

Wednesday, July 2nd, 2008

Other blogs about Ruby or Rails have already touched some of the tips I’m going to show, but it never hurts to remind you these small recipes aimed at Ruby novices:

(more…)

10 ponturi esentiale pentru utilizatorul de iPhone

Tuesday, May 20th, 2008

10 ponturi esentiale pentru utilizatorul de iPhone

Din meniu:

  1. cum sa iti deblochezi, decodezi si sa-ti eliberezi(jailbreak) singur iPhone-ul sau iPod-ul
  2. cum sa iti reformatezi(reinitializezi) iPhone-ul in caz ca ceva a mers prost
  3. introdu-ti propria cartela SIM
  4. dezactiveaza corectura automata la tastare
  5. cum sa faci capturi de ecran simplu si eficient
  6. cum faci poze mai clare
  7. acceseaza direct fisierele de pe iPhone via SSH sau SFTP
  8. descarca filme de pe YouTube folosind MxTube pentru a le vedea oricand esti offline
  9. importul de contacte de pe cartela SIM
  10. top 5 aplicatii utile GRATUITE pentru iPhone-ul tau

ebook gratuit despre iPhone
Ebookul este descarcabil gratuit de la acest link 10 ponturi pentru iphone .pdf (296KB) si va fi publicat in foileton pe blog, curand.

How to import Ultimate Warrior Tags into Wordpress 2.3+ and how to easily backup your Wordpress database

Monday, February 25th, 2008


If, like me, you had been using Ultimate Warrior Tags (UTW) to assign Technorati-compatible tags to your article, then you must have been as annoyed as I was when upgrading to Wordpress 2.3.2 or Wordpress 2.3.3. All of the sudden, Wordpress acquired tagging capabilities but disabled UTW along the way.

Don’t get me wrong, I love that Wordpress now knows tags natively, but I was pretty annoyed to discover that my previous ones had disappeared.
They didn’t, actually. As it turns out, importing the old UTW tags into the new Wordpress is an extremely simple built-in mechanism. All you have to do is open your Wordpress blog backend, log in as admin, go to the “Manage” menu, the “Import” page. There’s an “Import Ultimate Tag Warrior tags into the new native tagging structure” link in the bottom, that will start the 4-step no user action required process that worked perfectly for me.

Beware, though! The Wordpress builders give you the ferm warning: Don’t be stupid – backup your database before proceeding!.

In order to backup your Wordpress blog database, the simplest, easiest way, and the one I recommend, is to use WP’s built-in mechanism: just go to Manage->Export and click on “Download Export File“. This will save a pretty large xml file(1.3MB for a small blog, 6.8MB for a big blog) with data from WP’s tables – including custom fields set by plugins, but not the custom tables that some plugins create. Still, it’s the easiest, hassle-free backup procedure for your blog, so it would be a good idea to do it every once in a while, just in case.

Pont de SEO si autoritate Technorati cu teme de Wordpress

Saturday, February 23rd, 2008

Brief Enghlish version
Go create a Wordpress theme (I’d suggest a design for Sandbox, for instance), upload it to wordpress themes websites after having added your link in footer.php, then patiently wait for people to download and use it – easy Page Rank and Technorati Authority boost.

Longer Romanian version:
Stiu, nu dai doi bani pe autoritatea Technorati. Dar, din cand in cand, se mai fac topuri de bloggeri romani, si atunci parca te oftici ca nu ai o autoritate Technorati mai mare, cat sa fii si tu in “top 10″ bloggeri autoritari.

Iti zic acum solutia, dar promiti sa nu mai spui la nimeni :D

Daca te pricepi cat de cat la php si css, treci si fa teme de Wordpress. Nu e chiar greu – poti sa preiei altele deja existente, sa le schimbi designul, layoutul, culorile si tagurile CSS. Poti de pilda sa pornesti de la Sandbox si sa creezi doar un nou design CSS peste ea.

Nu uita sa adaugi in footer.php link catre blogul tau. Stiti voi, povestea cu “foobar theme designed by Alex Brie”.
Urci apoi tema de wordpress pe situri specializate.

Nu mai ai decat de asteptat ca altora sa le placa tema respectiva. Obtii repede linkuri moca numai bune pentru Page Rank, si mai ales autoritate Technorati maricica.

Nu ma credeti? Intrebati-i pe Dece sau pe Buddha daca merge sau nu. Eu zic ca, pe langa un karma bun (dai ceva gratuit comunitatii), metoda ajuta si la Page Rank si la Technorati…

Ruby Metaprogramming part 2

Wednesday, November 7th, 2007

Last time I discussed Ruby and metaprogramming, I was trying to stay DRY (Don’t Repeat Yourself) while coding some very similar-looking methods. The solution, then was to use class_eval to dynamically add methods into the current class, the way attr_accessor and it’s peers already do.

Today I was having a similar, yet more difficult problem: the architecture of my app includes two controllers: IncomeController and ExpenseController, two identical twins, each saving, updating and listing it’s associated models (Income/Expense), where Income has_many income_attributes and.. you guessed it, Expense has_many expense_attributes. And the list can go on, since they have some more relationships, all of them being identical but for the names and associations.

I know, perhaps such thing might have been avoided if, in the first place, we would have used single-table inheritance and such. But for various reasons we didn’t, and I was getting tired of keeping in sync all the changes in Income* to Expense* and vice-versa.

So.. what could the solution be? Namely, I wanted both IncomeController and ExpenseController to share the same codebase, the only difference being the names; I wanted a… replace_all to be run on the fly.

Luckily for me, I remembered Camping, a Ruby Microframework for web apps(kinda like Rails, but more simplistic), which uses some intense metaprogramming-kung-fu to keep its code to less than 4kb. For instance, in the homepage example, we see that

A skeletal Camping blog could look like this:
require ‘camping’
Camping.goes :Blog

The .goes method returns a class duplicate of the Camping one, where all occurences of Camping have been changed with Blog.

(more…)

*nix tip of the day

Friday, September 14th, 2007

I keep having the following problem when dealing with svn: I frequently find myself wanting to add to my own SVN repository stuff(javascript libraries, rails plugins) retrieved from some other svn repositories. The inevitable outcome of my bold attempt is that SVN starts complaining that the new folders can’t be submitted, that they already are under code control or something.

The reason is because when copying entire FOLDERS from one svn repository to another, you also copy their associated .svn folders with svn-specific information. These .svn folders are usually hidden, but you can see them (on Unix/Linux/OSX) by running ls -la from the terminal.

So you see my problem: I want to copy files or folders into my code repository, but don’t want to involve svn into this. I want them to be added as new files/folders, regardless of where they came from.

The following command-line command has helped me avoid quite a bit of frustration today:


find . -name "*.svn" -print
find . -name "*.svn" -ok rm -rf {} \;

The first command lists recursively all svn-specific subfolders of the current one.
The second command displays them to me one after the other and patiently awaits I press ‘y’ to remove it.
Extremely useful, right?
For many more uses of the find command, check out this page – where I learned about the useful ‘ok rm’ trick.

Beginner’s blogging guide – How to bring traffic to your blog

Wednesday, June 6th, 2007

I’ve started and (rather) successfully managed around 7 blogs until now. Each attempt has been a bit more successful than the previous one, each building on the shoulders of its predecessors. So, since nothing beats a little bulleted list, here they are – top ways to bring traffic to your freshly launched blog:

(more…)

Wordpress plugins you MUST have

Tuesday, March 27th, 2007

My tiny blogger experience (I’ve installed, configured and maintained more than 7 wordpress blogs, about 5 Blogspot ones and one Textpattern) made installing the must-have Wordpress plugins for this new blog a breeze. This comes mostly from having made myself a list of the MUST-have plugins. Vital for some, nice-to-have for most, they can make the difference between a popular blog and an anonymous one.
There are many great Wordpress plugins out there, but this is the list of the ones I installed right now. Surely you must have extra suggestions, which are welcome in your comments.

  • Akismet comes by default with Wordpress but still has to be enabled. It is THE TOOL for comment spam protection (remember that this was one of the reasons I dislike Textpattern?
  • All in One SEO Pack – should optimize the page for extra search-engine love. I’m taking a shot in the dark with this one, since it’s the 1st time I use it. Still, looks promising – no need for setup, just activate it and you’re set.
  • Google Sitemaps This generator will create a Google compliant sitemap of your WordPress blog. – also for greater Google search love
  • Permalink Redirect This plugin ensures that pages and entries are always accessed via the permalink. Otherwise, a 301 redirect will be issued. – same Google search love. Also, it’s great if you want to redirect all your rss readers to a Feedburner blog – it’s automatic and hassle free.
  • wp-cache Very fast cache module. It’s composed of several modules, this plugin can configure and manage the whole system. Once enabled, go to “Options” and select “WP-Cache”. – I never seem to get this straight. Gives me a bit of headaches to make it happen; but once it’s on, the Digg effect (the joy and nightmare of any blogger) becomes a pleasant breeze; shortly, this plugin makes your wordpress site resist to hundreds of simultaneous visitors, even on shared webhosts (such as Dreamhost).
  • WP-PostViews Enables you to display how many times a post had been viewed. It will not count registered member views, but that can be changed easily. – a nifty toy that’s great for discovering and making public your most popular articles.
  • WP-UserOnline Enable you to display how many users are online on your Wordpress blog with detailed statistics of where they are and who there are(Members/Guests/Search Bots). – want to see how many people are watching your site right now? Then this is the way to go!
  • Ultimate Tag Warrior – the most popular tagging plugin, makes tags (lightweight categories) for Technorati friendliness. Also pretty SEO friendly, so it’s always good to have around.