Strip Generator October 21, 2007

Posted by Predrag in : Resources and Links , 2 comments

Use Rails logger in tests October 5, 2007

Posted by Slobodan Kovacevic in : Resources and Links, Ruby & Rails , 1 comment so far

For some debugging in Rails test we wanted to be able to log data via Rails logger. Unfortunately, as it turns out you cannot directly access logger from tests (which is strange). Since we needed to add information to test.log we used this small piece of code (added to test_helper.rb):

def logger
RAILS_DEFAULT_LOGGER
end

and just use it in tests like this:

logger.info(’performing test now’)

[via Robby on Rails]

1280×800 Widescreen Wallpapers March 26, 2007

Posted by Predrag in : Resources and Links, 1280x800 Wallpapers , add a comment

small_wallpapers.jpg

In order to keep all our wallpapers in one place, we decided to create a separate page for all of them. So, if you wish to check them out, go to this page, or follow the link below.

Much more to come very soon!

View All 1280×800 Widescreen Wallpapers

MySQL insert a new row or update old one February 16, 2007

Posted by Slobodan Kovacevic in : Programming, Resources and Links , add a comment

Today I stumbled upon a newish MySQL feature that can often be very useful. Since MySQL 4.1 there’s a non-standard feature (i.e. it’s an extension of SQL standard and won’t work on other databases) that lets you insert a new row, but if it happens that a row with same primary/unique key already exists it will just update that row.

Insert query syntax looks like this:

INSERT INTO table (primarykeycol,col1,col2) VALUES (1,2,3) ON DUPLICATE KEY UPDATE col1=0, col2=col2+1

If there is already a row with primarykeycol set to 1 this query is equal to:

UPDATE table SET col1=0, col2=col2+1 WHERE primarykeycol = 1

Ordinarily to achieve the same result you would have to issue an UPDATE query, then check if there were affected rows and if not issue an INSERT query. This way, you can do everything in one step - first try insert and then update if insert fails.

One situation for which this type of syntax is perfect is when you work with daily counters. For example, you might have a table with PostID, Date and Count columns. Each day you’d have to check if you already created an entry for that day and if so increase the count column - and this can be easily substituted with one INSERT … ON DUPLICATE KEY UPDATE query.

Unfortunately there are some caveats. One being that when you have multiple unique indexes it will act as if you had an OR condition in WHERE clause of UPDATE query. This means that multiple rows should be update, but INSERT … ON DUPLICATE KEY UPDATE will update only one row.

For more information you should read article in MySQL manual: INSERT … ON DUPLICATE KEY UPDATE Syntax

Free Web based color scheme creator February 3, 2007

Posted by Predrag in : Resources and Links, Web Design , 3 comments

I simply enjoy this kind of stuff. Specially if client doesn’t have any specific color scheme request. This color cycle is easy to use and you can generate great color schemes, if you know where to click.

Color cycle

First, click on the buttons below the cycle and choose from (Mono, Contrast, Triad, Tetrad and Analogic). Then, play around with colors and see what you’ll get. Use variations to set the colors perfectly. There is also a simple preview where you’ll be able to see how colors fit. I prefer dark and light pastels myself.

Here is the link to Color Scheme Creator. Enjoy.

Niceforms 1.0 - final version January 31, 2007

Posted by Slobodan Kovacevic in : Programming, Resources and Links , 2 comments

Niceforms 1.0Over a year ago I wrote about an excellent script called Niceforms and little fix I wrote (see NiceForms with even nicer select). Now a final version has been released - Niceforms 1.0 which solves a lot of problems from previous version.

I still haven’t had chance to look at the new improvements but it seems that Niceforms now supports keyboard only navigation, scalable buttons, increased browser support, etc.

Unfortunately it still has some of the problems I tried to fix more than a year ago. Granted they tried to fix it, but it still has problems. For example, when you click on a select element if you move over some options and then move out it will immediately close the drop down. On the other hand if you open select element and don’t move over to any options (i.e. click on down arrow), but you move the mouse away from it - the select will remain open, which can again lead to strange effect where you can have a lot of open drop downs.

Perhaps that can be fixed in future versions - or at least I will try to make a patch for it.

If you want to get Niceforms 1.0 you can from author’s site.

Our reading list January 17, 2007

Posted by Slobodan Kovacevic in : Resources and Links, ArrayStudio News, Web , add a comment
photo by brothercake.

Recently we wanted to experiment with Amazon shops, so we have decided to setup a store with books we would would recommend - essentially our reading list. Books vary from those about web design and web programming to books about running a business (a must for anyone wanting to run their own business or even if you are only freelancing).

I hope you find our book recommendations useful.

We would also like to hear back from you. Have you read a good book that we haven’t included? Let us know and we’ll add it to our list.

Excellent PHP Thumbnailer Class August 29, 2006

Posted by Slobodan Kovacevic in : Resources and Links, PHP , 3 comments

PHP logo
I’ve found an excellent PHP Thumbnailer Class which lets you manipulate images easily. Beside usual functions you’d expect from thumbnailer class (such as resize and crop) it also has ability to create thumbnails on the fly or to save them. You can see it in action on PHP Thumbnailer demo page.

Coolest CSS Zen Garden solution ever! August 26, 2006

Posted by Predrag in : Resources and Links, Web Design , 2 comments

I couldn’t stop laughing once I saw this solution. As you probably know, CSS Zen Garden website is all about one singe XHTML page that designers can dress up using their external CSS. Well, this theme is called Geocites 1996, and it’s a real time machine!

Zen Garden?

I congratulate Bruce Lawson on this one, he really tried to make every detail in the same way as archdesigners done in those ages - and all that by using standard CSS! Great job!! This reminds me of Andy Warhol work from some reason. Anyway, thumbs up!

You can read more about this masterpiece here.

Ubuntu: xserver-xorg-core version 10.3. breaks the Xserver! August 23, 2006

Posted by Predrag in : Resources and Links, News , add a comment

If you updated your xserver-xorg-core recently, then you’re avare that your GUI ain’t working and all you can do is to login without one. Since I am new to Linux, I need some kind of step by step solutions in order to avoid panic.

What you need to do is to update your xserver-xorg-core to a version 10.4. It looks very simple once you visit this page.