" />

Howto push a hash onto an array

May 26th, 2009 mrochford 1 comment

This information was giving to me by my friend Matt
use Data::Dumper;
my @array;
push @array, {‘key1′ => ‘value1′, ‘key2′ => ‘value2′};
push @array, {‘key1′ => ‘value1′, ‘key2′ => ‘value2′};
push @array, {‘key1′ => ‘value1′, ‘key2′ => ‘value2′};
print Dumper(@array);

Will give you:

$VAR1 = {
‘key2′ => ‘value2′,
‘key1′ => ‘value1′
};
$VAR2 = {
‘key2′ => ‘value2′,
‘key1′ => ‘value1′
};
$VAR3 = {
‘key2′ => ‘value2′,
‘key1′ => ‘value1′
};

Popularity: 8% [?]

Categories: Perl, Programming Tags:

Finding a hostheader in IIS using Perl and Win32::OLE

May 26th, 2009 mrochford No comments

There is no easy way to find a host header in IIS. Unless you think clicking on each site is easy. I have found it difficult to find them in large installations. I wrote a script that will go through each site on the server and look at the host headers and then if found it will print the Site comment. You then use the site comment to find the main site in the MMC.

Here is the script.

Popularity: 14% [?]

Categories: IIS, Perl, Programming Tags:

Changing all directory paths in Microsoft IIS/Active Directory using perl and WIN32::OLE

May 26th, 2009 mrochford No comments

I was put in charge of a filer migration from a old netapp f810 to a new netapp 3040 cluster. One of the systems we have that used the netapp backend was a web cluster running MS Windows 2003. When it was first built it was using a cifs shares by system name (ie: \\f810..tld\customer-home). This is great if you never changed filers but a poor idea on our part. In theory you could have just changed the record to point at the new filer, but that was a temporary fix. We wanted to change the path completely to a arbitrary name like “web”. This will allow us to change it to any back end device no matter what it is. I like to do things programmaticly so below are the two scripts I used to get the job done. You will need to modify these script to fit your needs (ie: Paths).

Bulk IIS path change script: Link

Bulk Active Directory change script: Link

Popularity: 3% [?]

Categories: IIS, Perl, Programming Tags:

Making your own ringtones for your Iphone (mp3 to m4r)

May 26th, 2009 mrochford No comments

I have done much searching on the internet on how to convert mp3 files to Itunes m4r files. I really dont like using Itunes if I dont have to so I thought I would write something that will use my unix box.

This perl script will convert most mp3s to m4r.

I used 4 applications that can be installed on any GNU based system.

  • mp3info – An MP3 technical info viewer and ID3 1.x tag editor
  • mp3splt – Mp3Splt-project is a utility to split mp3 and ogg files selecting a begin and an end time position, without decoding.
  • Mplayer
  • Faac – FAAC is an open source MPEG-4 and MPEG-2 AAC encoder, it is licensed under the LGPL license.

or if you are running debian/ubuntu:

apt-get install mp3info mp3splt mplayer faac

Popularity: 43% [?]

Categories: IPhone, Linux, Perl, Programming Tags:

May 26th, 2009 mrochford No comments

Nothing motivates like having another programmer tell you they’re rewriting your code because it sucks.

Popularity: unranked [?]

Categories: Quotes Tags:

May 26th, 2009 mrochford No comments

It’s as true in life as it is in client-server programming: the only secret that can’t be compromised is the one you never revealed.

Popularity: unranked [?]

Categories: Quotes Tags: