Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Tuesday, February 18, 2014

Getting Scrivener Working in Wine 1.6



I had a similar problem with broken dependencies when trying to install wine and acroread, and a complaint when trying to install ia32-libs-multiarch, just after upgrading to 12.04 from 11.04 (passing over 11.10). It seems that some ppa's I had in 11.04 installed newer versions of applications in the system. After upgrading, the remains of these apps seemed to do some mess in the dependencies.
The solution that seems to work (until now), was found on a german ubuntu board (http://forum.ubuntuusers.de, posts from user Lasall):
First a downgrade is required and done with the following: create the 'preferences' file:
sudo vi /etc/apt/preferences
and insert the following lines:
Package: *       
Pin: release a=precise*
Pin-Priority: 2012
enter :wq to write the file. Pin-Priority must be greater than 1000.
Then you may downgrade the offending applications with:
sudo apt-get dist-upgrade
Then you may install packages that complained about dependencies, like sudo apt-get install ia32-libs-multiarch, or sudo apt-get install ia32-libs.
Finally, you should remove the file you just created:
sudo rm /etc/apt/preferences
because else no new updates would be found.
Hope this helps you too!

Thursday, May 16, 2013

Taming the Chrome Memory Pig

As I wrote in my last post, I've had problems with memory swapping on my Ubuntu system. Swapping is when programs and data are taken out of RAM and put on disk. Systems do this so they won't run out of RAM. Ubuntu, however, ships with a fairly aggressive swapping strategy.

The way I fixed the problem was to reduce the swappiness configurable in Ubuntu but, as I was analyzing that, I discovered that both Xorg and Chrome were eating a great deal of memory. As far as I can tell, Xorg bloats due to applications not releasing display memory properly. I figure there's not much I can do about that.

Chrome, however, was another matter. I found a Chrome plugin called OneTab. This product claims to reduce Chrome memory usage by 95%. It accomplishes this by collapsing all the open browser tabs down to one filled with links which, when clicked, restore the tab with no data loss.

It actually seems to work. The only problem is that restored windows don't retain their browser history so you can't use the back button to return to a previous screen after restoring a window. Still, when Chrome has your system crawling, OneTab is a good alternative.

Tuesday, May 14, 2013

Ubuntu Swappiness

My desktop has been running slow for a while. Granted I have a PoC computuer with only 4GB of RAM but it should suffice to run Ubuntu. The disk seems to grind a lot which usually indicates a lot of swapping. Since the wife and I use different browsers I have to assume one is swapped out over time. This seems odd since the system monitor shows swap space being used even though I have plenty of RAM left.

Enter the swappiness configurable. Here's a cut and past from the Swap FAQ.

What is swappiness and how do I change it?


The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
  • swappiness can have a value of between 0 and 100
  • swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
  • swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache
The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.
To check the swappiness value
cat /proc/sys/vm/swappiness

To change the swappiness value A temporary change (lost on reboot) with a swappiness value of 10 can be made with
sudo sysctl vm.swappiness=10

To make a change permanent, edit the configuration file with your favorite editor:
gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:
vm.swappiness=10

Save the file and reboot.

I'll try a swappiness of 10 and report back here in a few days if performance improves. The instant I changed it the disk stopped grinding so I am hopeful this will fix my problem.



Sunday, May 5, 2013

Setting up Ubuntu as a Media Server for Xbox and Android Devices

Recently we cut the cord with cable, relying solely on the internet for our entertainment. The reasons were many but not going deeper in the financial hole each month was a strong motivator. Also, our Wii system broke so we needed a replacement media console for Netflix and Hulu. My son wanted an Xbox we decided to go down that path.

The Xbox is a beefier gaming console and now that Zack is older, he wants to play more of the shoot-em-up games which the Wii doesn't support well. The Wii also does poorly with flight simulators, which Zack loves, so I decided to bite the bullet and spend the $300 for a new system.

I was pleasantly surprised to find a pretty sweet deal on new Xboxs. You can get one with 256 GB of memory for $99 if you sign up for 2 years of Xbox live. Since I was going to need the live account anyway, it seemed like a pretty cheap entry point.

What we had:
AT&T cable with a 12 MB internet pipe and phone, Netflix, Hulu, Amazon ~ $200/month

What we have now
25 MB internet pipe, phone, Netflix, Hulu, Xbox Live ~ $80/month

So we're saving around $120 a month. Over a year that adds up.

Before I start on the technical details I have to add a caveat: the wife isn't happy with the number of steps it takes to watch her shows. Some of them I have to find on either Amazon, Hulu, or Neflix. Others I find them on YouTube or other media sources. Still, we only watch a few shows each week so I don't consider this a burden. I think my wife feels differently.

Also, if you aren't going to use your PC as a media server that plays content you've stored there, then you really don't need to read much of this article. Everything I've listed above is well documented and pretty easy to set up. If, however, you want to use your computer as a way to serve up music, photos, and videos then read on.

Also, this is one area where windows is probably a better solution than Ubuntu. I have Ubuntu doing well but the Xbox is a Microsoft product and thus integrates with Microsoft windows really well. I've read more than one post stating people basically gave up and bought a cheap computer to sit next to their gaming console.

So, for you Ubuntu and Mac users, read on.

Recommendations:
  • This assumes you already have a broadband internet connection. Most plans these days will do but the ideal size of your internet pipe depends on how many machines you're going to connect. 12 MB download speed should be sufficient for anything. 
  • For the best experience, I suggest an HDTV using an HDMI cable for connection between the Xbox and the TV. 
Details
  1. Go to the $99 Xbox page - you'll have to sign up for an Xbox Live account for $15 a month then take the coupon to one of the participating stores (Microsoft, Best Buy, GameStop, Toys R Us, or Walmart) to redeem the coupon. You'll have a choice between a larger disk drive and a Kinex system. I recommend more drive space since the 4GB that comes with the Kinex isn't enough to store much.
  2. Purchase your system and install it at home. I would leave it outside of any cabinet, this system runs a hot.
  3. Set up your Amazon, Hulu, and Netflix accounts - its fairly simple. ( you can stop here if you aren't setting up your PC as a media server)
  4. Go to the PS3 Media Server Download page. You'll find links for Windows, Mac, and Linux. 
  5. For Linux, you'll see a pms-generic-linux-unix*.tgz file. Download this and extract the contents to a directory of your choosing.
  6. You have a choice of running the server by hand or setting it up as some sort of service. I still run it by hand but created a script on my desktop to run it. To run it the first time open a terminal window, cd to your extract director and run ./PMS.sh. You should see the window below. 
  7. You'll need to go to the Navigation/Share Settings tab and tell the PS3 Media Server what directories it can access.
  8. Add your Video, Picture, and Music directories here.
  9. I've found the transcoding video media streams doesn't seem to work well from PMS. My devices time out before my POC computer can serve the first of the stream. My advice is to only stream videos your device (Xbox or Android) that they can consume natively. Therefore, go to the transcoding tab and add mp4 and mpv to the 'skip transcode' box. 
  10. I'm not sure if this is needed but I would Quit the PMS and then start it back up again. 
  11. Now go to your Xbox and access the System Media Player under TV and Video. You should see your PMS server available. Now navigate to your content and enjoy!
Diving Deeper

Now for some of the fiddly bits. The MKV format is popular for downloadable internet content but Xbox doesn't support it and, if I read the Xbox support site correctly, they have no intention of supporting it.  A product called HandBrake solves the problem.

With HandBrake I can convert the mkv files into mp4 format which the Xbox reads well. To install on Ubuntu run the following commands in a terminal window
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk
This link talks about handbrake no longer supporting xbox and ps3 but other say it does
I installed it and created a m4v format ( basically an mp4 with apple compatibility crap) and it worked fine.

Other media streamers I've experimented with are MediaTomb and minidlna. Both are available from the Ubuntu store (for free) and both work well on my Android device. Xbox won't even see MediaTomb, however and minidlna sort of works for music.

For minidlna, you'll want to follow the config instructions at https://help.ubuntu.com/community/MiniDLNA
On extra thing I needed to do was manually create the /var/cache/minidlna directory then grant global permissions to is since it's used by everyone. The commands are
mkdir /var/cache/minidlna
chmod a+rw /var/cache/minidlna
Android

So this is one of those happy finds. I wanted a way to stream my PS3 Media Server to my phone. I found a package called Skifta available from the Google Play and Amazon store. Not only does it let me watch files served from any of the media servers I've listed in the article, it also share my phones media to anyone on my local network. So now I can watch movies on my phone on my Xbox. I use it on both my Kindle and Samsung.

I'm still experimenting with mkv formats on android. The best option so far seems to be creating either an mp4 or avi out of the mkv. A product called avidemux solves the problem. Just select the file type of either avi or mp4 when saving. It takes a while. After that you have video content your android can read.

I'm not happy that avidemux can't create mp4s or avis that xbox can read. I'm sure with a little more digging I could find the proper settings but this will do for now.

Good luck and happy viewing. 

Links

PS3 Media Server - http://www.ps3mediaserver.org/


Friday, January 4, 2013

Writing - Scrivener


Man is a tool-using animal. Without tools he is nothing, with tools he is all. 
Thomas Carlyle 


If you're serious about writing  you should get serious about your writing tools. You'll need a word processor and Microsoft Word is the big bull in the pasture. There are others, like Libre Office Write, that are as good as word with a lower cost. But all word processors try to do everything for everybody. They mail merge, fax, print labels and envelopes, and all sorts of other tasks that have nothing to do with writing a novel, screen play, or short story.

Monday, December 24, 2012

Backup with rsync

You have a number of options if you wish to protect your Ubuntu system against the unlikely event of a disk crash. I use a layered approach to save my precious files and memories. There are numerous cloud providers that will give you some free space to store your files: Ubuntu 1, DropBox, Google, and Amazon to name a few. None of them provide enough space to save my music, pictures, videos, and game files.

To save those drive eaters, I have two external drives use as redundant storage. The cloud providers save the documents I work on day-to-day while the external drives save files I add but seldom, if ever, change. I try to perform the backup on a monthly basis.

Sunday, December 23, 2012

Clearing the Rhythmbox database

So I've been at the music import thing for a while and am almost done placing my cherished songs on my Ubuntu system as well as Google Music. I've documented my journey in two other blog posts for those interested in the methodology.

I have a few albums left that aren't in the MusicBrainz database so those must be entered manually. Now I'm at the point of futzing with my music's tags and organization. 

I ran into a problem because once Rhythmbox has a song in its inventory it doesn't bother going back and rereading the tags. The solution to this was to delete the Rhythmbox database. It's located in 

~/.local/share/rhythmbox/rhythmdb.xml

Now my Southern Rock is Southern, my Alternative Rock is Alt, and my Classic Rock is truly Classic. It's also fun to watch the counters increment to my current collection size of 3062 songs. I have around 200 more to import and there are always stragglers hanging around the house and various family vehicles. 

This is been both a fun and fulfilling project that allows me to access my music from anywhere with a cell or internet connection.

Until next time.
Zack's Dad.

Saturday, December 8, 2012

Music Converter - OggConvert

From my last post you know that I'm ripping my CDs to my computer and using Google Music to put it in the cloud. Google does not support some of the music I've previously exported from a windows machines. I presume it has something about the Microsoft codecs being proprietary.

The open version for media files is OGG which is a free, open container format maintained by the Xiph.Org Foundation. The Ogg format is an unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia. The Ogg container format can multiplex a number of independent streams for audio, video, text (such as subtitles), and metadata.

Saturday, July 14, 2012

Chrome and Ubuntu 12.04 Flash Issue

I recently ran into a problem on my Ubuntu system with web sites containing embedded flash content - like YouTube. It seemed to hose up Chrome requiring a refresh to fix. In some cases I couldn't fix it at all. So now I've set Chrome to run Flash only when I click on the Flash area.

To do this, put this in your Chrome address bar (where you would normally put the URL)

chrome://settings/content 
(note, you may have to copy and paste if the link doesn't work)


On the resulting browser page, find the plug-ins section and turn off automatically running flash. In my case I just turned them all off.


And that seemed to fix the problem.

I still have occasional issues with the Google+ Event gadget and haven't yet found a decent work around other than to refresh the page.


Sunday, January 8, 2012

Ubuntu Apache Dev Web Server Install


I'm investigating Yii, a PHP web framework, for some friends. We want to do a web project and they know at least some PHP. Since I don't want to do all the programming myself, PHP seems like a good option.

The first step is installing the Apache HTTP Server. While I have that self-same web server already installed on my machine as a service, I decided I wanted a development copy I could mess up and not hose my machine's install.

Going to the Apache download site, I see 2.2 is the latest stable version. I navigate to that page and find the Unix tarball to download. Once downloaded, I extract the file any old place.

Step 1 -  run 'configure' with your final install directory for Apache.
./configure --prefix=[Apache Install Dir] --enable-so
Lots of output follows. I recommend giving a full path vs. a relative path to the install directory. You can probably use either but you never know.

Step 2 - Now it's time to run 'make'.
make
Lots more output follows.

Now run 'make install'. This actually creates the server instance software in you install directory you picked in step 1.
make install
Now navigate to your Apache install directory. Since this is a development web server, we're going to change the default listing port to 8080. I do this so it won't interfere with an installed web server running on the default port of 80.
cd [Apache Install Dir]/Apache2.2/conf
Use your favorite editor, and open httpd.conf. Find the line 
Listen 80
Change it to
Listen 8080
You can substitute 8080 with any other open port. If you need to see if a port is open you can run
netstat -a
and look through the results to make sure your port isn't in use.

Now change directory to the Apache bin directory and run apachectl start. This starts your web server.

cd [Apache Install Dir]/Apache2.2/bin
./apachectl start
Now open a web browser and try
http://localhost:8080/
You should bet a message that says
It Works
If you get this pat yourself on the back and go get a cup of coffee smiling that you've successfully geeked for the day. If not, do what we professionals do, consult the all knowing Google search.

Coming up next, configuring Apache to run PHP.


Saturday, March 5, 2011

Screencasts in Ubuntu

This one took me a while but I finally found a software stack that works well for screen casts in Ubuntu 10.10 and YouTube. recordmydesktop is great for capturing the full screen, a single screen, or a small portion of your display. The other product is Winff for converting the ogv file to an avi. This was actually the most painful part of the process as many products came and went but still exist in the wild world of the Internet.  The stack works really well. Just record, convert, and upload the YouTube.

Both are available from the Ubuntu repository via the Package Manager.

Below is a screen cast of me actually type this blog. It records audio from any microphone you have configure and thus you'll here me typing in the first part of the video. 


And here's a screen cast of using WinFF to convert OGV to an AVI file. You can view this file below.


Good luck and may the Force be with you.


Tuesday, February 15, 2011

Problems with ATT Uverse and Ubuntu

I recently switched from Time Warner Cable to ATT U-verse. I'm very happy with the picture quality on my TV but the Internet connection on my Ubuntu 10.10 system was very slow even though speed tests said I was getting the band width I paid for. The problem turned out to be the DNS. For whatever reason the DNS lookup was very slow using the new service. I switched to Google public DNS and everything worked fine.

To fix the problem I went to System->Preferences->Network Connections and selected Auto eth0 from the list and then the Edit button.  A window will pop up wiht 4 tabs. Select the IPv4 Settings tab. A drop down list will show Automatic DHCP. Change the drop down to Automatic (DHCP) addresses only and add your favorite DNS addresses to DNS Servers. I used 8.8.8.8, 8.8.4.4 for the addresses.

Your final window should look something like this.


This fixed my problem instantly.


Sunday, November 9, 2008

Ubuntu 8 and HP Deskjet F4280

My mother passed away recently bequeathed me a large number of old photos. I wish to save these treasures from the ravages of time and share them with others easily. Scanning them is the obvious solution but I"m afraid to use my old HP OfficeJeet K80 for the task. It has a scanner but you load the original like a FAX machine and I'm afraid this would damage the photos so I purchased a brand new HP DeskJet F4280 for the task. I got home with my new technological goody and prepared to scan away.

Note: I love Linux. Its a great operating system that takes a lot less system resources than Windows but there are times I just want to plug in my new piece of hardware and have it work. I you are that sort of person Linux is not necessarily for you.

I plugged the new device into my old home built computer and got an error. It simply would do a thing with it. So, I booted up my old laptop, discovered I had a bad disk drive, installed a new disk drive (we all have a spare laying around, right?), installed Ubuntu 8 on it and tried it. Same problem. Damn!

So, I hit the forums. The problem seemed to be that HP devices are controlled by something called HPLIP. HP decided to sidestep creating a new driver for everything that came out developed a single package which controlled all the HP devices attached to the various flavors of Linux.

The forum gurus stated I needed to upgrade to the latest version of this software if I had any hopes of getting the device working. But, as with everything involving Linux, it just wasn't that simple. I was running hplip 2.8.8 and needed hplip 2.8.10

I downloaded a run file named hplip-2.8.10.run from http://hplipopensource.com/hplip-web/install/install/index.html . Its simply a run file you execute by typing
sh hplip-2.8.10.run

Well, it almost worked. The thing hung up on the first step and would not go any further. I let the thing sit for an hour and still nothing.

I had tried to install Java docs earlier and for some reaons the java docs caused every install to hang afterwards. I'm still not sure why so I went to symantec package manager and unstalled java docs (although it never fully installed) and, for good measure, the existing hplip install.

After that, it installed fine and I saw the new print drivers in my printer setup window.

So now I can scan beauties like this

I can't believe I ever looked that young.

Monday, December 31, 2007

VMWare and Ubuntu Linux 7.10

I wanted to get an install of XP on my Ubuntu box and so downloaded VMWare server (its free) from here and found a howto here which I will quote throughout this post.

The first step is to load some of the Ubuntu modules you'll need to compile the vmserver via aptitude. Run the following command
sudo aptitude install linux-headers-`uname -r` build-essential (which requires your install cd)


Next install xinetd
sudo aptitude install xinetd
Per the instrustions from hotowforge, I went to the following site and downloaded the latest any-to-any patch. You'll need this patch in the middle of your install. http://www.vmware.com/community/thread.jspa?messageID=76957&tstart=0

Untar the vmserver tarball you downloaded.

tar -xvzf

Change directory into the resultant directory (there will be only one) and run

sudo vmware-install.pl

I accepted the defaults with the possible exception of the default vmware file location (you'll want it on a partiton with some space) and the following question you show answer NO to.

Before running VMware Server for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config.pl". Do you want this program to invoke the command for you now? [yes]

Answer NO. You will then exit the installation script.

Now you'll want to run the patch you downloaded. Untar that file and descend into the resulting directory.

sudo ./runme.pl

Again, accept the defaults. The script modifies the installed vmware software. At the end you will again be asked to run the vmware-config. Answer YES this time.

After that completes, start vmware with the command
vmware
If you did everything right, the vmware console should appear. At this point you'll need to create a new virtual machine. If your machine once ran a microsoft product, you can reinstall on the new virtual machine but you'll need the license code off the old box. Alternately, you can install a new copy of Ubuntu or any other operating system supported by VMWARE.

So, to create a new guest OS you tell the vm server to create it, give it resource such as disk and memory. A note here is to use the defaults the first time you create an instance and, if you us FAT file system as a backup, allow vm server to split the created disk into 2 GB chunks.

After you have the VM created, put your OS install CD in and tell the instance to boot. It should read the CD and install the whatever OS you've selected. Follow the normal install procedure for that OS. The only additional step I recommend is to install vmtools into the new image once its up and running and has all the patches you wish to install.

Vmtools allows you to resize the screen above 460x680 and allows you to cut and paste between host and virtual machine.

All in all it was a fairly painless process outside of the OS install.

Thursday, October 25, 2007

Failure to Recover

I have really old computers. You may think this odd with my being in the tech industry but I never go out and buy 'the next big thing' until it is superseded by at least two more 'next big things'. Its analagous to never buying a new car and letting someone else pay the 'drive off the lot' fee.

My personal computer has been a Dell Inspiron 8100 for some time. This thing is at least 6 years old and had begun to show its age. I run linux on my personal machines since it runs faster and in a smaller footprint than MS stuff and trends toward more reliable.

I like linux and I like the Ubuntu brand of linux for my personal use. Its reliable and easy to use without the normal issues of upgrading found in MS products. I did, however, get bit when I tried to upgrade from 7.04 to 7.10 (Feisty Fox to Gutsy Gibbon). The darn upgrade hung halfway through hosing my laptop. So, I created a 7.10 CD on another machine, mounted it on my laptop and proceeded to recover the files to my external USB via a combination of tar and gzip (also known as a tarball).

I wiped the disk on the laptop and proceeded to restore my data. This is when horror struck. The tarball was corrupt. The reason, I suspect, is that my usb is formated for the old windows FAT file system which has an upper limit of 4 GB. The tarball was bigger than that.

I tried everything I knew to try but I couldn't get past the corruption. Googling only brought back windows solutions to the corrupt tarball. I thought this very odd. Either I was missing something obvious or no one else had run into this issue.

I finally found a product for windows called gzrt which restored broken gzip files. It is a C program that comes with a make file. Of course, since I had a new install I didn't have a C compiler so I downloaded G++ the GNU C++ compile then found I was missing the zlib library which I also downloaded.

Once compiled, I lauched it against my corrupted backup
./gzrecover backup2.tar.gz

This made a file called backup2.tar.recover. Since tar doesn't work agianst bad files I used cpio to extract the data.
cpio -F backup2.tar.recovered -ivd

After that all was well. All my precious files came back.

Lessons learned include
1) FAT sucks.
2) Gzip and Tar should allow for more robustness.
3) Thank God for other geeks out there who have run into the same problem and taken the time to find a fix.

Monday, May 14, 2007

Ubuntu Upgrade

I upgraded to Feisty Fawn version of Unbuntu. So far I found this problem with Rhythm Box.

http://johnny.chadda.se/2007/02/21/unlock-the-gnome-keyring-upon-login/

I finally gave up on it although I did learn a lot about passwords along the way. I eventually created a new key ring profile, then deleted the default one and renamed my new one to default. It didn't solve my problem but I did get past the one problem of not being able to edit it.

Other than that, everything in Ubuntu seven works well.

Here's an update: In a previous post I explained how to download and install Java 6. You don't need to undertake that long drawn out process any longer. It installs like any other package now. You still need to set the alternatives but the directory names are a bit different than my last post on the subject.

After you do the install via the normal package manager, do the following

  • sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-sun/bin/java" 1
  • sudo update-alternatives --set java /usr/lib/jvm/java-6-sun/bin/java
  • java -version
You can always go back to a previous version but first you're going to need to find out what javas you have installed.

sudo update-alternatives --list java


This should allow you to use the 'set' command to set java to a previous version.

Monday, March 26, 2007

ImageMagick, Travel Pictures, and Getting Pictures to Import

I had a problem importing photos on my Ubuntu O/S. I received the following error.
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.

It worked fine on my old Fedora Core system so I hit the web to find the answer. It only took a few minutes, and some help from Google, to find the answer. It appears to be a bug.

Here's the link to fix it.
https://launchpad.net/ubuntu/+source/libgphoto2/+bug/91250

You can read the whole thing but here's the crux of it.

Edit /etc/udev/rules.d/45-libgphoto2.rules
replace
BUS!="usb*", GOTO="libgphoto2_rules_end"

with
SUBSYSTEM!="usb_device", GOTO="libgphoto2_rules_end"

On another subject, to change a bunch of photos at once, you can use a tool called ImageMagick. Here's a perl script I use to shrink photos for email or web posting. If you're using LINUX, you put it in a directory where your files are located and run it. At the end, you should wind up with some _sm.jpg.

#!/usr/bin/perl

## this perl script converts jpgs to smaller jpgs and set the maximum size.

$size = '640';
@files= `ls *.jpg`;
foreach $file(@files) {
chomp $file;
print "Infile is $file\n";
($outfile,$ext) = split(/\./,$file);
$outfile .= '_sm.jpg';
print "Outfile is $outfile\n";
$cmd = "convert -geometry $size $file $outfile";
print "$cmd\n";
system $cmd;
}


Here's another version that changes the formate from jpg to png. Note, you only need to change the filename extension to make this happen.

#!/usr/bin/perl

## this perl script converts jpgs to png and set the maximum size.

$size = '640';
@files= `ls *.jpg`;
foreach $file(@files) {
chomp $file;
print "Infile is $file\n";
($outfile,$ext) = split(/\./,$file);
$outfile .= '.png';
print "Outfile is $outfile\n";
$cmd = "convert -geometry $size $file $outfile";
print "$cmd\n";
system $cmd;
}

For more information about Image Magick, visit their site at http://www.imagemagick.org

Thursday, February 8, 2007

Automatix on Ubuntu Linux

one of the forum guys, I loaded in Automatix which, amoung other things, provides links to the various multimedia codex. So far it just looks like a list of popular downloads. Seems like this could have been done with a web site vs. an application but it may download and install things that are in a non-debian install file.

I'll update the blog with the things I install from Automatix but below you'll find the intstructions for loading the software on Ubuntu Edgy.

 echo "deb http://www.getautomatix.com/apt edgy main" | sudo tee -a /etc/apt/sources.list

Second Step:

 wget http://www.getautomatix.com/apt/key.gpg.asc

Third Step:

 gpg --import key.gpg.asc

Fourth Step:

gpg --export --armor 521A9C7C | sudo apt-key add -

Fifth Step:

 sudo apt-get update

Sixth Step:

 sudo apt-get install automatix2


Wednesday, January 31, 2007

DB2 on Ubuntu

I stated in my last post that I found a resource for installing db2. I'm going to quote that article verbatim here just in case that one ever goes away. Also, where my install differed from the instructions presented at
http://project-tigershark.com/people/rob/blog/2007/01/02/installing-db2-91-on-ubuntu-dapper-606/
I highlighted in red. Also, my Ubuntu is Edge Edge instead of Dapper Drake. I'm not sure this matters but it is a difference.


I do this because you never know when someone's going to delete their blog or have it removed by higher powers.

Installing DB2
The DB2 installation package is rpm-based, so we’ll need to install an rpm-compatible installer for Ubuntu. For this, we apt-get alien, an rpm package installer:

$ sudo apt-get install alien

also installed pdksh

sudo apt-get install pdksh

sudo apt-get install openssh-server

openssh-client was alread installed

sudo ./db2_install (from installation directory)


Now we may db2_install installation script that is bundled with DB2. This needs to be done as root:

$ tar xzvf db2exc_91_LNX_x86.tar.gz
$ sudo exp/disk1/db2_install

Here I simply used Archive Manager. In my installation is ran ./db2install from the directory where I extracted the tar file.

This should take a few minutes to install. At the time of this writing, the installation procedure had approximately ten steps and lasted about three to five minutes. Note that depending on the version of gcc that you have installed (if at all), you may need to install libstdc++5, as it is required for successful installation. This is easily obtained:

$ sudo apt-get install libstdc++5

Setting Up Groups/Users
Now that we have DB2 installed, we need to configure it for use. We start by creating the standard DB2 user groups: instance owners, fenced users, and administrators. (Note that these commands need to be run as root — the sudo is dropped here for notational simplicity and a # is added in its place for clarity).

# groupadd -g 999 db2iadm1
# groupadd -g 998 db2fadm1
# groupadd -g 997 dasadm1

Now we’ll create a default user for each group:

# useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1 -p password2
# useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
# useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 -p password4

Creating the Adminstrative Database
Now we need to create a DB2 Administration Server to administer all instances of DB2 under the purview of this installation:

# /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1

Note here that dasusr1 may be any user that is a member of the dasadm1 group we set up earlier.

DB2 Instance Semantics. Creating an Instance.
A DB2 instance is an environment that acts as a logical container for a collection of databases. It’s an abstraction that allows the creation and usage of multiple independent DB2 environments using the same physical resources.

We need an instance to hold all of our databases. We’l create a default instance using the db2inst1 user we just created as its owner:

# /opt/ibm/db2/V9.1/instance/db2icrt -u db2fenc1 db2inst1

As we noted, db2inst1 is the instance owner, while db2fenc1 credentials are used to execute fenced stored procedures and executables.

Below lists the commands and output of the commands presented in the referenced blog.

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.9926".
rkathey@delllaptop:~/db2install$ sudo groupadd -g 999 db2iadm1
rkathey@delllaptop:~/db2install$ sudo groupadd -g 998 db2fadm1
rkathey@delllaptop:~/db2install$ sudo groupadd -g 997 dasadm1
rkathey@delllaptop:~/db2install$ sudo useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1 -p password2
rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
useradd: unable to lock password file
rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
useradd: unable to lock password file
rkathey@delllaptop:~/db2install$ sudo useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
rkathey@delllaptop:~/db2install$ sudo useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 -p password4
rkathey@delllaptop:~/db2install$ sudo /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1
SQL4406W The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.
rkathey@delllaptop:~/db2install$ sudo /opt/ibm/db2/V9.1/instance/db2icrt -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.

Starting and Stopping an Instance
A DB2 instance is an environment that acts as a logical container for a collection of In order to start and stop the DB2 instance (remember, we may have multiple instances for a given installation on a physical host), we log in as the owner and call db2start after inializing the DB2 environment:

$ su db2inst1
$. ~/sqllib/db2profile
$db2start

db2inst1@delllaptop:~$ db2start
ADM12026W The DB2 server has detected that a valid license for this product has not been registered.
SQL1063N DB2START processing was successful.
db2inst1@delllaptop:~$ db2sampl

Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...

'db2sampl' processing complete.

Stopping the environment is just as simple: we’d call db2stop instead of db2start.

You may enable (or disable) automatic DB2 instance start/stop on system start-up/shut-down by calling:

$ db2iauto -on db2inst1

where db2inst1 is the login name of the instance. Replacing the -on flag with -off disables this feature.

The Sample Database
If you wish to build the sample database bundled with DB2 in order to play around, call db2sampl while logged into a DB2 instance owner account:

$ su db2inst1
$ . ~/sqllib/db2profile
$ db2sampl


After this I logged into db2inst1, ran the db2profile (as above) and launched db2ca to enter the graphical user interface. Thanks to the original author for the ubuntu db2 install.

The Great Ubuntu Reinstall of January 07

Well, I did it. I royally hosed up my new Ubuntu Linux install trying to get my laptop to play a microsoft media file. Oh sure, it wasn't easy. I had to install and reinstall about twenty packages but I finally managed to bugger up the the O/S. I could claim it's all part of Microsoft's attempt to take over the world but in the end I have only myself to blame.

So its back to a thirty minute operating system load then another hour spent reloading things I'd already loaded once. If I find the packaged that did me in I'll post it here so other will know what not to do.

Thus shows the true value of blogs and the internet. Don't do as others have done. Do as others wish they had done.

Ok, that said, here's a list of steps I performed.
First I backed up the old home directory. Basically I just copied the files to a blank CD

Next I reinstalled Ubuntu by placing the Ubuntu install CD into the drive and rebooting. It'll boot Ubuntu off the CD. There is an icon on the desktop labled "Install". Double click that.

Follow the install menu options. I choose to reformat the drive in order to blow away my old install. Wait forever for that to finish then allow the software updater to update what you just installed. You'll need to rebot after that.

Here's where I did things differently from the last install.

I edited the /etc/apt/sources.list and added universe and multiverse to the end of the first two lines so they look something like

deb http://us.archive.ubuntu.com/ubuntu/ edgy main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ edgy main restricted universe multiverse

Next I ran

sudo apt-get update

The reason this was needed is the fact that java-5 isn't in the application list of the default entries in /ect/apt/sources.list

After that I went to the System->Administration->Synaptic Package Manager, found Java 5 (and some cool 3d star system packages) and updated my system. I decided not to install java 6 this time.

I rebooted my system after this just to make sure all the java stuff was set correctly. This probably isn't needed, after all this isn't Windows I'm using, but I decided to do it anyway just to make sure.

After this I installed Eclipse using the package updater under Applications->Add/Remove menu

Next, so I won't have to do another full install, I did a system backup. To accomplish this, first read this post in the Ubuntu Forums for details but it boils down to the following two statements.
cd /
then
sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

After the backup finished, I copied it off to an external drive. The files was over a gig so it wouldn't fit on a CD.

I'll update the blog with more information as I run into other snags.

My next effort will be to install DB2. Luckily I found another blogger who's written instructions for this at http://project-tigershark.com/people/rob/blog/2007/01/02/installing-db2-91-on-ubuntu-dapper-606/