2013-02-13

MySQL Dump: Access Denied

I needed an SQL dump of my Global GoldSrc Database to continue work locally. Un-/Fortunately, the server owner and sysadmin is very concerned about server security, so I was unable to just dump the database with this:
mysqldump -p -u osaft osaft_gtfcdb4 > osaft_gtfcdb4-20130213.sql
The server wouldn't let me because of insufficient access.
mysqldump: Got error: 1044: Access denied for user 'osaft'@'localhost' to database 'osaft_gtfcdb4' when using LOCK TABLES
Fortunately, there's a simple solution that should work like a charm: --single-transaction.
mysqldump -p -u osaft osaft_gtfcdb4 --single-transaction > osaft_gtfcdb4-20130213.sql
Then just bzip it (or not) and you're done!
tar -cvjf osaft_gtfcdb4-20130213.sql.bz2 osaft_gtfcdb4-20130213.sql

2013-02-05

Default File Associations

Setting default programmes is actually very simple and straight-forward.
Open your user's defaults.list.
vim ~/.local/share/applications/defaults.list
Add lines formatted like this:
<mimetype>=<desktop file>
Here are some examples from my file.
text/html=sublime_text.desktop 
text/plain=sublime_text.desktop
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/magnet=transmission-gtk.desktop
The changes will be applied immediately.

Convenient Routing with Dnsmasq

If you're a web developer, you may have this issue: Creating a new virtual host in your HTTP server (I still use Apache, so sue me) works fine, but then there's that hosts file where you always have to add the new domain (e.g. mynewproject.dev) and link it with 127.0.0.1 - but not anymore! There's a very simple way of adding and routing a wildcard domain with a quite powerful programme named dnsmasq. Thanks to tomchuck for this solution.
First, get dnsmasq from your repo.
sudo apt-get install dnsmasq
Then create your config file. Note: All files in this folder are parsed by dnsmasq. This allows easy management of different IP ranges.
sudo vim /etc/dnsmasq.d/my-local
Put this into your config:
address=/.dev/127.0.0.1
Save and close the file, then restart the dnsmasq service.
sudo service dnsmasq restart
Now open your DNS config.
sudo vim /etc/resolv.conf
Add your computer as DNS server. Note: If you're planning to use other domains than .dev, you should put it at the top of the file, or at least higher than other nameserver entries.
nameserver 127.0.0.1
To make sure everything worked, ping a .dev domain.
ping test.dev
Oh, and you probably want to create an init.d/ script for the dnsmasq service to start on boot.