Archive for category howto’s

MySQL query with ORDER BY,GROUP BY to remove duplicate rows after ordering

Apparently this is a widely discussed issue with MySQL; many newbies (like me) wanting to SELECT rows from a table, where they know there are duplicates of some field ‘a’ which they want unique, but making sure that the selected row has the field ‘b’ with the lower, highest, longest or shortest (whatever) value among [...]

Tags: , , ,

Inverted search in MySQL database: check if keywords in field match some text

Usually, “searching a database” means looking for rows that contain a “document” in a field that matches a certain keywords set (mostly using the MATCH AGAINST construct); let’s say you want to do the opposite instead, that is finding those rows that have a field containing keywords, or a phrase, that matches to a text [...]

Tags: , ,

MySQL SELECT query with more WHERE conditions runs faster

For some reason I wanted to add more redundant conditions to a WHERE clause in a MySQL SELECT query, but I feared that, being redundant conditions, I may end up slowing up the query. Shortly, there is this classifieds site, where each item’s table has the town_id, province_id and region_id rows. If you know the [...]

Tags: , ,

Enable force feedback of Logitech Driving Force Wheel under windows

I got a Playstation 2 wheel controller for free off Freecycle sometime ago (thanks again Claudia), I read it was compatible with the PC, and in fact it sports a USB port, and Windows 7 recognizres it correctly; I wasn’t expecting full support for all the functions, but it did work as a game controller, [...]

Tags: , ,

BCU rattle on passenger airbag and dash/fascia in Rover 75

Vibrating noises while I am driving drive me nuts. It’s as simple as that. I got my Rover 75 less than a year ago, and the excitement of driving an elegant classy car somehow made me ignore at first the abundant rattles I heard everywhere while I drove (especially behing the passenger airbag), yet I [...]

Tags: , ,

Extract string between two tokens inside a text in bash shell scripting

The other day, as a total newbye, I was writing a script in bash to process an HTML page, look for a URL inside it, and then download the content at that URL, recursively for a series of pages; I had it already done in AutoHotKey language, but since I don’t keep my Windows workstation [...]

Tags: , , , ,

Li-Ion battery calibration, funny myth? Personal thoughts

I regularly lurk over at XDA since I started -happily- using my HTC HD2 Leo (actually, I just brought it to a collection center for warranty servicing… dead touchscreen, sigh). Since then, I began reading about “funny” practices regarding lithium ion battery usage to prolong their life. Even before that, when I still used older [...]

Tags: , ,

PHP search string functions performance is “needle” dependent

I was playing with some templating benchmarks in my post before this one, and bumped into an interesting find regarding the way strpos works, and consequently all similar “search (and replace)” functions like str_replace, strrpos, stripos, str_ireplace, substr_replace, even preg_match and preg_replace (I tested only str_replace and preg_match out of these, but I assume they [...]

Tags: , , ,

PHP templating, preg_match, file_get_contents and strpos, the fastest

While working on the website of reecycle.it, il frecycling italiano per il riciclo degli oggetti, I am spending my resources also on reducing at most the load on the Apache server of my italian shared hosting, Tophost, so i decided to make some benchmarks to see which was the best speed I could load the [...]

Tags: , ,

UPS and car battery, how to power up your emergency supply

UPDATE: there is a new article that expands and powers up this idea, you find it here. For a while an old UPS of mine was abandoned in a corner because its battery was long dead and didn’t sustain the load of a PC for even a few seconds; and for a while I’ve been [...]

Tags: ,