VMGuru.com - Home of the Virtualization Gurus

Our Books REALLY are Available Now!

Don’t become overwhelmed by your VMware Infrastructure project. Use the books that tens of thousands of others have used to design, plan, and implement their virtual infrastructures.Download Now!

Fun with PowerShell - Calculate Permutations PDF Print
Written by Scott Herold   
Saturday, 13 June 2009 22:17

I got sidetracked on Twitter tonight with a conversation between @jasonboche and @vmdoug, and since my wife is out of town visiting family I figured what better way to spend a Saturday night than to write a quick PowerShell script that can calculate the number of unique permutations based on 2 criteria.

First is the total number of available elements.  in this case, we were looking at the number of available URL combinations on bit.ly before they would "run out".  Without spending any more than 15 seconds investigating, I determined that bit.ly uses only alphanumeric keys, but is case sensitive.  That means we have 26 uppercase letters, 26 lowercase letters, and 10 integers (0-9).  That gives us 62 total elements.

The second criteria is the number of total elements used in the combination.  In this case, bit.ly still uses 5 character URL strings.

The math behind this is something that I actually still remembered from high school oh so many years ago and is P = n!/(n-r)! where P is the number of Permutations, n is the total number of available elements, and r is the number of elements used in the combination.

Borrowing a function from stackoverflow.com (The nested loop calculation was pissing me off so I had to cheat), I was able to put together the following PowerShell script that can rather quickly do basic permutation calculations.

function factorial( [int] $f ) 

$result = 1
if ( $f -gt 1){
$result = $f * ( factorial ( $f - 1 ) )  
}
$result
}
 
function permutation( [int] $n, [int] $r )
{
(factorial $n) / (factorial ($n - $r) )
}
[int] $n = Read-Host "Total number of available elements:"
[int] $r = Read-Host "Total number of elements in combination:"
 
if ($n -ge 1 -and ($n - $r) -ge 0) {
permutation $n $r
}
else{
Write-Host "Invalid input parameters"

 

So, when all is said and done, by using this script we can determine that when using 62 total elements in 5 element combinations, bit.ly currently has 776,520,240 URL combinations available.  if they were to change to a 6 character URL, the number jumps to 44,261,653,680, in addition to the 776,520,240 combinations from their 5 character URLs.  I think its safe to say that as long as the bit.ly database can handle the load, we don't need to worry about them running out of URLs any time soon.

 
Chapters 7 and 8 and Permutational Math PDF Print
Written by Scott Herold   
Saturday, 13 June 2009 21:29

I want to give a special thank you to Jason Boche for getting me all wrapped up in permutation calculations around the number of possible bit.ly permutations before they will need to add a 6th character to their strings (776,520,240 for those interested).  He through out a tweet mentioning my math skills and to check out my free chapters.  At that point I quickly got that sinking feeling in my stomach which quickly reminded me "Holy crap I'm behind".  Without further ado, I give you a two-for and introduce Chapters 7 and 8 from books 1 and 2.

 

 
More Chapters Coming Soon PDF Print
Written by Scott Herold   
Monday, 25 May 2009 02:36
So, I'm sitting here in the Quest Denmark office in Copenhagen, and suddenly remembered "Oh yeah, I'm supposed to be releasing free chapters".  Unfortunately, I only have Acrobat installed on my desktop computer at home and do not have it installed on my laptop.  After I complete my current tour of Europe on the 30th of May I will make sure I post the next few sets of chapters that I have fallen behind on.  Since I can't PDF the individual chapters, I guess there is nothing to do but have some Carlsberg (Yes, I can see their corporate offices from my office window) and enjoy my first visit to Copenhagen.
 
Resolving Improper Memory Limits on your Virtual Machines PDF Print
Written by Scott Herold   
Monday, 11 May 2009 12:14

Last week I posted an article that talked about what happens on an ESX Server when a virtual machine has a memory limit set lower than the amount of memory assigned to that virtual machine.  Sound confusing?  If so, head over and read the original blog post.

The short version is that the situation is simply not good, and has major performance implications across the ESX Host, and potentially across the whole infrastructure.  Today, I want to show how you can simply identify and resolve this significant VMware Infrastructure issue using some simple PowerShell commands.

 
IT Knowledge Exchange Blogger of the Week PDF Print
Written by Scott Herold   
Monday, 27 April 2009 14:35

I'm way behind on just about everything due to some travel last week, but while I was gone, I was actually honored with the IT Knowledge Exchange "Featured IT Blogger of the Week" award.  I'm still waiting for my trophy and pile of cash to show up, but in the meantime at least I have some bragging rights!

Thank you IT Knowledge Exchange!

 
Chapter 6's Released PDF Print
Written by Scott Herold   
Friday, 17 April 2009 12:53

As promised when i did the unthinkable and did a 2-Part blog post to make you guys come back *gasp*, 2 days in a row, I'm making Chapter 6 from Book 1 and Book 2 of the VMware Infrastructure 3: Advanced Technical Design Guide available.

 
Conception of a Turtle - Part 1 PDF Print
Written by Scott Herold   
Thursday, 16 April 2009 18:47

As many people have hopefully noticed, yesterday marked the release of Virtualization EcoShell from Vizioncore.  Virtualization EcoShell is a freeware desktop toolkit for VMware administrators based off Windows PowerShell technology.  When get out to customer sites or am at trade shows I am often asked “Where did this idea come from?”, or “Wow, what into getting this available?”  For this blog series, I figured I’d give everyone some insight into what went into taking Virtualization EcoShell from conception to delivery.  The trick will be doing so in a way that doesn’t put everyone to sleep.  I’ve decided to split this post into two parts that I will release over two days.  In exchange for making you guys come back both days, I’ll post another chapter a week early right after I post Part 2 tomorrow.

 
Memory Behavior when VM Limits are Set PDF Print
Written by Scott Herold   
Monday, 27 April 2009 11:23

There was a big buzz going around on Twitter this morning about memory management mechanisms implemented by the VMkernel in the event that a Guest OS has a limit set that is under its total assigned value.  The conversation was kicked off from Arnim Van Lieshout's blog post on memory management.  This is NOT a good scenario to have in your ESX environment, and I have seen it many times due to lack of education on what setting a limit means, or simply having a bad template deployed throughout the environment.  I want to start by saying that I am not 100% sure this is exactly what the VMkernel does, but having seen it, troubleshot it, and written rules in enterprise virtualization monitoring products around the behavior, I have a pretty solid base of understanding.

 

 
Conception of a Turtle - Part 2 PDF Print
Written by Scott Herold   
Friday, 17 April 2009 12:21

This is the second part of my blog post in which I give people a little insight into the "Behind the Scenes" of bringing Virtualization EcoShell to life.  Why did I do it, Why did I choose PowerGUI, etc.  My goal is to give people just a little appreciation into the amount of effort it takes to bring new ideas to market (and to do it for free!).

 
VI3: ATDG Chapter 5s PDF Print
Written by Scott Herold   
Wednesday, 08 April 2009 19:57

It's been a while since I've been able to take a breather and get the next set of book chapters online for download, but I am now happy to announce that Chapter 5 from Book 1 and Book 2 are available.  Head over to the book download page and get them now!

 
<< Start < Prev 1 2 3 4 5 6 7 Next > End >>

Page 1 of 7

Syndication

feed-image RSS Feed

Buy on Amazon