/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" Monad hosting "," Get current user in Monad "," Different ways to do things in Monad, and some lin... "," 2006 Winter Scripting Games "," Check spelling with MSN Search from MSH (Part 3) "," Search with MSNSearch Web API from MSH (Part 2) "," Search with MSNSearch Web API from MSH (Part 1) "," about_Switch Documentation "," Switch -regEx "," Dir, Dir and more Dir in MSH "," ")

Wednesday, February 15, 2006

 


2006 Winter Scripting Games (part 2)



I'v been a bit busy this week,As I prepared for my first Monad presention I did at work today,
and did join the 2006 Winter Scripting Games – February 13 - 24 as I mentioned earlier.

the games are realy nice to do (even in VBscript), also to remember how handy MSH would be to do the same,

as MSH is not a Official Script games language yet (I hope we will be allowed in next games),
I will do some of the events the monad way here , as the answers of the first event are posted on the Scripting Games page I will do some of those scipts here in MSH (complete scripts):
to follow them (see the original script and explanations ) you can check the Answer: Scriptathalon

Question 1.

("Sunday", "Monday", "Sundae", "Tuesday", "Sunshine") -match "sun"

Sunday
Sundae
Sunshine

Question 2.

([datetime]"2/1/2006").adddays(5).ToShortDateString()

2/6/2006

Question 3.

$values = 1, 2, 3, 4 ,5, 6, 7, 8, 9
for ($i=0 ; $i -lt $values.Length ; $i+=2) {$values[$i]}

1
3
5
7
9

Question 4.

[int](2721/13)

209

Question 5.

(66/100).tostring("p0")

66 %

Ok, this could take some extra explaining for some help on this one see :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp

Question 6

("A", "B", "C", "D", "E") foreach {[int][char]$_}

65
66
67
68
69

Question 7.

(8, 9, 10, 11, 12) foreach {$_.tostring("x")}

8
9
a
b
c
(see question 5 )

Question 8.

[string]::join(" ",("A","B","C","D","E"))

A B C D E

Question 9.

$Command = '$a = 1' + "`n"
$Command += '$b = 2' + "`n"
$Command += '$a+$b'

invoke-command $Command

3

Question 10.

$string = "This is a test string."

$a = $string.ToCharArray()
[array]::reverse($a)
[string]::join("",$a)

.gnirts tset a si sihT

Ok, I needed 3 lines for the last one (could only find a reverse function on the array type) , but the rest of the scripts not fixed with one line, but replaced by one line.


gr /\/\o\/\/
Tags :


Comments:
Anonymous Jeffrey Snover
Great stuff. I love reading your blog!
 
Post a Comment

Links to this post:

Create a Link



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?