What I've learned about posting VI Toolkit snippets in the forums

What I've learned about posting VI Toolkit snippets in the forums

Nov 4: The block now seems to be working properly, including handling of formatting characters such as \[, which is great. So just go ahead and use the \

 block as you would expect and ignore this post.

Original post:
I have been a bit frustrated with how my code snippets are formatted in the forums.

Having the inline tags is great, except when your samples use those tags, and the formatting of the 
 tag generates confusing line breaks for IE or chrome.

So my approach is as follows:
* Use the plain text editor
* Place code in this block \{quote}{font:courier new}...\{font}\{quote}
* Replace any \[ with backslash \[
* (Optional) End each statement with a ; even if there is a single statement on the line.  If the display is wrapped the snippet may still work.
* If it's a complete script or long snippet, attach the script file for people to download and use.
Here's an example of what I think we end up with. The indents are lost, but each line seems to be intact.
{quote}{font:courier new}## A sample script with formatting
Connect-VIServer $env:myVCServer;
$VMHost=@{}; Get-VM | Foreach-Object { $VMHost\[$_.Name]=$_.Host.Name; }
$VMCluster=@{}; Get-Cluster | Foreach-Object { $ClName=$_.Name; (Get-VM -Location $_ | Foreach-Object { $VMCluster\[$_.Name]=$ClName; }) }
$VMHost.getEnumerator() | Foreach-Object { 
$Item=new-object PSObject;
$Item | Add-Member -Type NoteProperty -Name "Name" -Value $_.Key;
$Item | Add-Member -Type NoteProperty -Name "Host" -Value $VMHost\[$_.Key];
$Item | Add-Member -Type NoteProperty -Name "Cluster" -Value $VMCluster\[$_.Key];
$Item;
} | Sort Cluster, Host, Name | Export-CSV VM-List.csv{font}{quote}

Oct 31: The site will soon be changed so that the 

flag shows new lines properly. Here's an example with the code tag so you want watch when things start to work.

## A sample script with formatting
Connect-VIServer $env:myVCServer;
$VMHost=@{}; Get-VM | Foreach-Object { $VMHost[$_.Name]=$_.Host.Name; }
$VMCluster=@{}; Get-Cluster | Foreach-Object { $ClName=$_.Name; (Get-VM -Location $_ | Foreach-Object { $VMCluster[$_.Name]=$ClName; }) }
$VMHost.getEnumerator() | Foreach-Object { 
  $Item=new-object PSObject;
  $Item | Add-Member -Type NoteProperty -Name "Name" -Value $_.Key;
  $Item | Add-Member -Type NoteProperty -Name "Host" -Value $VMHost[$_.Key];
  $Item | Add-Member -Type NoteProperty -Name "Cluster" -Value $VMCluster[$_.Key];
  $Item;
  } | Sort Cluster, Host, Name | Export-CSV VM-List.csv

Comments

This looks great. Thanks for documenting this best practice so clearly.

Thanks for this, it helped me quite a bit!

<a href="http://www.chinawholesaletown.com/"><font color="#1155FF" size="3" face="Arial Black">*China Wholesaler*</font></a> Town - China's most viable wholesale supplier of promotional gifts, *


Wholesale Umbrella
*you can customize your own logo, no matter anywhere in the world!
*
Wholesale Lighter
*
Successful corporations realize
*

Wholesale Camera

*that well-planned and well-executed employee incentives play an important

Wholesale Speakersrole in helping reach objectives, *

Wholesale Razor
*building company morale,

Wholesale Jewelry</font></a>and rewarding both the employees and the valued customers.<a href="http://www.chinawholesaletown.com/wholesale-Socks/">*<font color="#000000" size="5" face="Arial Black">Wholesale</font><font color="#000000" size="5" face="Arial Black"> Socks</font>*</a>

With promotional and novelty gift items, China Wholesale Town

*


Wholesale Furniture
*International became a specialist in providing branding services. *

Recorder Pen
*We proud ourselves in being fast and accurate. *

Wholesale Scarf
*
We can put your logo on all the products from our OEM / ODM ection. *

Wholesale Chair
*
Most of our items can be decorated with logo or personalized with personal engraving.
*

ladies Briefcase
We delivering to virtually every country in the world

<a href="http://www.chinawholesaletown.com/wholesale-Computer-Desk/"><font color="#1155FF" size="5" face="Arial Black">Computer Desk</font></a>*. Our warehouse and office

are staffed by a young team of Chinese and Western staff

Vacuum Storage Bag</font></a>

. Our professional staff will contact you as soon as possible to provide you with the best quality service through the mail and the telephone.<a href="http://www.chinawholesaletown.com/wholesale-Briefcase/">*<font color="#000080" size="5" face="Arial Black">Wholesale</font><font color="#000080" size="5" face="Arial Black"> Briefcase</font>*</a>

We can provide customers around the world with many well-produced goods and good service,<a href="http://www.chinawholesaletown.com/wholesale-Toys---Games/"><font color="#1155FF" size="5" face="Arial Black">*Wholesale Toys*</font></a>

because of many years of

experience in friendly and *

Wholesale Stress Ball
*
cooperative relations with many Chinese factories and suppliers.
*

Wholesale Fan
*Here you can find all the most popular, *

Wholesale Clocks
*stylish, high-quality goods. *

Wholesale Sweatshirt
*
China Suppliers, Custom Logo Imprinted, *
Wholesale Wallet
*Promotional Products, Promotional Gifts, Promotional Items, *

Waterproof Waist Pack
*Wholesale Suppliers, Wholesale Merchandise, Dropship Wholesale, Wholesale Accessories, Wholesale Directory


China Wholesale
Town - Most Reliable China Wholesale Suppliers, *


Wholesale Ashtray
*Custom Logo Imprinted Promotional Gifts,
Promotional Items
Products, Giveaway Material!<a href="http://www.chinawholesaletown.com/wholesale-Pen/">*<font color="#808080" size="5" face="Arial Black">Wholesale</font><font color="#808080" size="5" face="Arial Black"> Pen</font>*</a>

If you want to start your business with some daily used items, *
Wholesale Pillow
*here is the site you need to check. It offeres many products like

Bottle Opener, T-Shirts, Carabiner*

Wholesale Frisbee
* and Umbrella, Pen,

Wholesale Carabiner
ect.
Under each product section, there are some detailes classification. For

Wholesale Keychain, there are Coffee Mug, Water Bottle. For
Wholesale Socks
and
Wholesale USB Products, there are also some detailed classifications.
*

Wholesale Waterproof Case
*China Wholesale Town - China's most viable wholesale supplier of
Promotional Gifts
, you can customize your own logo, no matter anywhere in the world!



China WholesaleTown - Most Reliable China Wholesale Suppliers, Custom Logo Imprinted Promotional Gifts,
Promotional ProductsItems, Giveaway Material!
If you want to start your business with some daily used items, *
Wholesale Kitchenware
*here is the site you need to check. It offeres many products like

Wholesale Pom Poms, T-Shirts, Carabiner*

Wholesale First Aid Kit
* and Umbrella, Pen,
Bottle Openerect.
Under each product section, there are some detailes classification. For
Wholesale Cup, there are Coffee Mug, Water Bottle. For
Wholesale Clap Hands
and
Wholesale Water Bottle, there are also some detailed classifications.
China Wholesale Town - China's most viable wholesale supplier of
Promotional Gifts, you can customize your own logo, no matter anywhere in the world!

*


Wholesale Apron
*Top China Wholesaler-Buy Wholesale Promotional Gifts Promotional Products from China
Our main products are consumer electronics, gifts and souvenirs,
Wholesale Lanyard, health care products, beauty products,
Wholesale Carabiner, automobile parts, household items, plastic products, metal products,

Wholesale Mug, kitchen supplies, stationery, sports goods, toys,
Wholesale Christmas Gifts, watches, leather products, etc.

Tips for Choosing Sports
Wholesale Halloween Gift; One Way To Protect Your Device -
Wholesale Waterproof Case; Introduce The
Wholesale Lanyard</font></a> For You; Customized Cheaply Prices Promotional Caps-<a href="http://www.chinawholesaletown.com/wholesale-Bag/"><font color="#FF66FF" size="5" face="Arial Black">*Wholesale Bag*</font></a>; And the
Wholesale Clothes Rack</font></a>

also gradually become recognized best promotional product; Buying A Gift For your Friend Who Likes Reading-<a href="http://www.chinawholesaletown.com/wholesale-Golf-Items/"><font color="#3333CC" size="5" face="Arial Black">*Wholesale Golf Products*</font></a>; Customized Printed
Wholesale Vase


Personalization/Engraving Services
Some items, such as 

Crystal Award and Metal Coaster and Metal Money Clip and
Metal Luggage Tag and
Metal Keychain etc,

crystal material or metal material products. *<a href="http://www.chinawholesaletown.com/wholesale-Camera-Tripod/"><font color="#808080" size="5" face="Arial Black"><strong>Camera Tripod*</font></a>require a plate to be added for engraving. *

Wholesale Clothing
*

These plates can added as your request.<a href="http://www.chinawholesaletown.com/wholesale-Bean-Bag-Sofa/">*<font color="#006600" size="5" face="Arial Black">Bean</font><font color="#006600" size="5" face="Arial Black"> Bag</font>*</a>



Debossing/Embossing
Debossing services are offered on leather items. Such as

Leather Wallet and
Leather Mouse Pad and
Conference Folderand
Leather Name Card Holderetc, Debossing is a method that depresses yor company name or logo down into the surface of a leather item.
Eye Mask


*
Wholesale Earphone*
This method displays your company logo through the leather goods without color,

Water Guncommonly known as "blind debossing".
Wholesale MatWe use this method to ensure quality of your goods. Over time,

Wholesale Keyboardcolor that is added to leather will fade or flake away.

Screen/Silk Screen Printing<a href="http://www.chinawholesaletown.com/wholesale-Jackets/">*<font color="#006600" size="5" face="Arial Black">Wholesale</font><font color="#006600" size="5" face="Arial Black"> Jacket</font>*</a>
Screen or silkcreen printing is popular for our non-textile products.
Poncho RaincoatThis screening can be either single or multicolored. such as
Penand and
USB Flash Driveand
Tape Measureand
Mugand
Water Bottleand 
Umbrellaand

Inflatableetc, plastic material, leather material, metal material,
Wholesale Knife</font></a>silicone material, rubber material, <a href="http://www.chinawholesaletown.com/wholesale-Candle/"><font color="#006666" size="5" face="Arial Black">*Wholesale Candle*</font></a>textile material are available.

Embroidery
<a href="http://www.chinawholesaletown.com/wholesale-Mouse/">*<font color="#339933" size="5" face="Arial Black">Wholesale</font><font color="#339933" size="5" face="Arial Black"> Mouse</font>*</a>
A
t Corporate Snobs we pride ourselves in offering some of the best choices of customization in the industry.<a href="http://www.chinawholesaletown.com/wholesale-Calculator/">*<font color="#CCFF66" size="5" face="Arial Black">Wholesale</font><font color="#CCFF66" size="5" face="Arial Black"> Calculator</font>*</a>
Our embroidery options are available for most of our monogrammed Tote Bag  and 
Apronand
Cap  and
Embroidery Coasterand
Towel etc textile products. 


Decoration styles vary per item. *

PVC Vase
*
Each decoration style will be listed in the product page.

<a href="http://www.chinawholesaletown.com/wholesale-MP3-MP6-MP5-Player/">

Wholesale Mp3For various products,

Wholesale Tiedecoration options are available for customer to choose type of engraving desired.

BB GunsThis will be noted as a choice with the item.<a href="http://www.chinawholesaletown.com/wholesale-Earphone/"><font color="#336600" size="5" face="Arial Black">Wholesale</font><font color="#336600" size="5" face="Arial Black"> Earphone</font></a>Promotional Products, Promotional Gifts,


Electric Shaver Promotional items from China,


Toy GunsCustom-made gift Wholesale, Promotional Giveaway Material!
*

Sport Watch
* Wholesale Merchandise,


Safety BeltWholesale Suppliers, Wholesale Dropship,
*

Door Mat
* Wholesale Distributors, Wholesale Accessories,
*

Wholesale Watch
* Wholesale Directory, Discount Wholesaler


Flexi Vase</font></a>

d

Version history
Revision #:
1 of 1
Last update:
‎11-04-2008 03:46 AM
Updated by: