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

Extending Database_form to send Emails via Mailer extension

Radiant is just a gem. Its installation is very easy, and super fast. I really didn't have much trouble. But the thing is, I wanted to have more control over the code itself, since I will be tweaking the Radiant app into something that fits their needs, and my deliverables too. And so, if you end up with this decision, just unpack your radiant gem.

gem unpack radiant

Once you have the tree generated, you'll see that its a normal Rails application hiding in the gem. Now you can inspect the code, and have it tweaked according to your will. I made changes in some of the templates, stylesheets, etc, and added some extensions. One of the uses of the site would be to serve as a mail form where users can contact them via a feedback section. I checked out their [Third Party extensions][8] which was quite extensive enough. I found a couple of them that I really needed:

Read the rest of this entry

Testing is a Remarkable thing!

I never knew testing could really change the way I code. I know I’m a good programmer because I love implementing standards and doing the “right things” the “first time”.. and yet testing has made me realize something..

Read the rest of this entry

Trust nothing but tests

Where have all the tests gone?  What tests??? I "shoulda", I coulda.. but can't.  My energy gets wasted.  

Sound familiar?  I know it does.
Read the rest of this entry

Measuring it up

There are different ways to start your application out right. Some work on TDD methods, some equip their teams with good QAs, the others rely on extremely efficient project management and strong system administration. But the building of a good rails application does not only depend on code alone and its processes…

Read the rest of this entry

Quick fixing Blackbook gem for Gmail

The blackbook gem, though not really maintained well right now has still been a good solution for my needs in networking stuffs. Although, recently pointed out by Marco Fang was some trouble with Gmail changing the way data is retrieved via the API.

Previously, a query for contacts via..

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

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

Let's be nimble, let's be agile

Programming in Ruby on Rails introduced me to agile software development. I have been used to development in the traditionally confusing and dirty process of coding system. Agile development is different.

In the good old waterfall model, there is a strict flow of activities and process that is followed in the exact manner as they are described. What I really liked about agile method is that its ability to be adaptive, thereby allowing more programmer sanity. As defined by Wikipedia,

Some of the principles behind the Agile Manifesto are:

* Customer satisfaction by rapid, continuous delivery of useful software
* Working software is delivered frequently (weeks rather than months)
* Working software is the principal measure of progress
* Even late changes in requirements are welcomed
* Close, daily cooperation between business people and developers
* Face-to-face conversation is the best form of communication (Co-location)
* Projects are built around motivated individuals, who should be trusted
* Continuous attention to technical excellence and good design
* Simplicity
* Self-organizing teams
* Regular adaptation to changing circumstances
Read the rest of this entry

Writing good code

It has long been a debate on how to describe 'good code'. What are the criteria for declaring a code to be good, neat, and dry?

My advocacy is to promote writing good quality code. It is by painstaking practice and tons of reading that I get to exercise this advocacy. It is but a long journey, but little steps lead you to understanding and qualifying a code to be of high quality. So what are my benchmarks?

  • Long codes are less readable and more likely to fail.

Ruby scripts are far smaller and more compact in size compared to Java codes or C++ codes. Trust me, I've seen some and comparing them to Ruby, reading Java codes or C++ codes that are not mine would take me a longer time for understanding (even if docs and other help materials are present). Ruby has good metaprogamming (that sometimes gets abused because of monkey patching) and produce straightforward codes. Each line would end up more like real English sentences.

If you write ruby codes that take up to more than twenty lines.. hmm.. well, its doomed to fail, for sure. smile Refactor and review!

  • Codes that don't look anything like its API source is really smelly.

APIs are there for you to use as a general sitemap. It is your guide to efficiently write code with ease. Usually, APIs are well documented and even provide examples or snippets of codes to demonstrate its use. The lines of codes involved may also be present for you to inspect its process and even predict if it will pass your expectations.

Read the rest of this entry

Category: Coding, Ruby and/or Rails Tags: , ,

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 3 Jul
Commit: 5a240685eb489c6daacf2ecd7de9f02e81235efe

Move blogsticker js and css to local domain