Meteor User Seed

I have been trying to build a site with Meteor and have slowly started getting stuff working.

One of the ways to populate your development data has been with database seeding.

I wanted to link a user account with a document in one of my collections so I worked this out from the documentation.

You add users to the users collection this returns the userId for the new user which you capture in a variable that you use to insert the userId into your second collection.

if (Meteor.users.find().count() === 0) {
  seed1UserId = Accounts.createUser({
    username: 'lance',
    email: 'l@oo.com',
    password: '123456'
  });
  seed2UserId = Accounts.createUser({
    username: 'david',
    email: 'd@oo.com',
    password: '123456'
  });
  seed3UserId = Accounts.createUser({
    username: 'glenn',
    email: 'g@oo.com',
    password: '123456'
  });
  seed4UserId = Accounts.createUser({
    username: 'martin',
    email: 'm@oo.com',
    password: '123456'
  });
}

if (MasterList.find().count() === 0) {
 
  MasterList.insert({
    firstname: "Lance",
    lastname: "James",
    user_id: seed1UserId
  });

  MasterList.insert({
    firstname: "David",
    lastname: "Cope"
    user_id: seed2UserId
  });

  MasterList.insert({
    firstname: "Glenn",
    lastname: "Manner",
    user_id: seed3UserId
  });
  
  MasterList.insert({
    firstname: "Martin",
    lastname: "Drone",
    user_id: seed4UserId
  });
}

Quest NDS Migrator LogFile Parser

I am currently helping a customer migrate from Novell to Microsoft and they are using the Quest migrator product to move their data to new DFS servers.
They currently have a large amount of data stored on a number of volumes. The sheer number of volumes and data have required that they deploy a large number of the copy engine servers.
The copy engine does not utilize a central logging facility, it stores the logfiles in a folder alongside the copy engine.
This unfortunately has a side affect, that there are now quite a few log files and some are reaching over 1.5GB in size.
Trying to load these files into a text editor as proven impossible and unworkable and another way was needed.

I decided that the best way to achieve this was to use a script that would parse the log files and extract the errors from the files into another file that would be smaller and easier to work with.

I decided to use Powershell as the scripting language as it would run on the new infrastructure and could be run on a copy engine server with enough disk space.

I undertook quite a bit of research and trial and error but eventually I have a working script.

This script is not signed so you will either need to sign the script to run it or elevate the privileges with set-Executionpolicy on the system you are going to be using.

The script uses two files the main script file and a csv file with the volume names and copy engine server names.

Below you will find a copy of both. I have also created a git repository that you can find on GitHub if you would like to help make it better

Original PowerShell Script

[codebox 1]

Original CSV File

[codebox 2]

Building the new Bongo Admin UI

A while ago Alex (so_solid_moo to the IRC channel) created a php binding for the Bongo API. He also created the start of the new UI that we are working towards.

We started with the admin ui for now as we have created a user interface with the roundcube project that Alex also integrated with.

I stared porting the current Dragonfly assets into the project and I tried to stick to the old design style as much as possible as I really loved it’s look and feel.

After a bout a week I was done and submitted it to the git repo of the new project.

Although I was glad that we had stared the project and that I had done as well as I could on the pretty bits I was not quite happy with the quality of the work.

I was going through my git repo’s this weekend and found the twitter git repo where they have open sourced all their CSS (Cascading Style Sheets) http://twitter.github.com/bootstrap/ this inspired me to see if I could use this as it was MUCH better quality CSS that what I could come up with.

So I started work on the migration as an experiment and from the word go it was so much easier. Their default styles just make sense and to alter or add my customisation took only a very few lines of CSS code.

I was extremely grateful for this as it will enable us to improve our UI as we go along. you can find the new webui in Alex’s github project here.

Thanks twitter

How to copy custom attributes when migrating vmware vcenter to new database

I recently had to move hosts and guests to a new vcenter server as the old server had become corrupt and full of issues.
The current vcenter has a few custom attributes and notes that would not be transferred as part of the move.
So I wanted to use powercli to read the attributes out and put them back.

To export the attributes I used the script below.
You will need to add as many Key Value pairs as you have custom attributes

#load Vmware Module
Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer -User 'VMUSER' -Password 'USerPasswd221' -Server 'vcenter1'

$vmlist = get-vm
$Report =@()
foreach ($vm in $vmlist) {
$row = "" | Select Name, Notes, Key, Value, Key1, Value1, Key2, Value2, Key3, Value3
$row.name = $vm.Name
$row.Notes = $vm | select -ExpandProperty Notes
$customattribs = $vm | select -ExpandProperty CustomFields
$row.Key = $customattribs[0].Key
$row.Value = $customattribs[0].value
$row.Key1 = $customattribs[1].Key
$row.Value1 = $customattribs[1].value
$row.Key2 = $customattribs[2].Key
$row.Value2 = $customattribs[2].value
$row.Key3 = $customattribs[3].Key
$row.Value3 = $customattribs[3].value
$Report += $row
}

$report | Export-Csv "c:\vms-with-notes-and-attributes.csv" -NoTypeInformation

It should produce a csv file that looks something like this

VMNAME,NOTES,CREATEDATE,CREATOR,DEPLOYDATE,TEAM
vmguest1,note1,12/29/2011,Bob,12/30/2011,Web
vmguest2,note2,12/29/2011,John,12/30/2011,Accounts
vmguest3,note3,12/29/2011,Paul,12/30/2011,Database

Once you have exported the file you need to import it into the new vCenter
again adding Key Value pairs as needed.

#load Vmware Module
Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer -User 'VMUSER' -Password 'USerPasswd221' -Server 'vcenter2'

$NewAttribs = Import-Csv "C:\vms-with-notes-and-attributes.csv"

foreach ($line in $NewAttribs) {
set-vm -vm $line.Name -Description $line.Notes -Confirm:$false
Set-CustomField -Entity (get-vm $line.Name) -Name $line.Key -Value $line.Value -confirm:$false
Set-CustomField -Entity (get-vm $line.Name) -Name $line.Key1 -Value $line.Value1 -confirm:$false
Set-CustomField -Entity (get-vm $line.Name) -Name $line.Key2 -Value $line.Value2 -confirm:$false
Set-CustomField -Entity (get-vm $line.Name) -Name $line.Key3 -Value $line.Value3 -confirm:$false

}

Hope this helps someone.

Learning Ruby and rBongo with WeBongo

This post should have been written quite a while ago as I wanted to start documenting my efforts to learn to program using Ruby. As most of you know I have been trying for a while to teach myself to programe.

I started my efforts with a course in c# at a company in London, the course was just great and the instructor was a fantastic guy. Unfortunately life meant I could not practice at all. I worked for a company for a year that gave me no opportunity to play during the day and having a newborn baby left my wife and I looking more like zombies that real people.

Then things changed the year before last when I Joined Forward as a contractor to help them with their Virtual infrastructure. This company is completly different to anywhere I have ever worked before. Normaly as a contractor you are shoved in a corner and beat with a whip so that they get the most out of you, here at Forward this is definitly not the case.

Forward has some really great intelligent developers who are a pleasure to work with and be part of and that is where I was going with this post.

A short while ago Fred George held one of his famous OO Bootcamp training sessions and I was lucky enough to be invited to join and true to Freds statement he tries to keep the course at a level where you always feel stupid and belive me I felt REALLY stupid. The good thing about feeling stupid was I actually learnt something. You kind of learn to program by accident (quoting Tom Hall).

This is where the Ruby, rBongo, WeBogo bits come in. Fred uses Ruby to illustrate OO programming best practice and to help you understand OO in general a side effect of this is that you start learning ruby syntax and start learning the programming vocabulary needed to accomplish the tasks, having gained some experience with ruby during the course I thought it best to use ruby to continue learning to program.

I have been working on Bongo since it was founded and the other day I was speaking to Alex the project lead and we realised it is almost 10 years now. I have always wanted to contribute more than just packaging the app on the OBS and being available to do testing and such. Alex wrote the PHP binding for the Bongo Store and having seen what some of the guys can do at Forward with Ruby and jQuery I wanted to create a binding for the store in Ruby and create a gem from it thus allowing anyone to create the best REST interface ever.

This is forcing me to learn TCP Sockets win Ruby and other nice things. I will try to document as often as I can what I am upto on this.

My efforts will be on 2 Ruby projects. Initially I will need to work on rBongo which is the ruby binding for the Bongo store I am sure most of the developers at Forward could probably write this in a day or so, hopefully I can convince one or two of them to help out .

My second effort will be on WeBongo the REST webui for the Bongo mail store. I have other ideas for the webui once we have a working solution (using it as a sync destination for Tomboy desktop notes)

Please keep that in mind as I try to get this working.

vMware workstation 6.5.3 on openSUSE 11.2

I have just upgraded to 11.2 from ubuntu 9.10 on my IBM / Lenovo T61 laptop. ( I will post a better blog about that later)

What I wanted to mention here is that the current vMware workstation 6.5.3 does not want to run on my system.

I have found this post http://k—–k.blogspot.com/2009/09/install-vmware-workstation-653-on.html

Which has steps for compiling the modules yourself but by the look of things is based on 32bit openSUSE.

I will see if I can get it working here on my 64bit machine

HTC Hero owner

Over the weekend I was able to have my mobile contract changed and part of the deal is that I get an HTC Hero.

This has made me quite happy as I have been forced to run windows mobile on my old phone for far to long and it is refreshing that I have an android phone.

The first thing I noticed was that the box was really small, I wondered if they had actually just given me the charger by mistake.

As soon as I had opened the box the shiny new black phone was there and there was even place for the charger. In past occasions when I have taken possession of a new phone I dumped the box and manual and turned on the phone, because how difficult could it be to use it?

I went against my better nature and actually looked for a manual in the box and there was none, at first I thought that HTC had eventually realised that Men NEVER read the manual and had not provided one as it was just wasteful and well useless. I dutifully plugged the phone into the socket and waited for the phone to charge, this did not take very long as I was able to turn the phone on after only 2 hours and the battery reading said full. I was in business.

I started clicking round on the application list and found the pdf reader. I thought that would be a good thing to have. When the app opened I realised that HTC had just moved with the times and supplied a PDF user guide all 200+ pages of it.

One of the things that annoys me is that your contacts get synced to a google account. I really don’t like that at all. My contacts are MY property and I want to keep it that way.

I have searched for some time now for a contacts app that allows you to use the phone without contacting google or some other company to store your data. I have looked at what it would take to code my own one and then realised I can’t code……. say no more.

I would really appreciate any help in finding this killer app for my system.

I am really excited that we could develop an app for android or the iPhone that interfaces with our whole system and then this problem goes away. I just can’t wait. Enough for now I need to search for my contacts app.

EDIT: I just realised that I forgot to mention that there is no app I can find that will sync your evolution/thunderbird PIM to the android system. I have searched high and low but as far as I can tell nothing exists.

Boy I wish I could code

Bongo 0.5.2 Package Released on rPath

The new Bongo package has been compiled, packaged and promoted so it should now be available to those running the images.

This version has a number of fixes that were highlighted by the change to the cmake compiler.

Thanks to the hard work of Alex and Patrick we are now in a position to say the the mail store is now stable. I can’t wait for the changes that we will now be implementing on the web front.

The images can be found here

Enjoy

Mono Goings On

I too have been watching the Mono debate with some interest as I am in the process of creating a Mono API for the Bongo Store.

This interests me as I do not want to spend time working on something that will stop any distribution from running such a great app like Bongo.

What worries me more is the character assassination and blatant lie telling that has been going on to in some way justify what is being said by the Mono haters. I wholly agree with Alex’s take on the subject you can find here. I think that this will have an affect on the community but I am not sure what affect it will be.

I hope this is sorted out soon and that the lines get drawn and clarity starts coming to the situation.

I wish the Mono project the best of luck for the future.