Posts from the ‘Linux’ Category
It used to be a real pain to try and get google calendar working with kontact/korganiser, however now it is very simple. I have also provided a screenshot walk-through to aide the process.
Just install akonadi-kde-resource-googledata using your package manager or in the terminal with:
sudo apt-get install akonadi-kde-resource-googledata
This will install support of google calendar and google contacts into akonadi. If you’ve not heard of akonadi before, it is a backend that manages communications and protocols. So rather than having developers of separate applications working on the same thing rewriting code that does the same thing they can simply plug into akonadi. Kontact/korganiser can load can load from an akonadi resource:
Walkthrough
(see below for walkthough with screenshots)
- Right Click on calendars and click add resource
- Select akonadi
- Click Manage Calendar Sources
- Click add
- Select Akonadi Google Calendar Resource
- Enter your email and password and select ok
- Your calendar should now sync and appear in korganiser
Screenshot Walkthrough
This is a nice colour laser printer that I managed to pick up quite cheaply with 2 sets of toner.
Problem
On my system (kubuntu 9.10 x86_64) it did not appear in lsusb and dmesg showed the following:
[15208.550014] usb 1-6: new high speed USB device using ehci_hcd and address 10
[15208.701200] usb 1-6: configuration #1 chosen from 1 choice
[15208.741575] usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x413C pid 0×5516
[15208.741596] usbcore: registered new interface driver usblp
[15209.747326] usb 1-6: usbfs: interface 0 claimed by usblp while ‘usb’ sets config #1
Funnily enough it did appear in the list of devices in virtualbox, however I had no luck trying (and didn’t really want to) to install it virtually. So I decided I’d make use of the built in network abilities of the printer and plug it directly into the router (I didn’t do this initially as I wanted the printer in a different room to the router).
Solution
After setting the printer up on the network, I ensure logged into the web interface and changed the password from the default. I then followed this thread on the ubuntuforums which refers to this text for installing the “Fuji Xerox DocuPrint C525A” driver which is compatible with the dell 1320c.
The driver is an 32bit rpm by default (which is fine for redhat based os’s), you can use alien to convert the rpm to an deb, or you can just download a prebuilt deb from zoffix.com (Direct link. This is a 32 bit package still so we need to install it using “–force-architecture”
sudo dpkg -i fuji-xerox-docuprint-c525-a-ap_1.0-2_i386.deb –force-architecture
Once this driver is installed you can login to cups and configure your printer as you would normally (instructions below). However when you are required to select the printer you need to provide the ppd file manually if you have installed the driver
1 – Open a webbrowser and goto http://localhost:631/admin
2 – Click add printer
3 – Enter a name for the printer eg: dell1320c (spaces are not allowed)
4 – Enter the printer address. This is the ip address of your printer prefixed with “lpd://”. eg: lpd://192.168.1.121
5 – Either locate Fuji Xerox DocuPrint C525A or select the ppd directly which is located at /usr/share/cups/model/FujiXerox/en/FX_DocuPrint_C525_A_AP.ppd
6 – Memory Capacity should be 64MB, and Optional Tray Module should be 250 Sheet Feeder
7 – finish.
Bypass tray problem
You should now print a test page, however if you get the problem like me that the printer always attempts to load paper from the manual paper feed, you will need to change the paper source from bypass tray to tray 1 in each program you need to print with (hopefully there will be a fix for this, but in this cups there seems no option to set it)
Additional
I also noticed that this printer was covering each printed page with tiny yellow dots, which can be used to identify a printer (most likely for criminal matters).
I’ve heard a lot about CUDA, such as how it is 10,000% faster at cracking wireless passwords over a conventional program/hardware, but never really got around to testing it out before now. This post details the steps required to compile and setup CUDA 2.3 SDK and toolkit on ubuntu 9.10.
Downloads
You are required to have an Nvidia graphics driver (relatively new version) already installed. First download the CUDA toolkit and CUDA sdk from the Nvidia CUDA 2.3 download page.
Install the toolkit
# Make file executable chmod +x cudatoolkit_2.3_linux_64_ubuntu9.04.run # Run it as superuser sudo ./cudatoolkit_2.3_linux_64_ubuntu9.04.run
You now need to edit your .bashrc file in your home directory to include the paths (so your CUDA binaries can be found by the system)
export PATH=${PATH}:/usr/local/cuda/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
Note if you are using 32bit then “lib64″ should be replaced with just “lib”
Install the SDK
# Make file executable chmod +x cudasdk_2.3_linux.run # Run it as normal user ./cudasdk_2.3_linux.run
You should now have a NVIDIA_GPU_Computing_SDK folder in your home directory. Change directory into the C folder inside this one.
cd NVIDIA_GPU_Computing_SDK/C
In this folder is a make file which will compile all the Nvidia SDK and all the demos, in order for this to work in ubuntu 9.10 (x64) you will need to install several dependencies. By installing these before attempting to make will save you a lot of time, if you are getting errors please scroll down to the problems section to see if they are already covered.
# Install the necessary libraries sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev libxmu6
Making and running demos
You can then run the make command, once this is ran all of the executables will be placed in NVIDIA_GPU_Computing_SDK/C/bin/linux/released . We can check that our computer has an useable CUDA device install by running the deviceQuery program:
cd ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/released ./deviceQuery
This should output something similar to the following:
# ./deviceQuery CUDA Device Query (Runtime API) version (CUDART static linking) There is 1 device supporting CUDA Device 0: "GeForce GTX 260" CUDA Driver Version: 2.30 CUDA Runtime Version: 2.30 CUDA Capability Major revision number: 1 CUDA Capability Minor revision number: 3 Total amount of global memory: 938803200 bytes Number of multiprocessors: 27 Number of cores: 216 Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 16384 bytes Total number of registers available per block: 16384 Warp size: 32 Maximum number of threads per block: 512 Maximum sizes of each dimension of a block: 512 x 512 x 64 Maximum sizes of each dimension of a grid: 65535 x 65535 x 1 Maximum memory pitch: 262144 bytes Texture alignment: 256 bytes Clock rate: 1.47 GHz Concurrent copy and execution: Yes Run time limit on kernels: Yes Integrated: No Support host page-locked memory mapping: Yes Compute mode: Default (multiple host threads can use this device simultaneously) Test PASSED
Now that we can see CUDA is successfully installed and a suitable device is found we can run some of nvidia’s more ascetically pleasing demos:
./fluidsGL
./smokeParticles
./particles
./postProcessGL
Problems
libxi (Nvidia forum link) make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common' make[1]: Entering directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common' In file included from ./../common/inc/paramgl.h:24, from src/paramgl.cpp:19: ./../common/inc/GL/glut.h:60:20: error: GL/glu.h: No such file or directory make[1]: *** [obj/release/paramgl.cpp.o] Error 1 make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common' make: *** [lib/libparamgl.so] Error 2
sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak /usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak /usr/include/bits/mathinline.h:36: error: inline function ‘int __signbitf(float)’ cannot be declared weak /usr/include/bits/mathinline.h:42: error: inline function ‘int __signbit(double)’ cannot be declared weak /usr/include/bits/mathinline.h:48: error: inline function ‘int __signbitl(long double)’ cannot be declared weak /usr/local/cuda/bin/../include/math_functions.h:442: error: inline function ‘int __signbitl(long double)’ cannot be declared weak make[1]: *** [obj/release/particleSystem.cu.o] Error 255 make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/src/particles' make: *** [src/particles/Makefile.ph_build] Error 2
The problem is due to having gcc 4.4 installed rather than 4.3, it is possible to install the older version of this compiler but it is simpler to modify common/common.mk and add the following extra flag (Nvidia forum link):
# Change: NVCCFLAGS += --compiler-options -fno-strict-aliasing # To: NVCCFLAGS += --compiler-options -fno-strict-aliasing --compiler-options -fno-inline
and change the -O2
# Change: COMMONFLAGS += -O2 # To: COMMONFLAGS += -O0
The two remaining errors you may encounter are very similar and arrise from missing libraries:
libxi (Nvidia forum link)
/usr/bin/ld: cannot find -lXi collect2: ld returned 1 exit status make[1]: *** [../../bin/linux/release/particles] Error 1
sudo apt-get install libxi-dev
libxmu (Nvidia forum link)
/usr/bin/ld: cannot find -lXmu collect2: ld returned 1 exit status make[1]: *** [../../bin/linux/release/particles] Error 1
sudo apt-get install libxmu-dev libxmu6
So you want to use the nice notification features available in your desktop environment (KDE or Gnome) from a script you wrote? Below explains how to do just that for the two different environments.
KDE
The code below will use kdialog (should be installed along with kde) to create a popup message that displays for 3 seconds before closing:
kdialog --passivepopup 'notification message!' 3
This should look like the image below:
Source: stackoverflow
Gnome
A similar tool is available for gnome, but to the best of my knowledge (I don’t really use gnome) you need to install a package. The libnotify-
sudo apt-get install libnotify-bin
The command notify-send can then be used to create notifications from your script.
notify-send -t 3000 "notification title" "notification text"
Where 3000 is the timeout in milliseconds (so 3 seconds). notify-send features some nice additional options such as the ability to include images eg:
notify-send -i /home/user/exampleicon.png -t 3000 "notification title" "notification text"
Source: Coder’s Talk
Bash: Script to convert .flv to mp3
Flash Video (.FLV) is currently a very popular format of online videos, inparticular youtube. This post explains how to use a simple script to extract the sound from a flash video file and turn it into an mp3.
In order for the script to work you will need to download ffmpeg (to decode the video) and lame (to encode the mp3). This can be achieve in ubuntu by opening a terminal and running the following or alternatively you can use your package manager GUI to search and download the packages for you.
sudo apt-get install ffmpeg lame
You then need to create a new file named “flv2mp3.sh” and paste the following into it using your preferred text editor (which hopefully isn’t VI). Save the file and then change the file permissions so that it is executable (by running:`chmod a+x flv2mp3.sh` in the terminal or via the gui in you file browser)
#!/bin/sh
# this script should convert files from FLV to WAV and then to MP3
echo " "
echo " Welcome to FLV to MP3 converter! version 0.1"
echo " "
infile_name="$@"
# exit if the user did not enter anything:
if [ -z "$infile_name" ]; then
echo " "
echo "You did not tell me the file name, so I will exit now."
echo " "
exit
fi
echo " "
ffmpeg -i "$infile_name" -acodec pcm_s16le -ac 2 -ab 128k -vn -y "${infile_name%.flv}.wav"
lame --preset cd "${infile_name%.flv}.wav" "${infile_name%.flv}.mp3"
rm "${infile_name%.flv}.wav"
echo " "
echo "OK. I'm done! Have fun!"
echo " "
exit
You should now be able to convert a flashvideo into an mp3 by running the following command (changing the filenames to fit your purpose):
sh flv2mp3.sh videofilename.flv
Extra: Youtube
In linux it might be worth noting that youtube downloads the flv’s to your /tmp folder and you can easily copy them or convert to mp3′s (Ensure video is completly finished loading).
Also there is an application called ‘youtube-dl’ which can be installed from the repositories
sudo apt-get install youtube-dl
and then run using
youtube-dl http://www.youtube.com/video_to_borrow
Of course it’s up to your moral guidance to decide what you can and can’t download.
Android is a brilliant smart phone operating system, this is the start of a short series of guides for starting to program applications for it using the android SDK.
Android SDK
Download the android SDK
Once downloaded untar the SDK
tar xvzf android-sdk_r04-linux_86.tgz
The SDK is not complete as additional files need to be downloaded in order to compile for different versions of android. Open the SDK and AVG management application by moving into the SDK folder and running the following.
sh tools/android
In the avaliable packages select the android versions you wish to develop for, and begin downloading them. Should this fail please read the next section, otherwise skip ahead.
Failing to download
If you cannot download from the google website, goto settings and select “force https://… source to be fetched using http://” and click save and apply.
If this still does not work (as was the case for me) it is possible that for some reason a configuration file was not created for this program, this can be solved by creating it manually:
echo sdkman.force.http=true > ~/.android/androidtool.cfg
Creating Android Virtual Devices
You can create virtual android phones using the SDK and AVD manager, click the Virtual Device tab and select new. Enter a name for the device, and a size for the sd card and simply click create AVD.
Once you’ve created you Virtual Device(s) it should look like the following:
You can test these virtual devices and see how nicely the phones are emulated. This is much more useful once you begin writing applications.
Eclipse
I would highly recommend using eclipse as it, along with the android plugin, greatly simplifies production and testing of applications.
Download eclipse from the ubuntu repositories (or from the eclipse website)
sudo apt-get install eclipse
If you do not already have java installed then you will need to install it.
sudo apt-get install sun-java6-jdk sun-java6-jre
You will need to add the following line to your .bashrc in your home folder so that the android tools can be used in eclipse (and other programs).
export PATH=${PATH}:/home/user/android/sdk/tools
* replace /home/user/android/sdk with the path to where you downloaded the SDK
Installing the android plugin for eclipse
Google’s eclipse plugin install guide.
In eclipse goto help then Install new software and then add the google plugin url
https://dl-ssl.google.com/android/eclipse/
Then install Android DDMS and Android Development Tools.
Should you receive errors (like I did) relating to a missing package you will need to add the eclipse repository and install the missing packages.
http://download.eclipse.org/releases/galileo
You should then have a fully working eclipse with android plugin.
What next?
Now you should have everything setup in order to develop and android applications. I would recommend the google tutorials:
I preformed some acid3 tests on the browsers I currently had installed.
Chrome: It is sexy (only thing holding it back in Linux is the lack of flash support)
Score: 100/100
Version: 4.0.203.2
![]()
Opera: I used to use opera however not really any more, just installed it for this test.
Score: 100/100
Version: 10.00 (build 4585)
![]()
Arora: I don’t tend to use Arora, however I’ve heard alot of good things about it. It is a light-weight browser based on web-kit (as are chrome, safari and konqueror) and excels at its speed, highly recommended for notebooks which don’t need the bloat of firefox.
Score: 100/100 Linktest failed.
Version:0.8.0
![]()
Firefox: It seems to handle flash better (without crashing) and has lots of useful plugins.
Score: 93/100
Version: 3.5.2
![]()
Konqueror:
Score: 89/100 Linktest failed.
Version: 4.3.1
![]()
Google’s chrome comes first (with chrome having smoother and faster animation) followed by Opera and closely followed by Arora only failing on the link test, then firefox and trailing is konqueror. But I still love konqueror as its so convenient have filemanager and web-browser in one.
Partitions and disk space in linux
I’m sure there are many ways to see the partitions and corresponding diskspace in linux, but here is the method I found:
$df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda2 7513 5937 1576 80% /
tmpfs 1005 0 1005 0% /lib/init/rw
varrun 1005 1 1005 1% /var/run
varlock 1005 0 1005 0% /var/lock
udev 1005 1 1005 1% /dev
tmpfs 1005 1 1005 1% /dev/shm
/dev/sdc1 469453 353295 92311 80% /media/x
/dev/sdd1 1408345 979205 429141 70% /media/z
or visually:

I kept struggeling to remember what letters it was, as there are many two letter commands beginning with d in linux… (dc, dd, df, dh, do, dl, du). I now remember it, because ‘f’ is next to the ‘d’ key on my keyboard, and because df probably stands for disk-free.
For more information check out this site
Free
Using the free command gives output something like this (-m just tells free to output in megabytes):
free -m
total used free shared buffers cached
Mem: 2013 1996 17 0 27 1381
-/+ buffers/cache: 588 1425
Swap: 956 0 956
This is useful but annoying as it doesn’t show you how much memory is actually free. Files that are used are kept in the ram (referred to as caching). If the memory is needed it is simply overwritten, however if the file is used again it is already in the memory which saves time.
I wrote a quick little bash line to get the actually memory in use or the actual memory free. I use grep to select the right line from the output of free, and then use awk to do the string manipulation and math.
Memory in use
free -m | grep Mem | awk ‘{x=$3-$7; print x}’
Memory free
free -m | grep Mem | awk ‘{x=$2-($3-$7); print x}’






















