Click Technology Limited

Linux, Windows, Macs – it's all good!

Stereo problem…

April8

I ripped a CD to mp3 files and tried to play them using Universal Media Streamer to my Yummyha CRX-N560D stereo, but it kept coming up with “unknown format” on the stereo display.  Oddly, other mp3 files were just fine.

Solution?  My stereo only plays mp3 with a bitrate of up to 256kb/s and these files were ripped at 320kb/s.  So how to change that?  Convert them using avconv and liblame to reduce the sampling frequency. Noice!

First install the Linux libav tools thus..

sudo apt-get install libav-tools

Now convert. This command resamples the songs, e.g. song-name.mp3 to song-name-out.mp3 at 256k and then moves song-name-out.mp3 to song-name.mp3 thus overwriting the original.

for f in ./*.mp3; do avconv -i "$f" -c:a libmp3lame -b:a 256k "${f%.*}-out.mp3" && mv "${f%.*}-out.mp3" "${f%.*}.mp3"; done

The finished result is that all the files are there but now sampled at 256kb/s and play perfectly on my stereo. Sweet.

Fun fact : This guy is a Chinese actor and his surname is Chow. It’s the .gif that keeps on giving.

 

posted under Linux Tips | Comments Off on Stereo problem…

How to create and mount shared folders in VirtualBox

February2

On your workstation host, open VirtualBox.  Select the host you want to set up shared folders on, right click and click ‘Settings’.

3

In the Settings panel (shown above), click ‘Shared Folders’ in the left pane.

Click ‘Machine Folders’ in the right pane and then the new path folder icon on the extreme right hand side.

4

Add a folder path.  This location is on the host workstation and will be made available to the virtual machine, for example…

Folder Path : /home/username/VirtualBox/shared_folders/linux_mint
Folder Name : linux_mint

Click OK.  Now start the client OS.

Install VBox Addidtions

Install VBox Additions by now switching to the VM you have just started.

1

In the window of this device, click on the Devices menu, Insert Guest Additions CD Image.  That mounts the Additions CD.

2

Now open a terminal prompt.  Switch directories to the CD.  It’s auto-mounted at

/media/username/VBOXADDITIONS_4.3.18_96516

or similar, depending on revision / edition etc.  so cd into it thus..

cd /media/username/VBOXADDITIONS_4.3.18_96516

Now run the command below..

sudo ./VBoxLinuxAdditions.run

It’s installed.

Now, switch back to the host workstation. Open a command line and type the following…

sudo mkdir -p /mnt/hostOS
sudo mount -t vboxsf linux_mint /mnt/hostOS/

Finished.

 

posted under Linux Tips | No Comments »

Output a MySQL result set to a .csv file

October15

This is quite sweet. You need to get some table data straight out to a CSV for manipulating in OpenOffice Calc, or similar products. But how?

Connect to your SQL server using a command line, ususally

mysql -u root -p

enter your password. Show your databases using

SHOW DATABASES;

Switch to your database using

USE my_database_name;

Now show your tables if you like..

SHOW TABLES;

Now get your CSV out from the table results of a query thus..

SELECT Name, Surname, Address, Postcode, Telephone
FROM Customers
INTO OUTFILE '/tmp/customers.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Et voila, data dumped to /tmp/customers.csv! Nice.

 

Perhaps my favourite XKCD cartoon.

Perhaps my favourite XKCD cartoon from xkcd.com

OK, funny / cool but how do I get .CSV file to my PC?

Understood.  I use Linux Mint, but in any Debian, Ubuntu, Mint system, open your file manager (or Thunar in Mint-speak) and put

sftp://your_username@your.server.name.com/tmp/

Enter any password required for the target server and voilà, you’re on the /tmp directory on the target server!  From there, you can copy / paste the file as you wish,

posted under Linux Tips | No Comments »

Extract data from a photo

October3

All pictures taken with digital cameras add information to images they take. A lot of information. To see it, install imagemagick using this command on the command line..

sudo apt-get install imagemagick

Then, just use the identify command thus..

identify -verbose /home/me/pics/some_picture.jpg

and it should pump out a heap of data.

Personally, if ever uploading photos to the internet (never) or emailing them to friends (rarely), I make sure to strip all the data from them. For this, use mogrify, also from the imagemagick suite…

mogrify -strip /home/me/pics/some_picture.jpg

Now the exif data has been removed. Nice!

 

True dat..

posted under Linux Tips | No Comments »
« Older Entries