Makiavelo:: Now with Migrations!

That’s right! The latest code from Makiavelo just got a new feature: migrations.

In my never ending journey of re-inventing the wheel, a.k.a building my own web framework for PHP, I’ve recently updated the code with a new feature, migrations.
Whether you implement this feature like Rails does or anyother way, it is important to have a way to control the changes to the database in a way that allows to easily go back and forth between them. It is always a plus to have record of each change done to the database, I think it helps maintainability.
Continue reading

Fork me on GitHub
Tagged , ,

PHP::Makiavelo writing a simple blog Part II

On my previous post I talked about the basic steps needed to start up our mini-blog project on Makiavelo.

Now I’ll talk about the few lines of code needed to get the controllers ready and the configuration needed to setup the virtual host on Apache.

Let’s get down to business, shall we?

Continue reading

Tagged , ,

PHP::Writing a simple blog in Makiavelo Part I

Makiavelo is a new PHP Web Framework that’s in the works, you can find out more about it here.
I think that the best way to learn a about a new framework, is to create something that actually works with it, so I’ll go over a simple “blogging” application that will cover the basics:

  • Using the command line to create entities
  • Setting up basic user authentication
  • Basic html formatting
  • Apache configuration required to setup our virtual host.

So, lets go over the example….(I’ll assume you’ve been to the GitHub page and read the docs). In part I, I’ll cover:

  1. Setting up database
  2. Setting up entities
  3. Messing with routes
    Continue reading
Tagged , ,

How to REST and not die trying – Writing API’s the REST way

I’ve been interacting with APIs for several years now, I’ve seen good things, and I’ve seen bad things. I’ve seen quite a lot of XML with SOAP, and I’ve seen a lot of JSON with REST APIs.

I’m not ashamed (maybe I should be) to say that the few times I had to write my own, they were actually inside the “bad” bag.
So when I was faced with the task of creating a mid-size API to be used from a mobile device, I decided to read up a bit on how to do it properly for once.

So, lets get down to business.
Continue reading

Tagged , ,

The anatomy of a jQuery plugin: a case study

Back to the bloging world after a while, I’ll start by writing about jQuery plugins, a subject that even though is pretty straight forward, I think not many people dare to tackle.
I’m not a particular fan of the jQuery library, but I’m not a hater either. Hey, it’s not the silver bullet for all my JS problems, but it has been a savior several times in the past.

I’ll go over the basics of creating a new plugin going over the code of a plugin I wrote myself in order to understand the process a bit better: FieldSplitter.
Continue reading

Tagged , ,

Ruby::Mechanize, interacting with webpages from your source code

Did you ever have to crawl or scrape a site that required login? Or maybe one that had quite a lot of javascript for UI interaction?
Well, turns out, I had to do that a couple of weeks ago, I was required to interact with a site that required login credentials and the login form used quite a lot of javascript to authorized the user. After googling around for a while, I found the Mechanize gem and after giving it a try I was so happy with it that I decided to write a bit about it, so here it goes…

Continue reading

Tagged , , , ,

A story about a crawler and a search engine

So the other day on my way to work, a silly idea came to mind: “What if I were write a story about web crawlers and search engines…, but with a twist?”
And here is the result, it’s just something not related to code for once:

Once upon a time, in a small village known to the locals by the name of Internetville people lived in peace. There were but a few complications once in a while, the rest of the time the sun would shine and the birds would sing.
For many, many years, this was the story of Internetville, that is, ofcourse, until a vile creature decided to come to live just outside it’s doors.
The creature, a horrible being, with a spider-like body, hundreads of legs and eyes and black as night would go by the name of The Crawler.
Continue reading

Clojure, higher order functions and You

Like I’ve said before, I’m starting to read up on Clojure, and writing a bit about the things I learn seems like a good way to put that knowledge to use.

Today, I’ll be talking about Higher order functions in Clojure.

You know Clojure, right? This cool programming language that came from Lisp and runs on the JVM.
Well, since it follows the function programming paradigm, it has higher order functions.
Continue reading

Tagged ,

Javascript: OOP for the uninitiaded

Hello again!!
This post will be a continuation of a previous post: Javascript: you’re doing it wrong. (check it out if you haven’t yet!).
In here I’ll talk about two different approaches to Object Oriented Design in Javascript.

The way I see it, there are two main ways to tackle this subject: The closure approach (which I don’t really like, and I’ll explain why) and the prototype approach.
Continue reading

Tagged , , , ,

Leiningen: Creating your Clojure project without setting your hair on fire

I’ve recently started to read a bit about Clojure, just for the sake of understanding that strange syntax that the language has.
So far, I’m loving it, ofcourse I haven’t done much with it other than a few utilitary scripts but since I’m planning on doing something a bit bigger, I’ll start writing about the first major issue I faced when trying to create said project: working out the namespaces-classpath fiasco (clojure can’t find your files if they’re not on the classpath used by the JVM).

Hopefully, this will be the first of many posts related to Clojure, so stay tunned (that is… if you’re interested ofcourse :P ), now back to the topic at hand…

Continue reading

Tagged , ,