Deleting the code: Timestamp

development 1 Comment »

In many cases your application must keep track of an entity creation or update time. Do you know, that this can be done automatically?

Yes, I know, there is such feature out of the box in many frameworks (for example, Symfony). Naming convention guaranties that database table’s column named ‘stamp_created‘ will be set by entity creation date, and ’stamp_updated” – by time when any column of the entity has been changed. This done by application server side code (e.g. PHP).

The same can be done by good database table defenition (in MySQL).

  • Create a TIMESTAMP column with CURRENT_TIMESTAMP as default – and that’d be an auto-initializing ‘stamp_created field. 
  • Create a TIMESTAMP column with ON UPDATE CURRENT_TIMESTAMP  directive – and that’d be an autoupdating ‘stamp_updated’ field. 

Other options can be found in MySQL manual.

All this can be done in PHPMyAdmin application by correspondent settings. 

Drawback of such solution: table cannot have both ‘stamp_created’ and ‘stamp_updated’ fields – choose one pill, Neo.

Do you need a handwriting generating service?

ideas 6 Comments »

Now, my reader, I need your feedback: do you think it’s a good idea to create a handwriting generation service?

The idea is you come to a site, type some text in a form and as result download a PDF file which being printed looks exactly as if you wrote by a black gel ink pen.

I’m sure I can do this since I was working on such stand-alone tool several years ago. It would be fun for me to reimplement it for on-line use, but is there any point in such service?

What do you think?

P.S. It’s not a font looking like a hand-writing. You won’t recognize that it was generated+printed if an ink printer is used. As example:

Rival Alert Pal

FireFox, Rival Alert No Comments »

I created Rival Alert Pal - it’s a FireFox addon that helps to add data to my new data scraper project Rival Alert.

With its help you can just select a number on a web page which you want to track, right-click on it and select “Add to Rival Alert” menu item – after that this number will be added to the Rival Alert, and its updates will be tracked every day, so that you would be able to keep an eye on the value’s changes:

 

The same can be done for FeedBurner counter images – just right-click on it and ”Add to Rival Alert” menu item.

Rival Alert

Rival Alert No Comments »

I’m happy to announce that my project Rival Alert is ready for alpha testing!

Rival Alert is a data scraper that keeps track of statistics located on public web sites: forum registrations count, page visits, stock price or number of search results — any kind of numeric data.

Bloggers! There is a cool feature for you — Rival Alert can parse FeedBurner counter images so that you could know how popular other bloggers are.

You can find out more here.

Another PHPClasses victory

php, php classes No Comments »

September 2008 WinnerAnother my class has become a winner of PHP Classes Innovation Award – it’s the implementation of Binary Search algorithm. Yes, it’s the algorithm we all know from university – it’s strange for me, that it was considered as innovative.

I wrote this class as a test task while an interview for a new job. Results were so impressive for me, that I decided to share this piece of code: it finds result in 10Gb file for less than 5 seconds! File must contain key/value pairs (separator can be defined, by default it’s equal sign), and these pairs are sorted by keys. You define what key to search and get correspondent value very quickly.

For example:

Ann=5
Bob=3
Sandy=8
Zulu=1

If you search “Sandy”, you’ll get result “8″. Very quick :]

As a prize I selected an Apress book called “From Program to Product” – though I found it in PDF, it seems to be quite insightfull for me: we, developers, always think about code, and never about how to sell it. I have several product ideas, so I hope the book would help me to succeed.

P.S. Fun is that a few people emailed me to say how nice my new PHP Classes avatar is :] Thanks to Anton Dovgal for such a great picture of sad me.

Phonetic won!

development, php, php classes 4 Comments »

winner1.gif align=Yes, my class Phonetic won the first place of the PHPClasses Innovation Award.

Thanks to everyone voted for me!

You can check a demo here.

Vote for Phonetic class

development, php, php classes 1 Comment »

My PHP class Phonetic is nominated on phpclasses.org Innovation Award.

Vote for it!

The class generates words that phonetically are equal to the given one, but are written differently.

Get Mozilla FireFox T-Shirt

FireFox, development 3 Comments »

FirefoxDo you want to get a Mozilla Add-ons Developer T-shirt?

Recently I have received an email from Mozilla:

If you are able to achieve Firefox 3 beta 3 compatibility by March 18th on addons.mozilla.org, you are eligible for a Mozilla Add-ons Developer T-shirt. If you have updated your add-on, and would like a shirt, please fill out the following form:

https://addons.mozilla.org/en-US/firefox/developers/tshirtrequest

Additionally, if your add-on is one of the top 50 most used add-ons by Firefox 3 users on the Firefox 3 release day, Mozilla will offer to sponsor (for an amount we will determine) a party for you and your friends. That is, Mozilla will chip in for you and your friends to celebrate your tools success! Mozilla will be in contact with the top add-ons shortly after the Firefox 3 release.

As for me, I have created a Get File Size plugin, and as soon as I did it, I have become eligible to fill a shipping form.

Here is a couple of links to help you on this way:

It is a good chance to make your cool plugin idea come true.

Get file size

FireFox 33 Comments »

I have created a ‘Get File Size’ plugin for FireFox. It’s public.

Example screen

This simple plugin creates a HEAD request to the URL you clicked and alerts the size of the file – the value of ‘Content-Length’ header.

I’m here to delete code

development 1 Comment »

I have only made this letter longer
because I have not had the time to make it shorter

Blaise Pascal, Lettres provinciales.

What do you think you are supposed to do as developer? To create code? Nope. To delete it!

delete_eraser1.jpgHave you ever thought why it takes 5-15 minutes to get into the flow? From my point of view, that’s because you have to understand the root of a task, to load its code base into your operating memory – brain. So the less code you have to deal with, the more productive you are in juggling with it.

Alongside this fact consider these statements:

  • Less software is easier to manage.
  • Less software reduces your codebase and that means less maintenance busywork (and a happier staff).
  • Less software lowers your cost of change so you can adapt quickly. You can change your mind without having to change boatloads of code.
  • Less software results in fewer bugs.
  • Less software means less support.

( Getting Real :: Less Software chapter )

At the same time it’s funny how often I got more robust code by moving from 100 lines to 10…

In the next post I will describe the ways I use to achieve that goal.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in