Saturday, 12 September 2015

My experience as an Oracle developer running Ubuntu

If you have been following my blog, you may have noticed the desktop environment I use is the Ubuntu distribution of Linux. Growing up, I always tried Linux here and there, but never stuck with it - it was more just to try out. As with anything, if you are going to use something new, you really have to commit to it - pick a period of time you are willing to use it for, and see how you go. If you still don't like it at the end, go back into your old ways.

(I will add that I did once upon a time own a Mac. Actually, I purchased a Powerbook right before Apple made the switch to the Intel CPU architecture. I know Mac OS X seems quite popular in the development community nowadays, however I still prefer to be able to select my hardware, and I believe I get that freedom and also get a bit of Software freedom by running Linux.)

At around 2008 - actually, soon after I started working with APEX - I had a couple of colleagues that were running Ubuntu. Since I started developing with Oracle, I didn't have any reliance on Windows for work, which made the switch possible. I fully committed - both my work workstation and home PC were now running Ubuntu. I believe the first release I used would have been Karmic Koala (9.10). A couple of releases later, I decided that I would just stick to long term support (LTS) releases, which come out every 2 years. 

The installation supports creating different partitions for folders on your Linux system. So I have followed the general methodology of having 2 partitions, one for /home and another for / (root). /home can be akin to "C:/Documents and Settings" or C:/Users in Windows. So what this means is that every time I install a new release, I can opt not to format /home - which is what I do. So all my personal files (and application settings) remain, and it just blows away everything else to install afresh. Note, you can just do a system upgrade, but I just prefer to start afresh on a new installation.

These days Ubuntu uses their own Unity user interface, which seems to face a bit of criticism. Being Linux, you have lots of choice! You are not restricted to one distribution or user interface, but I personally have no problem with the UI.

So, what tools do I have in my repertoire?

Terminal

If you are going to use Linux, you will want to know how to use the terminal. Whilst you can probably get away using just GUI tools, there are likely going to be times when you need to use the terminal. You may be connecting to your development server over SSH, here is where you will be doing that. And there's a very good chance your server will not be having a GUI available to you.

A terminal will most-definitely come pre-installed on your system. The specific command would be gnome-terminal. There of course are other terminals that you can use with extended/more basic feature sets.

Oracle SQL Developer

Well, being this post is about Oracle development, you will most likely want SQL Developer. Luckily, this is a cross-platform application and supported for Windows, Mac and Linux. Just so long as you have Java available to you. In Ubuntu, there is OpenJDK in the repositories. However, I personally prefer to use the official Oracle Java JDK. This version had to be removed from the repositories due to licensing changes. There is a PPA you can add to your system which will make the installation quite easy - see this article: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html. However, what I tend to do is follow the instructions on askubuntu.comhttp://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

The next challenge with SQL Developer is that they don't provide an installation file in Debian package format (Ubuntu is based on Debian). They provide 2 options for Linux:

1. RPM (for Redhat based distributions)
2. tar.gz (an archive (or tarball if you will) of all the SQL Developer files)

What I tend to do is grab the RPM file, and use a tool alien to convert it into a debian installation file. The conversion process should take around

sudo apt-get install alien
sudo alien --to-deb -c sqldeveloper-*.noarch.rpm
#sqldeveloper_4.1.1.19.59-2_all.deb generated

F
That will give you an installation file Ubuntu knows how to handle, and all is pretty straight forward from there on in. Just double click the generated file and follow the prompts.

Google Chrome

Being APEX, you will probably want a web browser. Ubuntu comes with Firefox, but I personally prefer Chrome. And wanting to be on the cutting-edge I tend to grab the beta release. All the release channels can be seen here - https://www.chromium.org/getting-involved/dev-channel, but the specific link to download is: https://www.google.com/chrome/browser/beta.html?platform=linux

Code Editor

Ubuntu by default comes with gedit, which is a nice basic editor that will get you out of trouble. The main editor I have been using lately is the Atom text editor, which is an open sourced text editor released by GitHub. The most common comparison I have seen is that it's quite similar to Sublime text editor. You get download the installation media from: https://atom.io/. It also comes with a whole raft of packages (extensions). For instance, if your version control system is git, you will likely want to use the git-plus package - https://atom.io/packages/git-plus - which supports a raft of git operations.

For instance, if you want to see the git diff, you can type in 'diff` in the command palette (ctrl+shift+p).



Code Diffs

A great tool for comparing code files I've found is meld. It supports up to 3 way comparisons and supports either file (or blank, where you can paste code in), and directory comparisons. To give a sample of it's UI, I will add a tweak to the following code:

function sayHello(){
   
    console.log("hello, world");
}




As you can see, it highlights both differences on the same line of code, and additional lines of code.

This is easy to install. Just run, sudo apt-get install meld, on the command line.

Lately, when I've been using SQL Developers database diff tool, it has been coming back with differences in some packages. I've found the interface in SQL Developer a little hard to see what differences there between the two, so I have been double checking with meld what difference the packages had (if any) as packages were being returned as differing after a fresh sync.

FTP transfers

For the occasional time I need to do a transfer over FTP, FileZilla is my go to application. It's in the repo's so it's easy to install: sudo apt-get install filezilla.

This program is supported on all platforms, so there's a good chance you are already using it, and have some familiarity.

BI Publisher reports / Unavailable apps

Ok - this is the only problem area. The report builder is built for Microsoft Word, and it's probably no surprise to you that there is no Microsoft Word For Linux. Some folks will probably tell you that they use Wine, but I personally never use this. Instead I have a Windows based virtual machine running through VirtualBox. To install VirtualBox on Linux, it's best to follow the "Debian-based Linux distributions" instructions here: https://www.virtualbox.org/wiki/Linux_Downloads

I also have it set up to to share my home folder so that it is dead simple to move files between the two environments - which is added as a mount point in My Computer.



Nothing much else to stay here - other than try not to rely on this for your software! Find native alternatives where possible. Ubuntu/Linux has LibreOffice/OpenOffice. Outside of the report building phase, most of the documents I make these days are done in Google Drive - I don't actually use LibreOffice too frequently myself.


Expanding abbreviations (for less typing)

I've heard a couple of mentions of this in the community. TextExpander is the name of an OS X application and the basic concept is that you define abbreviations for words and the system will automatically expand them once you've typed them. Once such blog post about the app can be found here, by Jorge Rimblas - http://rimblas.com/blog/2013/07/textexpander-and-apex/

When I saw this post, I did go exploring to see if there was anything similar for Ubuntu, and what I found was AutoKey. Basically, if you just google <name of app> ubuntu, you should get some results on a similar program (usually as a question on askubuntu.com).

Once you find out the name, the next step is to search the repository:

$ apt-cache search autokey
autokey-common - desktop automation utility - common data
autokey-gtk - desktop automation utility - GTK+ version
autokey-qt - desktop automation utility - KDE version

Then, you can go ahead and install the relevant version. For me, that's the gtk version.

sudo apt-get install autokey-gtk

This application works on phrases. So you first create a phrase, and then set up an abbreviation. Following on from Jorge's demo, I set up a phrase for an APEX URL: "f?p=AppId:PageId:Session:Request:Debug:ItemNames:ItemValues". 

Then set up the abbreviation as: "aurl" 


Now, save the phrase, and wherever you type "aurl" followed by for example a space, the abbreviation will be replaced with the phrase. 

That's of course only a basic example, but if you feel this might be useful to you I encourage you to give it a shot!


..

What are your toolsets?

2 comments:

  1. Thanks for this. I've been using Ubuntu on my laptop for a while but haven't had time yet to go too deep and really get the hang of it.
    This list could probably be extended over time to include other replacement tools such as image editing.
    I need to upgrade from 14.04 LTS, LibreOffice refuses to save things at the moment. How have you gone with editing Office documents?

    ReplyDelete
    Replies
    1. Hi Scott,

      Yeah not too long for 16.04 LTS now - if you consider 6 months not too long!

      Hmm, haven't had any issues with saving in LibreOffice - do you get any useful error messages? You may consider upgrading to 5.0 through the PPA here: https://launchpad.net/~libreoffice/+archive/ubuntu/libreoffice-5-0 or as per http://askubuntu.com/questions/132837/how-do-i-install-the-latest-stable-version-of-libreoffice?

      Cheers,

      Delete