Categories
Linux Posts

“Look of disapproval” not correctly displayed in Ubuntu / Linux Mint

If internet memes such as the following are displaying as squares rather than the faces they should be, it’s because Ubuntu/Linux Mint doesn’t come with the correct font packages.

ಠ_ಠ

To install these packages, simply install “unifont”:

sudo apt-get install unifont

If you’re having trouble in other distros, just search for the unifont package and install in that (might be named slightly differently.)

Categories
Arch Linux Fedora HowTo Linux Posts Ubuntu

Setting Up Surround Sound in Linux

It’s been a while since I bothered, the reason being it’s always seemed like an un-worthwhile struggle to get it working but either things changed or I was doing something to overcomplicate the process but it’s actually pretty simple to get surround sound up and running on your Linux machine. Now, I’m not going to go in to how to install the drivers for your specific sound card, because there are so many and I don’t have them all and most times on most popular distributions (Debian, Ubuntu, Mint, Fedora, OpenSuse etc) you’re going to notice that the sound card is actually already supported. What I will be doing is showing you how easy it was to get my 5.1’s set up (and the same will be said for 7.1’s).

Step 1:

First off you’re going to want to edit the pulseaudio configuration file to add the number of speakers you’re using, it’s default is set to 2.

sudo gedit /etc/pulse/daemon.conf

Near the bottom of the file, there will be a line which looks like this:

;default-sample-channels = 2

The semi-colon is a comment, so this line isn’t actually doing anything unless you remove that. I would suggest leaving that line alone and adding a new line at the bottom:

default-sample-channels = 6

If you’re using 5.1’s the number of channels will be 6, 7.1’s will be 8 and I think you get where I’m going with this? So in this example, I’m using 5.1’s.

Now save and close that file. You’ll need to reboot your system now too, so that these changes will take effect.

Step 2:

So you’re back? Good..

Now you’re going to want to open up the Sound Preferences, usually you can do this by clicking on the little sound icon in your panel, or System > Preference > Sounds from the menu.

From here, you’ll want to click on the Hardware tab. Near the bottom it’ll say Profile: with a drop down box next to it. Here you can select the type of set up you have, as you can see in the screenshot I have an “Analogue Surround 5.1 Output”, yours might be different and that’s cool and if you don’t know feel free to try a few out. Next to that drop down box is a button which says “Test Speakers”, this didn’t work for me so I have to use an online test but give it a try as it might work!

That’s it, you should be done!

Categories
Linux Posts Ubuntu

OpenNI – error CS0006: cannot find metadata file `System.Windows.Forms.dll’

During installing the OpenNi kinect drivers, found here: https://github.com/OpenNI/OpenNI, I came across this error:

make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net’
gmcs -out:../../../Bin/Release/SimpleViewer.net.exe -target:winexe -unsafe -o+ -r:OpenNI.net.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll -lib:../../../Bin/Release ../../../../../Samples/SimpleViewer.net/*.cs ../../Res/AssemblyInfo-OpenNI.cs
error CS0006: cannot find metadata file `System.Windows.Forms.dll’
Compilation failed: 1 error(s), 0 warnings
make[1]: *** [../../../Bin/Release/SimpleViewer.net.exe] Error 1
make[1]: Leaving directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net’
make: *** [Samples/SimpleViewer.net] Error 2

To fix it, simply install the following package:

sudo apt-get install mono-complete

Once finished, re-make and make install and everything should be dandy!

Categories
Linux Posts Ubuntu

Java – .jar Error 127 /bin/sh: javac: not found.

If you’re getting a similar error to this while trying to compile java files (.jar) then you’re probably missing the jdk, in ubuntu it’s called “sun-java6-jdk” so just go ahead and install that and all should be good!

make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Wrappers/OpenNI.java’
javac -d Release ../../../../../Wrappers/OpenNI.java/src/org/OpenNI/*.java
/bin/sh: javac: not found
make[1]: *** [../../../Bin/Release/org.OpenNI.jar] Error 127
make[1]: Leaving directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Wrappers/OpenNI.java’
make: *** [Wrappers/OpenNI.java] Error 2

FIX:

sudo apt-get install sun-java6-jdk
Categories
Android Posts

Android 4.0 (Ice Cream Sandwich) First Look / Impressions

It’s only been a couple of weeks since the first batch of Ice Cream Sandwich (ICS) loaded phones were released, the Samsung Galaxy Nexus, but already custom ROMs are being updated to allow users of other phones to use ICS.

Luckily for me, a Samsung Galaxy S (I9000) owner, development for this widely popular phone has been going strong for a while. Custom ROMs from Darkys ROM to CyanogenMod allow for quicker Android updates with much better features and a lack of Samsung’s bloat-ware.

So it seems the next version of CyanogenMod (CM9) will be ICS based and keeping up with the SGS development “Teamhacksung” have started porting over the new version which will soon become the latest version CM9. It’s still in its early stages and there are a few known bugs which need to be sorted but they’ve released a ROM for public testing.

After a day or so of testing, everything feels smooth and finished, it seems to be much more user friendly in comparison to previous iterations of Android. It’s kind of like they’ve realised it’s not just linux geeks using Android any more and it actually has a pretty large market share and they had to re-design it to be for everyone.

New Features:
Home Screen:

The home screen hasn’t changed dramatically and still follows the 4×5 grid of icons and widgets.

The biggest and in my opinion most needed change here though is the relocation of the search bar, no longer is the search bar a widget but it now sits directly under the notification bar and remains constant on all home screens. This clears up an extra row for other icons and widgets but doesn’t over crowd the place.

When editing the home screen icons and widgets (long pressing on one of them), the Remove section replaces the static search bar at the top of the screen. Additionally while editing some widgets, such as the Calendar, allow for resizing, by framing the widget with a blue border with dots in the centre of each which can be dragged to change the length or width of the object. It’d be good to see this as a standard across all widgets even if setting limits was also done.

Folders are still here and they are a bit more awesome, to make a folder you simply drag one icon on to another and they bunch up. Clicking on the bunch opens up a pop up with all the icons in.

App Drawer:

The app drawer is now 4×5 screens which can be switched left and right between, still organised alpabetically. Now however going past the last page of apps brings you to a list of widgets which can be held down on to drag to a home screen. The app drawer also has a quick link in the top left to the market place.

It’d be great to see more customisation here, allow for constant flow of apps from left to right rather than in pages or alternatively up and down scrolling.

Multi-tasking:

Multi-tasking is made much simpler in this iteration of Android, holding down the home button brings up a vertical list of running applications. Clicking on one will take you back to the app at its last used screen and also gives you a preview of the screen you’ll be heading back to. Sliding the appliaction left or right however will close it. This is a much simpler way for non-power users to understand what’s going on and might help them control over the occasional lag which can come about when you have too many applications open. It also really makes switching between two applications a breeze.

Settings:

The settings menu have been cleaned up dramatically and now provide a lot of the useful settings at a much easier level. Things are grouped rather than a huge list of things and are generally much easier to understand.

Face Unlock:

One of the biggest new features to this version is the addition of Face-recognition to unlock your phone. unfortunately because the current ROM used to review this doesn’t have a very stable front facing camera driver it wasn’t really working in my tests.

Essentially you hold the camera in front of your face for a few seconds while it calibrates to your data and then when you unlock your screen the camera will start up and it should only take a second to detect your face and unlock, if it fails it has a fail safe which allows you to also enter a pin or pattern to unlock.

Two main issues arise, firstly as pointed out by the setup, the fact that people with similar faces will be able to unlock your screen, so don’t expect that your siblings can’t frape you. Also a picture of your face would also work, since it’s not 3D detection a photograph will also work for unlocking your phone.

Screenshots:

Screenshots are built in to this verison of android (it really made this review easier ;)) Just hold down the Volume Down button and Power button at the same time, a second or so and the screen will flash and it’ll save a screenshot in a folder on your phone.

Browser:

The browser has had a few tweaks including the way tabs are handled.

Overall it’s a nice clean update, I can’t say the difference between honeycomb since I don’t own a tablet but I’m sure this will be a welcome change to both phone and tablet users.

Gallery after the jump..

Categories
Posts Programming ROS

ROS – rviz X Window System error.

rosrun rviz rviz
[ INFO] [1322561467.803234807]: rviz revision number 1.6.7
[ INFO] [1322561467.803351442]: ogre_tools revision number 1.6.2
[ INFO] [1322561467.803374070]: compiled against OGRE version 1.7.3 (Cthugha)
[ INFO] [1322561467.946771146]: Loading general config from [/home/alex/.rviz/config]
[ INFO] [1322561467.946953292]: Loading display config from [/home/alex/.rviz/display_config]
[ INFO] [1322561467.972674791]: RTT Preferred Mode is PBuffer.
The program 'rviz' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 22 error_code 9 request_code 137 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

I got this error when I incorrectly compiled rviz using:

rosmake rviz rviz

You’ll want to re-compile it correctly, with only 1 input as followed:

rosmake rviz

Now when you run it, everything should be working.

Categories
Android Posts

How To Take Screenshots in Ice Cream Sandwich (Android 4.0.x)

Android 4.0 or Ice Cream Sandwich (ICS) finally brings screenshots natively to the mobile platform, to a lot of users of custom ROMs such as CyanogenMod or Darkys ROM it may seem like this has been a feature for a while but that isn’t the case.

To take a screenshot:
  • Simply hold down the Volume Down button and Power button for about a second.

 

You’ll see a flash and the screen will be framed which shows the screenshot was taken (I’ve tried grabbing a screenshot of this screen, but it’s pretty tricky and no luck yet!). The screenshot will be saved in a folder /Pictures/Screenshots on your phones internal SD card.

You’ll also get a new notification in the notification bar saying “Saving Screenshot…” and once it’s done there’ll be a “Screenshot captured.” notification in the pull down menu which will take you directly the screenshot in the Gallery.

For more screenshots, check out my first look and impressions post about ICS!
 HERE
Categories
Command Line Fedora Linux Posts Ubuntu

Linux USB Errors with usb-creator-gtk “stdin: I/O error stdin: error 0 /init: line 1: can’t open /dev/sr0: No medium found”

After installing Ubuntu on a USB stick with the Ubuntu USB Startup Disk Creator (usb-creator-gtk) you might encounter an error such as the following:

stdin: I/O error
stdin: error 0
/init: line 1: can't open /dev/sr0: No medium found

This is actually a bug with the software and isn’t anything you’ve done wrong. It seems to be a bug that’s effecting users running Karmic, Lucid, Maverick and Natty so it’s a pretty wide spread issue.

The best way I have found to get around this issue is to install and run unetbootin to create live USBs. If you’re using linux it should be found in the usual place you can install things.

Installation:

Ubuntu/LinuxMint/Debian:

sudo apt-get install unetbootin

Fedora/OpenSuse:

sudo yum install unetbootin
Create a live USB:

To install a distro it’s pretty simple, either select it from the “Distribution” option and pick a distribution and version, UNetbootin will then actually download it and install it for you. Alternatively you can pick an Diskimage and browse for the ISO file you download (and would usually burn to a CD/DVD) and install from that. Select the USB Drive at the bottom and hit ok and it’ll install a bootloader, the system and you’ll be up and running in no time.

Persistence File:

If you wanted a persistence install which allows you to save files, settings and installed programs you’ll have to do a little manual work as it currently doesn’t support that option.

Go to http://unetbootin.sourceforge.net/diskimg/ and download one of the files (128mb.zip, 256mb.zip, or 512mb.zip) corresponding to the amount of persistent space you want (make sure the size of the persistent disk image is smaller than the free space you have on your USB drive).

You’ll then need to edit the syslinux.cfg file that was created by UNetbootin in the root of the directory (just open it with a text editor) you should see something similar to the following:

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash —

So on the line that starts “appen initrd=” you’ll want to add the option of “persistent”, it should then look like the following:

NOTE: WordPress changes my double dash at the end of the last line to a single long dash, this won’t work. It’s easiest just to add the final word before the double dash in the file, do not copy and paste this in to your file. If you do, you will get more errors.

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash persistent —

I added this line to all that used the “file=/cdrom/preseed/ubuntu.seed” option, since that’s the image that’s being opened and it should then change all options on the bootloader that will load the ubuntu install.

Categories
Blog Posts Programming Python

Python – Making Use of Google’s Text To Speech Translation Tool

Text to speech (tts) is a difficult task to get right and there are quite a few packages that show just how hard with their terrible tinny voices, these are also usually only limited to English, which for the larger part than most people would like to believe don’t find it very useful. Nevermind, Google to the rescue, their Translation tool has had the ability to also voice translations for a while now. So wouldn’t it be awesome if we could utilize this, stable, constantly developing and ultimately free utlilty? Yes? Well luckly for you it’s possible. It’s been done before with the use of JavaScript, like here but those more used to scripting and desktop programming don’t worry, you can use it too.

Basically it works by sending a request to the Google translate servers which then, pretty much instantly, reply with an MP3 file which contains the requested words in their most sexy of robot voices.

Check this URL for an example of said voice – http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice (if it doesn’t load in your browser, open VLC, CTRL+N and paste the URL in)

First, we want to be able to get python to stream an MP3 file off the web:

More info on this can be found here, the following code was is a stripped down version of the code found at codeboje.de.

[gist][/gist]

Now we want to make a string to send :

We’re going to use command line arguments as the string which wants to be read by the Google TTS engine, the following code will grab those arguments and concatenate them into a string. It also has to be in a format like a usual Google URL, these usually replace white space for the ‘+’ sign, that’s easy to do.

[gist][/gist]

Now let’s just pass this URL to the bit we wrote to stream an MP3 and watch it go:

Full Source Code:

(Uses command line arguments as it’s input, run like ‘python ttsString.py Hello World‘)
[gist][/gist]

That’s pretty much how easy it is to use Google’s free online TTS engine, one main thing to watch out for is the 100 character limit to the use of this service in this way along with the API call limits which apply to each IP address. There are loads of cool things this can be used for and I’d love to see what anyone comes up with, keep me posted and have fun!

Categories
Blog Posts Programming Python

Python – Writing a ‘Fuzzy Clock’

If you want a clock that’s a little more human, there’s no better way than a ‘Fuzzy’ clock, essentially this converts the time in to a more brain friendly format such as “Twenty past Twelve” rather than 12:22.

Writing a simple fuzzy clock
Source Code:

[gist][/gist]

Output:

$ python fuzzytime.py
It’s 25 to 2

Writing a more readable fuzzy clock:

Now, this returns in a form of “It’s 20 past 1” rather than “It’s twenty past one”, if you’re going to want this then it’s only a little more tricky. For this I used a lookup table which would essentially replace the numbers for the written numbers.

Source Code:

[gist][/gist]

Output:

$ python fuzzytime.py
It’s two o’clock