Niko Roberts' Blog

Travel Addict and Web and Desktop Developer

Installing Jira on Ubuntu 10.04 Lucid

This January I decided to finally make the move to put Jira on my Rackspacecloud hosting. It took a bit of searching so I decided to make a step by step guide.

Sun Java 1.6

From a fresh install of 10.04 we need to install a few things to make Jira run nicely

nano /etc/apt/sources.list

add the line
deb http://archive.canonical.com/ lucid partner
Do a quick update and upgrade of the sources and any basic packages you have on the system
 apt-get update 
 apt-get upgrade
Then install Sun Java from the new source and check it is the right version
apt-get install sun-java6-jdk
java -version
java version "1.6.0_26" 
Java(TM) SE Runtime Environment (build 1.6.0_26-b03) 
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) 
If you have a different Java showing up here you may need to use

update-alternatives --config java

Once you have the Sun Java appearing in the java -version result you can move on

nano /etc/profile

Add the following

JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME

MySQL

 

Now install the MySQL instance for Jira to use

apt-get install mysql-server mysql-client

mysql -u root -p

Then enter the password you setup for the root account
Now we need to create the user and database on MySQL for the Jira installation 

CREATE USER 'jira_db'@'localhost' IDENTIFIED BY  '__PASSWORD__';
 GRANT USAGE ON * . * TO  'jira_db'@'localhost' IDENTIFIED BY  '__PASSWORD__' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
 CREATE DATABASE IF NOT EXISTS  `jira_db` ;
 GRANT ALL PRIVILEGES ON  `jira_db` . * TO  'jira_db'@'localhost';

 

Jira

 

Now we are ready to install Jira onto the machine
Following the steps from http://confluence.atlassian.com/display/JIRA/Installing+JIRA+on+Linux
Download the appropriate JIRA 'Linux 64-bit / 32-bit Installer' (.bin) file from the JIRA EAP Download page.

wget atlassian-jira-X.Y.bin
chmod a+x atlassian-jira-X.Y.bin
./atlassian-jira-X.Y.bin

Follow the on-screen install instructions. (I used the defaults for everything)

When you are done you should see a message like:

JIRA 4..4.4 can be accessed at http://localhost:8080
 Finishing installation ... 

When you open the website on port 8080 you should be able to figure out how to set up the MySQL

With Jira 5 you can add Gmail as your SMTP using apps (not available in the 4.4.4 version unfortuantely)

 

Posted

Google Adds Mobile and Landline calls to Chat

As of my birthday (3rd of Aug) Google has added a "Call phones from Gmail" feature to google chat.

Can anyone say "goodbye skype!"?

What most would consider the final advantage of Skype now has been matched and the proliferation of google chat into google plus only means less reason to boot up the slow and cumbersome dinosaur that Skype now is.

Skype, thanks for the good times but it looks like goodbye.
Microsoft, good luck
Google, well played

Posted

Google Realtime + Facebook

It is very encouraging to see that Google is not all politics and actually realises the potential that Facebook gives to the Google platform as well as the threat.

I am very encouraged that Google is working on something similar to what I have been exploring these last couple of weeks.
(more news about this I hope soon)

Posted

Why Portugal cannot pay it debts

Portugal has a big problem.... rotten bureaucracy

I am an Australian who is working as a freelancer in Portugal. I work primarily for an Australian company. In other words in terms of economic benefit for Portugal I remove money from Australia and spend it in Portugal. For me it is great because I am earning a decent wage (hard to do in Portugal). For Portugal it is great because more money if flowing through their economy.

The biggest problems I have faced over the 18 months, that I have been here, have come from the tax and social security systems.

Don't get me wrong, I want to pay tax and I want to put money into the Portuguese social security system.

The problem is how hard it is for a person to do that. I registered for "recibos verdes" (i.e. the freelancer system). All fine and dandy, the people in Finanças even tell me because I am a new tax payer I get a year free of paying tax. Because I am doing most of my work for a non-EU company my income would be exempt from VAT and my declarations would be pretty straight forward. So far, so good. I am doing a VAT declaration each 3 months, every time struggling with the legal "lingo" on top of an already difficult language.

So my 12 months of beginners tax-free living is over and now I am supposed to start paying income tax and supposedly some social security. In April I will fill out my income tax declaration for last year and I will not have to pay anything. For this year I will have to save my own tax payments as I earn money and pay it when it comes to tax time next year.
However the social security department is the hardest department to get any information out of, people start lining up an hour before the offices open. Reading their instructions in Portuguese are ridiculously difficult even for a native speaker. I am currently trying to find out if I have to start paying this monthly fee now or in October (I swear it says both). I have received requests for basic information from the department, most of which they already have copies of and some of which I don't even know. They have asked, for example, for my social security number, which they have not given me yet.

It is no wonder the Portuguese economy is in the toilet. Why are there proposals to reduce pensions when they don't even have a decent system to receive tax? With electronic citizen cards they can authenticate people, allow them to enter the information required and then give that data to a bureaucrat who can then contact that person with an answer, all without having to line up for hours and hours just to be told that the office is closing and you might have better luck tomorrow.

Posted

My thoughts on being a vegetarian

Let me just start by saying this is not an attack on vegetarians or their opinions. I have many good friends and family who are vegetarians and I am sure they all have logically thought out their own opinion on all the topics I am going to talk about. 

There seems to be a lot of conflicting information on the internet about why humans should not be eating meat. I will go through various topics that seem to get raised by various people.

1. Humans are not omnivores, we are in fact herbivores that have trained our digestive system to handle meat (badly)
I have some problems with this statement. I am yet to find reliable sources of studies done that provide any indication that humans do not consume the minerals, vitamins and proteins in meat. There are plenty of parts of meat we don't consume, but this is the same with most things that we eat, that is why things come out the other end.
To try and tell me that humans are not designed to eat meat because we don't have the same features that carnivores have, i.e. claws etc., seems a bit far fetched. Anyone else got these pointy teeth called incisors and canines??

2. We cook our meat anyway which removes all (or most) of the vitamins from the meat anyway.
Well this is just a big generalisation on "cooking" meat. If you stew everything you lose a lot more minerals out of the meat. Even with stewing for a couple of hours, the sources I have found (http://www.choose-healthy-food.com/cooking-meat.html) suggest that only 50% of minerals are lost maximum.
The reason we cook our meat is not because we can't digest it, it is because the bacteria that can be found on a piece of meat can be deadly. The technology to cook meat was one of our finest achievements as a species, as it meant we could eat with a much lower risk of serious food poisoning.

3. Animals grown for meat are treated badly while being grown and in abattoirs/slaughterhouses they are not killed humanely or with any respect for the animal.
I think this is definitely a massive factor for vegetarians to choose not to eat meat. I do however think the vast majority of vegetarians are just removing themselves from the problem, rather than finding a solution.
There are now a few organisations that aim to educate the general population about how animals are mistreated for the sake of mass production.
In my view, choosing to eat free range animals that have been killed with respect and minimal pain, is doing the same thing for the animals as choosing not to eat meat (in terms of what is going to happen to these animals)

4. The ethics of eating another sentient being, if we can survive without it, is ethically wrong.
Now this argument in one of the few I don't think anyone can argue against effectively.
Humans are superior so we should eat the animals less superior to us, just because we can? As my mother-in-law would say "mmmmm No"

[EDIT: Added 11:10am 2011-01-20]

5. The energy to produce 1kg of meat is 2-3 times more than 1kg of grain or cereal.
I think this is a very important part of how we should value the cost of eating meat. As our personal environmental affect becomes more of a priority, I hope that this sort of information is more widely known.
For me this is much more about being aware of our environmental cost in general and not just how much meat we eat.
As my cousin loves pointing out, the energy cost of using (new - not recycled) aluminium products is thousands of times more energy intensive than meat. The environmental cost of building your car is probably your lifetime's supply of eating meat.

Some stuff that relates slightly to this section, that annoys me to insanity, is the environmental impact the floods in Queensland are having. Because people have insurance, anything that has touched water is being thrown out and replacements are being claimed. As can be seen on news coverage, a lot of this stuff is new and undamaged goods, including aluminium kitchen sinks etc.
The environmental cost of the way people are behaving and the way that insurance companies are handling this, is ridiculously high.

[FINISHED EDIT]

My conclusions
Vegetarians are on the right track, reduction is the key, but completely forgoing meat doesnt seem to me as the way to fix the problem. One of my philosophies in life is "moderation, moderation, moderation", so I doubt I will ever be a vego or a vegan, but I am willing to cut my meat diet down and pay more for real free range and humanely killed meat (Added: 2011-01-20).
http://www.ajcn.org/content/78/3/660S.full
After reading the article above it gives idea about the cost of eating a majority meat diet. Something like twice the energy goes into producing a meat majority diet as opposed to a milk-egg-cereal based one.
Although if all the world abandoned meat and started just eating eggs, we wouldn't be in a much better position in terms of animal cruelty. Chickens are already some of the worst treated animals in the mass production food industry. (http://www.jamieoliver.com/jamiesfowldinners/)

I think that reducing meat consumed by the vast majority of people is important. But, halting consumption, unfortunately, isn't going to fix our problems, environmentally or ethically.
We need to step forward slowly, reducing consumption of meat, making sure the meat we do consume comes from animals that have died painlessly and making sure that we are consuming the nutrients our body actually requires.
Posted

MySQL CAST/CONVERT to FLOAT Equivalent

Well I after a little searching I thought I would post this as it seems to be missing from Google results.

When converting/casting a string to a float value there is no specific function to use.

CAST(1.0 AS UNSIGNED) makes the value an unsigned integer, i.e. 1

To get MySQL to really cast the value to a Float value you need to just +0.0 by doing this you can order the values appropriately (e.g. 1, 2, 5, 10, 19 rather than 1, 10, 19, 2, 5 like strings will do)

So to "cast" the string value to a Float/Double just do the following:
SELECT MyString2-0.0 AS MyFloat FROM MyTable ORDER BY MyFloat

I hope this helps anyone who is doing quick Google searches to find this information like I was.
Posted

Changing your site to be UTF-8

One thing I that really annoys me is how complicated charsets are on the internet. You need to study a ton to get everything working with "strange" characters. Which if you have anyone using a language that is not English comes up quite often.

Just playing around with a portuguese website I have been working on JPM and getting the charsets all changed from the default to UTF-8

 

First thing you have to do is change the following settings in your php.ini file (mbstring is a needed extension to create a transparent string handling system for UTF-8 strings, meaning you do not need to go encoding and decoding text)

mbstring.func_overload = 7
default_charset = "UTF-8"

You will also have to make sure MySQL (or other database) is using UTF-8 so when you input data to the DB it stays as UTF-8 (do this after the mysql_connect and mysql_select_db)

mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
 

Each html page will also need to know that it is encoded with UTF-8. Sending the PHP header command means the recipient gets the information in the header right at the start.

<?php header('Content-Type: text/html; charset=utf-8'); ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

If all of this stuff is done correctly there should not be any need to use utf8_encode or decode unless you are dealing with data that is coming from an external source.

Posted

Australian Independents Day

Just a little bit of political gibberish for a Satuday morning to mix things up.

I like the way these Independents (the crossbenchers in general) and their indications on what they will do to reshape Australian politics. I really have disliked the bickering between Labor and Liberal especially in the last few years. I would love to see more minority governments in Australia.
I hope minority governments will help achieve Don Chipp's aim to "keep the bastards honest"

If it takes a hung parliament to make these sorts of changes or a declaration of independence, I don't really care, as long as it reduces the ridiculousness of the schoolyard arguments between big party leaders.

I would also like to see a hell of a lot more conscience votes rather than voting with party policy.

I really like the fact that the crossbenchers are not all in agreement on lots of issues and clearly disagree with each other on certain topics, but they seem to be working well together for the good of the country.

I hope at the end of all this I can be a proud Australian... always the optimist

Posted

Super Bock Super Rock 2010

Sbsr10

Teresa and I just spent our weekend at Super Bock Super Rock 2010

There were plenty of great bands to see. The only trouble we had was with the terrible organisation of the campers. We thought that people who paid for 3 days would be treated better than the people who just turned up for the day. Apparently we thought wrong.

We turned up a day early and were quite excited about the prospect of camping when we saw the situation around the main stage area. Although a bit sandy and dusty it was flat and pretty well shaded with lots of trees, and best of all it was a huge space.

Imgp0227

Unfortunately as we continued around the side of the stage area we discovered that the landscape changed to steep and even more sandy. Unluckily (!?) this is where the organisers decided to put the campers who had paid for 3 days of festival. Not only was it on a slope and very sandy but it was also a tiny area. The organisers didn't bother designating any pathways through the camping area, so each time someone from the centre of this mess decided they wanted to go to the stage they had to discover new ways through the maze of tents.

(download)

After the first night Teresa and I decide that there was no advantage of being in the designated camping area. We moved our tent out into what we could only assume was meant for cars? We moved within 50 metres or so of the secondary stage.

Imgp0213
Maybe the organisers thought it would be easier to clean up if all the campers were cramped in a tiny little space. It does make some sense to put the cars on a flat less-sandy surface, but there was an undersupply of cars and too many tents for the area provided.

Anyway. Over the next two nights Teresa and I slept much better and didn't have to worry about someone tripping over a tent string and landing on us during the night. We also had the advantage of easy access to both entries into the main area (the one with all the campers always had a notoriously long line for the men to get in)

Somehow I think a women who really had a chip on her shoulder about lines at women's toilets organised the gate entry too. There was always a huge line for guys and the girlsalways walked straight though and then had to stand around waiting for guys to go through security... lol

Anyway saw plenty of cool acts including all 4 Australian acts who were there (Cut Copy, John Butler Trio, Temper Trap, Empire of the Sun). Prince was surprisingly good, although the crowd was a bit tired at times (not surprising after 3 late nights). As as a closing act Empire of the Sun rocked, even though it was 2am when they started the (big) crowd really got into it.

(download)

(download)

To see more pictures just check out http://picasaweb.google.com/niko.e.roberts/SBSR10

Or if you want to see more professional pictures have a look at http://www.festivaispt.org/1702-reportagem-super-bock-super-rock-18-de-julho-ultimo-dia/ 

Posted

PHP mcrypt and C# Encryptor

For the past day I have been looking for a solution to transfer encrypted information between a PHP web application and a C# desktop application.

This requires that both systems use the same algorithm, key and init vector (IV)

This isn't as easy as it sounds. The slightest difference in the setup of either system means that the encrypted information cannot be decoded on the other end and makes it basically useless.

(The following PHP code has been modified after some useful debugging and comments from Serge N.)

 



//Encryption function
function mc_encrypt($encrypt, $key, $iv)
{
    $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
    mcrypt_generic_init($td, $key, $iv);
    $encrypted = mcrypt_generic($td, $encrypt);
    $encode = base64_encode($encrypted);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    return $encode;
}


//Decryption function
function mc_decrypt($decrypt, $key, $iv)
{
    $decoded = base64_decode($decrypt);
    $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
    mcrypt_generic_init($td, $key, $iv);
    $decrypted = mdecrypt_generic($td, $decoded);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    return trim($decrypted);
}


 


//Usage in PHP
$original = "original message";
$key = "abcdefg_abcdefg_abcdefg_abcdefg_";
$iv = "abcdefg_abcdefg_";
$keysize = 128;


$enced = mc_encrypt(stripslashes($original), $key, $iv);
echo "Encrypted:<br>".$enced."<br>";
$unced = mc_decrypt($enced, $key, $iv);
echo "Decrypted:<br>".$unced."<br>"; 


That is the PHP code done. We can generate a key and then at any point use the decrypt function to unencode it.

Now the trick is getting the exact same functionality in .NET (with C#) 

I found that the class below does it pretty well (this uses the default Rijndael algorithm which is 128 in C#)



public static class Encrypter
{
          public static String EncryptIt(String s, byte[] key, byte[] IV)
          {


             String result;
              RijndaelManaged rijn = new RijndaelManaged();
              rijn.Mode = CipherMode.ECB;
              rijn.Padding = PaddingMode.Zeros;
              using (MemoryStream msEncrypt = new MemoryStream())
              {
                  using (ICryptoTransform encryptor = rijn.CreateEncryptor(key, IV))
                  {
                      using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                     {
                         using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
                         {


                             swEncrypt.Write(s);
                          }
                      }
                  }
                  result = Convert.ToBase64String(msEncrypt.ToArray());
              }
              rijn.Clear();
              return result;
          }
          public static String DecryptIt(String s, byte[] key, byte[] IV)
          {
              String result;
              RijndaelManaged rijn = new RijndaelManaged();
              rijn.Mode = CipherMode.ECB;
              rijn.Padding = PaddingMode.Zeros;
              using (MemoryStream msDecrypt = new MemoryStream(Convert.FromBase64String(s)))
              {
                  using (ICryptoTransform decryptor = rijn.CreateDecryptor(key, IV))
                  {
                      using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                      {
                          using (StreamReader swDecrypt = new StreamReader(csDecrypt))
                          {
                              result = swDecrypt.ReadToEnd();
                          }
                      }
                  }
              }
              rijn.Clear();
              return result;
          }
}

//Usage


Encoding byteEncoder = Encoding.UTF8;
byte[] rijnKey = byteEncoder.GetBytes("abcdefg_abcdefg_abcdefg_abcdefg_");
byte[] rijnIV = byteEncoder.GetBytes("abcdefg_abcdefg_");


String message = "original message";
String encrypted = Encrypter.EncryptIt(message, rijnKey, rijnIV);
String decrypted = Encrypter.DecryptIt(encryption, rijnKey, rijnIV);


Console.WriteLine("Original: "+message);
Console.WriteLine("Encrypted: "+encrypted);
Console.WriteLine("Decrypted: "+decrypted);


I hope this shortens someone's search process when trying to do this.

PS. Yes this is my first try at using the [ code ]  containers in Posterous (not the easiest thing in the world but after some tweaking eventually got the code to appear here nicely)

Posted