Archive for the ‘Uncategorized’ Category

Recording Sound in Kubuntu 8.10 (running KDE 4.1)

Sunday, September 14th, 2008

Exciting times ahoy! This weeks mystery was to get sound recording with the minimum of fuss. We’re not sure what soundcard is running inside the Dell Inspiron 1520 which was our test laptop but it seems to report itself as an HDA Intel SigmaTel STAC9205 in the system settings. Anyway, the first thing to do was to apt install audacity which can then be used for testing the recording functionality. Not being sure if the laptops builtin in mic had been detected correctly, we jacked in an external microphone into the mic socket.

This didn’t produce any encouraging results initially when we tried recording in audacity so we opened up the KDE volume controls by clicking the speaker icon on the taskbar and electing to open the mixer. Unfortunately the GUI controls for the mixer doesn’t have the full complement of volume controls so it was the good ol command line to the rescue - typing alsamixer in terminal brings up a nice range of controls. You can navigate between screens of controls with the tab key and jump from control to control using the left/right arrow keys. The trick was to navigate to the two controls marked ‘Capture’ and bump up the volume (they also need to be activated by pressing the spacebar when you’re on the control). Additionally, there were two controls marked ‘Digital’. One of these controlled the volume of the mic (via the up and down arrows) and the other switched between analog and digital mode (again via the up and down arrows). We found that the latter had to be set to ‘Analog I’ for the best result.

Then it was back to audacity to record a bit of chatter - and then lament how weird ones voice sounds when recorded! Now get mixing mon amis!

QUICK UPDATE (14 Sep 08)
One issue that occurred was that after recording a sample, it couldn’t be played back(”Error while opening sound device. Please check the output device settings and the project sample rate.”). Additionally, a second track couldn’t be recorded. The solution to these problems was to open the Preferences dialog and set both the Playback and Record devices to ALSA (default). Reference: http://audacityteam.org/forum/viewtopic.php?f=18&t=3377

Getting Ruby Plasmoids up and running in KDE 4.1 (on Kubuntu)

Saturday, August 2nd, 2008

NOTE: THIS ARTICLE IS NOT YET COMPLETE. IF YOU FOLLOW IT THEN YOU WILL GO A LONG WAY BUT THE PLASMOID IS NOT YET DISPLAYING. SEE THE ‘Run your applet’ SECTION NEAR THE END OF THIS ARTICLE BEFORE PROCEEDING.

Introduction
KDE 4.1 is an absolutely terrific release of the KDE desktop, licking most of the issues presented in the original 4.0 release. Although it is still an early adopter release, 4.1 will be of interest to techie’s who want to get their mitts on a sexy new graphical interface and is reasonably stable for daily usage. Not quite ready for Aunt Tillie yet though! One of the nicest features is the beauty and simplicity of Plasmoids and these super flexible little gadgets can now be written in Ruby - well almost!

This guide assumes that you’re using Kubuntu Hardy Heron. But you should be able to adjust the instructions for any distro.

  • The starting point for our tour is to have Ruby installed. Google this if you’re unsure as to whether or not it’s installed.
  • We need to install cmake via ’sudo aptitude install cmake’. This is a cross-platform build system, similar to make.
  • It’s likely that you will need to install the build UNIX build tools via ‘aptitude search build-essential’.

Get coding!
And now you’re be ready to go. The main tutorial out there on Ruby Plasmoids at time of writing is the Ruby Applet tutorial on KDE Techbase. This is a very good, well written guide on creating a simple Ruby applet in which a web browser is embeded inside the plasmoid. But the guide has a couple of gotcha’s, especially for the newbie (myself included!), so we have listed solutions to these problems as we go. In summary, use our article as an supplement to KDE Techbase’s.

Ok, to start with a demo everyone wants a nicely packaged directory of files, so let’s quickly put together the basic directory structure for our plasmoid - it’s pretty simple!

  • Create a directory called ‘ruby-web-applet’
  • Save the files plasma-ruby-applet-web.desktop and web_applet.rb into this directory.
  • Create a file called CMakeLists.txt under your ruby-web-applet directory and paste the following code into it
set(SERVICES_INSTALL_DIR /usr/lib/kde4/share/kde4/services/)
set(DATA_INSTALL_DIR /usr/lib/kde4/share/kde4/apps/)

FIND_PACKAGE (Ruby REQUIRED)

include_directories( ${RUBY_INCLUDE_PATH} )
install(FILES plasma-ruby-applet-web.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES web_applet.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_ruby_web_applet)

Go to KDE Techbase
Once you have the above directory in place, go and read the Ruby Applet tutorial on KDE Techbase article down to just before the ‘Install and test the Applet’ paragraph. This will teach you what’s going on in the code. At that point come back to me as I’ll go into a little more detail on the final installation procedure!

You’re back!
Great! Ok, so we have the files on disk, you have a good idea of what the code is doing, now let’s install it and kick your plasmoid into action!

Open the CMakeLists.txt file listed above in a text editor. Change the path listed for KDE4 services and data directories to the ones on your system. These are the lines to change.

set(SERVICES_INSTALL_DIR /usr/lib/kde4/share/kde4/services/)
set(DATA_INSTALL_DIR /usr/lib/kde4/share/kde4/apps/)

Do this by replacing ‘/usr/lib/kde4/share/kde4/services/’ with the output of the command ‘kde4-config –install services’ and replace ‘/usr/lib/kde4/share/kde4/apps/’ with the output of the command ‘kde4-config –install data’ command. If you are using Kubuntu then they should be the same as mine but otherwise you may need to change them.

Then make sure you are inside your ruby-web-applet directory and type

cmake .

to generate nice makefiles for you which the make command can then use. Don’t forget the trailing dot! Now type ‘make’ and ’sudo make install’. This will install your plasmoid code into the KDE4 services directory (you can see where this is by running ‘kde4-config –install services’) and your plasmoid data into the KDE4 data directory (you can see where this is by running ‘kde4-config –install data’). Effectively, the installation just involves the two files - plasma-ruby-applet-web.desktop web_applet.rb. If it’s worked then you’ll get output like

Install the project…
– Install configuration: “”
– Installing: /usr/lib/kde4/share/kde4/services/plasma-ruby-applet-web.desktop
– Installing: /usr/lib/kde4/share/kde4/apps/plasma_ruby_web_applet/web_applet.rb

The applet is now installed!

Run your applet (THIS DOES NOT WORK YET)
There are two ways to do this. In a developer kind of way you can run ‘kbuildsycoca4′ from the command line followed by ‘plasmoidviewer plasma-ruby-web-applet’. Unfortunately this currently brings up the error

findServiceByDesktopPath:  not found
findServiceByDesktopPath:  not found

IF YOU HAVE A SOLUTION TO THIS THEN PLEASE COMMENT BELOW!!!

As a user, the cmake/make/make install procedure should have done all the necessary to install your plasmoid and you can activate it by going to the right of the task bar and clicking the Add Widgets icon. You should see your plasmoid listed but unfortunately this is not yet working - presumably for the same reason as the above. Oh well, I’m sure a solution will soon be posted. Until then, happy hackin!

Final notes

Note that the KDE techbase article provides a version of this file but it didn’t work for me because

  • I knew nothing about cmake or cmake files and I didn’t even cop that right clicking on the CMakeLists.txt file link in their article and saving it to disk would also save a load of HTML into the file
  • The line ‘FIND_PACKAGE (RUBY REQUIRED)’ should really be ‘FIND_PACKAGE (Ruby REQUIRED)’ as it’s case sensitive and will otherwise give you the error

    CMake Error at CMakeLists.txt:6 (FIND_PACKAGE):
    find_package could not find module FindRUBY.cmake or a configuration file for package RUBY.

    Adjust CMAKE_MODULE_PATH to find FindRUBY.cmake or set RUBY_DIR to the directory containing a CMake configuration file for RUBY. The file will have one of the following names:

    RUBYConfig.cmake
    ruby-config.cmake

  • The destination targets specified in the file didn’t work for me. Perhaps some environment variables need to be set somewhere
  • I didn’t even know how to use cmake! Or that you needed to follow it up with ‘make’. Anyway we’ll come cover this soon!

I didn’t need to set any CMAKE_MODULE_PATH but if you are having troubles with this then it’s at /usr/share/cmake-2.6/Modules/ on Kubuntu Hardy Heron. You may be able to set it in your script if your having difficulties as follows ’set(CMAKE_MODULE_PATH /usr/share/cmake-2.6/Modules/)’. Again I haven’t tried this my self!

Microsoft Not So Sure on Taking on World…

Tuesday, May 15th, 2007

Under pressure arising from comments made by Microsoft’s Horacio Gutierrez and Brad Smith in an Fortune magazine article earlier this week saying that Open Source software contains 235 Micrsoft patents, the company has released a statement that it does not intend to resort to litigation in an effort to halt the growth of Open Source software. So why would they highlight an issue and then when asked to state specifically which are the patents in question they respond, “We’re not going to have a discussion publicly with that level of detail.”

The answer is simple. If they publish them it is likely that most of them will be thrown out by the U.S. courts as invalid. This became much easier recently, when the U.S. Supreme court made it easier to legally challenge individual patents and get them invalidated. This is because most software patents have been granted without due consideration and aren’t actually valid for many reasons. Patents have been grantly for things that are patently unpatenable.

Once this weeds out the likely majority of patents - Open Source developers will endevour to work around what patents, if any, remain.

So, back to the question, why would Microsoft highlight a meaningless question? Well, to bring up the issue in this manner creates a degree of uncertainty in the minds of certain business owners - however misplaced. Such people must weigh up risk every day and anything that they perceive adding risk to their business they will avoid. This will take two forms, one is to avoid Open Source software and stick with closed solutions. But this is becoming increasingly difficult as it is making more and more business sense to deploy Open Source solutions every day. The other is pay royalties to Microsoft for these (vaguely) alledged infringing patents. This is a sad situation because paying ‘money for nothing’ is money that you could otherwise use to grow your business.

Use the Force to Fix Evil Vista’s Bootloader

Friday, April 20th, 2007

Hmmm… Those lovely folks at Microsoft are at it again. This time trying to break my lovely Linux system by killing my bootloader - the clever bit of software which lets you choose whether to boot into Linux or Windows. Cheers guys! You’re real sweet!

I bought my machine with Vista pre-installed with about 50 gig spare for Linux. I installed OpenSuse 10.2 into this space, which uses a little program called GRUB to switch between the Windows Vista and OpenSuse Linux when you start up the computer. Somehow Vista managed to overwrite this - I don’t know how, as I installed Linux second, but anyway in order to fix you need to do the following

1.) Get yourself a LIVE Linux CD (ie. a linux system that boots of a CD with requiring it be installed on your harddrive). I used the OpenSuse 10.2 Live CD
2.) Boot from this disk and then folllow the brief instructions at the following link. Even though it outlines the process for Ubuntu (a different Linux distribution), it works just as well for OpenSuse 10.2

Happy hacking!