This has been haunting me for quite some time. When building Qt app for Windows, the QImage::save() function did not work for JPEG for deployed applications, while it did work if Qt SDK was installed on the machine.
Continue reading
Category Archives: Programming
Turn Your Box into a Dev Web Server
To turn your box into a dev web server is pretty simple, yet I’ve seen people struggling with this over and over again, so here’s a simple TODO list.
I won’t go over the likes of Apache installation, VirtualHost setup, .htaccess settings, etc. as you can find these online very easily, and might be specific to the needs of your project.
Most of the time I see people using localhost:8080 and a myriad of other ports to work on several sites locally; but you might as well work on http://www.myproject.com locally in just 2 simple steps:
- Create a VirtualHost in Apache which goes by “the name” http://www.myproject.com, by including the following within the definition:
<VirtualHost *:80> ServerName www.myproject.com DocumentRoot /var/www/myproject/ # all the other options and definitions ... </VirtualHost> - “Register” the domain name locally – simply add the following line to your /etc/hosts file (on Windows, this file is typically located under [Windows]/System32/Drivers/etc):
127.0.0.1 www.myproject.com
Now enable the VHost in Apache, restart Apache, and open http://www.myproject.com in the browser, and you’re ready to code off!
Note: The VHost name need not be a valid domain name – feel free to use myproject as ServerName and in /etc/hosts; just beware that some browsers will try to search for “myproject” instead of opening the local site. In such case, type in the whole http://myproject.
List of Indexed Tags in Solr
Apache Solr is one of the best search engines I use(d). It’s fast, simple to use, indexing is reasonably fast, and sports great many features.
PHP+MySQL and Unicode/UTF-8
Most of the wide-spread languages support Unicode and/or UTF-8 at least in some form; post-2K languages support Unicode quite commonly, but there are always few things to look after.
What’s wrong with PHP?! part 3
The magic quotes, and the safe mode… ‘nough said.
Fortunately, both of these are deprecated in new versions of PHP.
Unfortunately, most hostings are not that keen on updating PHP to the newest version (mainly they’re still stuck at the likes of version 5.1.x).
What to do?
Continue reading
Create User in MySQL if It Does Not Exist
MySQL does not support create user if not exists syntax as it does with create table and create procedure. This is pretty weird, as it just boils down to checking whether single row exists in the `mysql`.`user` table.
How to Setup SVN Server on Shared Hosting
You’ve got a hosting, neat… a shared one. Now it’d be cool if you could move your subversion repositories there also. But, you can’t just daemonize svnserve or enable webdav in Apache.
SSH is the solution for you. SVN+SSH to be precise. The setup and configuration is pretty straight-forward, but there are quite a few glitches along the way.
All you’ll need for this is SSH access to the server and basic experience with the shell.
Hope this guide will help you: Setup a SVN Server on a Shared Hosting – it took me some time to get over all problems, I hope it’ll save some time to you!
Convert Accented Characters to Non-Accented in PHP
Often “in the wild”, even in English texts, you meet both accented versions and non-accented versions of certain words, such as brand names.
You’re then facing two options – you can either work with both versions, or get rid of accents. The latter option bears advantage of cutting down the dimensionality of the problem, as you don’t need to presume that you support all existing versions of the spelling, but how to get there?
Migrating from VMWare to VirtualBox
After years of using VMWare, I suddenly had to migrate to VirtualBox; I’ve been using VirtualBox for quite some time now, but not in the way I use VMWare.
First I thought it will be a short-lived trip, but now I’m happily stuck. I still had the image of VBox the way it was in the version 1.x in the head. What a blow it was to fully explore 4.x, in my case 4.0.6!
Few 2D Graphics Optimization Tips
Here are few optimization techniques that were handy to me recently; they mostly concern 2D graphics programming, where these patterns often emerge, but are helpful anywhere where you have to iterate and update data.
In short:
- iterate
- don’t do if‘s
- map all you can
- don’t float
- cache your reads