Wednesday, November 18, 2015

Welcome Git, Thanks SVN!

First, I have to said that this is a late welcome, because Git has many years, I think 10 years as I'm writing this guide.

Several years have passed since I worked with different SCM, I started using CVS, then I migrated to SVN. Yes I'm think I'm getting older.

Since SVN, I thought there was nothing better and simpler until I get to know Git. First I said, why I should bother to migrate, this could be very tedious and long work, but let's face it, once you start using Git you'll never want go back.

But enough talking, here are the steps on how did I migrate from SVN to GIT my repositories.

Migrating from SVN to GIT


1. Checklist

You will need the following:

  1. Git installed in your system
  2. SVN installed in your system
  3. git-svn installed
  4. An SVN Repository you will migrate

2. Check git-svn


$ git svn --version
git-svn version 2.6.2 (svn 1.7.20)
If you don't have it installed you will see something like this:
$ git svn --version
git: 'svn' is not a git command. See 'git --help'.

Did you mean one of these?
 fsck
 show
Don't worry, if you are in Ubuntu, just hit this command:
$ sudo apt-get install git-core git-svn

3. Create Users File

You will need a file to map each user from SVN to Git.
For this guide create: users.txt

jdoe = John Doe 
pepe = Jose Perez 
bob = Bob Doe 
To see all users, on the existing SVN repository run this command:
$ svn log --xml | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /'

4. Clone SVN repository

Warning: Depending on the size of your repository this could take a long time so you should sit tight.

If you have an satandard layout, as

  • trunk
  • branches
  • tags
You can use option --stdlayout like: In my case I had some troubles, because I had some branches not under branch, something like this:
  • trunk
  • trunk-old
  • branches
  • tags

5. Check the repository

Go to your new new repo directory "project1-tmp".
Check all branches with:

  $ git branch -la
In this step you will have several Git branches:
  • branches like remotes/branch1, remotes/branch2, ...
  • tags like remotes/tags/tag1, remotes/tags/tag2, ...

6. Fix tags

SVN "tags" are no different than branches, and with this command you will create a Git tag and delete every branch that starts with remotes/tags/* Run this command to create Git tags:
Now check your tags and branches with

  $ git tag
  $ git branch -lr

7. Fix Branches

If you want to keep branches you should create a local branch for each remote branch. For exampe:

  $ git checkout -b local_branch remote_branch
You can use this script to generate shell commands (copy & paste), and then remove the ones you don't want. Don't forget to skip master.

8. Share your repository

Now you can change to a service like GitHub or BitBucket. Adding the origin and later push branches and tags. Replace URL: with your actual repository



References:

Tuesday, August 4, 2015

The volume "boot" has only 0 bytes disk space remaining

Disclaimer:

Please only do it if you know what you are doing and at your own risk!.


Last time I wanted to update my Ubuntu with the software updater and then I got this message:

The volume

Then I wanted to install updates using terminal (sudo apt-get upgrade command), and this includes new Kernel to my Ubuntu 14.04 dev box, but it failed to install new kernels, because I got no space left on my boot partition. You can see how much space left you have on your machine, open a terminal window and with the following command: df -h

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root  212G  199G  2.7G  99% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         3.9G  4.0K  3.9G   1% /dev
tmpfs                        788M  1.4M  787M   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         3.9G  1.3M  3.9G   1% /run/shm
none                         100M   64K  100M   1% /run/user
/dev/sda2                    237M  192M   33M  86% /boot
/dev/sda1                    511M  3.4M  508M   1% /boot/efi

As you can see I only have 33 MB left on my /boot partition.
So next we are going to see installed kernels on your system:

$ dpkg --list | grep linux-image
ii  linux-image-3.16.0-39-generic ...
ii  linux-image-3.16.0-40-generic ...
ii  linux-image-3.16.0-41-generic ...
ii  linux-image-3.16.0-43-generic ...

Now we are going to see which Kernel version is running now:

$ uname -r 
3.16.0-43-generic

So we have kernel version 3.16.0-43-genericas currently. So we are going to remove in this case 3.16.0-39 and 3.16.0.40. You can use this command

$ sudo apt-get purge linux-image-3.16.0-39-generic
$ sudo apt-get purge linux-image-3.16.0-40-generic
or 
$ sudo apt-get purge linux-image-[tab][tab] (Yes tab key to auto-complete.)

Now you can update your Ubuntu as usual, with a simple:

$ sudo apt-get upgrade


References:

Thursday, July 16, 2015

Ubuntu 14.04 "System program problem detected"

Have you turned on your Ubuntu 14.04, and suddenly found this message: System program problem detected.

This is the crash report for Ubuntu, normally it should go away, but sometimes it come backs on every boot. So what I do, it's just as simple to remove all files from /var/crash directory.

To remove crash report files, you only need open a terminal window (Ctrk-Alt-T) and type the following command:

$ sudo rm /var/crash/*

I hope this helps you to stop displaying this messages.

Saturday, July 4, 2015

How to get java version used to compile a Class file

I been working with an old java legacy code. The problem is that I have access to the SVN Repository, but we're not sure if the code is in sync with production. So I grab the ear file that is in production and wanted to know which java version was used to compile.

The solution was easy using javap command, which is an disassemble tool for java.

 $ javap -verbose ConsultasVariasEJB.class | grep "major"

We found major version: 49, which means JDK 1.5. I you want to see the complete list please see my post Java Class Versions.

References:

Tuesday, June 30, 2015

USB devices not working on my Virtualbox

As I'm now moving to Ubuntu exclusively! but wait I need to do some things to do in Windows. So I had to install Virtualbox and then suddenly I have to connect some USB dongle into my Virtual Windows, but sadly it didn't work.

I did my research on internet, so the problem was easy to solve, just add the user that it's running Virtualbox to the vboxusers group, like this:

$ sudo usermod -G vboxusers -a YOUR_USER

But for some reason, it didn't work until I restarted. Maybe I just only needed to log out and log in back.

Also if you need it, you can list all your USB devices connected to your Ubuntu with this command:

$ lsusb

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 2232:1029
Bus 001 Device 006: ID 0cf3:3004 Atheros Communications, Inc.
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 003 Device 004: ID 04b9:0300 Rainbow Technologies, Inc. SafeNet USB SuperPro
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

References:

Monday, June 29, 2015

Java Class Versions

Last week, I was trying to compile an old code written for JBoss 4.3.2. When I was deploying I got this error message:

Unsupported major.minor version 51.0

But for reference here is the list of class file version with java version:

Java SE 8 = 52
Java SE 7 = 51
Java SE 6 = 50
J2SE 5.0 = 49
J2SE 1.4 = 48
J2SE 1.3 = 47
J2SE 1.2 = 46
JDK 1.1 = 45

The complete error message:

  Bean   : MyClassEJB
  Section: 22.2
  Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the  element.
  Info   : Class not found on 'com.mypackage.ejb.MyClassEJB': Unexpected error during load of: com.mypackage.ejb.MyClassEJB, msg=com//mypackage/ejb/MyClassEJB : Unsupported major.minor version 51.0

The problem was that my Eclipse was running with Java SE 7. And because it was a old project (no maven, nothing modern), all class files were stored in a "bin" directory with version 51.0 (Java SE 7).

Later with an ant script, running with Java SE 6, all files were packaged. But the class obviously were in Java SE 7. That was my issue at deploying time.

Sunday, June 21, 2015

Color Picker for Ubuntu

I'm used have a color picker on my Windows dev machine called Color Cop. But now I found a replacement for my Ubuntu 14.04 called Gpick, so it's very easy to install just do:

 $ sudo apt-get install gpick
Happy coloring your html files.