Picking up the breadcrumbs

Its always easy to skip going through the details of what your stacked up knowledge and just go for trying out new stuff. This time, I take it one step back and skim through pages of books I have always ignored and pick some sections that are worth looking into and post them here.

I've been trying to cut down on paper materials at home. Mostly, trying to read all those books and photocopied materials and just jot down notes from them. I decided to post them instead. See some string, number, time/date extensions.

Read the rest of this entry

The power of toggle

I don't know if we've been missing out on deliberate API lovin' or that we're becoming dumber every minute because of too much work, or its just the love month? tongue ...but we've been missing the power of "toggle".

Toggle is [defined][1] as:

any instruction that works first one way and then the other; it turns something on the first time it is used and then turns it off the next time

Needless to say, toggle is very efficient for use with boolean values (defined by either true or false). Of course you might think its easy to implement, but this is an explicit example to illustrate on saving database reads and writes. Aside from that, you'll write a more elegant code. wink

Read the rest of this entry

DIY Ruby SFTP to S3

I was faced by a challenge of transferring some files from an FTP server to S3. At first, the nature of the problem seemed simple. I just had to get the files to my local machine and then upload them to S3. Piece of cake! But lo and behold, when I saw that there were over 32K files and each step took me almost 2 minutes each! Oooh lala!

I knew this was a job for fanfare sound here the almighty ruby! smile

And so, I set my priorities straight.. I had to work elegantly and save time altogether. I'm feeling quite exhausted and would really love to get some sleep soon, so here I am, depending on my great yet simple ruby skills and the power of ruby itself to help me achieve this task!

As I write this article, my script is silently running in the background as a very obedient and competent slave. tongue But to help you out, here is a brief guide on how to sit back, relax and let the task be accomplished in no time! You should really be sending me gifts.. or better yet, donate to me via Paypal! I'll love it, I promise.. I might even give you a page of exposure! :)

Read the rest of this entry

Forcing urls to use https

If you have the need to force certain pages of your site to use ssl, but its becoming extremely cumbersome to find out the links that point to that page, this is a better approach, which seems to be more adhering to SPOT or (single point of truth).

Just add one method to your application controller and call before_filters to your specific controllers. That's it!

Read the rest of this entry

Free mini store search app in PHP and AJAX - for dummies

This is a very crude and very simple application which was for a demo purpose as requested by the client. I haven't been using PHP and (moreso) AJAX in over a year and a half already. This task was really more of a fun challenge that I cannot resist. I just wanted to see how long I can work on this and deliver what the client's requests were. Funny that this simple task was quoted to take 14 days of dev work, while it took me less than 5hours (since I was able to work on a CMS from scratch along with this all in 5hours of work time).

If you find yourself in need of a jumpstart, consider this the best freebie for you. Enjoy, and next time, give the client the correct estimates. It might save you both from hating each other and ruining possible future projects. wink

Read the rest of this entry

Category: Coding, Database Tags:  0 Comments »

Premium should be quality

Aside from daily tinkering of Ruby on Rails application, both for work and play, I have to serve requests that involve other scripting languages such as PHP and Python. PHP is the least of my favorites, but since its still the most widely used scripting language, in which more and more non CS grads have been so boastful of knowing, then I still go ways to cater to such applications. Love of Python is another thing. Its as beautiful as Ruby is for me, and as strict as how I tend to live my life. wink

As of the moment, I have a project running in PHP which was built using Smarty, though is not yet deployed on client's public server. Aside from this, I am also happily supporting several Wordpress powered blogs. I don't choose the themes, but I do have an input on whether its a good choice or not. We have completed customization of two of these blogs and was working on the last one yesterday. The chosen theme was IndoMagz2. Of course, I immediately uploaded the theme for use. After that was the anticipation of other stuff to be removed or added.

I couldn't have reacted negatively if I didn't have to go through the codes themselves to make some tweeks. At first glance, it looked just like any other magazine type wordpress theme. Blocks of elements are organized in the left and right columns of the layout. Although, I quite believe that three columned layouts are far better in information exposure, I don't have anything against using two columned layouts. I even thought that the layout was neat looking and the default banner would have really suited the new blog we were fixing. It was called "Ugaling Pinoy" which translates to "Filipino Attitudes" or even "Filipino Characteristics".

Read the rest of this entry

Migrate to your Wordpress blog using Ruby and Atom

Recently, I have encountered a dilemma regarding my personal blog. I have it hosted by a local blog host provider. It was great staying there and blogging there when there was still this very tight-knit community of bloggers. From time to time, we'd all meet up and just express our thoughts in person. The providers were really great with hearing out their users' thoughts, wishes including rants and raves. They were really good with what they were doing (up to some point in time).

...

Now, being the Ruby lover that I am, I decided to write a Ruby script that would scrape my content and push it onto my new Wordpress blog. There are a couple of assumptions/caveats for this script:

  • You can scrape off content from only YOUR OWN BLOG. Please don't use this to steal other people's content. I am not liable for any online content theft from the use of this script.
  • You must be able to understand the structure of the blog you are scraping. You should know where the "excerpt", "main body", "post date", "post author", etc. info are located from the markup/source of the blog you are scraping.
  • You must have the credentials of the blog where you want to push the scraped content.
  • If in case you need something else, or some more tweaking to this script, you must know Ruby, or maybe you can drop me a line and I'll see how I can help you.
  • This script uses Atom tools, although there are other gems available, this is what I chose to use.
  • Turn on Atom publishing in your Wordpress blog.

...

Read the rest of this entry

Removing "out of sync" error in acts_as_solr

It could've been pretty straightforward removing this concerned item from the solr index and then everything would be well.. but its a lot harder than that if you're looking at over a thousand indexed elements vs their 'existing' counterparts in the database! Finding the exact data to remove was really the hardest part! I never knew this until I took the liberty of helping out our kind Infra Team to resolve the problem. I decided to tweak the solr parser method returning the "out of sync" error. I thought that it would actually be brilliant to just display the concerned element's id so that they could delete it from the index itself. And so, I had something like this: (in acts_as_solr/lib/parser_methods.rb) Read the rest of this entry

To run RubyRun

I’m excited to have found RubyRun! I’ve just got the gem, but haven’t really fiddled with it. I’m gonna have it tested soon. I’ve heard about NewRelic and other stuffs too, but this one is new. We used to work with just bleakhouse, and I’ve tried dike. They are both hard to use and takes a lot of analysis to extract good info from it.

Read the rest of this entry

Category: Ruby and/or Rails Tags:  1 Comment »

Rails addressbook importer

I’ve been a developer for almost 10years now, yet I haven’t done any implementation of an address book importer. Well, this is the first time. smile

Since I started using symfony, I started to love its framework. Later on, I moved to using Ruby on Rails. Ever since, I loved working on Rails, and see myself wanting to create more Rails applications that would be better and more beautiful each time. That is why I always welcome the things I don’t know. I want to spend more time learning than simply perfecting what I already know.

Enter Rails address book importer.

Read the rest of this entry

Meaningful 404s and 500s

My site is still young and contents aren't that many right now, but what I really enjoy doing is making all the pages look better and be more usable. One thing that I recently gave thought on were my error pages.

I tried to advertently access a missing page, and I was greeted with my old one liner text and a suggestion to visit my blog. At the bottom of it was my twitter feed. It had the same layout as the rest of my site's pages and had the usual links on the right side. Funny though, when you access this missing page, it did take the usual loading time only to be displayed with such a page. And so I thought it needed a revamp.

Read the rest of this entry

How to use helper methods in Liquid template

I’m just a new user of Mephisto, and I find that its a mature blogging platform (that still has a lot to improve though). I’m liking it already, but I feel that there aren’t much resources available for the Mephisto users. I had a hard time finding a theme that suits my taste, and so I decided to use my own.

As I was writing my own layout, I had to look at liquid markup and quickly breeze through it so that I could go on with fixing my blog. To my surprise, even the Google Group for Liquid were not so kind enough to post answers to those questions related to “using helper methods in liquid layouts/template”.

Its sad that I had to work on it on my own. And now that I finally learned how to do it, I’m sharing it with you.

Read the rest of this entry

Hi, I've been busy you know. wink If you don't know yet, this site and my blog codes are hosted in . I recently moved to Git and found that they have support for private Git repositories. Below are details of my last git push.

Maricris S. Nonato on 26 Mar
Commit: e734bd6878629223c5067326471d7ec0aac7d6e4

Updated display of ads and popular content