Netbeans on Fedora 17

Recently, I was thrust semi-willingly into the dark and musky world of Java development. That’s not a bad thing, as I’ve found myself learning a lot about Java development and in general, learning is not especially a bad thing. I’ve chosen upon using Netbeans as my development environment of choice. Partially because it’s the most mature Java development environment, and I have experience in using it with PHP (another language I’ve recently found myself thrust into). Mostly because JDeveloper doesn’t run on Linux and Eclipse is crap.

Anyway, getting Netbeans working is a bit of a challenge. At least in Fedora. 17, which is my distro of choice.

So, first off, you’re going to want to get the latest version of the JDK. This is available from Oracle’s website. Download it and install it either through the GUI or with the following command:

rpm -i <filename of latest JDK RPM>.

Installing it should be pretty painless, and once it’s all over and done with, you’re going to want to do the same with Netbeans. Now, Netbeans isn’t entirely GPL licensed (of course it isn’t. It’s owned by Oracle), so Fedora refuse to allow it in their repositories. That’s OK though, because it’s not exactly difficult to install it.

Download the latest version of netbeans from the website. Once you’ve got it, open up a terminal session and get root. Traverse to the directory and give it executable permissions with the following command.

chmod +x <netbeans file name>.

Once you’ve given it executable permissions. run the Netbeans shell script you just downloaded. The command to do that is :

./<netbeans file name>

Press ‘next’ a few times. Accept a few license agreements. Go get a coffee. In about 10 minutes, it should have finished installing. Cool.

Now, try and create a new Java project. Odds are good (particularly if you have the open JDK knocking about on your system, it’ll whinge about not having the right JDK installed. The right one being (of course) the official Oracle one. Now, given that you just installed the Oracle JDK, you should probably find this a wee bit suspect.

Now, there’s a fairly easy way to deal with this. Open up a terminal. Provided that you’ve not messed around with the installation paths of Netbeans, or moved stuff around, this should work.Navigate to the /bin folder of your Netbeans installlation. Your netbeans installation is located within /usr/local/.Run the following command, substituting <folder of JDK> with the folder of your JDK installation:

./netbeans –jdkhome /usr/java/<folder of JDK>

Bear in mind, whenever you want to use Netbeans to work on a Java project, you’ll have to execute that command, so you might want to put it in a nice little shell script on your desktop.

If you liked this article and need the use of a VPS, Linode come highly recommended. They’re cheap, fast, have incredible support and support a huge range of Linux distributions including Fedora, Centos and Ubuntu. And, if you sign up with this referral link, I get a nice kickback. Everybody wins!

Hercules Hilarity in Mainframe Land – Part 1 – Back to the Future

If you are a customer of NatWest, Royal Bank of Scotland or Ulster Bank, the previous week probably has been a bit trying for you. For those who might not have heard, these banks recently had a bit of a problem where they were unable to process any payments. Now, this is a fairly serious issue in of itself as processing payments is generally one of those duties that banks have to perform. However, this issue was compounded by the fact that it happened around pay-day* and that these three banks represent a huge chunk of the UK retail banking market.

The issue ended up costing the banks a fair bit of cash, and wiped a few percentage points from their share price. It also raised a few serious questions with regards to the state it IT provisioning within these banks. RBS, which is the parent company of Ulster Bank and Natwest (although, all three work fairly independently of each other, sharing only IT infrastructure) laid off thousands of IT workers shortly after it had to take a multi-billion dollar bailout from the UK government.

These IT workers generally were highly experienced with the legacy machines that constituted the backbone of the Royal Bank of Scotland’s infrastructure. Some had clocked a few decades working with the systems that were depended upon by over 20 million UK banking customers. And then… Well? Their jobs vanished. The bulk of them went to Hyderabad, India where people performed the same tasks for roughly £10,000 a year.

Now, these workers generally lacked the kind of experience you can only get from spending a third of your life working on the exact same thing. And as a result, the quality of output tended to be significantly lower. So, when a software upgrade went wrong, a young, inexperienced tech made a serious error of judgement. Instead of backing out of the upgrade which (allegedly) is a fairly trivial task, he instead wiped out all of the scheduling rules and cleared the entire queue.  Oh dear.

So, what originally would have been a fairly easy fix ended up being a veritable disaster, with all lost information having to be reinputted and all scheduling rules having to be recreated. This in itself is an (apparently) arduous task, and it resulted in people not having access to their funds for well over a week. To RBS and Natwest’s credit, they did extend opening hours on most branches. They even opened some branches on Saturday and Sunday.

I’m interested to learn more about how these ancient mainframe computers work. Our governments rely upon them. So does our entire banking infrastructure. And we’re facing a serious talent shortage of people competent enough to operate these beasts. The same is true when it comes to the maintenance of the banking applications that run on these mainframe computers.They generally are written in a programming language called COBOL that is so old, it is seven years older than the current prime minister of the United Kingdom. A language that is also facing a serious talent shortage as more and more developers retire or die.A language that we depend upon.

I’ll be using a program called Hercules, which is an emulates the architecture that the old IBM mainframe computers used to run upon. On top of this, I’ll be running Kevin Leonard’s spin of OS/360 with HASP and the COBOL/FORTRAN compilers.Through this, I hope to learn how these old and mysterious machines work, if it’s possible to learn the fundamentals of operating them in a short amount of time and to gain a greater understanding of the catastrophe that resulted in one out of three Britons not being able to recieve any funds.

Fun times. Happy hacking everyone.

Part Two is Now Up.

* In the UK, payday generally happens on the last Friday of the month.

If you liked this article and need the use of a VPS, Linode come highly recommended. They’re cheap, fast, have incredible support and support a huge range of Linux distributions including Fedora, Centos and Ubuntu. And, if you sign up with this referral link, I get a nice kickback. Everybody wins!

Light Table Playground – First Impressions

If you have been residing underneath a really big rock (think Ularu, or Mount Jura), the news that there is a new paradigm of IDE design may come as a bit of a surprise. It’s called Light Table. And it’s insanely awesome.

When it was first announced, it stirred up a great deal of interest in the software development community. So much so that it raised over $300,000 USD on Kickstarter and many long threads on /r/programming and Hacker News were started as a result. It’s that cool.

The developer, Chris Granger has said that Light Table is based upon five guiding principles:

  • You should never have to look for documentation
  • Files are not the best representation of code, just a convenient serialization.
  • Editors can be anywhere and show you anything – not just text.
  • Trying is encouraged – changes produce instantaneous results
  • We can shine some light on related bits of code

Now, compare this to any popular development environment such as Visual Studio, NetBeans or Sublime 2 where code is not automatically executed/evaluated and documentation is seldom built into the IDE (or at least, not very gracefully) and you can suddenly see the appeal of Light Table.

Currently you can download a demo version which allows you to evaluate some of the features before it gets released later this year. It runs in the browser and by no means is it anything resembling feature complete, but as a proof-of-concept it’s pretty awesome.

It’s also worth noting that whilst the demo version only has support for Clojure (an interesting LISP-like language built on the JVM), the full version will support Javascript and Python. There’s no news on LOLCODE support yet, however.  

I downloaded it onto my development box running Fedora, and immediately had problems getting it running. Now, to load it you have to run a BASH script called “light” which tries to open it in Google Chrome as Root. If Chrome doesn’t exist on the system, it’ll fall back to Firefox.

Now, when you try to load Chrome as root, it generally throws a little bit of a tantrum (as displayed below).

Now, if you want to avoid editing random myopic configuration files (who doesn’t? Besides sysadmins.) go into the directory where you have the bash script and change the file permissions to allow read/write permissions. The command to do that is:

chmod +rwx light
Once you have changed permissions, open it in your text-editor of choice. Then change this:

if [ “$OS” = “Linux” ]; then
if which google-chrome &> /dev/null; then
echo “$purple — Starting Chrome $reset”
google-chrome $localLt
elif which firefox &> /dev/null; then
echo “$purple — Starting Firefox $reset”
firefox $localLt
echo “$purple — No browser found $reset”
echo “$puple — Open $localLt in a browser $reset”

to this:

if [ “$OS” = “Linux” ]; then
if which firefox &> /dev/null; then
echo “$purple — Starting Firefox $reset”
firefox $localLt
elif which google-chrome &> /dev/null; then
echo “$purple — Starting Chrome $reset”
google-chrome $localLt
echo “$purple — No browser found $reset”
echo “$puple — Open $localLt in a browser $reset”

Fairly self-explanatory, really.

Now, it’s worth noting that I’m not a clojure developer. I’ve not written a single line of clojure code until today*. This blog post is only to talk about the user experience of it… And, well?

I hate it. It makes me angry. It’s the worst thing I’ve ever set my eyes on, and I resent it. Why? Well, mostly because it’s so bloody good and clever. Now, going back to Visual Studio or Sublime (an admittedly good text editor) is going to feel vapid and devoid of joy.

You’ll wonder why your IDE isn’t evaluating your functions as you write them. You’ll wonder why you have to constantly switch from editor to browser, just to look at some documentation** (although, documentation viewing isn’t currently a feature on Light Table Playground). You’ll wonder why there has been so little evolution in proprietary development environments in such a long time. Seriously. Can anyone point out a single, revolutionary change in the latest version of Visual Studio that wasn’t there in the previous one? I’m not talking about a little “enhancement”. I’m talking about something unheard of, that changed how we develop software. Exactly.

So, yeah. LightTable has a demo out. It rocks. Get it.

* If you’re wondering, that code was:
(defn multiplication [a b c]
(* a b c))

(multiplication 2 3 5)

I know. I’m leet.

** Although, a more pertinent question might be why you are developing with a single monitor.

Fedora 17 Hardening – Part 4 – I Got The Power

So, in Linux, it’s not just users that have administrative privileges. Applications can have privileges that the end user may not have. It’s generally a good idea to regularly check what applications have superuser permissions and quarantine any application that you do not recognize.

Discovery can be done by invoking the following command:

find / -type f -perm /u=s,g=s

To quarantine the suspicious app, copy it to somewhere where it cannot be executed (think a flash drive, or FTPing it on to a box where it cannot execute) and delete the original.

Later I will show you how to set up your machine to check app permissions on a regular basis and have the results emailed to you with a useful utility called Cron.

If you liked this article and need the use of a VPS, Linode come highly recommended. They’re cheap, fast, have incredible support and support a huge range of Linux distributions including Fedora, Centos and Ubuntu. And, if you sign up with this referral link, I get a nice kickback. Everybody wins!

Fedora 17 Hardening – Part 3 – The Computer Misuse Act

Right, so you’ve turned off any services you’re not going to be using. How about mitigating any damage they might be inflicted by a particularly clueless end-user?

You probably want to limit how much access to system resources they have. This seems a bit counterintuitive, since it seems a bit silly to place artificial limits on how much memory or system processes an end user can use. However, end users tend to be a rather thick bunch, and if they’re willing to download sketchy EXEs off the internet (they often are), odds are good that they’ll blindly run BASH commands without question.

So, it’s probably a good idea that we lock down the system, lest somebody unleases a forkbomb*. In /etc/security/ there’s a conf file called “limits.conf”. This allows you to control the memory used, the number of processes running, the amount of open files at any given time and the amount of permissible concurrent logins.

So, suppose you have an end user called Quentin and you want to only permit him 10 megs of ram, 50 concurrent processes, 100 open files and two concurrent logins. You would append the following information to your limits.conf file.

quentin hard rss 10240
quentin hard nproc 50
quentin hard nofiles 100
quentin – maxlogins 2

This syntax is obvious: { username | limit strength | item | value}. Not too hard, eh?

* Forkbombs are rather cool things. What they basically do is infinitely spawn processes of themselves, which in turn spawn processes of themselves, which spawn even more processes of themselves, ad infinitum. So, consider the following code. “:(){:|:&};:”. That looks kinda cool, doesn’t it? Innocuous too. It isn’t. Trust me.

What that code does is define a function called “:”, and then calls itself whilst piping another call to itself. And then it loops around again. And again. And again. Until the system crashes or is rebooted. Forkbombs may be known by different names, such as “wabbit”, “bacteria” and “folding@home”.

Once you’ve set up your resource allocation, move on to the next chapter.

If you liked this article and need the use of a VPS, Linode come highly recommended. They’re cheap, fast, have incredible support and support a huge range of Linux distributions including Fedora, Centos and Ubuntu. And, if you sign up with this referral link, I get a nice kickback. Everybody wins!