Skype sounds audio distorted in Ubuntu

Now that I have Skype installed on Ubuntu 13.04 I discovered that the various Skype sounds were distorted.  It was almost like the sounds had some static mixed in with them.  I thought it was probably just a problem with the new version of Skype, or the new sound drivers.  However, I made a discovery that fixed the issue.

I tried the AlsaMixer fix, but it didn’t work. (A reboot simply resets the PCM to 100 again, and the sound is still crackly.)  So it all came down to a simple file edit to get it fixed.

Edit the file /etc/pulse/default.pa using the command:

sudo gedit /etc/pulse/default.pa

Add the following to the end of the line shown:

pulse audio file

So after adding “tsched=0” to the end of the line “load-module module-udev-detect” you will be all set.  After a reboot the sounds is still good.

Enjoy!  Hope it works for you.

Skype for Ubuntu 13.04 Ringtail

I am running the new version of Ubuntu 13.04 Raring Ringtail, and so far really like it.  However I’ve had a bit of trouble with Skype, because I could not get it to use the indicator area of the tray.  Other than that it seemed to work fine.

When I installed Skype I did it from the Skype website, and didn’t realize there was a package at http://archive.canonical.com/ partners already carrying it because that repository is not turned on by default for Aptitude.

The repository can be activated by either command line, or by using the Software & Updates which enable it for command line or Ubuntu Software Center, or Synaptic Package Manager.

Via terminal:

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update

Via GUI:

Open the System Settings and click on the Software & Updates icon, or using the Dash you can simply type “Software & Updates”.  Once it opens you can select the “Other Software” tab and check the first box titled Canonical Partners.

Software and Updates

Now we are able to install Skype from the Canonical Partners repository no matter what method you wish to use.

Install Methods:

From terminal

sudo apt-get install skype

Or search for it through Ubuntu Software Center or Synaptic Package Manager and install nromally.

It will install some other required packages with it, but after the install it now works as expected with the indicator and all.

Enjoy!

Add items to Ubuntu 12.04 Unity Launcher (quicklaunch)

The recent upgrade to Ubuntu 12.04 Precise Pangolin left me somewhat hanging when it comes to creating launchers on the desktop, and also in the Unity Launcher (also called quicklaunch in some places) for Zend Studio and PHPStorm. In Gnome prior to Unity in Ubuntu it was easy to right click the desktop and select Create Launcher to create icons on the desktop to launch applications or scripts, but in 12.04 that options is gone. So here is how I solved some of the issues.

I will cover adding Eclipse to the launcher, adding Zend Studio to the launcher, and PHPStorm to the launcher.

Method 1 (easiest)

For Netbeans and Eclipse based editors like Zend Studio or Aptana it is not too bad. I created a {name}.desktop files for each one and put it in the /home/{username}/.local/share/applications/ directory. Here is how I created a zendstudio.desktop file:

Note: If you want this option to be available for all users you can alternatively create the file in the /usr/share/applications/ directory, but that requires superuser permissions.

[Desktop Entry]
Version=1.0
Name=Zend Studio
Comment=PHP IDE for PHP development
Type=Application
Categories=Development;IDE;
Exec=/home/{username}/Zend/ZendStudio/ZendStudio
Terminal=false
StartupNotify=true
Icon=/home/{username}/Zend/ZendStudio/icon.xpm
Name[en_US]=Zend Studio

After creating the file above I rebooted. Following the reboot I was able to click the Unity Dash Home button, type “Zend” in the search field, then drag and drop the Zend Studio icon to the launcher where I wanted it to be. Now the application stays in the Unity Launcher.

For PHPStorm see method 3 below.

Method 2

Another method I found was to install the ‘gnome-panel’ package. (Actually it was already installed on my system for some reason.)

sudo apt-get install --no-install-recommends gnome-panel

With the gnome-panel I was now able to create a launcher on the desktop using the command below.

gnome-desktop-item-edit ~/Desktop/ --create-new

In the create launcher dialog I filled it out as follows:
Type: Application
Name: PhpStorm
Command: /bin/bash /home/username/PhpStorm/PhpStorm-117.257/bin/phpstorm.sh

NOTE: You could use /bin/sh or whatever shell you use. I use bash so that is why I put /bin/bash.

To create a shortcut in the Unity Launcher I double clicked the new desktop launcher I created above. (NOTE: If you start PHPStorm by executing the phpstorm.sh you do not get any options at all when right clicking the icon in the Unity Launcher.) Then when PHPStorm was running I was then able to right click on the icon in the Unity Launcher and selected “Lock to Launcher”. Voila! Now I have phpstorm on the Unity Launcher.

Method 3

This option is built right into PHPStorm. The wonderful people at JetBrains created a handy item in Tools to automatically create a menu item for you. Simply click on Tools->Create Desktop entry…and now you can Lock to Launcher the next time you run it. Start the JetBrains PhpStorm IDE from the Unity Dash you can then right click on the icon that shows up in the Unity Launcher and select “Lock to Launcher”. The icon now stays there, even after a reboot/logout.

Update:

Method 4

See comment to this post below by Shinybird on using Ubuntu Tweak. (Not sure if it works, but it sounds good.)

Enjoy!!!

Collect hardware info in Ubuntu

I had some trouble installing/upgrading my system to Ubuntu Precise 12.04, so I reported the bug and wanted to also provide my hardware info with the bug report. I found 2 commands that returned slightly different results about my hardware, but both had usable info.

The best seemed to be:

sudo lshw

Another I came across was:

sudo dmidecode

I hope this helps others.

Executing CakePHP script using Windows Scheduled Task

In Windows adding a scheduled task is just not as straight forward as adding a CRON job using Linux. (Don’t get me started on troubleshooting a Windows Schedule Task that did not run for some reason.) However, it is not so difficult once you get it figured out. Here is what I did:

In this case I wanted to run a CakePHP script as a CRON job, or more accurately, as a Windows Scheduled Task since this customer insisted I create the application and use a Windows server. (I used XAMPP, so it wasn’t too bad.)

In order to run the script and take full advantage of the models in CakePHP it required that I use the CakePHP shell. Luckily the CakePHP developers created a ‘cake.bat’ script that enables this to happen on a Windows machine.  Normally on a Windows or Linux server you can navigate, via command line, to the ‘app’ folder and execute the ‘cake  name_of_script’ command, but using Windows Scheduled Tasks you need to execute the bat file.

Windows Scheduled Task Settings:
Run: C:\path\to\cake.bat  script_name {without the extension .php}
Start in: C:\path\to\app\folder
Run As: type in the appropriate users

Then of course you will need to go to the Schedule tab and set in the schedule you desire for your script.

Here is a screenshot: (you can see the default folders for xampp were used)

IMPORTANT: This entire process assumes that you have already created your script and placed it in the appropriate directory “/app/vendors/shells/{name_of_script.php}”.  It also assumes you understand how to create a cronjob for CakePHP to use.  (see below for a sample)

Sample content of ‘script_name.php’:

class ScriptNameShell extends Shell {
 
	var $uses = array('model1','model2');
 
	/**
	 * the main function is kicked off like a contructor
	 *
	 */
	function main() {
		echo 'Doing something.';
 
		$callingSomething = $this->otherFunction();
 
		echo $callingSomething;
	}
 
	function otherFunction() {
		$content = 'This is content from otherFunction.';
 
		return $content;
	}
}