Sunday 3 April 2016

Require Mutiple Dependencies With Puppet

The puppet cookbook gives a few different options for installing multiple packages at once.
e.g.
    # you can use a global package parameter
    Package { ensure => 'installed' }
    package { 'screen': }
    package { 'strace': }
    package { 'sudo':   }

    # you can specify the packages in an array ...
    $enhancers = [ 'screen', 'strace', 'sudo' ]
    package { $enhancers: ensure => 'installed' }

However, I had over 30 packages to install and needed some of these packages for a subsequent command.

  • If I used an array, the title is the array and you can't use it in require.
  • When I moved the array to name I got the error Name must be a String not Array.
  • If I don't use an array, I will have to chain the 30 package calls with individual requires.

The solution isn't documented on that cookbook page, but instead of using require on the dependent task you can use notify on the package task.
e.g.
    

$packages = [
                'bison',
                'build-essential',
                'ccache',
                'curl',
                'flex',
                'g++-multilib',
                'gcc-multilib',
                'git',
                'gnupg',
                'gperf',
                'lib32ncurses5-dev',
                'lib32readline-gplv2-dev',
                'lib32z1-dev',
                'lib32z-dev',
                'libc6-dev-i386',
                'libesd0-dev',
                'libgl1-mesa-dev',
                'liblz4-tool',
                'libncurses5-dev',
                'libsdl1.2-dev',
                'libwxgtk2.8-dev',
                'libx11-dev',
                'libxml2',
                'libxml2-utils',
                'lzop',
                'maven',
                'pngcrush',
                'schedtool',
                'squashfs-tools',
                'unzip',
                'x11proto-core-dev',
                'xsltproc',
                'zip',
                'zlib1g-dev'
              ]
  package { $packages:
    ensure => 'installed',
    notify => Exec['install repo']   
  }

  exec { 'install repo':
    cwd     => '/usr/local/bin',
    command => 'curl https://storage.googleapis.com/git-repo-downloads/repo >repo',
    creates => '/usr/local/bin/repo',
  }

Monday 9 January 2012

SVN 1.7 New Feature Remote Dumps - svnrdump

I recently wanted to move a project from one svn repo to another, but I also wanted to keep the version history.

This can be done with the svnadmin commands but it can sometimes be tricky so my svn admin declined my request and said I should just check in the latest version!


SVN 1.7 to the rescue!

There is a new feature in SVN 1.7 called svnrdump. This is almost the same as svnadmin dump, although not quite.

The main difference is that you don't need to be an admin (or be on the server) to use it.

The other difference is a pain in the arse as we will see below, but basically svnrdump dumps in the diff format 3 that can't be read by svndumpfilter!

Apparently that was a design choice, but in my mind it was a bad one!


So how did I move the project?

In order to do this process you will need svn 1.7 and uberSVN (or install SVN normally in Apache) installed locally.

I used Cygwin as well to do the piping to svndumpfilter as I wasn’t sure how to do it in Windows.

This example assumes that I have one repo at https://svn.mycompany.net/repos/oldrepo that contains a project that I want to move to this repo https://svn.mycompany.net/repos/newrepo

It also assumes that you have installed svn locally and created a repo called test.

svnrdump dump https://svn.mycompany.net/repos/oldrepo > oldrepo.dmp
cat oldrepo.dmp | svnrdump load http://localhost/test
svnadmin dump http://localhost/test > dump.full
cat dump.full |svndumpfilter include trunk > dump.trunk
cat dump.trunk | svnrdump load https://svn.mycompany.net/repos/newrepo/trunk/clients/ --username myUsername
svn mv https://svn.mycompany.net/repos/newrepo/trunk/clients/trunk https://svn.mycompany.net/repos/newrepo/trunk/clients/oldproject --username myUsername -m "Rename imported trunk to oldproject"

Basically we use the new feature in 1.7 to remote dump the repo. This can take a long time.
We then load it in our local repo.
We then dump it using svnadmin from our local repo. The reason for this is that svnrdump doesn't provide a dump that can be filtered with svndumpfilter.
We then filter it to just include trunk (or you could just specify a certain directory).
We then import this filtered dump into the new repo.
This gave me a dir called trunk so I renamed it to oldproject.

In order for svnrdump load to work you need to have the “pre-revprop-change” pre-commit hook present (it can be empty).

You can do this locally in your own installation whilst testing by creating a file called pre-revprop-change.bat (or pre-revprop-change.sh if you are on Linux - don't forget to chmod +x it!) in your hooks directory, but I still needed my admins to do it for me on my company server. Fortunately they were obliging for this part.


Something to note that can happen if you are testing and the load is aborted.

You can get errors like this:
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
Failed to get lock on destination repos, currently held by 'GH-T624-09:e4464587-ae24-48be-9220-e4d0ecdba17a'
svnrdump: E000022: Couldn't get lock on destination repos after 10 attempts

To work out why you can't get a lock, you need to list all the properties on revision 0.
svn proplist --revprop -r0 http://192.168.56.128:9880/test
Unversioned properties on revision 0:
svn:date
svn:rdump-lock

Its fairly clear here what the lock is. So lets remove it!
svn propdel --revprop -r0 svn:rdump-lock http://192.168.56.128:9880/test
property 'svn:rdump-lock' deleted from repository revision 0

Sunday 7 August 2011

Why LibreOffice/OpenOffice Just Don't Cut It

I like free software and I do my best to contribute where I can.
 e.g. report bugs, update wikis, open-source code I write.

So I tried to use LibreOffice instead of Microsoft Office.
However, although it looks like it should be OK to use it just doesn't cut the mustard.

Let me give you some examples of things that work in Excel (and have worked since as far as I can remember).
Dragging cells.
Select a range of cells then drag it to a new place.
In Excel the pointer changes when you hover over the border of the range and you drag it to a new place. Every time.
In Calc the pointer doesn't change and a large proportion of the time I end up creating a new range instead!

Tooltips
Excel has tooltips on all the toolbar buttons.
For some reason in Calc none of the tooltips appear on the toolbar buttons.

Text wrapping
- I downloaded a file from Google Docs that had the wrapping on a cell that meant I couldn't see the whole contents.
In Excel it was immediately obvious that this was the case (highlighted in the ribbon).
In Calc I still havn't managed to find out how to turn this on and off!

Row height 
In Excel I can see the row height in pixels as I resize and can set them all to 17.
In Calc I have no idea if all my rows are the same height or not as there is no feedback.

Now these look like trivial problems and they should come second to things like making sure the calculations are correct.
On the one hand that is true, on the other hand; if I am frustrated at every turn in every little operation I do, I'm just not going to bother even finding out if the calculations are correct because I've stopped using the application.

Now its not just LibreOffice that suffer from this.
I see it in million dollar trading systems too.
People need to spend more time on the small details and add some polish to applications.
Spend 1 day a month doing little things, like making sure that your text boxes have context menus.
Or hire new staff and put them on all the low priority work to get used to it.

Don't underestimate how much people will slag off your application for the tiny flaws.
Don't forget about the big calculations but don't neglect the polish!

Sunday 1 May 2011

Something From Eclipse That Isn't A Stinking Pile Of Horse Shit

Your first thought when reading the title must be "that can't be true!" and I would normally agree with you.
Everything that comes from IBM is a pain in the arse to work with and eclipse is no exception.
However, there is a small beam of light in the pit of hell that is working with eclipse.
Google has bought WindowBuilder Pro and made it available for free.
http://mashable.com/2010/12/19/google-java-eclipse/
Apparently this is worth $5M - not surprising it costs so much to make anything half decent out of eclipse!

I know that this is old news but people still don't seem to be aware of it.
This probably isn't surprising though as eclipse users are so afraid of change they wont even add a new plugin in case it craps over their installation and they have to start again from scratch (and people say the plugins are eclipse's best feature! - shows you how shit everything else is!)

Anyway, time to switch on the positive hat;
Although it doesn't look as nice as the Netbeans editor (it feels all squashed in) it has 2 redeeming qualities that have allowed me to add eclipse on to my system.
  1. It can read Netbeans forms so you are no longer tied to Netbeans if you started your work there
  2. It can read hand written code!
The latter is especially useful when picking up old code from someone else that you need to tidy up.

As much as it pains me to say it, this is something from eclipse that isn't a stinking pile of horse shit
Give it a go
http://code.google.com/javadevtools/download-wbpro.html

EDIT: It is now included in the default installation of eclipse

But afterwards, don't forget to go back to IDEA ;)
There is a free version available now too.
http://www.jetbrains.com/idea/

Monday 28 February 2011

IBM Sales Team - I Salute You!

No-one can hold a candle to the IBM Sales Team.
Nearly all the stuff they peddle is an utter nightmare to work with yet they still manage to get it in nearly all the big banks I contract in.

Q: What's the biggest technology mistake you ever made - either at work or in your own life?
A: When I was at IBM, I started a product called Websphere...


How do they do it?
Is it bribery?
Magic?
Do they have a silky smooth lube with a scent of pheremones that bank management can't resist?

It must be, because whatever crap they have the banks seem to just bend over and take it!

IBM Sales Team - I Salute You!

IBM Engineering Team - you can burn in hell :P 

Sunday 27 February 2011

My (Mostly Bad) Experiences With The Netbeans Platform

First off, I'd like to say that my day-to-day programming is with Intellij IDEA (note that there is a free version available now) but I do prefer Netbeans for GUI designing.

A friend of mine suggested trying out the Netbeans 'Platform' for a new project that we had plans for.
The philosophy sounded great - the platform would help to create windows with a tested layout system and would contain useful modules such as database integration etc.

However, the result was less than pleasing.

I didn't want to dive straight into the big project so I thought I would start off with something small.
An SVN client.

Netbeans already has SVN support built in so it should be easy to create an SVN client right?
Just strip off the rest of the components and there you go right?
Well not so easy.


Posting on the Netbeans forum publishes your email address!
WTF??
So what if it is synchronised to a mailing list.
If I register a user on a web forum, I don't expect my email address to be available to anyone on google!
I had to create a new email address specifically to post on the forum.


The platform is not intuitive at all.
When you go to File - New Project there are Netbeans Modules Samples available:


The samples get created nicely and they run giving you nice examples but when you look at the code it doesn't make any sense.
Where is all the code?
Time to read the tutorials!


The samples aren't at the right level to start with
e.g. browse though the CRUD Tutorial and see if it makes any sense
I didn't get to the bottom of it before closing the page so I didn't notice a link to the Learning Trail

However, this isn't laid out well either because it doesn't tell you where to start.

(For reference if you do decide to start after all my ranting you should look at the HTML Editor)


The community is poor.
Now I realise that the forums aren't my own private support line and that people have now obligation to reply.
However, most other forums with a good community have a good turnover on replies.
e.g. http://www.vbforums.com, http://devnet.jetbrains.net/community/idea/eap, http://forums.opensuse.org/ etc

My first question was basically asking for pointers on where to get started and took 5 weeks and 2 bumps to get any response!

My second question was similar but got no response at all :(.

At this point (2 months on and off - mostly off) I have managed to get some sort of semblance going.

I ask a question about how to modify the menus and get no response either.

IDE change screws you up
Now, I mentioned above that I generally use IDEA so I tried to use it for this without any luck.
Although Geertjan posted info on how to import the project, the project doesn't really make much sense outside of Netbeans.

However, you would think it would be OK in Netbeans though right?
Well, I updated to Netbeans 7beta and now my project doesn't work!
I get ClassNotFoundExceptions
e.g.  org.netbeans.modules.subversion.ui.update.UpdateWithDependenciesAction
and my Window is missing panels!

The Configuration Is Magic XML 
Your application is configured in a file called layer.xml.
This seems nice in some way because you make a small change and "bam!" you have a new toolbar easy as pie.

However,  where you take a look at it, it is all backward.
Here is a snippet of my Toolbar, try and work out what it looks like
    <folder name="Toolbars">
        <file name="Build_hidden"/>
            <file name="Debug_hidden"/>
            <file name="Memory_hidden"/>
            <file name="QuickSearch_hidden"/>
    </folder>
Thats right! It has the following
  • New
  • New Project
  • Open Project
  • Save All
  • Undo
  • Redo
Couldn't you tell??
Thats because instead of specifying what is to be put IN, you specify what is to put taken OUT.
Riiiigggghhhht!!!

Can't Modify Existing Modules
So at this point I had a window and an svn pane, but I didn't really like the fact that it had its own little toolbar attached.
I wanted to use my main application toolbar - especially as I would put more useful stuff on it.
Plus it wasn't filling the main window, it was only sliding in and out from the bottom.
Well, guess what?
This seemed impossible to change and it looked like I would have to write it from scratch!
I asked on the forums, but what a surprise! Nobody replied!

My advice is to stay away from the Netbeans 'platform'.
Its a pain in the rear and a waste of your time!