Wednesday, January 4, 2017

Starting with Arduino

If you are just starting your Arduino journey, this could be a good place to start. As part of my job as a Senior Developer, I held an internal workshop for the IT department where Developers, Architects, Project managers, Devops and others could come and learn what you can do with Arduino. This resulted in a powerpoint presentation plus a number of guides I made to ease getting started. Please do comment if you find these useful, and if you have any additions, let me know! Enjoy.

Thursday, February 26, 2009

[VPN] How to install Cisco VPN client on Ubuntu

Here is a quick guide on how I set up Cisco VPN client.
  1. Install the "patch" tool if you haven't done already, eg. run "sudo apt-get install patch".
  2. Download the client: http://tuxx-home.at/vpn/Linux/vpnclient-linux-x86_64-4.8.01.0640-k9.tar.gz to whatever location.
  3. run "tar zxvf vpnclient-linux-x86_64-4.8.01.0640-k9.tar.gz"
  4. Go to the new dir, eg. "cd vpnclient"
  5. Download the patch that matches your kernel into the directory where your vpn client was extracted. In my case: http://projects.tuxx-home.at/ciscovpn/patches/vpnclient-linux-2.6.24-final.diff
  6. Run "patch < vpnclient-linux-2.6.24-final.diff" in the directory where you extracted the vpnclient.
  7. Install the vpnclient by running "sudo ./vpn_install" and follow the instructions.
  8. Start the vpn client: "sudo /etc/init.d/vpnclient_init start"
After installation you can add the VPN profiles you need (pcf files) to the cisco profile directory "/etc/opt/cisco-vpnclient/Profiles/".

Once everything has been set up, use "sudo vpnclient connect <your-vpn-profile>" to connect to the VPN.

That's it!

Enjoy!

Tuesday, January 6, 2009

[CVS] How to overwrite all files in HEAD/TRUNK with all files from a BRANCH.

If you are using CVS and have a branch that contains whatever code is in production, and you use HEAD/TRUNK for future development, you can sometimes end up in situations where you really want to overwrite whatever is in HEAD/TRUNK with the latest production version from your BRANCH.

In this and many other cases the following might come in hand...

The bottom line is that you need to execute the following four cvs commands:
Reset sticky tag:
   cvs up -A <Filename>
Update from branch:
   cvs update -r<YourBranchName> -p <Filename> > <Filename>
Add uncommitted files:
   cvs add <UnCommmittedFilenames>
Commit changes:
   cvs commit

In case that wasn't enough for you, here's a little more info that I hope will be understandable... Otherwise, just ask!

Preconditions:
- Run UNIX bash shell... :)
- filenames and pathnames can contain spaces (as the bash "for" will split the filename into separate files).
- Two directories exist, one with the development HEAD/TRUNK version called "/home/me/myproject_head" and one with the production BRANCH called "/home/me/myproject_branch".
- No new directories have been added/removed. If you have added or removed any directories you need to modify the bash commands below with something like "mkdir -p $i" (also remove the filename from $i) for creating the directories that doesn't exist.

Start out by removing all the files you have in your HEAD/TRUNK directory
for i in `find /home/me/myproject_head -type f \
   | grep -v CVS`; do rm $i;\
   done;

In the above case, I've added a grep -v for "CVS" as all files/directories containing this name should be excluded from the deletion, since we need these files if we later on want to commit (and we do!).

Now copy all files that you want to replace from the BRANCH directory to the HEAD directory.
Start out by running a "cd /home/me/myproject_branch".
for i in `find . -type f \ 
   | grep -v CVS | grep -v "org.eclipse" \
   | cut -b 3-`; do \
   cp /home/me/myproject_branch/$i `echo "/home/me/myproject_head/$i"`; \
   done;

In this case i have chosen not to copy the CVS directories (a MUST), however I've also chosen to exclude the org.eclipse from the copy, as I have directories that are eclipse specific that I don't want to copy. You can add more " | grep -v partialname" if you wish.

So, now we can work on the new files with the old cvs structure.

First we need to make sure no sticky tags exist:
for i in `find /home/me/myproject_head/ -type f \
   | grep -v CVS | grep -v "org.eclipse"`; do \
   cvs up -A $i; \
   done;

Then we replace the files in HEAD/TRUNK with the ones from the BRANCH in cvs:
for i in `find /home/me/myproject_head/ -type f \
   | grep -v CVS | grep -v "org.eclipse"`; do \
   cvs update -rMY_PROJECT_BRANCH_XX -p $i > $i; \
   done;

This states that we want to take all the files in our local HEAD/TRUNK version and overwrite them with the versions that exist in the "MY_PROJECT_BRANCH_XX" branch in cvs.


Finally, before we call commit we need to add all the files that exists in the BRANCH but haven't yet been added to HEAD/TRUNK. This requires that you execute "cd /home/me/myproject_head/"
for i in `cvs -nq up | grep "? " | cut -d " " -f2 `; do\
   cvs add $i; \
   done;

Now we are ready to commit:
cvs commit -m "REPLACED HEAD/TRUNK WITH BRANCH"

That's it... You should now have a working HEAD containing the same as the stuff in your BRANCH!

The example above can probably be simplified, however this is how I did... Feel free to comment if you have a more simple solution!

Enjoy!