Archive of articles classified as' "MySQL"

Back home

mysql order by numeric difference

1/10/2008

Whilst recently implementing a discount system for an e-commerce site I needed to apply the biggest discount should there be a product which was eligible for more than one discount. As the system allowd x for y type discounts I needed to order my results with x-y so I could find out which of the x for y discounts was the best value for money.

In order to do this I used something like the following SQL:

SELECT discount FROM discounts WHERE ABS(x_value - y_value) DESC

With thanks to:
http://www.bradino.com/mysql/order-by-numeric-difference/

No Comments

obligatory dev tools post

9/09/2008

I’ve been blogging now for a few months (albeit quite sparsely!) and I think it’s about time I write the obligatory dev tools post. These are tools that I use day in, day out and couldn’t imagine developing without. If you have any which you would like to add, please do so in the comments below…

editor/ide

Texpad – love its flexibility and simplicity. Does everything I need, never crashes and has loads of settings.

ftp

Smart FTP – ok, so you have to pay for it, but it really is the best ftp client out there.

honourable mention

FileZilla – a nice, simple, free solution. Seems to update all the time, which is a bit annoying, but other than that a very nice alternative to smart FTP.

database management

PHPMyAdmin – Was torn between this and Navicat for the main spot, but went for this because it’s free.

honourable mention

Navicat – This has some really nice features and is a lot more enterprisey than PHPMyAdmin, but then you have to pay for it :(

browser

Firefox – at the time of writing Google Chrome has just been released and so far it looks good, however firefox is still number 1. Everything about it just feels right, and the add ons take it to a different level.

honourable mention

Google Chrome – just released, but looks by far the next best thing after firefox, and who knows, could even surpass firefox one day (Tangent: isn’t google developing a browser a bit of a conflict of interests, considering the money they plough into firefox?!)

firefox extensions

Web Developer – the mother of all firefox webdev extensions. If you’re a web developer and you don’t have this plugin, you may as well go home.

Firebug – Another plugin I couldn’t live without. The inspect function is awesome, the javascript console and debugging is incredible, again this is a must have.

HTML Validator – Validates pages as they load and has some nice features like tidying up the html.

Color Zilla – Lets you instantly get any colour from any web page with the handy colour picker.

Screengrab – Allows you to easily take a screengrab of the page, visible portion or just a selection.

YSlow – A plugin for firebug this allows you to see how fast your page is and where you could improve.

Delicious Bookmarks – Allows me to easily bookmark pages and also gives me access to my bookmarks at the click of a mouse.

Bloglines Notifier – A bit naughty this one, but when you love bloglines as much as me it makes sense.

version control

Tortoise SVN – If you’re using subversion then you need to have this gui tool (if working in windows).

regex

Regex Builder – There are loads of online ones, but I like this one for its simplicity and quickness. Shame it requires the .net framework though.

misc

Stickies – Very useful when having to log time. These handy sticky notes sit on your desktop so you can easily record what your working on and between what hours.

Ok, so that’s my list. If you would like to add to it, or feel there’s a tool out there which you can’t believe I don’t use then please point me toward it.

2 Comments