Archive

Archive for the ‘tips’ Category

Restore an MSSQL backup to a different database name

December 24th, 2008 Petros 2 comments

I had a database backup and was trying to restore it but to a different database name than that from where it was backed up.
Read more…

Categories: tips Tags: , ,

Rails drop down lists

November 17th, 2008 Petros No comments

Sometimes you want to have a drop down list in your Rails application that contains both the items from a collection of model instances and some other items that are not coming from the collection.

Read more…

Categories: tips Tags: , ,

Reporting bugs

August 29th, 2008 Petros No comments

I am sure most programmers and me know by now the 101 rule: Maintain a bug database if you develop software. This post is not about this. I assume you know and practice it already. I want to talk about what a bug report should include and I encourage you to train the people who will report bugs to follow this advice.

Read more…

Categories: tips Tags: , ,

Rails and Greek

February 17th, 2008 Petros No comments

Rails is great when you want to start quickly and 10 minutes later have your first web application up and running. This is because many things that are needed are pre-configured. This is true but unfortunately if you live in a part of the world where everyone speaks a weird sounding language that has characters that are not standard, you have to use Unicode.

I live in this part of the world where everyone speaks Greek. Somehow we manage to communicate, but that’s another story.

I want to share with you what I found the hard way. How to setup your Rails application to handle Greek language without any problems:

Read more…

Categories: tips Tags: ,

Selecting only today’s records

June 19th, 2007 Petros No comments

My database background has been mostly related to Oracle. These days, I am working as a freelancer with a company that heavily uses SQL Server. As a result, I miss knowing stuff out of my mind without having to search.

Today, I wanted to select from a table only those records that where created today. This table has a DateTime column that gets a default value from GetDate(). Here is how I did it:

select
*
from
myTable
where
DateDiff(DAY, MyDateColumn, GetDate()) = 0

Is there a better way?

Categories: tips Tags: ,