Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, July 1, 2013

Installing Minecraft 1.6 on Ubuntu

I had previously blogged about Installing Minecraft on Ubuntu. As of Minecraft version 1.6 these instructions no longer work because of a newly introduced launcher. The following is updates instructions for version of Minecraft 1.6 and above.

First we need to install Java. The website claims it needs Oracle Java, but the open source Java in the Ubuntu repos works just fine in my experience.
sudo apt-get install openjdk-7-jre
Now we need the launcher
sudo wget https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft
The file contents should be as follows.
#!/bin/bash
java -jar /usr/games/Minecraft.jar
And then set the proper permissions on the file
sudo chown root:games /usr/games/minecraft
sudo chmod 755 /usr/games/minecraft
Again, change vi with something else if that is easier for you.
sudo vi /usr/share/applications/minecraft.desktop
And put this in the file.
[Desktop Entry]
Name=Minecraft
Comment=Build your own world
Exec=minecraft
Icon=minecraft
Terminal=false
Type=Application
Categories=GNOME;Applications;Game
Keywords=minecraft;Game
StartupNotify=true
The last piece we need is an icon. There are many good Minecraft icons at http://www.rw-designer.com/icon-detail/5547 I like http://www.rw-designer.com/icon-image/5547-256x256x32.png as it gives us the highest resolution available. Replace the URL of the icon you prefer to use in the following command.
sudo wget http://www.rw-designer.com/icon-image/5547-256x256x32.png -O /usr/share/pixmaps/minecraft.png
Now you should be able to play Minecraft by simply typing minecraft in the command-line, in the Unity dash, the KDE prompt, or by browsing to the games menu in the applications menu in your desktop environment of choice. It is also available to all users of your desktop.

You also do not need to do anything to update. Minecraft updates itself each time you start it.

BONUS

I've got one more neat trick up my sleeve. If a CraftBuntu spin sounds good to you, here's how you can setup Ubuntu to just run Minecraft when you sign in. It assumes you have already done the above.
sudo cp /usr/share/applications/minecraft.desktop /usr/share/xsessions/
Now Minecraft is an available option when you select your desktop environment. This works best if you set Fullscreen in the Minecraft options.

You could do a number of things with this setup. You could setup a minimal Ubuntu installation that has no desktop environment, or other desktop-related software installed. You could also allow guests to play Minecraft without touching any of your stuff by them selecting the Ubuntu guest account and setting Minecraft for the login. I have even found that on my struggling laptop this setup allows Minecraft to run more smoothly as there is no other desktop cruft running in the background.


UPGRADING FROM 1.5

If you had already followed my instructions back in the days before 1.6, the following will get you updated to 1.6
sudo rm /usr/games/minecraft.jar
sudo wget 
https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft

The file contents should be as follows.

#!/bin/bash
java -jar /usr/games/Minecraft.jar

Thursday, January 17, 2013

Installing Minecraft on Ubuntu

UPDATE: As of Minecraft 1.6 these instructions no longer work. I have posted updated instructions at Installing Minecraft 1.6 on Ubuntu.

This post is for anyone who wants to install Minecraft on Ubuntu and have it feel like any other game installed via the Ubuntu Software Center. It assumes you have already purchased Minecraft and provides full Unity integration, though Unity is not needed for this to work. In fact, I suspect it should work for any Linux distribution that has a desktop environment.

We are going to do this via the command-line because copy-and-pasting commands from this tutorial is easier and more fool-proof than following a long list of screen shots. It's also easier for me to write it that way as there are fewer steps.

First we need to install Java. The website claims it needs Sun Java, but the open source Java in the Ubuntu repos works just fine in my experience.
sudo apt-get install openjdk-7-jre
Now we need the actual game
sudo wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar -o /usr/games/minecraft.jar
sudo chown root:games /usr/games/minecraft.jar
sudo chmod 755 /usr/games/minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft
The file contents should be as follows.
java -Xmx1024M -Xms512M -cp /usr/games/minecraft.jar net.minecraft.LauncherFrame
And then set the proper permissions on the file
sudo chown root:games /usr/games/minecraft
sudo chmod 755 minecraft
Again, change vi with something else if that is easier for you.
sudo vi /usr/share/applications/minecraft.desktop
And put this in the file.
[Desktop Entry]
Name=Minecraft
Comment=Build your own world
Exec=minecraft
Icon=minecraft
Terminal=false
Type=Application
Categories=GNOME;Applications;Game
Keywords=minecraft;Game
StartupNotify=true
The last piece we need is an icon. There are many good Minecraft icons at http://www.rw-designer.com/icon-detail/5547 I like http://www.rw-designer.com/icon-image/5547-256x256x32.png as it gives us the highest resolution available. Replace the URL of the icon you prefer to use in the following command.
sudo wget http://www.rw-designer.com/icon-image/5547-256x256x32.png -o /usr/share/pixmaps/minecraft.png
Now you should be able to play Minecraft by simply typing minecraft in the command-line, in the Unity dash, the KDE prompt, or by browsing to the games menu in the applications menu in your desktop environment of choice. It is also available to all users of your desktop.

You also do not need to do anything to update. Minecraft updates itself each time you start it.

BONUS

I've got one more neat trick up my sleeve. If a CraftBuntu spin sounds good to you, here's how you can setup Ubuntu to just run Minecraft when you sign in. It assumes you have already done the above.
sudo cp /usr/share/applications/minecraft.desktop /usr/share/xsessions/
Now Minecraft is an available option when you select your desktop environment. This works best if you set Fullscreen in the Minecraft options.

You could do a number of things with this setup. You could setup a minimal Ubuntu installation that has no desktop environment, or other desktop-related software installed. You could also allow guests to play Minecraft without touching any of your stuff by them selecting the Ubuntu guest account and setting Minecraft for the login. I have even found that on my struggling laptop this setup allows Minecraft to run more smoothly as there is no other desktop cruft running in the background.

Tuesday, May 29, 2012

ssdownloader

I recently purchased some electronic media from Simon & Schuster.

Apparently the technology guys at Simon & Schuster believe in "Java Over Functionality." Unlike most companies that sell DRM-free digital media, I was not given a link to download zip file containing the contents of my purchase.

Instead, I was given a JNLP file, which is nothing more than an XML file. A little Googling revealed that these files should be openable by javaws, a Java Web Starter application. After getting the file to successfully run, I was greeted with a custom download manager. This is great because why offer a simple download that will be managed with my browser's download manager when I can have some half-rate, custom download manager to fudge things up?

So the download manager asked me where I would like to save the file, downloaded each file individually for about twenty minutes, and then told me it was done. There was a big problem, my files where not in the location I specified. In fact, a hard drive search revealed they didn't exist anywhere on my machine.

I tried again, no dice.

So, if Mother Necessity if the driver of invention, then welcome her new baby, ssdownloader. I wrote this Python app up in a little over an hour. It was a good chance to strengthen my weak command of Python, and to actually get the stuff I paid for.

It simply parses the JNLP file to find the other XML file that defines where the actual downloads are. It then loops through that file, grabbing each file and saving it locally. If anyone out there gets frustrated trying to make good on their Simon & Schuster purchases, feel free to use this to make your life happy.

Tuesday, January 10, 2012

Copy and paste from the system clipboard with vim

Often, when using vim, highlighting text in the terminal to copy-and-paste it around is plausible.  This is definitely true when on a true terminal.  I use the rnu option so that I have relative line numbers on each line.  So copying multiple lines with the mouse grabs the line number with unwanted indentation.  When I need to move code around it is annoying to have to manually remove the numbers.

To understand how to get vim's clipboard to match your system's you need to understand vim registers.  On a computer we usually only get one clipboard.  Every time we ctrl-c, the contents of the clipboard are discarded and replaced with whatever is highlighted.  We don't have any option to copy multiple objects and then paste them around.  However vim has multiple "registers" where text can be copied and pasted from.  To see the registers type :reg in command mode.

The register that we are interested in is register +.  To test it out, copy some text from another application then run :reg and see the contents displayed in register +.

So now we just need to know how to access the contents of register +.  Register access is done with ".  To paste from they keyboard we type "+p  To copy, for example an entire line, into the system clipboard we type "+yy  To delete the current line and store it in the system clipboard we type "+dd

We can also use registers with visual mode.  If we wanted to copy the line underneath the cursor we would type V"+y  We could copy the next three lines into the system clipboard by typing Vjj"+y

To sum it up, to use the system clipboard to copy and paste in vim simply do what you would usually do in vim, then prepend "+ to your y (yank) or p (paste) command.

Update:
Depending on the version of vim you are using, the register for the clipboard may work differently. In some cases the * and + registers are the same register. If you want to find out which register is for your system clipboard, simply copy some text from anywhere into your clipboard, then run :reg. Whichever register has the text you copied is the register that holds the contents of your clipboard.

Saturday, August 6, 2011

Fix flickering in Boxee with ATI graphics card

I recently installed Boxee on a new computer I got for my daughter.  It was running Ubuntu 11.04 and I used this fix to get it to install.  Unfortunately, like many in the comments section of the fix blog post, was getting too much flickering in the application to be able to use it.  It took me a little Googling, but I finally found a fix after following a link that suggested I follow another link, which finally took me to instructions that hinted at how to fix it.  Apparently the problem exists when using an ATI card with the open source driver and Compiz enabled, but don't quote me on that.
To fix it, one simply needs to turn off vsync.  To do this open up the guisettings.xml configuration file and change vsync from 2 to 0.
First, lets backup the file.
cp ~/.boxee/UserData/guisettings.xml ~/.boxee/UserData/guisettings.xml.bak
Now we need to edit the file.  Run the first command to do it with a GUI, or the second to use vim.
gedit ~/.boxee/UserData/guisettings.xml
vi 
~/.boxee/UserData/guisettings.xml
Find vsync in this file and change the 2 to a 0, and save the file.  It should be line 551 in the file.  Lines 546  through 552 should look like this initially.   
    <videoscreen>
        <guicalibration></guicalibration>
        <resolution>11</resolution>
        <testpattern></testpattern>
        <testresolution></testresolution>
        <vsync>2</vsync>
    </videoscreen>
After the change they should look like this.
    <videoscreen>
        <guicalibration></guicalibration>
        <resolution>11</resolution>
        <testpattern></testpattern>
        <testresolution></testresolution>
        <vsync>0</vsync>
    </videoscreen>
Now if you start boxee it no longer flicker.

Wednesday, July 20, 2011

How to setup auto-login in Ubuntu at the console Part 2.

These instructions are for Ubuntu 11.10 Oneiric and onward, and any other version that uses LightDM, as opposed to the previous default of GDM, which I had previously wrote about at here.
First we'll backup the configuration file and then in your editor of choice, probably vi open up /etc/gdm/gdm.conf.
sudo cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.bak
sudo vi /etc/lightdm/lightdm.conf
Next find the line that reads:
#default-user=bob
#default-user-timeout=5
In the first line change "false" to "true" and in the second line append the username you want to auto-login after the equals sign. Here is how mine looked:
default-user=david
default-user-timeout=0
After a reboot you will find that Ubuntu goes straight to the desktop of the user you defined.
There are other settings you can set in here, such as a time login. Most of these are available from the GUI, but feel free to look around and find any other settings you might want to change.

Sunday, July 10, 2011

Features needed in Thunderbird to replace Evolution

As most know by now, Ubuntu 11.10 is looking to replace the Evolution mail client with Mozilla Thunderbird.  Evolution has long been problematic.  I have found it to crash pretty often, fail to display mail messages, and just generally be quirky.  Over the last two years it has really shaped up a lot, but still remains pretty quirky as of Ubuntu 10.04 LTS.
To produce a quality Linux desktop, shipping a quirky e-mail client can be a turn off for many, and that's what's lead to talk about replacing Evolution with Thunderbird.  Despite it's problems, Evolution does many things right.  Syncing Evolution with your cloud services, especially Google services, is especially easy.  Evolution also comes with native Exchange support, with some exceptions.  The Exchange server must provide Webmail for the Exchange support to work.  However when it does work, users can send/receive e-mail, view and mail contacts, and integrate with their Exchange calendar, all in one application, almost as if they where using the Microsoft Outlook.  This can be a real savior for people like myself who run Ubuntu in a corporate environment deeply tied to Microsoft products.
All Calendar integration in Evolution comes with the benefit of desktop integration.  Any calendar configured in Evolution shows up in Gnome calendar panel, allowing the user to easily see what's scheduled without having to fire up Evolution.
All-in-all Evolution has a very solid feature set, and great usability and integration.  It's just those nasty quirks that pop-up from time to time that keep it back.  It seems to me that the best thing the Ubuntu community could do is go through the Evolution bug list and start applying some fixes.  A change of client seems rather drastic, but at this point, inevitable.
In this light, I have installed the Oneiric release client and kicked the Thunderbird tires.  Here's what I've seen so far.
Setting up Gmail is very easy.  I simply put in my Gmail login and password and that was it.  Thunderbird recognized the @gmail.com and did the rest of the configuration.  Evolution will auto-populate the Google server information, but Thunderbird doesn't even show you the server configuration options.  It simply notifies you it knows what to do from here and finishes.
After it downloaded all the message headers, I had one new e-mail, I received a desktop notification about the new e-mail.  However, Evolution also turns the mail notification icon in the menu green.  If you click on it, you will see the new e-mail in your inbox.  Thunderbird provided no such desktop integration.
Thunderbird does not include any sort of Calendar integration by default.  Instead, I had to manually install the Lightning plugin, which provides the calendar support.  However, this was not enough, as Lightning does not provide any remote calendar syncing.  To get Google Calendar support I had to install the "Provider for Google Calendar" plugin.
Even still, it was not as intuitive to setup Google Calendar support.  I had to log into Google Calendar in my browser to get the iCal URL of the calendar I wanted to support, and copy-and-paste this into Thunderbird.  With Evolution I simply provide my calendar credentials and it will give me a list of calendars in my Google Calendar account, and then syncs the one I selected.
Finally, the calenders do not integrate with the Gnome calendar.
I hope that 11.10 has the Lightning and Google Calendar plugins installed by default, but even still, this is a step backwards.  Showing people the tight integration between cloud calendar services and Ubuntu has been a point of impression for many users in my experience.
Next is the contact syncing.  Again, setting up Evolution to sync with your Google Contacts is very easy.  With Thunderbird I had to install the "Google Contacts" plugin.  After that I selected my existing Google account and my contacts where in Thunderbird.  I really liked that I didn't need to reenter my Google credentials.  This is a move forward from Evolution, and a feature I'd like to see replicated in the Google Calendar plugin.
Thunderbird has no Exchange support.  For those of us in a corporate environment, this is a loss.  If your Exchange server supports IMAP, one can still check their e-mail in Thunderbird, but there will be neither contact or calendar support.
Others thoughts.  Thunderbird does not store its connection information in Seahorse, leaving the connections unavailable to other applications that would like to integrate.  I don't think the icons are coming from the Gnome theme.  Minimizing to tray can be accomplished via an extension, but I'd like to see something similar to how Rhythmbox and Banshee can be minimized to the sound menu.  Neither of these are possible in Evolution either, so ...
So where does this leave us?  I believe we need to have the Lighting, Google Calendar, and Google Contacts plugins installed by default.  A custom plugin needs to be written to bring the Lightning calendars into the Gnome calendar menu.  This will bring most users into having all of their existing Evolution functionality in Thunderbird.  An Exchange plugin for Thunderbird should be started.  Thunderbird needs to be extended to act like an application that was written to be part of the Linux desktop, not an application that just happens to also run on the Linux desktop.
Finally, I wonder how much the mail client really matters.  I don't know many people who use thick mail clients.  Everyone seems to be happy using their providers webmail.  The only reason I use Evolution is to have an offline backup of my e-mail, and for the desktop notifications about new e-mail and calendar events.  When I receive these I then go to the webmail interface and respond accordingly.
I wonder what KDE users think about how it looks, feels, and integrates for them.

Saturday, May 14, 2011

Install Boxee on Ubuntu 11.04 Natty Narwhal

The Ubuntu package for the current version of Boxee as of this writing, 0.9.22.13692M, does not install on the latest version of Ubuntu.  It throws an error "Dependency is not satisfiable: libxmlrpc-c3"  The problem arises because libxmlrpc-c3 has been renamed to libxmlprc-c3-0.  The solution is to modify the debian package and change its dependencies.  This is easier than it sounds, but you have to know how.  Download the debian installer from the Boxee website, and place it in your home directory and then open up a terminal
dpkg-deb -x boxee-0.9.22.13692.i486.modfied.deb boxee
dpkg-deb --control boxee-0.9.22.13692.i486.modfied.deb boxee/DEBIAN
Now we need to edit the file that lists the dependencies.  Run the first command to do it with a GUI, or the second to use vim.
gedit boxee/DEBIAN/control
vi boxee/DEBIAN/control
Find libxmlrpc-c3 in this file and append -0 to the end of it so that is read "libxmlrpc-c3-0", and save the file.  Now we need to repackage our changes into a new debian package file.
dpkg -b boxee boxee-works.deb
When it is done simply double-click the newly created boxee-works.deb file and install it with Software Center.  Hopefully it will not be too long before the peeps over at Boxee fix the package so that it Just Works™.

Monday, April 25, 2011

cx_Oracle on Ubuntu 11.04 Natty

I used the following to install cx_Oracle on Ubuntu 11.04 for use with Python 3.2, though they should work with any version of Python supported by cx_Oracle.  This will basically involve using alien to convert lots of rpms into debian package.  Go ahead and install alien as well as some other libraries we will need.

sudo apt-get install alien libaio1 python3.2 libpython3.2

Change the above to reflect the version of Python you want to use.

First we need the Oracle Instant Client software.  Go to http://www.oracle.com/technetwork/topics/linuxsoft-082809.html or http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html (for 64-bit) and download either the basic or basiclite rpm.  I did not try the basiclite client, but I think they should both work.  You can also grab sqlplus and whatever other packages you may need while working with Oracle, but only the basic package is needed for cx_Oracle to work.  Once downloaded convert it to a debian package.

sudo alien -d oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm

Replace the above line with the appropriate version of the instant client that you downloaded.

Now install it.

sudo dpkg -i oracle-instantclient11.2-basic_11.2.0.2.0-2_i386.deb

We need to create a configuration file pointing to the oracle library folder.

sudo vi /etc/ld.so.conf.d/oracle.conf

Depending on the version of the instant client installed you should have a folder like /usr/lib/oracle/11.2/client/lib.  This folder should be the first line to the oracle.conf file we create here.
Finally, for our Oracle client install, we need to define our ORACLE_HOME.  We need to create a new file.

sudo vi /etc/profile.d/oracle.sh

Add the following line, tweaking it as necessary to point to the version of Oracle you installed.
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

On 64-bit installs then do the following line instead.
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

Now that our client software is setup, we can install the python library to connect to Oracle.

Download cx_Oracle from http://cx-oracle.sourceforge.net/  I want the 11gR2 client for my x86 (32-bit) machine, and I want to use it with Python 3.2, so here I download the line labeled CentOS 5 i386 RPM (Oracle 11g, Python 3.2)  Make sure NOT to download the Unicode version unless you know for sure you need it.  Download the version for the version of Oracle and Python that you plan on using.  Usually, regardless of the version of Oracle you plan on using, downloading the latest version will work with any of the older versions of Oracle.

After downloading we use alien again to created a debian package.

sudo alien -d cx_Oracle-5.1-11g-py32-1.i386.rpm
sudo dpkg -i cx-oracle_5.1-2_i386.deb

The way our debian installs cx_Oracle isn't quite what Ubuntu needs, so run the following command to set things right.

cd /usr/lib/python3.2
sudo mv site-packages/cx_Oracle* dist-packages/
sudo rmdir site-packages/
sudo ln -s dist-packages site-packages

If the dist-packages folder does not already exist, you may need to run the following.

sudo mkdir dist-packages

Now you should be able to import the cx_Oracle module into Python and start creating connection.

david@fink:/usr/lib/python3.2$ python3.2
Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle

Profit!

Friday, March 18, 2011

Connect to MySQL database from LibreOffice Base on Ubuntu

LibreOffice's Base program can provide a quick easy way to access a MySQL database and write some reports against data.  The following outlines how to easily setup LibreOffice Base to connect to MySQL.  It assumes that you already have LibreOffice Base installed.  It works just as easily for OpenOffice Base.

First we need to install the JDBC driver for MySQL
sudo apt-get install libmysql-java
Next open up any LibreOffice program and then click on Tools->Options.  Expand LibreOffice and then click on Java.  Click on the Class Path button on the right followed by Add Archive.  Browse to /usr/share/java/mysql-connector-java.jar  Click Ok and choose to restart LibreOffice.

Now open LibreOffice Base and choose to Connect to an existing database.  In the drop-down menu choose MySQL, and connect using JDBC.  Click on the Test class button to make sure the JDBC driver loads successfully.  If it doesn't, then check that you followed the previous steps properly.  If it does load then simply enter the settings as it relates to your MySQL database.

If you get the JDBC driver to load properly, but you cannot connect to your MySQL database, then I would recommend installing the mysql client and making sure you can connect from the MySQL client first.  If the JDBC driver loads properly, and you can connect to your database with the MySQL database, then you should not have any problem connecting with LibreOffice.

Sunday, March 6, 2011

Installing Oracle 11gR2 on Ubuntu 10.04 Lucid Lynx 32-bit

I did this install in a virtual machine, which I would strongly suggest you do first before doing it on a physical install that you intend to use.
Start off by logging in as the user you created during the install.  This user should have sudo powers.  First we need to install the libraries needed.
sudo apt-get install unzip build-essential x11-utils rpm ksh lsb-rpm libaio1
Ubuntu 10.04 comes with libstdc++6, but we need libstdc++5_3.3.6.  Browse to http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/ and find the latest version.  When I wrote this it was 5_3.3.6-21.  Let's download and install it.
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-21ubuntu1_i386.deb
dpkg-deb -x libstdc++5_3.3.6-21ubuntu1_i386.deb ia32-libs
sudo cp ia32-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib/
sudo ln -s /usr/lib/libstdc++.so.5.0.7 /usr/lib/libstdc++.so.5
Next, we need to setup the oracle users and groups.
sudo addgroup oinstall
sudo addgroup dba
sudo useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
sudo mkdir /home/oracle
sudo chown -R oracle:dba /home/oracle
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
sudo mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S ; do sudo ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
sudo mkdir -p /u01/app/oracle
sudo chown -R oracle:dba /u01
Various configuration files need to be modified.  Next we back up the original configuration file and add the configurations.

sudo cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo 'fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 9000 65535
' | sudo tee -a /etc/sysctl.conf > /dev/null
sudo cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo 'oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535' | sudo tee -a /etc/security/limits.conf > /dev/null
sudo sysctl -p

Now it is time to log out, and then log back in as our new oracle user.  As the oracle user download the software from oracle.com  You should be able to find it at http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Open a terminal and change into the directory where you downloaded both files.  And then run the following to unzip and run the installer.

unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
cd database
./runInstaller
From here it is up to you which options you want to choose.  I used all the defaults and supplied 'password' for my passwords, since it is just a test install.
Last, we just need to setup our system paths.

sudo echo '
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export EDITOR=/usr/bin/vi' >> /etc/profile
Your install is ready to go.  You should be able to log in with sqlplus, or any other IDE you want to use, based on the setup you chose during the install.
Now, we need Oracle to start up on each reboot.  To do this we need to create an init script.  As root, create a file at /etc/init.d/oracledb with the following contents.

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
# these are the paths for our base installation
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi
case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        touch /var/lock/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        rm -f /var/lock/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac
exit 0

Now we need to make it bootable and tell Ubuntu to run it on bootup.

sudo chmod a+x /etc/init.d/oracledbsudo update-rc.d oracledb default
Use dbca to create and manage databases, and use netca to create and manage listeners.

Friday, January 7, 2011

How to sync your Facebook calendar to Evolution

It looks like Facebook provides some very weak, but better than nothing, webcal support, that can be used to have your Facebook events show up in Evolution, and thus, on your Ubuntu desktop calendar.

  1. Log in to Facebook and then browse to http://www.facebook.com/?sk=events
  2. At the bottom, find the links that says, "Export Events"
  3. Right-click the webcal link and copy the link address.
  4. In Evolution, go to the Calendar section.
  5. Click on New->Calendar.
  6. Under Type, choose On The Web.
  7. Paste the link you copied from Facebook into the URL field.
  8. Give the calendar a name, like "Facebook", and put your Facebook username in the Username field.
  9. Click OK and then supply your Facebook password when prompted.
  10. Profit.
This webcal is read only, so you cannot add Facebook events through Evolution, and invites won't be synched back to Facebook either.

Thursday, December 16, 2010

How to compile mame in Ubuntu 10.04 Lucid Lynx

UPDATE: A newer guide is available at Compiling Mame on Ubuntu 14.04 Trusty Tahr.

Using the following instructions you should be able to compile Mame on Ubuntu 10.04 Lucid Lynx, though it should also work in most any other version of Ubuntu too.
  1. Download the latest source from http://mamedev.org/release.html Grab the .zip version. The following command will grab the latest source as of the time I wrote this tutorial.
    wget http://mamedev.org/downloader.php?file=releases/mame0140s.zip --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" -O mame_source.zip
    Here we change the user/agent string, because the server is set to prevent robots, like wget, from programmatically downloading the file.
  2. Unzip the file, and then unzip that file. Place it anywhere you like, perhaps your home directory.
    mkdir mame
    unzip mame_source.zip
    unzip mame.zip -d mame
    rm mame.zip
  3. Next we install all the libraries and dependencies necessary to build mame.
    sudo aptitude install build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev
  4. Finally, lets get to building it.
    cd mame
    make
  5. Let's setup a rom folder and get some roms.
    mkdir roms
    cd roms
    wget http://mamedev.org/roms/sidetrac/sidetrac.zip --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
  6. Now that we have legally obtained an arcade ROM, let's play it!
    cd ..

Once you know what libraries to install, compiling Mame from source is quite easy in Ubuntu. Drop me a line in the comments if this is helpful, or if you run into any problems or have any suggestions.

Ubuntu Up and Running Book Review

Note: This is a review of the O'Reilly book Ubuntu: Up and Running.  I received this book through O'Reilly's Blogger Review Program.  When I received this book I was already in the middle of Machine of Death, and JavaScript: The Definitive Guide.  So it took me a little longer than I expected to finish this book, and finally, get around to writing this review.
This book touts itself as "A Power User's Desktop Guide."  This rather accurately defines the target audience of the book.  It is not for your average user, but for a technically inclined user who is interested in getting his or her hands dirty with Ubuntu.
This book is very thorough, going step-by-step through each process, often times in what can be grueling detail for someone if such detail is not necessary.  I committed myself to not skipping any parts, and that made some parts of this book very hard to read, as it went through each and every single little click to perform certain tasks.  However, this attention to detail and verbosity probably makes this a very good read for the person who needs to be taken all the way to the finish line to understand the concepts being taught in this book.  This level of detail also makes it a good read for those who may not consider themselves all that technical literate, but are willing to put in the time and effort needed to really learn Ubuntu.  The first chapter of the book introduces the reader to Ubuntu, Linux, and the whole FOSS movement.  It lets the reader know that Ubuntu is more than just an operating system, but it is the leader in a movement that has been fighting the good fight for over thirty years.  After finishing this chapter, the reader should have a good idea of common open source idioms, such as free as in beer versus free as in freedom, and be familiar with some of the leaders in the open source movement including RMS, Torvalds, and Shuttleworth.
With the history out of the way, the second chapter goes into installing Ubuntu.  Here the level of detail this book goes through is revealed.  Installing Ubuntu is a trivial task.  I've given disks to non-technical people, and they where able to get Ubuntu installed without any hand-holding.  However, this book doesn't just cover a vanilla install.  It covers dual-booting, an installing in VirtualBox, and installing through Wubi, as well as upgrading from a previous version.
For each type of install, this book goes step-by-step, screen-by-screen, explaining everything along the way.
I did feel that this book should have stressed the advantages of doing a real hard-disk install over a Wubi or virtual installation.  In my experience the other types of installations provide a significantly reduced experience over a real HD install.
I also felt like there where some areas covered that where really unnecessary, and could give the impression that Ubuntu may be harder to get up and running than it really does.  This includes going over the different Function Key Options.  I feel that for the sake of brevity, and being relevant, these areas could be skipped.  A person who is likely to use these areas of the installer is unlikely to need this book anyhow.
The book then moves on to configuring your installation, and then covers areas of use such as chapters devoted to multimedia, OpenOffice, etc.  I did feel that the order of chapters could have been laid out better.
After getting the user to install Ubuntu, it probably would have been best to have an introduction to the desktop, going over the basic features of the Gnome interface, including the Menu Bar, the different widgets in the top-right, and the default folders in the home folder.  This would make the user comfortable with the basics of Gnome, and would encourage the user to discover the other features, such as web browsing, multimedia, etc. on their own.
I believe Chapter 7, which covers the command line, should have been moved to the back.  It makes more sense, I believe, to cover all the tools that have been developed so that Linux users no longer have to master the command line to perform your usual tasks.  This could help dispel the fear that many users come in with, that if they don't master the command line, then Linux is not for them.
While the true power-user, be they a Linux user, or otherwise, will spend a good deal of time on the command-line, I think it is important to stress to new users that the most important tasks can be performed through point-and-click.
It also would have been helpful if this book had waited for Ubuntu 10.04 to come out, and spent more time focusing on the features of 10.04, since it is an LTS release, and would make this book more relevant over the next three years that this version of Ubuntu will be supported.  10.04 also alleviates some of the problems this book mentions such as the immaturity of the Empathy IM client in Ubuntu 9.10, making the suggestion of trying Pidgin somewhat more mute.  It could have also covered in better the Ubuntu One music store, if it had spent more time focusing on Ubuntu 10.04.  While this book says that it covers Ubuntu 9.10 and 10.04, it really covers 9.10, with some mentions of 10.04 enhancements.
With all that said, I would stay give this a book a "would recommend" as it is very detailed, and can go a long way in taking the interested reader from being interested in Ubuntu, to reasonably well versed in Ubuntu.
The chapter covering the command line is thorough and clear.  In fact, I learned a few things that I didn't about using some CLI tools installed in Ubuntu.
I look forward to future versions of this book covering newer versions of Ubuntu, and hopefully, through the Blogger Review program, is touched up in some of its rough edges.
I already have some friends and acquaintances lined up to borrow this book, as they have an interest in getting their feet a little more wet with Ubuntu.

Monday, November 1, 2010

Introducing Git-Notifier

This evening I finished the preliminary base code for a project I have been working on called Git-Notifier.  Inspired by Gitifer for OSX, Git-Notifier provides pop-up notifications for updates of a remote git repository using libnotify in Ubuntu.
As it stands, the program is currently a bash script, and configuration is a manual process.
To get started, download the come from http://github.com/maxolasersquad/Git-Notifier/archives/v0.1 in either tar.gz or .zip format.  Extract the .gitnotifier folder to your home directory.  Extract the gitnotify.sh file to wherever you would like to execute it from.  I keep this file in my home directory as well.
Next cd into the ~/.gitnotify directory and clone the remote repository using the -n switch.  For example, to get notified of updates to the Git-Notifier application, do the following
cd ~/.gitnotify
git clone -n git://github.com/maxolasersquad/Git-Notifier.git
Finally, edit the file ~/.gitnotify/gitnotify.ini file.  To the right of repos=, list out each git project you have cloned.  Using the same example from above, the line would look like this.
repos=Git-Notifier
If you have cloned any more repositories, simply list them all in the repos line, separated by a space.
Finally you can change how often the program looks for updates, and the pretty style to display the results. To see the different options for the pretty styel, run man git show.
Once you have cloned the directories you want, with the -n switch, and you have configured the ini file appropriately, simply run the gitnotify.sh script.  As commits are made to the remote repository, you should get notifications on your deskop.
The code could probably use some love, and a few more features would be nice as well.  Once I am happy with how this script works, I'd like to port it over to python.  I'd also like to have better support for non-Ubuntu flavors of Linux, though I'm not sure what other notifications are out there that can be easily programmed from Bash.
Any bugs, fixes, improvements, etc. would be appreciated on the github site.

Sunday, October 3, 2010

Updating JOSM in Ubuntu

If you are a contributor to Open Street Map, and you run Ubuntu, then you probably use JOSM from time-to-time.  It has a lot of great tools that are not available in the online editor.  My favorite is the Orthogonalize Shape tool.
Anyhow, I got tired of being told to update each time I started the application.  Plus, I like being up to date.  Since Ubuntu only gets an updated version of JOSM with each new release of Ubuntu, I decided to find out how to cleanly update JOSM in a way that integrates well with the currently installed JOSM.  Here's what I did.

  1. Go to http://josm.openstreetmap.de/
  2. Under the Download section, click on the "tested JOSM" link and save it.
  3. Under a terminal run the following.
    sudo cp ~/Downloads/josm-tested.jar /usr/share/josm/
    cd /usr/share/josm/
    sudo ln -f -s josm-tested.jar josm.jar

  4. Change ~/Downloads/josm-test.jar to the location in which you saved the josm-tested.jar file.
Now when you run JOSM the way you always have, it will load the latest stable version of JOSM.
When you first start JOSM you should go ahead and update your plugins.
This was testing in Ubuntu Lucid 10.04, but should work with any version of Ubuntu, and with any version of JOSM.  If it doesn't for any reason, respond in the comments below.

Thursday, March 11, 2010

Ubuntu 10.04 Lucid Lynx Alpha in VirtualBox with Guest Additions

Today I installed the latest alpha of Ubuntu 10.04 Lucid Lynx Alpha inside of VirtualBox.  After getting all of the updates I installed the VirtualBox Guest Additions.  Upon boot my screen flashed lots of fun colors and then told me that my display configuration was fubared.
I booted up in low graphics mode and then searched for the answer, which I'm going to repeat here.
After installing the guest additions you need to modify a file.

gksudo gedit /usr/src/vboxvideo-3.1.4/vboxvideo_drm.c

Replace line 90 with the following:


#if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 33)
                 .unlocked_ioctl = drm_ioctl,
#else
                 .ioctl = drm_ioctl,
#endif


Finally, run the following command:
sudo /etc/init.d/vboxadd setup


So anyways, this got me as far as logging in without the graphics dying.  However, it looks like Compiz gets enabled and kills everything.  I'll update if I find a solution to this.


Source:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/536929
http://www.virtualbox.org/ticket/6198
http://www.virtualbox.org/changeset/27248

Edit: Bug 6198 is fixed as of VirtualBox 3.1.6. To get it for Ubuntu add the VirtualBox PPA found at http://www.virtualbox.org/wiki/Linux_Downloads and run sudo aptitude install virtualbox-3.1

Friday, February 12, 2010

FLOSS-POS, IS4C and Bread & Roses

A new food coop has started up in town named Bread & Roses.  I went to a few of their fund raisers, and was aware of the effort.  In late December they opened their doors in Railroad Square.  They had a pretty sparse selection of goods for sale, but they have grown considerably in the little bit of time they  have opened.
On the TLUG group discussion someone mentioned that they were helping Bread & Roses come up with a Linux-based solution for their POS (that's point-of-sale) system.  I had it in my mind that I wanted to try to get Bread & Roses on the Linux path, and here was a direct offer to make it happen, so I agreed to show up at the next meeting.
It turned out the guy who posted it, Ray, was at an Ubuntu release party I had held a little bit ago.
At first I tried Lemon POS, but it was written in Python as a desktop application, and after poking around the code wasn't sure if I would be able to bend it to my whims, or at all for that matter.  My knowledge in PHP, Javascript and other web technologies.
After some more research I came across IS4C, a POS software written for Linux machines by a consortium of IT guys supporting food coops.  It is written in PHP, and the demos on its website looked very promising.  I installed the server and client on two separate virtual machines and started testing.  My initial impressions had me pretty excited.  Some more rigorous testing revealed some problems.
I displayed it for Justin and he identified a number of ways it did not cater to the Bread & Roses business model.  The great thing was that I had confidence that I could rewrite whatever I needed to do things the way we needed them to.
Aurora's grandfater, Stefan, donated a laptop and desktop to Bread & Roses.  After installing the server on the desktop and the client on the laptop I began making changes.
Looking around the IS4C website I noticed that there weren't any tools for distributed development.  No wiki, software repository, etc.  Essentially, none of me fixes, changes, or else where pushable back to the project head.
I hit up their forum telling them I'd like to work with them to get collaborative tools setup.  My post went unanswered for some time.  As I kept making changes and fixing problems I decided to just fork the code in a way that would allow others to jump in and collaborate with me if they so wished.
Learning git has been on my radar for a while, so I decided to use this as an opportunity to start learning. I put the project up on github and start pushing my changes to the github repo.  I named the project FLOSS-POS, and posted my fork on the thread I published a month earlier.
A few days later I started getting responses from people interested, and I have since got at least one person at the Wedge Coop making fixes that I have since been merging back into FLOSS-POS.
One of the most important changes, that Bread & Roses needed, is the ability to have separate member pricing, instead of just percentage-based discounting.  I have also changed the default browser for accessing the application from Galeon to Google Chrome.  Chrome should allow us to take advantage of HTML5 awesomeness soon, on a browser that is open source and cross platform.
In the long term I would like to do a ground-up rewrite of the code.  I am leaning towards using this as an opportunity to learn something else that's been on my radar, and rewrite it using python+django.
I've began doing some initial ERDs of the new database structure, which should be more robust and, allowing for greater flexibility and more detailed reporting.
I'm pretty pumped about this project and am hoping to get an active community of volunteers assisting on this program.  I think there is a lot of opportunity for the FLOSS community to inject itself rather effectively in the POS industry, which is presently dominated by expensive, closed source solution that prey on vendor lock-in to drive out competition.

Sunday, November 15, 2009

Scanning Problems in Ubuntu Karmic 9.10

I went to scan in some pictures today with my new Karmic install and ran into problems.  When I went to scan I would get "Failed to start scanner: Invalid argument"  Some Googling revealed that many people are experiencing broken scanning after upgrading to Karmic with various printers.  A little more searching revealed the solution.  I think that there is probably an even better solution, but this is how I got scanning to work.
First I installed libsane-extras:
sudo aptitude install libsane-extras
Next I edited saned.conf to enable the epson driver.
gksudo gedit /etc/init.d/sane.d/dll.conf
In this file I removed the # at the line that read #epson
To get the parameters for me scanner I ran:

$ sane-find-scanner

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04b8, product=0x0839) at libusb:001:003
found USB scanner (vendor=0x0bc7 [X10 Wireless Technology Inc], product=0x0004 [USB Receiver]) at libusb:007:002
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.

Here the line that read "found USB scanner (vendor=0x04b8, product=0x0839) at libusb:001:003" was the key.  These parameters needed to go in the epson drivers file.
gksudo gedit /etc/init.d/sane.d/epson.conf
I replaced the line that read "usb" to read "usb 0x4b8 0x0839"  Finally I just needed to restart the sane daemon.
sudo /etc/init.d/saned restart
After this scanning finally worked.