Holidays are gone, tiredness not

It’s been a while, since last post…

A lot of work through holidays, if I could call it that way. Holidays for people around me, and for me, it was like a extended school period.

Anyway, I’ve been doing some rather neat things regarding my point of interest. Since I’m about to finish master studies at my faculty, or I hope I will asap, I’ve been wasting my time on couple of last exams. To make it short, there was a subject called Internet Programming, about JAVA web technologies, and for the project I did something I firstly doubled I could.

Main goal was to connect my idea of programming XMPP client, with GlassFish application server. It was very frustrating experience, since there is no systematic documentation about various Java technologies online. So, I had to use forums, and strongly rely on my intuition about some things. I have used GlassFish 3.1.2 server, with NetBeans 7.2 IDE and Jabberwocky framework for implementing XMPP components. It took me about two weeks to make it work, since CDI has been bugging me for a week. Like I said, documentation was very poor, and community very small. I’d like to thank to a man/team developing this framework, since they tried to help me. In the end, I did full install on virtual machine with java 7 jdk packages, and it worked without any problems. For developing console based client, I have used Smack Java library, and developing the client was a peace of cake, in comparing to the Jabberwocky component. But, it worked splendid at project presentation. Not to mention that professor did not even look at the code 🙂

Thing I’ve been working for a couple of days now is Python/PyGame simulation for another subject, which exam I’m going to take tomorrow. Simulation is about satellite/space ship orbiting a planet. Since that subject lectures finished in January, I did first satisfying version in February, but it had some peculiar errors in calculations (numerical), so I’ve abandoned it for some time. This is the video of it:

The second version, which I completed couple of days ago, had those errors fixed, but I did remove all eye cookie, just for the sake of debugging speed. This is the second version:

As you can see, there are no fancy panels, but having fixed all the errors, I’ve “repaired all system panels, and restore it to it full capacity” 🙂 and added some eye cookie, like velocity vector, gravitational force vector and radius vector. I hope it is finished, for good 🙂 Here is the final version:

Since this is based on numeric calculations, there is some calculation error, based on how short time period is. In this case, time period is 10^-2. To make things more serious, I’ve made some tests, without graphic interface and exported them and draw some charts in PyPlot. In, lets say, first 300 steps of iteration, error is slight, and you can see even on graphic representation. If you make 1000 iterations, and take 300 steps at the end, you can see how numeric orbit is changed through time, in comparing to a orbit which is drawn regarding analytic formula. Here is the chart for 300 steps, form 699th until 999th.

Blue line is orbit drawn by coordinates based on iterative process. Green one is based on 100% correct coordinates based on analytic formula of ellipse. Reducing time period to 10^-4, errors are slight even for 20 000 iteration steps. Of course, you have to find balance between wanted precision and time needed to finish calculations.

This is what I’ve been doing lately. Maybe its interesting?

Installing axis2 on Ubuntu host

Hey ppl, it is time for one of my super helpful mini tutorials 🙂

Its been a while since last post. I had lot of work and things on my mind. Today I decided to write mini tutorial about installing axis2, as I setup it again on my virtual machine.

Before we start, I’d like to tell you why I’m installing everythin again! 😦 It is because my old virtual machine was broken few days ago.

I had WinXP on it, and I was doing some IDEF0 and DFD diagrams. I needed ERWIN for some ER diagrams and I tried to install it. It started and took some time, and then VBox started going crazy! It shutdown WinXP virtual machine and threw me an error about it. If I just had a clue not to edit Virtual Box.xml file, I’d be very happy man right now. Anyway, I had removed some lines, or something like that and all my virtual machines and their snapshots were inaccessible. I have lost few hours trying to make it work again, but with no success. So, I’m giving you advice, FIRST READ THEN EDIT CONFIG FILES 🙂

Ok, now we will start with installing axis2.

First, you have to install java6, tomcat6 packages with next command:

sudo apt-get install sun-java6-jdk tomcat6-admin tomcat6-docs tomcat6-examples

Now, you can try accessing localhost:8080/ in your browser. If you try to get on admin pages, to deploy some servlet, you’ll get prompt for username and password. Because tomcat6 default install hasn’t those parameters in config file, you’ll have to edit /var/lib/tomcat6/conf/tomcat-users.xml. In it you’ll have to add next lines:

<role rolename=”admin”/>
<role rolename=”manager”/>
<user username=”admin” password=”password” roles=”admin,manager”/>

between tomcat-users tags. Change “password” with your own.

After this, you’ll have to restart tomcat6 with:

sudo /etc/init.d/tomcat6 restart

Then, you have to access manage-webapp link on localhost:8080/ and enter your username and password from tomcat-users.xml file.

Inside, you can do lot of things, but we will do war deploy :D. Since we are installing axis2, you must download WAR archive from this link:

Then you choose path to axis2.war file, and deploy it. To access it, visit localhost:8080/axis2/. I’m pretty sure you’ll get error. It took me som time to figure out what is blocking it. The problem is in tomcat6 script in /etc/init.d directory. You have to switch tomcat security flag from yes to no. Then restart tomcat6, and you’ll have axis2 working.

That is all. Feel free to comment and ask, and I’ll feel equally free to answer them 🙂 BYE!

Working with the VBoxManage and VBoxHeadless

Hello everybody, today I’m going to show you some basics in managing virtual machines in VirtualBox, from command line.

First, lets assume you have installed virtual machine and you want to run particular one, but you don’t know what was its real name. To list all virtual machines you use:

VBoxManage list vms

Then when you see the name of machine, you can run it by typing:

VBoxHeadless -startvm “nameofmachine”

This way, you’ll be able to run machine without running VirtualBox GUI.

Now that I experimented with VBoxManage controlvm, you can use it to reset, poweroff , savestate of machine and all those cool stuff you can do in GUI. For example, to restart machine, use:

VBoxManage controlvm “nameofmachine” reset

One more thing, that is very cool is that you can change type of networking while machine is still running. You can do that with:

VBoxManage controlvm “nameofmachine” nic<1-N> null|nat|bridged|intnet|hostonly [<devicename>]

For device name, I have vboxnet0, and that is the device which your host recognizes. After changing the way your virtual machine access the network, you can reset it just in case, and everything should work well.

For exporting you can use command:

VBoxManage export “nameofmachine” -o nameofovffile.ovf –legacy09

You can add some informations about virtual machine but they are not needed for importing it and running safely. Legacy09 is for including possibilities that someone who will import can read OVF 0.9 standard and not newest 1.0.

Importing is also piece of cake:

VBoxManage import nameofovffile.ovf

You can include –dry-run or -n flag to go through the process of imorting in detail and choose what to import and the way of importing.

After importing, you may find some difficulties in network access on virtual machine. The problem should be easy solved by removing /etc/udev/rules.d/70-persistent-net.rules

I’d also point you to this post, cuz this is very good post about doing some virutal machine work in command line. YEY! 😀

Installing LAMP, SSH, Webmin, SVN repository on jeOS

Hey ppl, today I’m going to tell you how I did this particular job of setting up a Linux based server dedicated for my project.

I’m going to cut the intro and start with the real deal :).

First, I used VirtualBox for making virtual machine. I’m using VBox 3.1.4. I made a dynamic sized hard disk and set its max capacity for 6 GB, which is just enough for my needs.

Second, I downloaded jeOS from this link, You can download it just clicking on this link, ooooor you can use wget tool in your command line(terminal), if you are linux geek, like me :D. After downloading it, make sure you add in the virtual media manager, in VirtualBox. Then, open the settings for your newly created hard disk and choose to mount jeOS’s .iso. In the Network part, choose NAT. I’ll explain that latter. Then ruuuun the coolest virtual machine ever :).

In the mean time, as you install jeOS, let me say that it is based on Ubuntu 8.04 LTS server, where LTS is for Long Time Support. I read somewhere that it is going to be supported until 2013!!! That means, you wont have to think of setting a new virtual machine for a looong time. Cool, isn’t it? 😉

Now that you have installed the jeOS, we are going to update and upgrade installation. First, you can use sudo vi for editing the /etc/apt/sources.list file, and if you know what you are doing, removing some pound symbols. After successfully editing it, run sudo apt-get update for updating the list of available packages. After that, run sudo apt-get upgrade for making sure that installed packages are going to be newest.

Until that happens, I’m going to tell you, that jeOS is Ubuntu based server edition made only for virtual machines, so it doesn’t have all the packages that real 8.04 LTS server edition has. That is going to make our job slightly harder, because there are going to be some dependencies that we are going to have to solve. No need for panic, I already did this, so you are getting this without sleepless nights and red eyes, as I did. Poor mee! 😦 😀

Anyway, thanks for ppl who helped us as much as they could and made us a package called lamp-server^. It basically installs Apache, PHP, MySQL in one, without making us install all these packages one by one, by apt or downloading and compiling them. Compiling is much better if you have to make some slightly changes and fine tune the server. That is not the subject of this post, so we are not going to do that.

So, we install lamp server with sudo apt-get install lamp-server^. Make sure that you put ^ at the end of package name. Next to do is installing the SSH support, so you do not have to do all this from virtual machine, but by accessing it through the terminal or putty. Of course, this is just installing it, for accessing it you will have to to some things that I’m going to explain latter. So, to install ssh server, run sudo apt-get install openssh-server.

After this, the best way to administrate your server machine is to install Webmin. You can get it by wget, that I suggest, because if you download it on host machine at this point, you wont be able to transfer it to virtual machine. So, use wget! How coooool, back to the command line! 😀 Whis is the site where you can get the latest version of webmin, After downloading it,if you try to install it, it will print some broken dependencies, about some perl libraries. So before installing webmin, type sudo apt-get install libnet-ssleay-perl openssl libauthen-pam-perl libio-pty-perl libmd5-perl. This is going to fix all dependencies and then run sudo dpkg -i <nameofdownloaded-file>, for installing it. Of course, you have to download the .deb package to install it with dpkg -i, oooor you can download and .rpm for example and use alien to conver it to .deb. This is just an info, we are not going to to that! 🙂 coz there is no need for it.

That is it, now you could access webmin by typing the ip of the machine and choosing the port 10000. Only problem is that virtual machine is accessing the internet over the NAT, so it has IP from private domain, and you can’t see it. No big deal, we will fix that very soon.

Now, to install SVN. This is very useful tool for you if you are working on some project with your colleagues or buddies. It can make work on project a piece of cake. To install it type sudo apt-get install subversion libapache2-svn. The second package is module for Apache, so you can access your svn repository over http with Apache. Cool stuff, but if you are doing some classified project, better use it with https protocol, to make sure it is crypted over the internet. You are going to think that this is the end of setting up the SVN, and I’d like to tell you that! 🙂 Buuuut, it is not! You have to use adduser or useradd commands in command line and add the svn user. Make sure that when you add it, edit the /etc/passwd file with super user permissions and edit the default shell for svn to /bash/false. That way, no one will be able to log in on server as svn user. Next thing is to edit /etc/group file, agains as SU and add you as member of svn group. You can add all users that are going to be using svn repository. After finishing that, we are going to make repository directory. Now, I made it on /srv/svn/, but you can choose whatever you like. When you make a directory, run sudo svnadmin create /path/to/your/directory/repos. I did svnadmin create /srv/svn/repos. Now run sudo chown -R svn.svn /srv/svn for making the svn user a owner of that directory, and then sudo chmod -R g+w /srv/svn, for letting all members of svn group to access and write in your svn repository.

So, now you can access your svn repository ove svn+ssh://machineip/path/to/svn/repos oooor making it available over http or https with Apache. To do the Apache way, you have to turn off the machine. Now is the time for changing the Network settings. When virtual machine is turned of,  go to settings and change from NAT to Host only networking. This way, your host and your virtual machine are going to be able to see each other as if they were in local network. Bad thing is that virtual machine will only see host machine then. But, we installed all the packages we are going to need so that is not the problem. Just for info, internal network is for virtual machines to see each other, and bridged network is for making the virtual machine as real computer on your LAN. That way, it will get real 192.168.. adress and be more like a real server. But this part is more complicated, cuz you have to make some changes on host. Anyway, run the virtual machine, and when you log in run ifconfig and see that it is ip address of virutal machine. Type that address in web browser on host, and you should see the words “Ii works!”. If you use https protocol and name the port 10000, you will be able to access webmin. There you will be able to set a virtual host, or even change settings for svn repository. The way we are going to edit apache’s settings is over the command line! Yey! 😀

So then, edit the /etc/apache2/sites-enabled/000-default file, with SU permissions and add before closing the VirtualHost tag, this:

<Location /svn/repos>
DAV svn
SVNPath /srv/svn/repos
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/passwords
Require valid-user

Dav svn – Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request. SVNPath is saying where is the repository. AuthType is for authentication, AuthUserFile is file where you specify  the users that are permitted to access repository. There are crypted passwords. Since you create it and it is empty, you can add user and password with this command, sudo htpasswd -cb /etc/apache2/passwords username password. Of course, it is not suggested to type password, coz it is going to be seen in command line history. To make htpasswd propmt for password, exclude the b flag.

Now, you have to reload apache daemon, with sudo /etc/init.d/apache2 force-reload. This way, when you type in hosts browser http://ipofthevirtualmachine/svn/repos login window should appear and when you enter password, it should show you the repository.

I had in mind showing you the basic commands for managing the virtual machines from command line, but since this post took so much time, I’ll leave vbox managing for another time.

I hope my english was good enough, and be free to comment this post, if it is good or bad, or if you have some problems about setting up the LAMP on jeOS. I’d be glad to help.

Bye!!! 🙂