QoolArchives. An Archives WordPress plugin

We would like to inform you about the QoolArchives WordPress plugin!!
This plugin tries to solve a big WordPress problem that has to do with CPU load and speed.

The problem
When you have a wordpress site with 200-400 articles, WordPress is just fine but when it comes to a site that has more than 1500-2000 posts, then WordPress is a real CPU load monster! The problem is because WordPress asks the total number of posts from the database every time we make a request, making the DB to run a full scan of the post’s table. This can really kill your server!!!

The cause
Wordpress uses FOUND_ROWS. What this does is, that it asks the database for the total number of rows found on a query with no need for a second sql query to count the rows. As mentioned above, this is fine for a wordpress installation with 200-400 posts but it sucks when you have to do with thousands of posts.

The QoolArchives sollution
The plugin creates archived posts and moves the posts from the post’s table to another one. Thus making the post’s table smaller and easier for the FOUND_ROWS function to deal with.

Side effects
The plugin has some side-effects though.

Widgets problem
The calendar and the archives widgets will display records only for posts that have not been archived yet. So if the latest archive has been created at 28-03-2011 the calendar will display records only for days after 28-03-2011 . This is not such a big problem cause you can actually see the posts by going to a previous day :

www.example.com/2011/03/27

Download
You can download the plugin here: QoolArchives WP plugin

Any demos?
The QoolArchives plugin has been installed here: Writer.gr

Read More

Using APIs With PHP? Here Are Your Classes

Do you want to use an API but you are too lazy to write your own code to handle the requests? If you code in PHP as I do, then you will definitely need these classes. By using the classes listed here you will be able of using a great number of web services with an easy and documented way.

Pear

We couldn’t write a post about PHP classes without PEAR. PEAR  stands for “PHP Extension and Application Repository” and the Web Services category is the place to get ready made classes for:

  • Akismet
  • Amazon
  • Blogging
  • Compete
  • Delicious
  • Digg
  • eBay
  • Facebook
  • Google
  • Twitter
  • Yahoo
  • Youtube

and many more.

Even though PEAR is a great resource for web services related classes, sometimes you might want to use another class that doesn’t rely on PEAR to do the job or a more sophisticated one. The list that follows has PHP classes for different web services.

Read More

If Programming Languages Were Real Persons

What if programming languages were real persons like you and me? What if they were parts of families and had relations and affairs? Have you ever thought of going to a supermarket and Visual Basic was the young woman waiting in the line in front of you?

Well we did. We let our imagination free and we came up with pictures and facts :). We hope you enjoy this article since it only exist as a geeks humor. Names are fictional and images has been collected from Google’s search.

Charlie C

C is a 70 years old man that knows a lot. Perhaps too proud to reveal what he knows and sometimes too cryptic. He is a very strict person that follows his way of doing things and nothing seems possible to change his mind. In the past he was known as one of the strictest teachers in the Devel City university.

C can make you happy or disappoint you so much that, you want go for one of his sons or daughters. It depends on how much you try to learn his ways. The more you try the more he gives you.

C has been the main builder behind large projects like the Linuxious stadium and other large scaled buildings that we all use. He still works as a freelancer engineer and has involved in many other projects. Even at his age and with a lot of competition mainly from his son C++, C is still the choice of many companies to do things in Devel City.

C has 3 daughters :

  • Perl,
  • Java and
  • C#

and one son, C++.

Vin C++

C++ is 45 years old teacher at the Devel City university, following his father’s steps to become as respected as he is. He loves his father so much that tried to continue his work and knowledge. Being a younger man than C though, made him a much more friendly guy, in the means of approach, than his father. He works as a teacher in the Devel City university and his students have a love and hate affair with him.

C++ often lets his students choose their way in the learning process since he follows a different way of teaching approach than his father used to. His students love him because he lets them work in their own way but sometimes they fear his inheritance of C.

Most of his followers admire his wide range of knowledge that mixes C’s knowledge with knowledge gained through his life.

There are also a lot of people that criticise him of being so wide. Most of the time they talk about him as a direct descendant of C that has adopted all of his fathers disadvantages and added some more to it.

C++ has spent many years to get rid some of his fathers bad habits and never does things not needed. He prefers to put as much effort as needed to do the job right and never bloats things. This is why his projects are much more targeted than his fathers.

Montana Perl

Perl is a 37 years old young woman and works as a data analyst at the department of linguistics in Devel City. As a sexy young woman, her colleagues just love to work with her.

She is extremely clever, very strict when it comes to how people treat to her but has added great value to her carrier with her regular way of expressing things and her unique way of finding needles in haystacks. Many of her colleagues depend on Perl to fix things and they call her a “Swiss knife”.

Her father was a source of inspiration for Perl. Many of her father’s principles was inherited and many more added to her philosophy of how things should be done and why. She is a rather laconic character that speaks less but means a lot.

Perl finds it easy to work on different environments and performs well with a little help from her beloved husband Cygwin who always supports her ambitions.

Perl loves to travel. Each summer she goes around the world, most of the time she will be riding a camel in Africa and many times you might find her playing Golf in the State of the union stadium.

She also loves poetry and runs her own amusement company named Acme which aids in teaching young kids the way to do things the funny way.

Bianca Java

Java is a 35 years old sexy young woman and a mother also. Being so young and mature, Java is one of the most popular women in Devel City. She is very adoptable and can work everywhere. Her name comes as a feature in many projects and a lot of companies want their projects to carry her “Java powered” signature of quality.

Being C++’s sister, does not stop Java to be one of the biggest competitors of her brother. As a woman, Java is clean and manages to keep garbage out of her place, clean and clear. She works at JVM, a company specialized in ports creation.

Java loves sun. Each summer is Java’s favorite season and she loves playing with Duke in the beach.

Java has created her own legacy, just like her father did and has 2 daughters that promise to be as competitive as she is. Her daughters also work at JVM and stand out from the crowd of talented persons in Devel City. Their names are:

  • Groovy and
  • Scala

Jessica Groovy

Groovy is 21. Young but her impact in Devel City is bigger than just big. She was greatly inspired by her aunt Perl and her best friend Ruby.

Groovy is laconic and very expressive like her aunt, got any possible knowledge of her mother and added some cool ways to do her job in JVM. Most of the time she guides her colleagues in a rather strange way… by adding question marks (?) wherever she thinks something should be checked again.

Jane Scala

Scala is 22 years old.She is sweet and quite friendly but many of her friends in Devel City feel a little thread when it comes to job opportunities. The case of Twittorix, where the managers of the project asked Scala to do the job, made Ruby upset.

Scala like her little sister Groovy, got all of her mother’s knowledge and took it to a newer level. Not only Scala can work the same way as her mother does, she can also make new ways of working and doing things for a specific job which makes her a valuable part of JVM. Scala gets a lot of suggestions to work for NET (another ports creation company) but she is too busy with JVM at the moment that makes this a little hard to accomplish.

Pierson PHP

PHP is 29 years old and Java’s bitter friend. PHP runs her own company in Devel City called Zendix and has become one of the worlds well known ladies because of her easy way of doing things, her adoption of new technologies and a large fun club that make her desirable and efficient.

PHP was a student of C, Java’s father and used to work with Perl where she got her expressive character and power. Being a very beautiful woman, PHP has a lot of admirers that range from newcomers to Devel city, to old residents. She might seem easy but she needs a lot of attention to master her ways.

Sometimes her affairs are too strong and sometimes people seem to glance at Java and Ruby which makes her trying to add some of Java’s charm into her character. This, makes a lot of people say that PHP tries to become Java in some way.

Recently, PHP was voted as the 3rd most popular person in Devel’s city Object’s awards.

Mary JavaScript

JavaScript is often confused with Java in Devel City especially from newcomers… but you know what they say that: “where no smoke without fire”. Many rumors say that JavaScript is Java’s half sister but she denies it, so does Java.

JavaScript is 32 and her close friends call her “JS”. She is very strict but relaxed also. This, makes her a wonderful companion for most of Devel’s residents and she is very popular since a large part of the city has used her services at least once.

JS is one of the most successful women in Devel City. She runs a network of more than 20 companies some of which are unique.  jQuerysius, Mootool and Dojodic, to name a few are popping out each and every day.

She works silently and a lot of people think that she spents most of her time to make her job look glamourus. Most of her competitors say that she is good only for that but, to be honest, all of them know that there are some things that only she can accomplish.

She believes that to become successful, you have to keep your friends close and, your enemies closer. So, she tries to cooperate and coexist with all other businessman and businesswoman in Devel City. Everybody loves her even if she breaks things up sometimes.

Angelina Ruby

Ruby is a good friend of Groovy. She is 20 years old and she is one of the upcoming names in Devel City mainly because of her professional maturity and the way she manages to do a job cleanly and fast. Although Scala, Groovy’s sister, got a big job from Ruby’s hands (case of Twittorix), Ruby is still considered as one of the best professionals out there.

Ruby, became one of the most successful women in City of Devel, after the creation of her Rails company  and got a lot of fame. She also inspired many other famous women in Devel City to start their own Rails-like companies with PHP being one of them with Symfoniac LTD.

She is a very calm person and not fond of surprises. When she works, she wants to have everything there as helpful as it can be for her and her co-workers. Most of the time she applies the POLS principle to her job.

Some Devel City residents state that, if Perl goes away one day, Ruby will do the job as good as she does and with more freedom than with Perl.

Ruby believes in one principle: “Divide and Conquer”, this is why she has divided all of her company groups into Gems. Ruby just needs to use a gem to do a particular job.

Jack Python

One of the most known and respected persons in Devel City, is Python. A 54 years old construction builder. Some people believe that he can use the power of his brain to do magic. Python works in a rather modern way that his age implies and here is where he amazes Devel’s residents.

Python always finds new ways of doing things. If a tool is good to work with, Python will use it with no particular disadvantages. Python is one of the best man in Devel to work with since he allows anyone to work the way he thinks is better.

His favorite words are spam and eggs and his projects are named after his nickname. For example PyGameing station and PyS6000 which was a futuristic TV series.

Python as his name implies, is a snakes lover and has a lot of them as pets. His favorite pet is an Anaconda.

His work has been approved by some of the biggest companies in Devel City like 10^10, Yohaaa and DERN.

Read More

Damn Small PHP Frameworks. Because size does matter.

First of all let me clarify, that if you are looking for a Symfony, CodeIgniter, CakePHP.. etc article, this is not what you are looking for. In this article you will find small and extra lightweight PHP frameworks that in some cases, can make your life easier. Really.

Why use a framework?

Because re-inventing the wheel again and again is something a productive (note the word used: productive* ) developer, should not do. By using a framework that supports the MVC patern (Model,View,Controler), you can keep your code readable and understandable, you seperate application logic from presentation and many more things that would require more than an article to cover.

Kohana

We start our listing with the Kohana framework. The Kohana team describes the framework as a PHP5 framework with support to the MVC architectural pattern that aims to be secure, lightweight and easy to use. The full package sized only 1.5MB (629KB compressed) has everything you need to create great and fully functional php applications. Some of the modules included are:

  • Archive – Compressed archive creation, supports zip, tar, gzip, and bzip.
  • Auth – Simple authentication and user management. Uses ORM for models.
  • Gmaps – Google Maps integration, geolocation, and API support.
  • Kodoc – Dynamic self-generated documentation. (Beta!)
  • Payment – Provides merchant and payment gateway wrappers. Supports Authorize.net, PayPal, Trident, Trust Commerce, and YourPay.

Great documentation (Wiki based, this means that everyone can contribute. Something like the PHP Manual, where user comments are the real documentation) , excellent and small tutorials like : Creating a blog with Kohana Part 1 and Part 2, make learning the kohana framework a lot easier.

Rapyd

Rapyd is another small php framework that can also be used as a library. 250KB of compressed files with an uncomressed size of 484KB. It is definetely impressive what you can do with it. Some of it’s features:

  • No compiling, no command line needed, just unzip, it will work.
  • PHP5 Strict
  • Modules support
  • Nice URLs (SEO oriented)
  • Tiny MVC in few files

epicode

epicode is an extremely lightweight PHP framework. It includes caching, session, database, form validation, twitter, oauth and asynchronous/non-blocking curl components. EpiCode started off as an MVC framework but has evolved into a set of extremely useful tools. Every tool is completely decoupled so they can be used independently or in conjunction. Each library in EpiCode is thought out and implemented in an extremely cohesive manner. The documentation can be found here.

Extra Light Framework

ELF PHP is a php framework with a very small footprint, built on Model-View-Controller architecture. Believe it or not, PHP ELF is sized only 39KB compressed and when extracted it’s size is only 72KB. Although it’s small size it features:

  • Caching system
  • URL Routing system
  • Logging system
  • Requests handler
  • Image manipulation class
  • Database abstractization
  • Minimal server load

and the plans for the Beta 3 include adding:

  • Validation class
  • Session class
  • Pagination class
  • File upload
  • Common scripts
  • Improved caching engine
  • Improved models

BaseApp

BaseApp Framework is aimed at individual commercial developers or small web application builders who need a starting point.Also if you are a CakePHP User you will find yourself at home with the API. BaseApp was inspired by CakePHP And Codeigniter but tries to do everything under 50 kb.
It has support for most common features available in frameworks these days but achieves all this in under 50 Kb of compressed Code and not MBs of it. Some technical data:

  • PHP 5 with support for new features like autoloading etc.
  • Fully MVC ( But can be used as a library also ).
  • CakePHP API ( 80 % ) and Layout.
  • Active Records and Object Relation Ship Mapping (ORM).
  • Model Validation with complementing form helpers.
  • Data Abstraction Layer with Adodb Support ( Almost all databases supported ).
  • Extensive Debugging and Exception Handling facilities ( FireBug Support Built in ).
  • Extendable Cookie and Session Handling.
  • Search engine friendly and url routing features.
  • Ajax Support through Jquery.

The project is hosted on Google code.

Read More