tag:blogger.com,1999:blog-56068598741058107642024-03-13T13:47:30.310-07:00Roman Pelepei's .Net How To? BlogRoman Pelepei gives smart answers on questions about C# .Net, ASP .Net, WPF and Silverlight programming with examples and source code.rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.comBlogger444125tag:blogger.com,1999:blog-5606859874105810764.post-56830957761392370622014-01-22T10:00:00.000-08:002014-01-22T10:00:08.216-08:00AWS Memory Monitoring Script for Windows Server Error: "Please Install .NET sdk for this script to work."<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The location of the SDK has changed</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Change the following line:</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
$SDKLibraryLocation = dir C:\Windows\Assembly -Recurse -Filter "AWSSDK.dll"</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
to:</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
$SDKLibraryLocation = dir "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell" -Recurse -Filter "AWSSDK.dll"</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-87075294011689649322014-01-08T06:38:00.001-08:002014-01-08T06:38:59.964-08:00How to determine Read/Write intensive table from DMV/DMF statistics<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This is a follow-up question on Stack Overflow question</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<a href="http://stackoverflow.com/questions/1575676/how-to-find-out-sql-server-tables-read-write-statistics" style="background-color: transparent; border: 0px; color: #456583; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">How to find out SQL Server table’s read/write statistics?</a></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The goal is the same as the previous question</div>
<blockquote style="background-color: #eeeeee; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin: 0px 0px 10px; padding: 10px 10px 1px; quotes: none; vertical-align: baseline;">
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The goal here is to find out <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">appropriate fill factor for indexes</strong></div>
</blockquote>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
According to Mitch Wheat's answer, he suggested that</div>
<blockquote style="background-color: #eeeeee; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin: 0px 0px 10px; padding: 10px 10px 1px; quotes: none; vertical-align: baseline;">
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
... ordinary tables use the default 90% fill factor, high insert tables somewhere between 70 - 85% (depending on row size). Read only tables can utilise a fill factor of 100%</div>
</blockquote>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Even after finding out index statistics, I am having trouble making sense of the result. </div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">How do you determine</strong> whether a table is a high</div>
<ul style="background-color: white; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">insert</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">read</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">insert/read table?</li>
</ul>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Do you have to take <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">all</strong> stats like <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">leaf_insert_count</code>, <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">leaf_delete_count</code>,<code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">user_seek/scan/lookup_count</code> etc into account?<br />or Would I need to look at only few domains?</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
I would love to see what <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><em style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">other ways</em></strong> there are to determine how to determine fill factor for a particular index.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Query used to get index stats,</div>
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">select db_name(US.database_id)
, object_name(US.object_id)
, I.name as IndexName
, OS.leaf_allocation_count
, OS.nonleaf_allocation_count
, OS.leaf_page_merge_count
, OS.leaf_insert_count
, OS.leaf_delete_count
, OS.leaf_update_count
, *
from sys.dm_db_index_usage_stats US
join sys.indexes I
on I.object_id = US.object_id
and I.index_id = US.index_id
join sys.dm_db_index_operational_stats(db_id(), null, null, null) OS
on OS.object_id = I.object_id and OS.index_id = I.Index_id
where I.type <> 0 -- not heap
and object_name(US.object_id) not like 'sys%'
order by OS.leaf_allocation_count desc,
OS.nonleaf_allocation_count desc,
OS.leaf_page_merge_count desc,
US.User_updates desc,
US.User_Seeks desc,
US.User_Scans desc,
US.User_Lookups desc
</code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
And sample result.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<img alt="alt text" src="http://farm4.static.flickr.com/3475/4023217984_c8759ed9e1_o.png" style="background-color: transparent; border: 0px; margin: 0px; max-width: 640px; padding: 0px; vertical-align: baseline;" /></div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-43253457084579576212014-01-03T04:37:00.001-08:002014-01-03T04:37:23.657-08:00Visual Studio : Build Solution, Rebuild Solution and Clean Solution<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">I always thought of what is the difference in Build, Rebuild and Clean Solution and which one is appropriate to use at which time?</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">So I tried to find the reason and here is my findings.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<h2 style="background-color: white; border-bottom-color: transparent; border-bottom-style: solid; border-bottom-width: 1px; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; margin: 0px -15px; padding: 0.6em 15px 0.5em; position: relative;">
Clean solution</h2>
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">will remove the build intermediate files from the previous build. If there are any other files in the build target directories like </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">bin</i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> and </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">obj</i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> they may not be removed, but actual build artifacts will be removed. </span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<h2 style="background-color: white; border-bottom-color: transparent; border-bottom-style: solid; border-bottom-width: 1px; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; margin: 0px -15px; padding: 0.6em 15px 0.5em; position: relative;">
Build solution</h2>
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">will build assemblies, if there is no change in assembly after previous build then it would not build the assembly. So it use partially-built wherever changes occurred after previous build.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<h2 style="background-color: white; border-bottom-color: transparent; border-bottom-style: solid; border-bottom-width: 1px; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; margin: 0px -15px; padding: 0.6em 15px 0.5em; position: relative;">
Rebuild solution</h2>
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">will clean and then build the solution from scratch, regardless of changes has been occurred or not.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: center;">
<a href="http://3.bp.blogspot.com/-zAJiWPkk7IA/UozCmnC_qkI/AAAAAAAAAME/LepgX3qHvmE/s1600/clean+and+rebuild.png" imageanchor="1" style="clear: left; color: #4d469c; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://3.bp.blogspot.com/-zAJiWPkk7IA/UozCmnC_qkI/AAAAAAAAAME/LepgX3qHvmE/s400/clean+and+rebuild.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" /></a></div>
<br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Here comes another question, rebuild will clean and then build the solution, so Is it equivalent to Clean Solution and then Build the solution?</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Actually No!!! they are not equal. </span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">The difference is in the sequence projects get clean and build. Let say we have two projects in a solution. Clean and then build will perform clean to both projects and then build will occur individually while on rebuild project A will get and clean and then build after that project B will be clean and then build and so on.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: center;">
<a href="http://4.bp.blogspot.com/-vRzM0Q8k1Yk/UozEvi75UTI/AAAAAAAAAMQ/3XLGD-3425g/s1600/clean.png" imageanchor="1" style="color: #4d469c; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://4.bp.blogspot.com/-vRzM0Q8k1Yk/UozEvi75UTI/AAAAAAAAAMQ/3XLGD-3425g/s400/clean.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" /></a></div>
<br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">If you have any comments please do post.</span></div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-8593573058992886502014-01-03T04:21:00.001-08:002014-01-03T04:21:58.368-08:00Renaming Project Solution and Items<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Today I need to rename one of my Project Solution.It is actually complex to do correctly because the project name is used in several places.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Here are steps you need to follow to rename a solution:</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 1:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">In Solution Explorer, right-click the project, select </span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>Rename</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">, and enter a new name.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 2:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">In Solution Explorer, right-click the project and select </span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>Properties</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">. On the </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Application tab</i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">, change the</span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>"Assembly name"</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> and </span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>"Default namespace"</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 3:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">In the main cs file (or any other code files), rename the namespace declaration to use the new name. For this right-click the namespace and select </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><b>Refactor > Rename</b></i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> enter a new name. For example:</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<div class="syntaxhighlighter " id="highlighter_732973" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #444444; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 13px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; min-height: inherit !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 580.125px;">
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">namespace WindowsFormsApplication1</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: center;">
<a href="http://2.bp.blogspot.com/-HzZde3w-xIw/Unt9DgqCEGI/AAAAAAAAALw/iCIDc2DDTTI/s1600/refactor+rename.jpg" imageanchor="1" style="clear: both; color: #4d469c; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://2.bp.blogspot.com/-HzZde3w-xIw/Unt9DgqCEGI/AAAAAAAAALw/iCIDc2DDTTI/s320/refactor+rename.jpg" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" /></a></div>
<br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 4:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Change the </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">AssemblyTitle</i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> and AssemblyProduct in </span><i style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Properties/AssemblyInfo.cs</i><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br />
<div class="syntaxhighlighter " id="highlighter_931415" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #444444; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 13px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; min-height: inherit !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 580.125px;">
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyTitle(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"New Name Here"</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyDescription(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">3</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyConfiguration(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">4</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyCompany(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">5</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyProduct(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"New Name Here"</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">6</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyCopyright(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Copyright © 2013"</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">7</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyTrademark(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">8</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[assembly: AssemblyCulture(</code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">)]</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 5:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Delete </span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>bin</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> and </span><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><i>obj</i></b><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"> directories physically.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 6:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Rename the project physical folder directory.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 7:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Open the SLN file(within notepad or any editor) and change the path to the project.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Step 8:</b><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Cleans and Rebuild the project</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">Here it is now your project is completely renamed.</span><br style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">If you found any other place which I missed do comment here.</span></div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-25828726941065169412013-12-27T08:37:00.001-08:002013-12-27T08:37:59.022-08:00calling google Url Shortner API in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
you can check the code below (made use of System.Net). You should notice that the contenttype must be specfied, and must be "application/json"; and also the string to be send must be in json format.</div>
<pre class="lang-cs prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">using </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">System</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
using </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">System</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Net</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
using </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">System</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">IO</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
namespace </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">ConsoleApplication1</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">class</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Program</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">static</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">void</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Main</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">string</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">[]</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> args</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> httpWebRequest </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HttpWebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">WebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Create</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"https://www.googleapis.com/urlshortener/v1/url"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
httpWebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">ContentType</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"application/json"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
httpWebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Method</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"POST"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
using </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> streamWriter </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">StreamWriter</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">httpWebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">GetRequestStream</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">()))</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">string</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> json </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"{\"longUrl\":\"http://www.google.com/\"}"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Console</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">WriteLine</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">json</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
streamWriter</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Write</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">json</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> httpResponse </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">HttpWebResponse</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">httpWebRequest</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">GetResponse</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">();</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
using </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> streamReader </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">new</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">StreamReader</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">httpResponse</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">GetResponseStream</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">()))</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> responseText </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> streamReader</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">ReadToEnd</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">();</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Console</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">WriteLine</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">responseText</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">}</span></code></pre>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-25216968498994035912013-12-27T07:39:00.003-08:002013-12-27T07:39:46.252-08:00Generate unique strings and numbers in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
The <a href="http://msdn2.microsoft.com/en-us/library/system.guid.aspx" style="box-sizing: border-box; color: #2f70a9; text-decoration: none;">System.Guid</a> is used whenever we need to generate a unique key, but it is very long. That’s in many cases not an issue, but in a web scenario where it is part of the URL we need to use its string representation which is 36 characters long. It clutters up the URL and is just basically ugly.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
It is not possible to shorten it without loosing some of the uniqueness of the GUID, but we can come a long way if we can accept a 16 character string instead.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
We can change the standard GUID string representation:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
<em style="box-sizing: border-box;">21726045-e8f7-4b09-abd8-4bcc926e9e28</em></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
Into a shorter string:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
<em style="box-sizing: border-box;">3c4ebc5f5f2c4edc</em></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
The following method creates the shorter string and it is actually very unique. An iteration of 10 million didn’t create a duplicate. It uses the uniqueness of a GUID to create the string.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
<span style="background-color: transparent; box-sizing: border-box; color: black; font-family: 'Courier New'; font-size: 11px;"><span style="background-color: transparent; box-sizing: border-box; color: blue;">private</span> <span style="background-color: transparent; box-sizing: border-box; color: blue;">string</span> GenerateId()<br style="box-sizing: border-box;" />{<br style="box-sizing: border-box;" /><span style="background-color: transparent; box-sizing: border-box; color: blue;"> long</span> i <span style="background-color: transparent; box-sizing: border-box; color: red;">=</span> 1;<br style="box-sizing: border-box;" /><span style="background-color: transparent; box-sizing: border-box; color: blue;"> foreach</span> (<span style="background-color: transparent; box-sizing: border-box; color: blue;">byte</span> b <span style="background-color: transparent; box-sizing: border-box; color: blue;">in</span> Guid.NewGuid().ToByteArray())<br style="box-sizing: border-box;" /> {<br style="box-sizing: border-box;" /> i *= ((<span style="background-color: transparent; box-sizing: border-box; color: blue;">int</span>)b <span style="background-color: transparent; box-sizing: border-box; color: red;">+</span> 1);<br style="box-sizing: border-box;" /> }<br style="box-sizing: border-box;" /><span style="background-color: transparent; box-sizing: border-box; color: blue;"> return</span> <span style="background-color: transparent; box-sizing: border-box; color: blue;">string</span>.Format(<span style="background-color: #e4e4e4; box-sizing: border-box; color: #666666;">"{0:x}"</span>, i <span style="background-color: transparent; box-sizing: border-box; color: red;">-</span> DateTime.Now.Ticks);<br style="box-sizing: border-box;" />}<br style="box-sizing: border-box;" /></span></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
If you instead want numbers instead of a string, you can do that to but then you need to go up to 19 characters. The following method converts a GUID to an Int64.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
<span style="background-color: transparent; box-sizing: border-box; color: black; font-family: 'Courier New'; font-size: 11px;"><span style="background-color: transparent; box-sizing: border-box; color: blue;">private</span> <span style="background-color: transparent; box-sizing: border-box; color: blue;">long</span> GenerateId()<br style="box-sizing: border-box;" />{<br style="box-sizing: border-box;" /><span style="background-color: transparent; box-sizing: border-box; color: blue;"> byte</span>[] buffer <span style="background-color: transparent; box-sizing: border-box; color: red;">=</span> Guid.NewGuid().ToByteArray();<br style="box-sizing: border-box;" /><span style="background-color: transparent; box-sizing: border-box; color: blue;"> return</span> BitConverter.ToInt64(buffer, 0);<br style="box-sizing: border-box;" />}<br style="box-sizing: border-box;" /></span></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Alegreya, georgia, Verdana, Geneva, 'DejaVu Sans', sans-serif; font-size: 24px; line-height: 36px; margin-bottom: 10px; padding: 0.4em 0px;">
The standard GUID is still the best way to ensure the uniqueness even though it isn’t 100% unique.</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-61938987459048682582013-12-27T07:39:00.001-08:002013-12-27T07:39:25.241-08:00What's the best way to create a short hash, similiar to what tiny Url does?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
.NET string object has a GetHashCode() function. It returns an integer. Convert it into a hex and then to an 8 characters long string.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Like so:</div>
<pre class="lang-cs prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="kwd" style="background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;">string</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> hashCode </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">String</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">Format</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"{0:X}"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> sourceString</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="typ" style="background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;">GetHashCode</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">());</span></code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
More on that: <a href="http://msdn.microsoft.com/en-us/library/system.string.gethashcode.aspx" rel="nofollow" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">http://msdn.microsoft.com/en-us/library/system.string.gethashcode.aspx</a></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">UPDATE:</strong> Added the remarks from the link above to this answer:</div>
<blockquote style="background-color: #eeeeee; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin: 0px 0px 10px; padding: 10px 10px 1px; quotes: none; vertical-align: baseline;">
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The behavior of GetHashCode is dependent on its implementation, which might change from one version of the common language runtime to another. A reason why this might happen is to improve the performance of GetHashCode.</div>
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
If two string objects are equal, the GetHashCode method returns identical values. However, there is not a unique hash code value for each unique string value. <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Different strings can return the same hash code.</strong></div>
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Notes to Callers</strong></div>
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The value returned by GetHashCode is <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">platform-dependent</strong>. It differs on the 32-bit and 64-bit versions of the .NET Framework.</div>
</blockquote>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-56797455645281840762013-12-02T05:50:00.003-08:002013-12-02T05:50:20.552-08:00.Config Transformation for projects which are not Web Projects in Visual Studio<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
I tried several solutions, and here is the simplest I've found.<br /><a href="http://stackoverflow.com/users/376859/dan" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Dan</a> pointed out in the comments that <a href="http://www.olegsych.com/2010/12/config-file-transformation/" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">the original post</a> belongs to <a href="http://www.olegsych.com/" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Oleg Sych</a>—<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">thanks, Oleg!</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Here are the instructions:</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">1. Add an XML file for each configuration to the project.</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Typically you will have <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">Debug</code> and <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">Release</code> configurations so name your files <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.Debug.config</code>and <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.Release.config</code>. In my project, I created a configuration for each kind of enironment so you might want to experiment with that.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">2. Unload project and open .csproj file for editing</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Visual Studio allows you to edit <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.csproj</strong> right in the editor—you just need to unload the project first. Then right-click on it and select <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Edit <projectname>.csproj</projectname></strong>.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">3. Bind App.*.config files to main App.config</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Find the project file section that contains all <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.config</code> and <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.*.config</code> references. You'll notice their build actions are set to <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">None</code>:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><none span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><none span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.Debug.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><none span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.Release.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span></none></span></none></span></none></span></code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
First, set build action for all of them to <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">Content</code>.<br />Next, make all <em style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">configuration-specific</em> files <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">dependant</strong> on the main <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.config</code> so Visual Studio groups them like it does designer and codebehind files.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Replace XML above with the one below:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><content span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><content span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.Debug.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><dependentupon></dependentupon></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">App.config</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></content></span></content></span></code></pre>
</div>
<span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><content span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"App.Release.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><dependentupon></dependentupon></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">App.config</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></content></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">4. Activate transformations magic</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
In the end of file after</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><import span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Project</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"$(MSBuildToolsPath)\Microsoft.CSharp.targets"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span></import></span></code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
and before final</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
insert the following XML:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><usingtask span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">TaskName</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"TransformXml"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">AssemblyFile</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><target span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Name</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"AfterCompile"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Condition</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"exists('app.$(Configuration).config')"</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;"><!-- Generate transformed app config in the intermediate directory --></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><transformxml span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Source</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"app.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Destination</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"$(IntermediateOutputPath)$(TargetFileName).config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Transform</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"app.$(Configuration).config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;"><!-- Force build process to use the transformed configuration file from now on. --></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><itemgroup></itemgroup></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><appconfigwithtargetpath span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Remove</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"app.config"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><appconfigwithtargetpath span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Include</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"$(IntermediateOutputPath)$(TargetFileName).config"</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><targetpath></targetpath></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">$(TargetFileName).config</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></appconfigwithtargetpath></span></appconfigwithtargetpath></span></transformxml></span></target></span></usingtask></span></code></pre>
<span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Now you can reload the project, build it and enjoy <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">App.config</code> transformations!</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
Another solution I've found is NOT to use the transformations but just have a separate config file, e.g. app.Release.config. Then add this line to your csproj file.</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><propertygroup span=""><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">Condition</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">" '$(Configuration)|$(Platform)' == 'Release|x86' "</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><appconfig></appconfig></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">App.Release.config</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></propertygroup></span></code></pre>
<span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This will not only generate the right myprogram.exe.config file but if you're using Setup and Deployment Project in Visual Studio to generate MSI, it'll force the deployment project to use the correct config file when packaging.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
You can use a separate config file per configuration, e.g. app.Debug.config, app.Release.config and then use the configuration variable in your project file:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><propertygroup></propertygroup></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><appconfig></appconfig></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">App.$(Configuration).config</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span></code></pre>
<span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></span><div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This will then create the correct ProjectName.exe.config file depending on the configuration you are building in.</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-32254143481096466302013-12-02T05:48:00.002-08:002013-12-02T05:48:55.800-08:00Windows Maximum Path Length Limitation<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is <strong>MAX_PATH</strong>, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\<em>some 256-character path string</em><nul>" where "<nul>" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.)</nul></nul></div>
<div class="note" style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
<strong>Note</strong> File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.</div>
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the <em>lpMaximumComponentLength</em> parameter of the <a href="http://msdn.microsoft.com/en-us/library/aa364993(v=vs.85).aspx" style="color: #03697a; text-decoration: none;"><strong xmlns="http://www.w3.org/1999/xhtml">GetVolumeInformation</strong></a> function (this value is commonly 255 characters). To specify an extended-length path, use the "\\?\" prefix. For example, "\\?\D:\<em>very long path</em>".</div>
<div class="note" style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
<strong>Note</strong> The maximum path of 32,767 characters is approximate, because the "\\?\" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.</div>
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
The "\\?\" prefix can also be used with paths constructed according to the universal naming convention (UNC). To specify such a path using UNC, use the "\\?\UNC\" prefix. For example, "\\?\UNC\server\share", where "server" is the name of the computer and "share" is the name of the shared folder. These prefixes are not used as part of the path itself. They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory. Because you cannot use the "\\?\" prefix with a relative path, relative paths are always limited to a total of <strong>MAX_PATH</strong> characters.</div>
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
There is no need to perform any Unicode normalization on path and file name strings for use by the Windows file I/O API functions because the file system treats path and file names as an opaque sequence of <strong>WCHAR</strong>s. Any normalization that your application requires should be performed with this in mind, external of any calls to related Windows file I/O API functions.</div>
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
When using an API to create a directory, the specified path cannot be so long that you cannot append an 8.3 file name (that is, the directory name cannot exceed <strong>MAX_PATH</strong> minus 12).</div>
<div style="color: #2a2a2a; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
The shell and the file system have different requirements. It is possible to create a path with the Windows API that the shell user interface is not able to interpret properly.</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-37561217054923913422013-11-22T07:22:00.001-08:002013-11-22T07:22:09.379-08:00Simulate a Windows Service using ASP.NET to run scheduled jobs<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Introduction</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
How do we run scheduled jobs from ASP.NET without requiring a Windows Service to be installed on the server? Very often, we need to run some maintenance tasks or scheduled tasks like sending reminder emails to users from our websites. This can only be achieved using a Windows Service. ASP.NET being stateless provides no support to run code continuously or to run code at a scheduled time. As a result, we have to make our own Windows Services to run scheduled jobs or cron jobs. But in a shared hosted environment, we do not always have the luxury to deploy our own Windows Service to our hosting provider's web server. We either have to buy a dedicated server which is very costly, or sacrifice such features in our web solution. However, running a scheduled task is a very handy feature, especially for sending reminder emails to users, maintenance reports to administrators, or run cleanup operations, etc. I will show you a tricky way to run scheduled jobs using pure ASP.NET without requiring any Windows Service. This solution runs on any hosting service providing just ASP.NET hosting. As a result, you can have the scheduled job feature in your ASP.NET web projects without buying dedicated servers.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
How it works</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
First, we need something in ASP.NET that is continuously running and gives us a callback. The IIS web server is continuously running. So, we somehow need to get a frequent callback from it so that we can lookup a job queue and see if there's something that needs to be executed. Now, there are several ways a web server comes to us:</div>
<ul style="background-color: white; border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;" type="disc">
<li style="border: 0px; margin: 0px; padding: 0px;">When a page hits</li>
<li style="border: 0px; margin: 0px; padding: 0px;">When an application starts</li>
<li style="border: 0px; margin: 0px; padding: 0px;">When an application stops</li>
<li style="border: 0px; margin: 0px; padding: 0px;">When a session starts and ends/timeouts</li>
<li style="border: 0px; margin: 0px; padding: 0px;">When a cache item expires</li>
</ul>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The page hit is random. If nobody visits your website for hours, you can't do the pending jobs for hours. Besides, the execution of a request is very short and needs to finish as soon as possible. If you plan to execute scheduled jobs on page execution, then the page will take longer to execute, which will result in a poor user experience. So, clearly this is not an option.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
When an application starts, we get a callback in the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_Start</code> method of <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em>. So, this is a good place to start a background thread which runs forever and executes scheduled jobs. However, the thread can be killed anytime the web server decides to take a nap due to zero load.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
When an application stops, we get a callback at <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_End</code>. But we can't do anything here because the whole application is going to die soon.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Session_Start</code> in <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em> is triggered when a user visits a page that requires a new session to be initiated. So, this is also random. We need something that fires consistently and periodically.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
A cache item expires on a given time or duration. In ASP.NET, you can add entries in the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Cache</code> and set an absolute expiry date time, or you can set a duration after which the item is removed from the cache. You can do this by utilizing the following method of the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Cache</code> class:</div>
<div class="pre-action-link" id="premain0" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg0" preid="0" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse0" preid="0" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="0" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre0" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> Insert ( System.<span class="code-SDKkeyword" style="border: 0px; color: #339999; margin: 0px; padding: 0px;">String</span> key , System.<span class="code-SDKkeyword" style="border: 0px; color: #339999; margin: 0px; padding: 0px;">Object</span> value ,
System.Web.Caching.CacheDependency dependencies ,
System.DateTime absoluteExpiration ,
System.TimeSpan slidingExpiration ,
System.Web.Caching.CacheItemPriority priority ,
System.Web.Caching.CacheItemRemovedCallback onRemoveCallback )</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">onRemoveCallback</code> is a delegate to a method which is called whenever a cache item expires. In that method, we can do anything we like. So, this is a good candidate for running code periodically, consistently without requiring any page visit.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
This means, we can simulate a Windows Service utilizing Cache timeout! Now, who thought that this would be possible?</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Creating cache item callbacks</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
First, on <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_Start</code>, we need to register a cache item that will expire in two minutes. Please note, the minimum duration you can set for expiring a callback is two minutes. Although you can set a lower value, it does not work. Most probably, the ASP.NET worker process looks at the cache items once every two minutes.</div>
<div class="pre-action-link" id="premain1" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg1" preid="1" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse1" preid="1" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="1" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre1" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">const</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> DummyCacheItemKey = <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">GagaGuguGigi"</span>;
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">protected</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> Application_Start(<span class="code-SDKkeyword" style="border: 0px; color: #339999; margin: 0px; padding: 0px;">Object</span> sender, EventArgs e)
{
RegisterCacheEntry();
}
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">bool</span> RegisterCacheEntry()
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">if</span>( <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">null</span> != HttpContext.Current.Cache[ DummyCacheItemKey ] ) <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">return</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">false</span>;
HttpContext.Current.Cache.Add( DummyCacheItemKey, <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Test"</span>, <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">null</span>,
DateTime.MaxValue, TimeSpan.FromMinutes(<span class="code-digit" style="border: 0px; color: navy; margin: 0px; padding: 0px;">1</span>),
CacheItemPriority.Normal,
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> CacheItemRemovedCallback( CacheItemRemovedCallback ) );
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">return</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">true</span>;
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
This cache entry is a dummy entry. We do not store any valuable information here because whatever we store here might be gone on application restart. Besides, all we need is the frequent callback from this item.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Inside the callback, we do all the service work:</div>
<div class="pre-action-link" id="premain2" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg2" preid="2" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse2" preid="2" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="2" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre2" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> CacheItemRemovedCallback( <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> key,
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">object</span> value, CacheItemRemovedReason reason)
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Cache item callback: "</span> + DateTime.Now.ToString() );
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> Do the service works
</span>
DoWork();
}</pre>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Store item in cache again upon expire</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Whenever the cache item expires, we get a callback and the item is gone from the cache. So, we no longer get any callback in future. In order to have a continuous supply of callback, we need to store an item in cache again upon expiration. This seems quite easy; we can call the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">RegisterCacheEntry</code> function shown above from the callback function, can't we? It does not work. When the callback method fires, there is no <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">HttpContext</code> available. The<code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">HttpContext</code> object is only available when a request is being processed. As the callback is fired from the web server behind the scene, there is no request being processed and thus no <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">HttpContext</code> is available. As a result, you cannot get access to the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Cache</code> object from the callback function.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The solution is, we need to simulate a request. We can make a dummy call to a dummy webpage by utilizing the<code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">WebClient</code> class in the .NET Framework. When the dummy page is being executed, we can get hold of the<code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">HttpContext</code> and then register the callback item again.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
So, the callback method is modified a bit to make the dummy call:</div>
<div class="pre-action-link" id="premain3" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg3" preid="3" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse3" preid="3" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="3" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre3" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> CacheItemRemovedCallback( <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> key,
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">object</span> value, CacheItemRemovedReason reason)
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Cache item callback: "</span> + DateTime.Now.ToString() );
HitPage();
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> Do the service works
</span>
DoWork();
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">HitPage</code> function makes a call to a dummy page:</div>
<div class="pre-action-link" id="premain4" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg4" preid="4" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse4" preid="4" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="4" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre4" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">const</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> DummyPageUrl =
<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">http://localhost/TestCacheTimeout/WebForm1.aspx"</span>;
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> HitPage()
{
WebClient client = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> WebClient();
client.DownloadData(DummyPageUrl);
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Whenever the dummy page executes, the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_BeginRequest</code> method gets called. There, we can check whether this is a dummy page request or not.</div>
<div class="pre-action-link" id="premain5" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg5" preid="5" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse5" preid="5" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="5" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre5" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">protected</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> Application_BeginRequest(<span class="code-SDKkeyword" style="border: 0px; color: #339999; margin: 0px; padding: 0px;">Object</span> sender, EventArgs e)
{
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> If the dummy page is hit, then it means we want to add another item
</span>
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> in cache
</span>
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">if</span>( HttpContext.Current.Request.Url.ToString() == DummyPageUrl )
{
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> Add the item in cache and when succesful, do the work.
</span>
RegisterCacheEntry();
}
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
We only intercept the request to the dummy page, and we let other pages execute as it is.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Restart cache item callback on web process restart</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
There are several cases where the web server might be restarted. For example, if the Administrator restarts IIS, or restarts the computer, or the web process gets recycled (Windows 2003). In such cases, the service will stop running unless a page is hit and the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_Start</code> is called. <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_Start</code> is called only when a page is visited for the first time in a web project. So, when the web process is restarted, we need to manually call the dummy page, or someone needs to visit the home page of your website, in order to get the service running again.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
One tricky solution to this problem can be adding your website to search engines. Search engines crawl pages frequently. So, they will hit a page of your website, resulting in <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Application_Start</code>, and thus the service will get up and running.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Another idea is to register your website to some traffic or availability monitoring services. There are lots of Web Services which keep an eye on your website and checks whether it is alive and the performance is satisfactory. All these services hit your web site pages and then collect the statistics. So, by registering in such services, you can guarantee your web application is alive all the time.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Testing possible types of job executions</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Let's test whether we can do all possible tasks that we can do from a Windows Service. The first problem is, we cannot do everything a Windows Service does because it runs in the Local System account. This is a very high privilege account, and you can do anything to your system under this account. However, the ASP.NET web process runs in the ASPNET account (Windows XP) or NETWORK SERVICE account (Windows 2003). This is a low privilege account, and does not have the right to access the hard drive. In order to allow the service to write to the hard drive, the web process account needs to be allowed write permission to a folder exclusively. We all know about this security problem, so I won't go into details about it.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Now, we will be testing all possible things that we normally do from a Windows Service:</div>
<ul style="background-color: white; border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;" type="disc">
<li style="border: 0px; margin: 0px; padding: 0px;">Write to a file</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Database operations</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Web Service calls</li>
<li style="border: 0px; margin: 0px; padding: 0px;">MSMQ operations</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Email send</li>
</ul>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Let's write some test code for this inside the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">DoWork</code> method:</div>
<div class="pre-action-link" id="premain6" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg6" preid="6" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse6" preid="6" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="6" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre6" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> DoWork()
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Begin DoWork..."</span>);
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Running as: "</span> +
WindowsIdentity.GetCurrent().Name );
DoSomeFileWritingStuff();
DoSomeDatabaseOperation();
DoSomeWebserviceCall();
DoSomeMSMQStuff();
DoSomeEmailSendStuff();
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">End DoWork..."</span>);
}</pre>
<h3 style="background-color: white; color: #666666; font-family: 'Segoe UI', Arial, sans-serif; font-size: 18px; font-weight: normal;">
Testing file write</h3>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Let's test if we can really write to a file. Create a folder named “<em style="border: 0px; margin: 0px; padding: 0px;">temp</em>” in your <em style="border: 0px; margin: 0px; padding: 0px;">C</em> drive, and if the drive is an NTFS partition, allow the ASPNET/NETWORK SERVICE account to write to that folder.</div>
<div class="pre-action-link" id="premain7" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg7" preid="7" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse7" preid="7" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="7" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre7" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> DoSomeFileWritingStuff()
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Writing to file..."</span>);
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">try</span>
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">using</span>( StreamWriter writer =
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> StreamWriter(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">@"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">c:\temp\Cachecallback.txt"</span>, <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">true</span>) )
{
writer.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Cache Callback: {0}"</span>, DateTime.Now);
writer.Close();
}
}
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">catch</span>( Exception x )
{
Debug.WriteLine( x );
}
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">File write successful"</span>);
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Open the log file, and you should see entries like:</div>
<div class="pre-action-link" id="premain8" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg8" preid="8" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse8" preid="8" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="8" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre8" lang="text" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;">Cache Callback: 10/17/2005 2:50:00 PM
Cache Callback: 10/17/2005 2:52:00 PM
Cache Callback: 10/17/2005 2:54:00 PM
Cache Callback: 10/17/2005 2:56:00 PM
Cache Callback: 10/17/2005 2:58:00 PM
Cache Callback: 10/17/2005 3:00:00 PM</pre>
<h3 style="background-color: white; color: #666666; font-family: 'Segoe UI', Arial, sans-serif; font-size: 18px; font-weight: normal;">
Testing database connectivity</h3>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Run the following script in your “tempdb” database inside SQL Server 2000:</div>
<div class="pre-action-link" id="premain9" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg9" preid="9" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse9" preid="9" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="9" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre9" lang="sql" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">IF</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">EXISTS</span> (<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">SELECT</span> * <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">FROM</span> dbo.sysobjects <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">WHERE</span> id =
object_id(N<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">'</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">[dbo].[ASPNETServiceLog]'</span>) <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">AND</span>
OBJECTPROPERTY(id, N<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">'</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">IsUserTable'</span>) = <span class="code-digit" style="border: 0px; color: navy; margin: 0px; padding: 0px;">1</span>)
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">DROP</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">TABLE</span> [dbo].[ASPNETServiceLog]
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">GO</span>
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">CREATE</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">TABLE</span> [dbo].[ASPNETServiceLog] (
[Mesage] [<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">varchar</span>] (<span class="code-digit" style="border: 0px; color: navy; margin: 0px; padding: 0px;">1000</span>)
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">COLLATE</span> SQL_Latin1_General_CP1_CI_AS <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">NOT</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">NULL</span> ,
[<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">DateTime</span>] [<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">datetime</span>] <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">NOT</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">NULL</span>
) <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">ON</span> [<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">PRIMARY</span>]
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">GO</span></pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
This will create a table named <em style="border: 0px; margin: 0px; padding: 0px;">ASPNETServiceLog</em> for you. Remember, as it is created in <em style="border: 0px; margin: 0px; padding: 0px;">tempdb</em>, this table will disappear when SQL Server restarts.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Next, make the <em style="border: 0px; margin: 0px; padding: 0px;">ASPNET/NETWORK SERVICE</em> account a member of <em style="border: 0px; margin: 0px; padding: 0px;">db_datawriter</em> of the <em style="border: 0px; margin: 0px; padding: 0px;">tempdb</em> database. Alternatively, you can define a more specific permission and allow only writing to the table.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Now write the test function:</div>
<div class="pre-action-link" id="premain10" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg10" preid="10" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse10" preid="10" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="10" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre10" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> DoSomeDatabaseOperation()
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Connecting to database..."</span>);
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">using</span>( SqlConnection con = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> SqlConnection(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Data Source"</span> +
<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">=(local);Initial Catalog=tempdb;Integrated Security=SSPI;"</span>) )
{
con.Open();
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">using</span>( SqlCommand cmd = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> SqlCommand( <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">INSERT"</span> +
<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;"> INTO ASPNETServiceLog VALUES"</span> +
<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;"> (@Message, @DateTime)"</span>, con ) )
{
cmd.Parameters.Add(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">@Message"</span>, SqlDbType.VarChar, <span class="code-digit" style="border: 0px; color: navy; margin: 0px; padding: 0px;">1024</span>).Value =
<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Hi I'm the ASP NET Service"</span>;
cmd.Parameters.Add(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">@DateTime"</span>, SqlDbType.DateTime).Value =
DateTime.Now;
cmd.ExecuteNonQuery();
}
con.Close();
}
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Database connection successful"</span>);
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
This will create entries in the log table, which you can check later on to ensure if there was any delay between the service execution. You should be getting one row per two minutes.</div>
<div align="center" style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
<img alt="Service Log File" complete="true" height="72" src="http://www.codeproject.com/KB/aspnet/ASPNETService/image001.jpg" style="border: 0px; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="263" /></div>
<div align="center" class="Caption" style="background-color: white; border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 12px; font-style: italic; font-weight: bold; margin: 0px; padding: 0px;">
Figure 1: ASP NET Service Log Table Data</div>
<h3 style="background-color: white; color: #666666; font-family: 'Segoe UI', Arial, sans-serif; font-size: 18px; font-weight: normal;">
Testing email delivery</h3>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The most common requirement for running a Windows Service is to send periodical email alerts, notifications, status reports, etc., via mail. So, it's important that we test if email works from such a service:</div>
<div class="pre-action-link" id="premain11" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg11" preid="11" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse11" preid="11" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="11" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre11" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> DoSomeEmailSendStuff()
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">try</span>
{
MailMessage msg = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> MailMessage();
msg.From = <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">abc@cde.fgh"</span>;
msg.To = <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">ijk@lmn.opq"</span>;
msg.Subject = <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Reminder: "</span> + DateTime.Now.ToString();
msg.Body = <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">This is a server generated message"</span>;
SmtpMail.Send( msg );
}
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">catch</span>( Exception x )
{
Debug.WriteLine( x );
}
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Please replace From and To recipient addresses with some meaningful address, and you should be getting email alerts every two minutes.</div>
<h3 style="background-color: white; color: #666666; font-family: 'Segoe UI', Arial, sans-serif; font-size: 18px; font-weight: normal;">
Testing MSMQ</h3>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Let's write a small function to test whether we can access MSMQ from ASP.NET properly:</div>
<div class="pre-action-link" id="premain12" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg12" preid="12" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse12" preid="12" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="12" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre12" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> DoSomeMSMQStuff()
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">using</span>( MessageQueue queue = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> MessageQueue(MSMQ_NAME) )
{
queue.Send(DateTime.Now);
queue.Close();
}
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Alternatively, you can call the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Receive</code> method of the queue to get pending messages in the queue that needs to be processed.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
One issue that you should remember here is, do not subscribe to the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Receive</code> event of the queue. As the thread can die anytime and the Web Server can be restarted anytime, a continuous blocked <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Receive</code> will not work properly. Besides, if you call the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">BeginReceive</code> method and block code execution until a message arrives, the service gets stuck and other codes will not run. So, in this case, you will have to call the <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Receive</code> method to fetch the pending messages.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Extending the system</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The ASP.NET Service can be extended in many ways to allow pluggable jobs. You can introduce Job queuing from web pages which this service will execute periodically. For example, you can queue jobs in a cache item and the services pick up the job and executes it. This way, you can simulate a nice job processing system inside your ASP.NET project. Previously, this was only possible with a Windows Service, but now you can do it with ASP.NET also.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Let's make a simple <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">Job</code> class which contains information about a job to execute.</div>
<div class="pre-action-link" id="premain13" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg13" preid="13" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse13" preid="13" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="13" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre13" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">class</span> Job
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> Title;
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> DateTime ExecutionTime;
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> Job( <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">string</span> title, DateTime executionTime )
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">this</span>.Title = title;
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">this</span>.ExecutionTime = executionTime;
}
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">public</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> Execute()
{
Debug.WriteLine(<span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">Executing job at: "</span> + DateTime.Now );
Debug.WriteLine(<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">this</span>.Title);
Debug.WriteLine(<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">this</span>.ExecutionTime);
}
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
From a simple ASPX page, we will queue a job to a static <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">ArrayList</code> called <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">_JobQueue</code> declared in <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em>:</div>
<div class="pre-action-link" id="premain14" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg14" preid="14" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse14" preid="14" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="14" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre14" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;">Job newJob = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> Job( <span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">"</span><span class="code-string" style="border: 0px; color: purple; margin: 0px; padding: 0px;">A job queued at: "</span> + DateTime.Now,
DateTime.Now.AddMinutes(<span class="code-digit" style="border: 0px; color: navy; margin: 0px; padding: 0px;">4</span>) );
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">lock</span>( Global._JobQueue )
{
Global._JobQueue.Add( newJob );
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
So, the job gets queued to be executed after 4 minutes. The service code runs every two minutes and checks the job queue if there's anything that is overdue and needs to be executed. If there's any job waiting, it is removed from the queue and executed. The service code now has an additional method called <code style="border: 0px; color: #990000; font-family: Consolas, 'Courier New', Courier, mono; font-size: 11pt; margin: 0px; padding: 0px;">ExecuteQueuedJobs</code>. This function does the scheduled job execution:</div>
<div class="pre-action-link" id="premain15" style="background-color: white; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-width: 0px 0px 1px; color: #005782; font-family: 'Segoe UI', Arial, sans-serif; font-size: 11px; margin: 0px; padding: 0px; text-align: right;" width="100%">
<img height="9" id="preimg15" preid="15" src="http://www.codeproject.com/images/minus.gif" style="border: 0px; cursor: pointer; height: auto; margin: 0px; max-width: 100%; overflow: auto; padding: 0px;" width="9" /><span id="precollapse15" preid="15" style="border: 0px; cursor: pointer; margin: 0px; padding: 0px;"> Collapse</span><span style="border: 0px; margin: 0px; padding: 0px;"> | </span><a href="http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc#" preid="15" style="border: 0px; color: purple; margin: 0px; padding: 0px; text-decoration: none;">Copy Code</a></div>
<pre id="pre15" lang="cs" style="background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; overflow: auto; padding: 6px; white-space: pre-wrap; word-wrap: break-word;"><span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">private</span> <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">void</span> ExecuteQueuedJobs()
{
ArrayList jobs = <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">new</span> ArrayList();
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> Collect which jobs are overdue
</span>
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">foreach</span>( Job job <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">in</span> _JobQueue )
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">if</span>( job.ExecutionTime <= DateTime.Now )
jobs.Add( job );
}
<span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;">//</span><span class="code-comment" style="border: 0px; color: green; font-style: italic; margin: 0px; padding: 0px;"> Execute the jobs that are overdue
</span>
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">foreach</span>( Job job <span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">in</span> jobs )
{
<span class="code-keyword" style="border: 0px; color: blue; margin: 0px; padding: 0px;">lock</span>( _JobQueue )
{
_JobQueue.Remove( job );
}
job.Execute();
}
}</pre>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Don't forget to lock the static job collection because ASP.NET is multithreaded, and pages being executed on different threads have a high possibility for trying to write on the job queue at the same time.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
Who can benefit from this</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
ASP.NET developers who host their website on shared hosting environments which do not offer a Windows Service feature can benefit from this code. Also for those who do not have their own dedicated server to install Windows Services.</div>
<h2 style="background-color: white; color: #ff9900; font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 200; margin: 20px 0px 11px; padding: 0px 0px 10px;">
How to run the sample project</h2>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
The sample project is a very simple website with a dummy page. All the code is inside <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em>. You need to modify the connection string, MSMQ name, and the folder path according to your settings.</div>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
Here's how to setup the code:</div>
<ul style="background-color: white; border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;">
<li style="border: 0px; margin: 0px; padding: 0px;">Extract the zip in a folder.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Create a virtual directory named "<em style="border: 0px; margin: 0px; padding: 0px;">TestCacheTimeout</em>" and map to the extracted folder.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Load the project file and run.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Create an MSMQ Queue called "ASPNETService".</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Run the SQL to create the log table in <em style="border: 0px; margin: 0px; padding: 0px;">tempdb</em>, as explained earlier.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Create a <em style="border: 0px; margin: 0px; padding: 0px;">temp</em> folder in <em style="border: 0px; margin: 0px; padding: 0px;">C:</em> drive and add the ASPNET/NETWORK SERVICE account with Write permission.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Fix all the constants available in <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em>.</li>
</ul>
<div style="background-color: white; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px;">
If you want to add the code in your own project, do the following:</div>
<ul style="background-color: white; border: 0px; color: #111111; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; margin: 10px 0px; padding: 0px 0px 0px 40px;">
<li style="border: 0px; margin: 0px; padding: 0px;">Copy the <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em> code to yours.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Create a dummy page which queues the cache item. The dummy page needs no code.</li>
<li style="border: 0px; margin: 0px; padding: 0px;">Modify the constants available in the <em style="border: 0px; margin: 0px; padding: 0px;">Global.asax</em> at the beginning.</li>
</ul>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-20405420616473137502013-11-22T07:20:00.001-08:002013-11-22T07:20:35.644-08:00Пишем свой Windows service<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Многие из нас сталкиваются с такой задачей, когда нужно запускать своё приложение при запуске компьютера. Конечно можно поместить ярлык в автозагрузку, но как-то это неправильно. Да к тому же если комп перегрузился, а пользователь не залогинелся, то и ваше приложение тоже не запустится. </span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Самым верным решением в данной ситуации является написание Windows сервиса.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Пример создания сервиса в Studio 2010, .Net C# под катом</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><a href="" name="habracut" style="background-color: white; border: 0px; color: #6da3bd; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></a><br />
<h2 style="background-color: white; border: 0px; color: #999999; font-family: Verdana, sans-serif; font-size: 20px; font-weight: normal; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Шаг 1. Создание проекта.</h2>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Создайте новый проект, выбрав шаблон </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Windows Service</strong><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/01.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Переименуйте класс сервиса как вам нужно.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/02.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Получили такой вод код:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br />
<blockquote style="background-color: white; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-width: 0px 0px 0px 2px; clear: both; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0.83em 0px; outline: 0px; padding: 0px 0px 0px 15px; quotes: none; vertical-align: baseline;">
<code style="border: 0px; color: #222222; font-family: Menlo, Monaco, 'Courier New', monospace; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="color: black;"><span style="color: blue;">namespace</span> ExampleSrv<br />{<br /> <span style="color: blue;">public</span> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> MyService : ServiceBase<br /> {<br /> <span style="color: blue;">public</span> MyService()<br /> {<br /> InitializeComponent();<br /> }<br /><br /> <span style="color: blue;">protected</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> OnStart(<span style="color: blue;">string</span>[] args)<br /> {<br /> }<br /><br /> <span style="color: blue;">protected</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> OnStop()<br /> {<br /> }<br /> }<br />}</span><br /><br /><span style="color: grey;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx" style="border: 0px; color: #990099; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="color: grey;">Source Code Highlighter</span></a>.</span></code></blockquote>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Это и есть, собственно, сам сервис.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Используйте </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">OnStart </strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">и </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">OnStop </strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">события для реализации своей поставленной задачи.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br />
<h2 style="background-color: white; border: 0px; color: #999999; font-family: Verdana, sans-serif; font-size: 20px; font-weight: normal; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Шаг 2. Добавление установщика.</h2>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Чтобы ваш сервис заставить работать, его нужно установить.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Чтобы его установить, он должен иметь установщик.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Клик правой кнопкой… </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Add installer</strong><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/03.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Теперь у нас есть </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">serviceProcessInstaller</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;"> и </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">serviceInstaller</strong><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img alt="img04" src="http://img.verych.info/h1/04.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">В первом можете поставить значение </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Account </strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">в </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">LocalSystem</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Во втором укажите имя сервиса, описание и не забудьте поставить </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">StartType</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;"> — </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Automatic</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/05.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Установщик готов.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br />
<h2 style="background-color: white; border: 0px; color: #999999; font-family: Verdana, sans-serif; font-size: 20px; font-weight: normal; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Шаг 3. Логирование.</h2>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Для того чтобы вы смогли узнать что делал ваш сервис, когда он стартовал, завершался или что-нибудь еще, вы можете использовать системное логирование. </span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Делается это очень легко.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Перетаскиваете из Toolbox в свой сервис </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">EventLog</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/06.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Примерно так делается логирование:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br />
<blockquote style="background-color: white; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-width: 0px 0px 0px 2px; clear: both; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0.83em 0px; outline: 0px; padding: 0px 0px 0px 15px; quotes: none; vertical-align: baseline;">
<code style="border: 0px; color: #222222; font-family: Menlo, Monaco, 'Courier New', monospace; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="color: black;"><span style="color: blue;">public</span> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> MyService : ServiceBase<br /> {<br /> <span style="color: blue;">public</span> MyService()<br /> {<br /> InitializeComponent();<br /> }<br /><br /> <span style="color: blue;">protected</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> OnStart(<span style="color: blue;">string</span>[] args)<br /> {<br /> AddLog(<span style="color: #a31515;">"start"</span>);<br /> }<br /><br /> <span style="color: blue;">protected</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span> OnStop()<br /> {<br /> AddLog(<span style="color: #a31515;">"stop"</span>);<br /> }<br /><br /> <span style="color: blue;">public</span> <span style="color: blue;">void</span> AddLog(<span style="color: blue;">string</span> log)<br /> {<br /> <span style="color: blue;">try</span><br /> {<br /> <span style="color: blue;">if</span> (!EventLog.SourceExists(<span style="color: #a31515;">"MyExampleService"</span>))<br /> {<br /> EventLog.CreateEventSource(<span style="color: #a31515;">"MyExampleService"</span>, <span style="color: #a31515;">"MyExampleService"</span>);<br /> }<br /> eventLog1.Source = <span style="color: #a31515;">"MyExampleService"</span>;<br /> eventLog1.WriteEntry(log);<br /> }<br /> <span style="color: blue;">catch</span>{}<br /> }<br /> }</span><br /><br /><span style="color: grey;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx" style="border: 0px; color: #990099; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="color: grey;">Source Code Highlighter</span></a>.</span></code></blockquote>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br />
<h2 style="background-color: white; border: 0px; color: #999999; font-family: Verdana, sans-serif; font-size: 20px; font-weight: normal; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Шаг 4. Установка.</h2>
<br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Чтобы установить сервис, нужно вызвать утилиту установки и передать параметром путь к своему сервису.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Для этого я создал install.bat такого вида:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><code style="background-color: white; border: 0px; color: #222222; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe D:\...\ExampleSrv\bin\Debug\ExampleSrv.exe<br />pause</code><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Если вы выбрали в </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">serviceProcessInstaller </strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">значением поля </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Account</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;"> — </span><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">User</strong><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">, то при установке вы должны будете ввести логин и пароль учетной записи, под которой будет запускаться сервис. Внимание! Писать домен перед именем пользователя обязательно!</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Запускаем батник обязательно с правами администратора и наблюдаем в конце:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><strong style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">The Commit phase completed successfully.<br />The transacted install has completed.</strong><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Это значит что сервис установлен.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Проверяем:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/07.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Установился.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Пару раз делаем запуск и остановку. Смотрим логи:</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><img src="http://img.verych.info/h1/08.png" style="background-color: white; border: 0px; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Видим когда сервис запускался и останавливался.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Наш сервис готов.</span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Материал частично взят от сюда: </span><br style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;" /><a href="http://msdn.microsoft.com/en-us/library/zt39148a" style="background-color: white; border: 0px; color: #990099; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">msdn.microsoft.com/en-us/library/zt39148a</a><span style="background-color: white; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">(VS.80).aspx</span></div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-67655224602672136532013-10-27T13:30:00.002-07:002013-10-27T13:30:59.950-07:00What's the git equivalent of “svn update -r”?<div dir="ltr" style="text-align: left;" trbidi="on">
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">git checkout HEAD~1
</code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This will move your current HEAD to one revision earlier.</div>
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">git checkout <sha>
</sha></code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This will move your current HEAD to the given revision. Use <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">git log</code> or <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">gitk</code> to find the revision you’re looking for.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
And getting back to latest (equivalent to: svn up), you'll need to update the branch, usually:</div>
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">git checkout master
</code></pre>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
This is because the HEAD refers to the version that is being checked o</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-82787675129253591932013-10-22T04:48:00.001-07:002013-10-22T04:48:50.504-07:00AUTO SCALING YOUR WEBSITE WITH AMAZON WEB SERVICES (AWS) – PART 2<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
In <a href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-1/" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="AutoScaling Part 1: How to setup and use EC2 instances on Amazon AWS">the first half of this article</a>, we set up an EC2 instance on Amazon AWS, deployed our LAMP-based micro-site on it, tested it, and created an AMI image of the web application. If you’re following along and have an EC2/AMI ready, continue below to configure auto-scaling, otherwise review <a href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-1/" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank">Part 1</a>.</div>
<h2 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 28px; font-weight: 400; line-height: 31px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
PART 2: SETTING UP AUTO SCALING</h2>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Within the overall umbrella of Amazon Web Services are dozens of individual technologies that you can use together to provision, launch, monitor and manage scalable web applications. Setting up intelligent auto scaling (AS) on AWS requires several of them, including:</div>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><strong style="font-family: MyriadProSemibold, sans-serif;">Amazon Machine Image (AMIs)</strong> – snapshot templates defining a launchable EC2 server instance</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><strong style="font-family: MyriadProSemibold, sans-serif;">Elastic Load Balancer (ELB)</strong> – a virtual load balancer platform with configurable events</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><strong style="font-family: MyriadProSemibold, sans-serif;">CloudWatch (CW)</strong> – tools to monitor and check your EC2 instances</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><strong style="font-family: MyriadProSemibold, sans-serif;">Command line tools</strong> – simple Java programs that call out to the AWS API using your credentials. Unfortunately, Amazon hasn’t added all of the autoscaling configurations to the online AWS Console yet, so until further notice, you’ll have to use a few command-line scripts to finish out the autoscaling configuration. Download the <a href="http://aws.amazon.com/developertools/2535" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="Download the Auto Scaling Command Line Tools from Amazon Web Services">Auto Scaling command line tool</a> from the AWS developer portal and run them on the command line to configure your autoscaling setup.</li>
</ul>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
WHY AUTO SCALING?</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Online marketers spend hours, days, weeks and even months, planning marketing campaigns, both online and offline, to drive traffic to websites, and IT provisioning is difficult even when you know in advance when the traffic is coming. But what if you don’t know when a huge traffic spike will hit your server? The better a social or viral marketing campaign is, the more likely it could result in irregular traffic patterns or server load spikes at unexpected times. The flexibility of AWS autoscaling frees you from having to accurately predict and provision servers in advance of huge traffic spikes.</div>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
HOW IT WORKS</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
In general, Auto scaling with Amazon Web Services works like this:</div>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">You define an AMI instance and create an Auto Scaling Group to launch instances into.</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">You use CloudWatch to monitor your server(s) instance(s), and when certain configurable events happen, you can launch more instances based on the AMI template you define.</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">EC2 instances launch behind the Elastic Load Balancer (ELB) you define.</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">The ELB will send traffic in a round-robin pattern between all the instances assigned to it, and you can control in real time how many instances you want to launch to cover sporadic bursts of high-volume traffic, and keep at least one or two running during traffic lulls. If any of your EC2 instances fails to respond, the ELB will detect it and launch a replacement. When web traffic dies down, you can terminate instances automatically, too.</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">CloudWatch lets you configure alarms that trigger auto scaling policies to launch additional EC2 instances into your auto scaling group when network traffic, server load, or other measurable statistic, gets too high—say, 80% usage. The number of servers you add is based on whatever your policy states—1, 3, 10 more servers—it’s up to you. Each server is a duplicate instance of the AMI you define in your auto scaling config. You can even use Amazon Simple Notification Service (SNS) to send yourself an email or text message when an auto scaling event occurs.</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Your ELB automatically spreads out the incoming visitors between all the servers in your Autoscaling Group. You can set a minimum and maximum number of instances in your group, offering you peace of mind that your site will not crash due to the influx of visitors, and also to limit the impact on your billing statement. You are also able to tell AWS to decrease the number of instances when network traffic drops below, say 20% usage for a measurable amount of time, to scale back the number of servers in your web server farm.</li>
</ul>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
HOW MANY SERVERS WILL I NEED?</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
That’s the toughest question to answer—a lot of variable factors are involved. It depends on the volume of traffic you receive, the type of EC2 instances you use, and the complexity of your application. For our simple PHP application, we estimated that a single t1.micro instance, Amazon’s smallest and least expensive EC2 option, should easily handle between 50 to 75 simultaneous users. We determined this based on the available amount of RAM available in a t1.micro instance, and comparing that to the average amount of memory taken by a typical PHP request on our application. We then did some actual load-testing and benchmarking with the command-line tool, <a href="http://www.joedog.org/siege-home/" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="Download siege to load test your web application servers">siege</a>. We’ll get into the details of that later. Ultimately we decided that we wanted no fewer than 2 servers and no more than 100, or support for up to 7,500 simultaneous users, based on using t1.micro’s in our autoscaling configuration.</div>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
WHAT TO MONITOR</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
AWS CloudWatch lets you monitor several different EC2 server performance metrics in real time, including…</div>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">CPU Utilization (%)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Memory Utilization (%)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Network Out Utilization (MB)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Memory Used (MB)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Memory Available (MB)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Swap Utilization (%)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Swap Used (MB)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Disk Space Utilization (%)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Disk Space Used (GB)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Disk Space Available (GB)</li>
</ul>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
…and many more. It’s up to you what to monitor, but the metrics most useful for knowing when you should scale up and add another server or scale down by terminating a server are probably CPU utilization, memory utilization or network utilization.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
It should also be noted that Amazon provides plenty of basic monitoring metrics for free. Basic monitoring has a 5 minute refresh interval. If monitoring every 5 minutes isn’t fast enough for your application, you can also look at the detailed monitoring option, which costs only fifty cents per metric per month. Detailed monitoring fires events at 1-minute intervals. Here’s a <a href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html#ec2-metricscollected" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="Amazon CloudWatch Metrics">list of the EC2 metrics</a> you can monitor using CloudWatch. If you don’t find a metric that will suit your application, you can even submit (via the Amazon AWS API) a custom metric from your app that CloudWatch should monitor.</div>
<h2 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 28px; font-weight: 400; line-height: 31px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
HOW TO CONFIGURE AUTO SCALING</h2>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Before we get started, let’s look at the two prerequisites you need to have in place before creating an auto scaling configuration.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong style="font-family: MyriadProSemibold, sans-serif;">Prerequisite 1: Choose an AMI to use.</strong> If you haven’t created an AMI from one of your running EC2 instances, <a href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-1/#ami" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank">go back to Part 1 and create an AMI now</a>, or click over to your AMIs page on the AWS Console to retrieve the AMI ID to be used as a template, and write it down. You’ll need an AMI ID in Step 1.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong style="font-family: MyriadProSemibold, sans-serif;">Prerequisite 2: Fire up an ELB.</strong> The ELB name that is displayed on the AWS Console will also be passed to the command we run in Step 2. We used the AWS Console to create an ELB, and simply accepted the defaults on each of the Elastic Load Balancer setup screens. Once your ELB is up, you will most likely create a CNAME record at your DNS provider pointing your landing page or vanity domain to the DNS name given in the AWS Console. Visit the <a href="http://aws.amazon.com/elasticloadbalancing/" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="Elastic Load Balancing at Amazon AWS">Elastic Load Balancing at Amazon AWS</a> page for additional information.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Okay, here we go! As we mentioned above, not all of the functions needed to implement autoscale are implemented in the AWS Management Console yet. So, roll up your sleeves and fire up Terminal (Mac) or CMD (Windows). We’ll be using a few different command line tools to finish our autos caling configuration.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong id="launch-config" style="font-family: MyriadProSemibold, sans-serif;">Step 1: Create a launch config.</strong> The first command to setting up autoscale is <em>as-create-launch-config</em>. Using this command, you tell AWS:</div>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a unique name for the configuration,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">which AMI ID you want to use as your template for creating more EC2 instances,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">the EC2 instance type (the size and power of the server) to launch using your AMI,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">your access key,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">and a security group to deploy the instances into.</li>
</ul>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
The API replies with: “OK-Created launch config.”</div>
<div class="syntaxhighlighter " id="highlighter_86402" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> as-create-launch-config {your_launch_config_name} --image-</code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">id</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{your_ami_id} --instance-</code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">type</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">t1.micro --key {your_access_key} --group {your_group_name}</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Return message: OK-Created launch config</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong id="auto-scaling-group" style="font-family: MyriadProSemibold, sans-serif;">Step 2: Create an auto scaling group.</strong> Use the <em>as-create-auto-scaling-group</em> command to define the properties for your group of servers. Auto scaling groups are the core component of an auto-scaling configuration. This command takes the<em>launch_config_name</em> you defined from the step before as a parameter, the name of the ELB you want to use, and most importantly, lets you define the minimum and maximum number of servers you want to have in your cluster. In the example below, we define a group with a minimum of 2 servers and a maximum of 10.</div>
<div class="syntaxhighlighter " id="highlighter_50271" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> as-create-auto-scaling-group {your_scaling_group_name} --launch-configuration {your_launch_config_name} --availability-zones us-east-1d --min-size 2 --max-size 10 --load-balancers {your_load_blancer_name} --health-check-</code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">type</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ELB --grace-period 300</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Return message: OK-Created AutoScalingGroup</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
The grace period is the number of seconds that AWS will wait after an autoscaling event occurs before possibly triggering another autoscaling event. This is an important consideration that prevents AWS from adding too many servers too quickly. AWS responds with “OK-Created AutoScalingGroup.”</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong id="scaling-policy" style="font-family: MyriadProSemibold, sans-serif;">Step 3: Create auto scaling policies.</strong> Once we have our EC2 AMI, an AS launch config, and an AS group defined to deploy our instances into, we’re ready to define the auto scaling policies that will actually cause more (or fewer) EC2 instances to be launched and attached behind the ELB.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
The command used to change the number of servers in the group is the <em>as-put-scaling-policy</em> command. With auto scaling, you use EC2 monitoring within CloudWatch to trigger a certain policy, but before we can do that, we need to define the actual policies that will be triggered. You can use this command to manually trigger scaling events as well, for testing before your traffic burst arrives, and in doing so, you can not only see the effect of scaling up and down, but you can watch AWS work its magic by refreshing your Instances view—new server instances appear in the AWS Management Console as your traffic increases beyond the thresholds you set.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
The <em>as-put-scaling-policy</em> command takes the auto scaling group name we defined in step 1, a name for the policy, such a “scale-up” or “scale-down,” the type of scaling change the policy defines, and a cooldown period. Again, the cooldown period is used to prevent AWS from executing multiple policies within a very short time.</div>
<div class="syntaxhighlighter " id="highlighter_609268" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> as-put-scaling-policy --auto-scaling-group {your_scaling_group_name} --name scale-up --adjustment 1 --</code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">type</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ChangeInCapacity --cooldown 300</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Return message: arn:aws:autoscaling:us-east-1:751374139099:scalingPolicy:e31ae79c-4210-42ad-8d86-60210aaf7a20:autoScalingGroupName/sg-breezes-gma:policyName/scale-up</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Above you can see the basic upscale policy we defined, named “scale-up,” a ChangeInCapacity policy to add 1 server and wait 3 minutes before another policy can be triggered. Below is the reverse operation, or a “scale-down” policy to remove 1 server from our group.</div>
<div class="syntaxhighlighter " id="highlighter_532212" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> as-put-scaling-policy --auto-scaling-group {your_scaling_group_name} --name scale-dn </code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(42, 0, 255) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"--adjustment=-1"</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">--</code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">type</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ChangeInCapacity --cooldown 300</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Return message: arn:aws:autoscaling:us-east-1:751374139099:scalingPolicy:07a0f71c-d214-4497-973f-c4cdcb15851f:autoScalingGroupName/sg-breezes-gma:policyName/scale-dn</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
In both cases, AWS replies with a return message including the unique auto-generated name of our two new auto scaling policies. We’ll use those unique policy identifiers to connect to our CloudWatch events in the final step.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<strong style="font-family: MyriadProSemibold, sans-serif;">Step 4: Link a CloudWatch event to an auto scaling policy.</strong> At the moment we have everything we need for an <em>intelligent</em> autoscaling configuration <em>except one thing—the intelligence!</em> The smarts come from choosing a CloudWatch event, such as 80% CPU utilization of an EC2 instance in our group, and wiring up that condition to automatically trigger the scale-up policy we defined. We’re also going to want to do the same in reverse for scaling back down at 20% CPU utilization.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
The command to do this comes from the CloudWatch command line tools, and is called<em id="metric-alarm">mon-put-metric-alarm</em>. This command takes several parameters:</div>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a name for the alarm that you choose</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"> a description for what the alarm is monitoring,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">the namespace for the alarm (in this case, AWS/EC2)</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">the name of the [namespace] metric that you want to monitor</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">the statistic type of the monitoring metric, such as Average or Percent,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a period or time interval,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a threshold for the statistic you choose,</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a comparison operator, such as greater than or lesser than</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">a dimension, which is the ID of an EC2 instance to monitor</li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">and the number of evaluation periods during which the metric you choose has to consistently return over or under the average or percent unit you define</li>
</ul>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
As you can see, there’s a lot to this command, but once we look at every parameter, you can see that without each of them, you wouldn’t have the ability to control auto scaling changes with enough granularity. The name and description are shown back to you later when using the <em>mon-describe-alarms</em> command. The statistics you’re watching, and the thresholds and time intervals, are important to test for your particular application. For example, we chose to monitor average CPU utilization for a period of 60 seconds, and an evaluation period of 3 intervals (or 3 minutes), for an event of 80% or greater level. Here’s the command to achieve this.</div>
<div class="syntaxhighlighter " id="highlighter_627636" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> mon-put-metric-alarm --alarm-name sample-scale-up --alarm-description </code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(42, 0, 255) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Scale up at 80% load"</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">--metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 60 --threshold 80 --comparison-operator GreaterThanThreshold --dimensions InstanceId=i-37b12752 --evaluation-periods 3 --unit Percent --alarm-actions arn:aws:autoscaling:us-east-1:751374139099:scalingPolicy:78d05062-0eda-436c-864e-d93776461eba:autoScalingGroupName/sg-sample-group:policyName/scale-up</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">OK-Created Alarm</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
In English, the above command says, “If the average CPU utilization of instance i-37b12752 is measured at 80% or greater 3 times over 3 minutes, then trigger our scale-up policy.”</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Here is the reverse <em>mon-put-metric-alarm</em> command we used to terminate one of the servers if the CPU utilization drops below an average of 20% over 3 minutes.</div>
<div class="syntaxhighlighter " id="highlighter_952277" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> mon-put-metric-alarm --alarm-name sample-scale-dn --alarm-description </code><code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(42, 0, 255) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Scale down at 20% load"</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">--metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 60 --threshold 20 --comparison-operator LessThanThreshold --dimensions InstanceId=i-37b12752 --evaluation-periods 3 --unit Percent --alarm-actions arn:aws:autoscaling:us-east-1:751374139099:scalingPolicy:78d05062-0eda-436c-864e-d93776461eba:autoScalingGroupName/sg-sample-group:policyName/scale-dn</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
For more information and examples, refer to the <a href="http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/US_BasicSetup.html" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank">Auto Scaling</a> section on the Amazon developer documentation.</div>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
TESTING WITH SIEGE</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
As mentioned above, we used the command line tool <em>siege</em> to work through the configuration setup and to verify whether our policies were working as we wanted. Using siege on a different server or EC2 instance, you can easily simulate tons of website traffic for a short period of time. Siege does this by creating dozens or even hundreds of concurrent HTTP requests to your URL for the duration you specify. This gives you a chance to see what will happen to your auto scaling policies when real users flood your web server with traffic and CloudWatch alarms start triggering.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Siege can be installed with the package manager on your system. We simply ran</div>
<div class="syntaxhighlighter " id="highlighter_124616" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">sudo</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">apt-get </code><code class="functions" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">install</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">siege</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
on our Ubuntu/Debian system, and that was it. TechRepublic.com has a great <a href="http://www.techrepublic.com/article/test-your-web-server-lay-siege-to-it/5171727" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" target="_blank" title="Tech Republic article on siege">article on installing from source and using siege</a>.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Siege is simple to use—just give it the number of concurrent connections you want to create (-c), the length of time (-t) to run the test, and your URL, as shown:</div>
<div class="syntaxhighlighter " id="highlighter_304629" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">siege -c25 -t10M www.example.com</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
One thing to note here is that CloudWatch basic monitoring refreshes every 5 minutes, and our auto scaling policies above require a metric to be met for 3 consecutive minutes, so we had to run siege tests for at least 6 to 10 minutes to ensure that our policies had enough time to trigger at least twice. While siege was running, we refreshed the CloudWatch tab in AWS Management Console to verify that more servers were indeed getting launched.</div>
<h4 style="background-color: white; color: #9c8f7c; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 30px; margin-bottom: 20px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
TIME-LAPSE SHOWING THE EFFECT OF SIEGE TESTING ON AUTO SCALE</h4>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
<img alt="AWS Auto Scaling Animation" class="size-full wp-image-5572" height="300" src="http://www.cardinalpath.com/cpwp/wp-content/uploads/AutoScaleAnimation.gif" style="border: 0px; height: auto; margin: 0px; max-height: 100%; max-width: 100%;" title="AWS Auto Scaling Animation" width="600" /></div>
<ol style="background-color: white; color: #ff7900; font-family: MyriadProSemibold, sans-serif; font-size: 18px; line-height: 21px; list-style-image: initial; list-style-position: initial; margin-bottom: 20px; margin-left: 50px; padding: 0px 0px 0px 1.25em;">
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Two instances running prior to launching Siege</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Siege test starts; new instances automatically launched as the scale-up policy is triggered</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Additional instances launched to handle continued Siege test</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">No more instances needed, load is handled and stable</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Siege test is completed</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Shutting down an instance as bottom threshold is met</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;">Two instances now terminated after scale-down policy, returns system to initial state</li>
</ol>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
MAKING CHANGES</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
It should have come as no surprise that we would need to make changes to our landing page and micro-site at the last minute, right before our client’s scheduled appearance on a national TV show. To make changes to the landing page, we need to upload some new files to our EC2 instance. No big deal, right?</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Under a normal web hosting scenario, this is no problem, but when you have an AMI defined to be the source template for an auto scaling configuration, and the entire micro-site content is baked into the AMI, it’s an issue because the moment one of our events is triggered and CloudWatch triggers our auto scaling policy to launch a new instance, it’s going to be copied from our now-stale AMI with the outdated content.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
It’d be nice to simply create a new AMI with the changes and re-run the <em>as-create-launch-config</em> script where we define the AMI to use, however trying that gives the following error:</div>
<div class="syntaxhighlighter " id="highlighter_154449" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">configuration already exists with the name sample-launch-config-name</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
So that won’t work. Next, we thought maybe could just delete the auto scaling group, using the <em id="delete-auto-scaling-group">as-delete-auto-scaling-group</em> command, and AWS asks, “Are you sure you want to delete this AutoScalingGroup?” When we replied “Y,” we got this error:</div>
<div class="syntaxhighlighter " id="highlighter_712664" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-delete-auto-scaling-group: Malformed input-You cannot delete an AutoScalingGroup </code><code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(127, 0, 85) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">while</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">there are instances still </code><code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(127, 0, 85) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">in</code> <code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">the group.</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Well that’s good to know—you cannot inadvertently delete an auto scaling group while instances are running inside it. What instances <em>are</em> running inside it? You can use the <em id="describe-auto-scaling-instances">as-describe-auto-scaling-instances</em> command for that. This command is nearly identical to <em>ec2-describe-instances</em>, but instead of showing all your instances, it lists the ones running inside each autoscaling group you have configured.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
In order to actually terminate the instances, though, we have to change the minimum number of instances allowed. Remember, when we ran the <em>as-put-scaling-policy</em> earlier, we defined minimum instances as two. If we terminate the instances in the group, AWS will just launch more to replace them to meet the minimum. So, next, we had to change the minimum number of servers in our auto scaling group to zero. This is most easily done with the <em id="update-auto-scaling-group">as-update-auto-scaling-group</em> command, as shown:</div>
<div class="syntaxhighlighter " id="highlighter_174620" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; color: #4b372d; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 18px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 649.21875px;">
<div class="lines no-wrap" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">1</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$PROMPT> as-update-auto-scaling-group sample-sg-name --min-size 0</code></td></tr>
</tbody></table>
</div>
<div class="line alt2" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(120, 120, 120) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;">2</code></td><td class="content" style="background-image: none !important; border-left-color: rgb(212, 208, 200) !important; border-left-style: solid !important; border-width: 0px 0px 0px 1px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; white-space: pre !important; width: auto !important;"><code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">OK-Updated AutoScalingGroup</code></td></tr>
</tbody></table>
</div>
</div>
</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Once we did that, we could terminate our instances using the <em id="terminate-instance">as-terminate-instance-in-auto-scaling-group</em> command. Finally, we could run <em>as-delete-auto-scaling-group</em>followed by <em id="delete-launch-config">as-delete-launch-config</em>.</div>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
Granted, this manual work to build up and tear down an auto scaling configuration is kind of a pain point, but in our case we didn’t have time to use a proper deployment script, as is normally the case for cloud deployments. On the other hand, it did force us to learn all the command line tools to reverse, undo, tear down and delete an auto scaling configuration and document them here.</div>
<h3 style="background-color: white; color: #ff7900; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 27px; margin-bottom: 10px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
AUTO SCALING COMMAND SUMMARY</h3>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
To build up an auto scaling group</div>
<ol style="background-color: white; color: #ff7900; font-family: MyriadProSemibold, sans-serif; font-size: 18px; line-height: 21px; list-style-image: initial; list-style-position: initial; margin-bottom: 20px; margin-left: 50px; padding: 0px 0px 0px 1.25em;">
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#launch-config" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-create-launch-config">as-create-launch-config</a></li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#auto-scaling-group" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-create-auto-scaling-group">as-create-auto-scaling-group</a></li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#scaling-policy" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-put-scaling-policy">as-put-scaling-policy</a> (for scaling up)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#scaling-policy" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-put-scaling-policy">as-put-scaling-policy</a> (for scaling down)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/scaling_plan.html#policy_running" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-execute-policy">as-execute-policy</a> (for testing the policies)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#update-auto-scaling-group" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-update-auto-scaling-group">as-update-auto-scaling-group</a> (for changing policies)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#metric-alarm" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS mon-put-metric-alarm">mon-put-metric-alarm</a> (for triggering policies)</li>
</ol>
<div style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 28px; margin-bottom: 20px;">
To tear down an auto scaling group</div>
<ol style="background-color: white; color: #ff7900; font-family: MyriadProSemibold, sans-serif; font-size: 18px; line-height: 21px; list-style-image: initial; list-style-position: initial; margin-bottom: 20px; margin-left: 50px; padding: 0px 0px 0px 1.25em;">
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#update-auto-scaling-group" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-update-auto-scaling-group">as-update-auto-scaling-group</a> (to set a minimum of 0 instances)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#describe-auto-scaling-instances" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-describe-auto-scaling-instances">as-describe-auto-scaling-instances</a> (to see the instance IDs)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#terminate-instance" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-terminate-instance-in-auto-scaling-group">as-terminate-instance-in-auto-scaling-group</a> (terminate each ID)</li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#delete-auto-scaling-group" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-delete-auto-scaling-group">as-delete-auto-scaling-group</a></li>
<li style="color: #574034; font-family: MyriadPro, sans-serif; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a class="scroll_blog" href="http://www.cardinalpath.com/autoscaling-your-website-with-amazon-web-services-part-2/#delete-launch-config" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Amazon AWS as-delete-launch-config">as-delete-launch-config</a></li>
</ol>
<h4 style="background-color: white; color: #9c8f7c; font-family: TradeGothic, sans-serif; font-size: 24px; font-weight: 400; line-height: 30px; margin-bottom: 20px; margin-top: 0px; text-shadow: rgb(255, 255, 255) 0px 1px 1px; text-transform: uppercase;">
REFERENCE DOCUMENTATION</h4>
<ul style="background-color: white; color: #4b372d; font-family: MyriadPro, sans-serif; font-size: 18px; line-height: 21px; list-style: none; margin-bottom: 20px; padding: 0px 0px 0px 1.25em;">
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://aws.amazon.com/documentation/" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="AWS Developer Documentation">AWS Developer Documentation</a></li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/SettingUp_CommandLine.html?r=2389" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Getting Started with the Command Line Tools">Getting Started with the Command Line Tools</a></li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://docs.amazonwebservices.com/AutoScaling/latest/GettingStartedGuide/Welcome.html?r=8402" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Get Started with Auto Scaling">Get Started with Auto Scaling</a></li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/Welcome.html?r=128" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Auto Scaling Developer Guide">Auto Scaling Developer Guide</a></li>
<li style="background-image: url(http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath2.0/img/ul-chevrons_orange.png); background-position: 0% 7px; background-repeat: no-repeat no-repeat; line-height: 24px; margin-bottom: 15px; padding-left: 20px;"><a href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/GettingStartedGuide/SetupCLI.html" style="-webkit-transition: color 0.3s ease; color: #316498; font-family: MyriadProSemibold, sans-serif; line-height: inherit; outline: 0px; text-decoration: none; transition: color 0.3s ease;" title="Set Up the Command Line Interface">Set Up the Command Line Interface</a></li>
</ul>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-39167410290141518782013-10-22T04:47:00.001-07:002013-10-22T04:47:50.541-07:00How to use Amazon Web Services Auto Scaling Groups<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This post we will cover all the commands to create and managed Amazons <strong style="border: 0px; font-family: inherit; font-size: 16px; font-style: inherit; letter-spacing: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Auto Scaling Groups</strong></div>
<h3 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 2.5em; font-weight: normal; margin: 30px 0px 20px; outline: 0px; padding: 0px; vertical-align: baseline;">
What is an Auto Scaling Group?</h3>
<blockquote style="background-color: #f4f4f4; border: 1px solid rgb(208, 208, 208); color: #282828; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; font-style: italic; margin: 0px 0px 40px; outline: 0px; padding: 20px 30px; position: relative; quotes: ''; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1.4em; font-style: inherit; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Auto Scaling allows you to scale your Amazon EC2 capacity up or down automatically according to conditions you define. With Auto Scaling, you can ensure that the number of Amazon EC2 instances you’re using increases seamlessly during demand spikes to maintain performance, and decreases automatically during demand lulls to minimize costs.</div>
</blockquote>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
You will need to <a href="http://www.robertsindall.co.uk/blog/how-to-set-up-amazon-auto-scaling-group-command-line-tools-on-windows/" style="border: 0px; color: #c84a28; font-family: inherit; font-size: 16px; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" title="How to set up Amazon Auto Scaling Groups Command Line Tools on Windows">set up Amazon Auto Scaling Groups Command Line Tools on Windows</a></div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Now you will need an Amazon Machine Image (AMI)</div>
<h3 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 2.5em; font-weight: normal; margin: 30px 0px 20px; outline: 0px; padding: 0px; vertical-align: baseline;">
What is an Amazon Machine Image (AMI)?</h3>
<blockquote style="background-color: #f4f4f4; border: 1px solid rgb(208, 208, 208); color: #282828; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; font-style: italic; margin: 0px 0px 40px; outline: 0px; padding: 20px 30px; position: relative; quotes: ''; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1.4em; font-style: inherit; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
An Amazon Machine Image (AMI) is a special type of pre-configured operating system and virtual application software which is used to create a virtual machine within the Amazon Elastic Compute Cloud (EC2). It serves as the basic unit of deployment for services delivered using EC2.</div>
</blockquote>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Let’s imagine you have an AMI: ami-xxxxxx</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Before you can create an <strong style="border: 0px; font-family: inherit; font-size: 16px; font-style: inherit; letter-spacing: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Auto Scaling Group</strong> you need a <strong style="border: 0px; font-family: inherit; font-size: 16px; font-style: inherit; letter-spacing: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Launch Configuration</strong></div>
<h3 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 2.5em; font-weight: normal; margin: 30px 0px 20px; outline: 0px; padding: 0px; vertical-align: baseline;">
What is a Launch Configuration?</h3>
<blockquote style="background-color: #f4f4f4; border: 1px solid rgb(208, 208, 208); color: #282828; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; font-style: italic; margin: 0px 0px 40px; outline: 0px; padding: 20px 30px; position: relative; quotes: ''; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-size: 1.4em; font-style: inherit; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
A Launch Configuration defines the AMI to be used, the size of the EC2 instances to be used, the security group the instances will live in and the private key used to decrypt the password in Windows or for gaining access via SSH</div>
</blockquote>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
You will need to <a href="http://www.robertsindall.co.uk/blog/how-to-set-up-amazon-auto-scaling-group-command-line-tools-on-windows/" style="border: 0px; color: #c84a28; font-family: inherit; font-size: 16px; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" title="How to set up Amazon Auto Scaling Groups Command Line Tools on Windows">set up Amazon Auto Scaling Groups Command Line Tools on Windows</a> before you can start</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to create a Launch Configuration?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_905089" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 937px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 911px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// create launch config</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-create-launch-config my-launch-config-1 --image-id ami-xxxxxx --region eu-west-1 --instance-type m1.small --group my-securitygroup-sg --key myKey</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to check the launch configuration has been created?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_853394" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// check launch config has been created</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-describe-launch-configs --headers --region eu-west-1 --max-records 50</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
or check just your launch config has been create</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_865756" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// check your launch config has been created</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-describe-launch-configs my-launch-config-1 --headers --region eu-west-1 --max-records 50</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to delete a launch configuration?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_628942" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// delete launch config</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-delete-launch-config my-launch-config-1 --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to creating an Auto Scaling Group?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_745303" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1969px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1943px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// create auto scaling group</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-create-auto-scaling-group my-auto-scaling-group --region eu-west-1 --launch-configuration my-launch-config-1 --availability-zones eu-west-1a eu-west-1b eu-west-1c --min-size 3 --max-size 3 --desired-capacity 3 --default-cooldown 5 --grace-period 5 --tag "k=Name, v=my-server, p=true" --tag "k=enabled, v=true, p=true"</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to check the Auto Scaling Group has been created?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_199099" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// check auto scaling group has been created</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-describe-auto-scaling-groups --headers --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to add or update the Auto Scaling Group tags?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Add or update the Name tag</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_813536" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 811px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 785px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// add or update the tag</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-create-or-update-tags --tag "id=my-auto-scaling-group, t=auto-scaling-group, k=Name, v=my-server, p=true" --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Add or update a custom ROLE tag</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_171871" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 817px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 791px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// add or update the tag</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-create-or-update-tags --tag "id=my-auto-scaling-group, t=auto-scaling-group, k=ROLE, v=production, p=true" --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
Add or update a custom ALLOWED_IPS tag</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_271351" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 889px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 863px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// add or update tag</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-create-or-update-tags --tag "id=my-auto-scaling-group, t=auto-scaling-group, k=ALLOWED_IPS, v=XXX.XXX.XXX.XXX, p=true" --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to scale up the Auto Scaling Group?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This would scale your group of instances up to 6 and set a max of 12</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_983084" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 751px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 725px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// scale up</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-update-auto-scaling-group my-auto-scaling-group --region eu-west-1 --min-size 6 --max-size 12 --desired-capacity 6</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to scale down the Auto Scaling Group?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This would scale your group of instances up to 3 and set a max of 6</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_970615" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 745px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 719px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// scale down</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-update-auto-scaling-group my-auto-scaling-group --region eu-west-1 --min-size 3 --max-size 6 --desired-capacity 3</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to set zero instances in the Auto Scaling Group?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This would remove all instances, but keep the auto scaling group configuration ready for use in the future</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_882021" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 745px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 719px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// with zero instances</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-update-auto-scaling-group my-auto-scaling-group --desired-capacity 0 --max-size 0 --min-size 0 --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to delete an Auto Scaling Group?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_236389" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// delete auto scaling group</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-delete-auto-scaling-group my-auto-scaling-group --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to get the Auto Scaling Groups latest activities?</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This is handy for trouble shooting problems with your Auto Scaling Group</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_18299" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 708px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 682px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// to get latest actions</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-describe-scaling-activities --auto-scaling-group my-auto-scaling-group --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to update the Auto Scaling Group Configuration</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This command lets you change auto scaling group configuration, zones, the min, max and desired number of instances</div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_96897" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1321px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1295px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// with many options</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-update-auto-scaling-group my-auto-scaling-group --launch-configuration my-launch-config-2 --availability-zones eu-west-1a eu-west-1b eu-west-1c --desired-capacity 3 --max-size 3 --min-size 3 --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h5 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 1.9em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
How to change the Auto Scaling Group’s Launch Configuration</h5>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.4em; line-height: 1.6em; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline;">
This will set a new <strong style="border: 0px; font-family: inherit; font-size: 16px; font-style: inherit; letter-spacing: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">launch configuration</strong> for the <strong style="border: 0px; font-family: inherit; font-size: 16px; font-style: inherit; letter-spacing: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">auto scaling group</strong></div>
<div style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 11px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
<div class="syntaxhighlighter text" id="highlighter_257765" style="border: 1px solid rgb(211, 211, 211) !important; font-family: inherit; font-size: 1em !important; font-style: inherit; margin: 2em 0px !important; outline: 0px; overflow: auto !important; padding: 0px; position: relative !important; vertical-align: baseline; width: 708px;">
<div class="toolbar" style="background-color: rgb(108, 226, 108) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: none !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 10px !important; height: 11px !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; z-index: 10 !important;">
<span style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><a class="toolbar_item command_help help" href="http://www.robertsindall.co.uk/blog/how-to-use-amazons-auto-scaling-groups/#" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: white !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; text-decoration: none !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?</a></span></div>
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 715px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 689px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// with new launch config</code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="text plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">as-update-auto-scaling-group my-auto-scaling-group --launch-configuration my-launch-config-2 --region eu-west-1</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h4 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 2.2em; font-weight: normal; margin: 10px 0px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Further Reading</h4>
<ul style="background-color: white; border: 0px; color: #3f3f3f; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.7em; list-style: none; margin: 10px 0px 0px 20px; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="background-image: url(http://robertsindallblog.s3.amazonaws.com/blog/wp-content/themes/sharp_orange/images/left_arrow_li.gif); background-position: 8px 6px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-size: 17px; font-style: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 5px 40px; vertical-align: baseline;"><a href="http://aws.amazon.com/autoscaling/" style="border: 0px; color: #c84a28; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" target="_blank">Amazon Auto Scaling</a></li>
<li style="background-image: url(http://robertsindallblog.s3.amazonaws.com/blog/wp-content/themes/sharp_orange/images/left_arrow_li.gif); background-position: 8px 6px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-size: 17px; font-style: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 5px 40px; vertical-align: baseline;"><a href="http://docs.aws.amazon.com/AutoScaling/latest/GettingStartedGuide/Welcome.html" style="border: 0px; color: #c84a28; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" target="_blank">Get Started with Auto Scaling</a></li>
<li style="background-image: url(http://robertsindallblog.s3.amazonaws.com/blog/wp-content/themes/sharp_orange/images/left_arrow_li.gif); background-position: 8px 6px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-size: 17px; font-style: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 5px 40px; vertical-align: baseline;"><a href="http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AS_Concepts.html" style="border: 0px; color: #c84a28; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" target="_blank">Auto Scaling Concepts and Terminology</a></li>
</ul>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-18615320085356359132013-10-18T09:21:00.001-07:002013-10-18T09:21:46.423-07:00Number Formatting in JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
I got to this question page hoping to find how to <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">format numbers</strong> in JavaScript, without introducing yet another library. Here's what I've found:</div>
<h2 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 19px; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Rounding floating-point numbers</h2>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The equivalent of <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">sprintf("%.2f", num)</code> in JavaScript seems to be <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">num.toFixed(2)</code>, which formats <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">num</code> to 2 decimal places, with rounding (but see @ars265's comment about <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">Math.round</code>below).</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">12.345</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">toFixed</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">2</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// returns "12.35" (rounding!)</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">12.3</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">toFixed</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">2</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// returns "12.30" (zero padding)</span></code></pre>
<h2 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 19px; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Exponential form</h2>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
The equivalent of <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">sprintf("%.2e", num)</code> is <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">num.toExponential(2)</code>.</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">33333</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">toExponential</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">2</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// "3.33e+4"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// ^ Note the space, which keeps the . from being a decimal point.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// Leaving out the space is a syntax error :-(</span></code></pre>
<h2 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 19px; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Hexadecimal and other bases</h2>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
To print numbers in base B, try <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">num.toString(B)</code>. JavaScript supports automatic conversion to and from bases 2 through 36 (in addition, some browsers have <a href="https://developer.mozilla.org/en-US/docs/DOM/window.btoa" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">limited support for base64 encoding</a>).</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">3735928559</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">toString</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">16</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// to base 16: "deadbeef"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
parseInt</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">"deadbeef"</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="lit" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">16</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;">// from base 16: 3735928559</span></code></pre>
<h2 style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 19px; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Reference Pages</h2>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<a href="http://www.mredkj.com/javascript/numberFormat.html" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Quick tutorial on JS number formatting</a></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number/toFixed" style="background-color: transparent; border: 0px; color: #4a6b82; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Mozilla reference page for toFixed()</a> (with links to toPrecision(), toExponential(), toLocaleString(), ...)</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-13931507046847709422013-10-16T05:13:00.000-07:002013-10-16T05:13:06.333-07:00Filter Fiddler Traffic by Host<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="post-text" style="background-color: white; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin: 0px 5px 5px 0px; padding: 0px; vertical-align: baseline; width: 660px; word-wrap: break-word;">
<div style="background-color: transparent; border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline;">
See this screenshot. Located at the top right part of the screen <img alt="Fiddler localhost filter" src="http://i.stack.imgur.com/oqImx.png" style="background-color: transparent; border: 0px; margin: 0px; max-width: 640px; padding: 0px; vertical-align: baseline;" /></div>
</div>
<table class="fw" style="background-color: white; border-collapse: collapse; border-spacing: 0px; border: 0px; color: black; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 13px; line-height: 12px; margin: 0px; padding: 0px; vertical-align: baseline; width: 665px;"><tbody style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><td class="vt" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: top;"><div class="post-menu" style="background-color: transparent; border: 0px; margin: 0px; padding: 2px 0px 0px; vertical-align: baseline;">
<br /></div>
</td><td align="right" class="post-signature" style="background-color: transparent; border: 0px; height: 58px; margin: 0px; padding: 2px 0px 0px 5px; vertical-align: top; width: 175px;"><div class="user-info user-hover" style="background-color: transparent; border: 0px; height: 35px; margin: 0px; padding: 0px; vertical-align: baseline; width: 185px;">
<div class="user-action-time" style="background-color: transparent; border: 0px; margin: 2px 0px 4px; padding: 0px; vertical-align: baseline;">
<br /></div>
</div>
</td></tr>
</tbody></table>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-22654427601096239762013-10-06T05:50:00.002-07:002013-10-06T05:52:40.254-07:00Structuring an Angular Project<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
<img alt="ngapp" class="alignright size-large wp-image-19501" height="600" src="http://www.johnpapa.net/wp-content/uploads/2013/08/ngapp-245x600.png" style="border: 1px solid rgb(221, 221, 221); box-sizing: border-box; float: right; height: auto; margin: 0px 0px 1.625em 1.625em; max-width: 100%; outline: rgb(0, 0, 0); padding: 6px; vertical-align: baseline;" width="245" />We can build amazing SPA and HTML5 applications when choosing a powerful framework like <a href="http://www.angularjs.org/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Angular</a>, <a href="http://www.durandaljs.com/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Durandal</a>, <a href="http://emberjs.com/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Ember</a>, or <a href="http://backbonejs.org/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Backbone</a>. And while I love <em style="border: 0px; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">my personal favorites Angular and Durandal</em>, it’s not all magic. There is a learning curve and some things are helpful to decide up front. Once you choose your presentation framework, you should decide how you will organize the structure of your project.</div>
<blockquote style="background-color: white; border-left-color: gray; border-left-style: solid; border-width: 0px 0px 0px 2px; color: #787878; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 14px; font-style: italic; line-height: 28px; margin: 20px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 0px 20px; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
If you are interested in SPA, HTML5, Angular, BreezeJS or JavaScript patterns then you will love my upcoming course at <a href="http://pluralsight.com/training/Authors/Details/john-papa" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Pluralsight</a>, due out in September 2013. Or if you prefer Knockout and Durandal check out <a href="http://pluralsight.com/training/Authors/Details/john-papa" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">my courses on Pluralsight today</a>.</div>
</blockquote>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
In this post I’ll show one way how I organize my Angular based projects and discuss why I like it.</div>
<blockquote style="background-color: white; border-left-color: gray; border-left-style: solid; border-width: 0px 0px 0px 2px; color: #787878; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 14px; font-style: italic; line-height: 28px; margin: 20px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 0px 20px; vertical-align: baseline;">
<div style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
Before you ask “Why didn’t he mention<a href="http://www.knockoutjs.com/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">Knockout.js</a>? Doesn’t he love it anymore?”, let me answer that up front. Knockout.js is awesome. I love it. I use it. In fact, it is an integral piece of Durandal such that I often refer to Durandal as Durandal/Knockout. But that is the point: Durandal and Angular are frameworks. Frameworks handle a lot of things for you that cover most of the plumbing you need in a SPA. Knockout handles 1 thing: data binding. Now, it handles it very well and has some awesome features that crop out of it, like custom binding handlers and extensions. But I do not consider Knockout a complete framework, nor do I believe it is intended to be one. So you’ll often hear me talk about Durandal and Knockout together as a framework choice.</div>
</blockquote>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Sorting Boxes</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
Most of my client code ends up in one of these 4 folders. I like to keep code I wrote separate from code someone else wrote. Sounds pretty simple when you say that but I see a lot of projects where everything gets tossed in the same folder and it makes a mess to find what you need or run code analysis against just your code. (Who wants want to run static code analysis against angular or knockout?) I also want my tests separated from my app and all of my assets (images, fonts, css) in yet another folder.</div>
<pre class="prettyprint " style="background-color: white; border-color: rgb(231, 231, 231) rgb(231, 231, 231) rgb(231, 231, 231) rgb(108, 226, 108); border-style: solid; border-width: 1px 1px 1px 3px; color: #505050; font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace !important; font-size: 14px; line-height: 1.3; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); overflow: auto; padding: 15px 20px 15px 18px; vertical-align: baseline;"><span class="str" style="border: 0px; color: #008800; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/app
/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">content
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">scripts
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">test</span></pre>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
So for me, all of my code goes in the <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">app</code> folder, 3rd party or vendor scripts go in the<code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">scripts</code> folder, assets in the <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">content</code> folder, and tests in the <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">test</code> folder.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
App Code</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
My <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">app</code> folder is where all of my files I wrote for my app reside. This includes JavaScript and HTML files. The root of the folder is where I put my app.js which is my boot file. This is where all the magic starts and the application gets kicked off. For angular this means the modules get loaded and run. I generally name my root module <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">app</code>. I also usually create a config.js here to store all of my commonly used variables across the app. For angular I store these in<code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">app.value</code> or <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">app.constant</code>.</div>
<pre class="prettyprint " style="background-color: white; border-color: rgb(231, 231, 231) rgb(231, 231, 231) rgb(231, 231, 231) rgb(108, 226, 108); border-style: solid; border-width: 1px 1px 1px 3px; color: #505050; font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace !important; font-size: 14px; line-height: 1.3; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); overflow: auto; padding: 15px 20px 15px 18px; vertical-align: baseline;"><span class="str" style="border: 0px; color: #008800; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/app
/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">controllers</span><span class="str" style="border: 0px; color: #008800; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/
/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">services</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">views</span><span class="str" style="border: 0px; color: #008800; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/
/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">app</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">js
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">config</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">js
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">content
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">scripts
</span><span class="pun" style="border: 0px; color: #666600; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">/</span><span class="pln" style="border: 0px; color: black; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">test</span></pre>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Controllers</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
The <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">controllers</code> folder is where all of my controllers live. Makes sense, an app usually has several of them so why not put them all in one place. Notice what is not there though? The word “controller” in the name of the files. I’m not a fan of naming just for the sake of it. By putting all of my controllers in a <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">controllers</code> folder, guess what, I know they are controllers. I do not find an advantage in naming them “controller.session.js” or “sessionController.js”. If you are wondering about the casing, I use camelCase because I it feels right <img alt=":)" class="wp-smiley" src="http://www.johnpapa.net/wp-includes/images/smilies/icon_smile.gif" style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-variant: inherit; height: auto; line-height: inherit; margin: 0px; max-width: 100%; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;" /> . That’s just how I roll. When I use a controller, Angular creates a new one for each view instance. Should it be PascalCase … that’s your choice. It’s more important to be consistent and understand that controllers come and go, and you can test this by tapping into the <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">$destroy</code> event.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Services</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
The <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">services</code> folder contains all of my services for the SPA. When I say services here I mean a unit of code that provides a discrete service to the rest of the app. I am not specifically talking about the Angular provider, service or factory, though these services may be constructed from those Angular features. I will generally have services for typical uses such as a logger, datacontext, routing, or storage. Sometimes I will add more specialized services here too such as work in progress or client side repositories. My services follow these 3 criteria: any set of code that can be …</div>
<ul style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; list-style: none; margin: 20px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 0px 20px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">reused</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">tested on its own</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">encapsulated</li>
</ul>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
I also put all of my directives in the <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">services</code> folder.</div>
<h4 style="background-color: white; border: 0px; color: #505050; font-family: Archive; font-size: 1.4em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Directives</h4>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
Generally I put them in a single file named <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">directives.js</code>. Some folks like to separate their directives, and I get it … I just don’t agree. I will often have several of these, but they are all small and often I want to look at other directives when I am developing new ones (for ideas). Now, I will create multiple files for directives if there is an obvious logical separation. For example, if I create a bunch of directives that apply just to using <a href="http://www.breezejs.com/" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">BreezeJS</a> functionality, then sure, I’ll make a file just for those. And what goes in a directive for me? Ideal candidates are any DOM interaction or events that are not covered by out of the box Angular directives. I also use this to wrap 3rd party widgets that I like. If I had a ton of directives and several files, then I would consider a new folder for them too. When I use filters, I also create a filters file in this folder. Some projects I don’t use filters. Why? Well, that’s a topic for another post.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Views</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
The final core folder is <code style="background-color: #f7f7f7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px dotted rgb(211, 211, 211); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; font-style: italic; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 2px 4px; vertical-align: baseline; white-space: nowrap;">views</code>, which is where my HTML resides. This includes inclusive views such as sessions.html. But it also includes partial views that may be inclusive or only intended to be used in another view. For example, some partial views have their own Angular controllers. These views can be placed in other views, and the controller comes with them. So they work anywhere. Then there are partial views that rely on some parent view. I tend to try to stick with the latter (views that have their own controller) … that’s just my preference. But I don’t go nuts either way.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Your Choice</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
Ultimately how you organize your code is entirely up to you (and your team). I find it is immensely valuable to think it through before I start working with a team and tossing files all over the place. Having logical sorting boxes for all of your code just makes life easier. There are many ways to skin this cat so don’t fret if you don’t follow this exact pattern. That’s what it is: a pattern. Not gospel.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Next</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
For smaller apps I find this structure quite simple, organizing by types. Once the app grows and starts expanding into multiple features and especially modules, I like to change the structure to group by feature. I’ll explore this side by side a bit more in a future post. Both structures have value and really depend on how easy it is to find what you are looking for.</div>
<h2 style="background-color: white; border-bottom-color: rgb(221, 221, 221); border-bottom-style: double; border-width: 0px 0px 4px; color: #505050; font-family: Archive; font-size: 1.7em; font-weight: inherit; letter-spacing: -1px; line-height: 1em; margin: 35px 36.84375px 0px 110px; outline: rgb(0, 0, 0); padding: 0px 0px 5px; text-shadow: rgba(0, 0, 0, 0.2) 2px 2px; vertical-align: baseline;">
Update</h2>
<div style="background-color: white; border: 0px; color: #505050; font-family: Arial; font-size: 14px; line-height: 28px; margin-left: 110px; margin-right: 36.84375px; margin-top: 20px; outline: rgb(0, 0, 0); padding: 0px; vertical-align: baseline;">
In the comments Joel mentions a <a href="http://cliffmeyers.com/blog/2013/4/21/code-organization-angularjs-javascript" style="border-bottom-color: rgb(210, 210, 210); border-bottom-style: dotted; border-width: 0px 0px 1px; color: #be5a31; font-family: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: rgb(0, 0, 0); padding: 0px 0px 2px; text-decoration: none; vertical-align: baseline;" target="_blank">great post by Cliff Meyers</a> that discusses another approach to organizing an Angular app. Cliff’s approach is to organize by functional area. There is much wisdom in this choice too. Where I differ personally is if the app is in a single module I consider the module the functional area. Then once within that area, I choose to separate by type as discussed above. For me, once I see a different functional features, I consider making a new Angular module and separating from there. But again, these depend on your comfort. Happy coding!</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-85101796764775943942013-09-30T03:56:00.001-07:002013-09-30T03:56:23.194-07:00Test remote SQL connectivity EASILY!<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18.162500381469727px;">
I learned about something very useful today and thought I’d share.</div>
<div style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18.162500381469727px;">
Have you ever been troubleshooting a problem with remote SQL Iproxy MP, remote DB, etc) and wanted to test to see if the local system account (or any account for that matter) could make a remote connection to SQL but you didn’t want to install the SQL tools just to make that test? Seems there is a file type – UDL file – that you can simply create that will bring up a window to allow testing of remote connections to SQL.</div>
<div style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18.162500381469727px;">
Just go anywhere on your system and create an empty text file named anything but instead of txt make sure the extension is UDL. Then, double-click on the file and up pops a SQL connectivity window to allow testing of remote SQL connections.</div>
<div style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18.162500381469727px;">
<a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-59-74-metablogapi/8032.clip_5F00_image002_5F00_2.jpg" style="color: #0066dd; cursor: pointer; outline: none; text-decoration: none;"><img alt="clip_image002" border="0" height="341" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-59-74-metablogapi/0020.clip_5F00_image002_5F00_thumb.jpg" style="background-image: none; border: 0px; display: inline; height: auto !important; margin: 5px 5px 5px 0px; max-width: 100%; overflow: hidden; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="clip_image002" width="223" /></a></div>
<div style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18.162500381469727px;">
Very easy to use to test connectivity with a known user account or as local system (using PSExec).</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-87943339037305883422013-09-19T04:23:00.001-07:002013-09-19T04:23:52.495-07:00Windows 7 — не запускаются программы. Ошибка 0xc0000005<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; text-align: justify; vertical-align: baseline;">
Если с вами случилась такая же беда, то знайте — это связано с обновлением<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">KB2859537</strong>.</div>
<div style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; text-align: justify; vertical-align: baseline;">
Чтобы его удалить, запустите cmd.exe от имени администратора и наберите в консоли:</div>
<blockquote style="background-color: white; border: 5px dashed rgb(252, 226, 124); color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; font-style: italic; line-height: 24px; margin: 3em; padding: 0px 3em; quotes: none; text-align: justify; vertical-align: baseline;">
<div style="background-color: transparent; border: 0px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
wusa.exe /uninstall /kb:2859537</div>
</blockquote>
<div style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; text-align: justify; vertical-align: baseline;">
После перезагрузки компьютера, все придет в норму. Рекомендую отключить Автоматическое обновление Windows, чтобы больше не сталкиваться с этой проблемой.</div>
<div style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; text-align: justify; vertical-align: baseline;">
В противном случае вам придется еще удалить обновление <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">KB2872339</strong>, которое вышло после <strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">KB2859537</strong> и вызывает такую же ошибку.</div>
<div style="background-color: white; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; text-align: justify; vertical-align: baseline;">
Чтобы его удалить, запустите cmd.exe от имени администратора и наберите в консоли:</div>
<blockquote style="background-color: white; border: 5px dashed rgb(252, 226, 124); color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; font-style: italic; line-height: 24px; margin: 3em; padding: 0px 3em; quotes: none; text-align: justify; vertical-align: baseline;">
<div style="background-color: transparent; border: 0px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
wusa.exe /uninstall /kb:2872339</div>
</blockquote>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-36306807571996967032013-09-19T04:22:00.001-07:002013-09-19T04:22:54.845-07:00FIX: Не запускаются программы (ошибка 0xc0000005) после установки обновления KB2859537 или KB2872339<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
13 августа Microsoft выпустила обновление KB2859537, и форумы запестрели мольбами о помощи – у людей перестали запускаться программы.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<a href="http://www.flickr.com/photos/photomedicamadrid/8427111427/" style="color: #1772af; text-decoration: none;" title="Help !!!! by Pepe (ADM), on Flickr"><img alt="Help !!!!" height="357" src="http://farm9.staticflickr.com/8476/8427111427_b4dc15f8b9.jpg" style="border: 0px; margin: 5px; max-width: 542px; padding: 0px;" width="500" /></a></div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Из этой экспресс-записи вы узнаете, как исправить проблему, почему она возникла и как избежать подобных ужасов в будущем.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<span id="more-15229"></span></div>
<h4 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 14px; margin: 20px 0px 5px; padding: 0px;">
<a href="" style="color: #1772af;">[+]</a> <strong>Сегодня в программе</strong></h4>
<h2 style="background-color: white; border-bottom-color: rgb(43, 43, 42); border-style: none none solid; border-width: 0px 0px thin; color: #2b2b2a; font-family: arial; font-size: 18px; margin: 20px 0px 5px; padding: 0px 0px 5px;">
<a href="" name="_Toc364370256" style="border: none; color: #1772af; font-weight: normal; padding-bottom: 5px;"></a>Назначение обновления KB2859537</h2>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<img alt="tool-kit-icon-96" class="align-right size-full wp-image-11750" height="96" src="http://www.outsidethebox.ms/blog/wp-content/uploads/tool-kit-icon-96.png" style="border: 0px; float: right; margin: 5px; max-width: 542px; padding: 0px;" width="96" />Обновление <a href="http://support.microsoft.com/kb/2859537" style="color: #1772af; text-decoration: none;" target="_blank">KB2859537</a> было призвано исправить четыре уязвимости в ядре Windows, позволяющие несанкционированное повышение прав. Первая уязвимость позволяла загрузить DLL в процесс, обходя механизм защиты ASLR, призванный снизить риск эксплуатации уязвимостей.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Три остальные уязвимости связаны с ошибками в проверке адресов ядром Windows, что приводит к повреждению памяти и позволяет запустить произвольный код в режиме ядра. После этого повышение прав уже не проблема. Технические подробности доступны в бюллетене безопасности <a href="http://technet.microsoft.com/security/bulletin/ms13-063" style="color: #1772af; text-decoration: none;" target="_blank">MS13-063</a>.</div>
<h2 style="background-color: white; border-bottom-color: rgb(43, 43, 42); border-style: none none solid; border-width: 0px 0px thin; color: #2b2b2a; font-family: arial; font-size: 18px; margin: 20px 0px 5px; padding: 0px 0px 5px;">
<a href="" name="_Toc364370257" style="border: none; color: #1772af; font-weight: normal; padding-bottom: 5px;"></a>Почему возникла проблема и в чем она заключается</h2>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<img alt="question-96" class="align-right size-full wp-image-11939" height="120" src="http://www.outsidethebox.ms/blog/wp-content/uploads/question-96.jpg" style="border: 0px; float: right; margin: 5px; max-width: 542px; padding: 0px;" width="96" /><a href="http://support.microsoft.com/kb/2859537" style="color: #1772af; text-decoration: none;" target="_blank">KB2859537</a> заменяет массу системных файлов, в том числе файлов ядра (полный список есть в статье базы знаний). Если оригинальное ядро было модифицировано, его замена может привести к проблемам.</div>
<blockquote style="background-color: #f3f3f3; background-image: url(http://www.outsidethebox.ms/blog/wp-content/themes/graphene/images/sprite_master.png); background-position: 0% -475px; background-repeat: no-repeat no-repeat; border: 1px dotted rgb(227, 227, 227); clear: both; font-family: arial; font-size: 12px; margin: 10px 0px 10px 20px; padding: 8px 18px 5px 32px;">
<div style="border: 0px none; color: #2c2b2b; font-size: 13px; line-height: 20px; margin-bottom: 5px; margin-top: 10px; padding: 0px;">
<strong>Upd. 12-Sep-13</strong>. Обновление KB2872339, вышедшее в сентябре, заменяет KB2859537, т.е. содержит более новые версии файлов ядра. Его установка может привести к точно таким же проблемам.</div>
</blockquote>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
У такой модификации есть две наиболее вероятные причины.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<b>Вредоносные программы</b>. Это не первый случай, когда обновление ядра выявляет наличие проблем в системе – так, 3.5 года назад <a href="http://www.outsidethebox.ms/12012/#_Toc295077921" style="color: #1772af; text-decoration: none;" target="_blank">случайно обнаружился руткит Alureon</a>.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<b>Нелегальная активация</b>. Этот момент отлично разобрал участник конференции OSZone<b><a href="http://forum.oszone.net/member.php?u=39948" style="color: #1772af; text-decoration: none;" target="_blank">simplix</a></b>, который не понаслышке знаком со сборками Windows, а также является автором полезной программы <a href="https://antisms.com/" style="color: #1772af; text-decoration: none;">AntiSMS</a> для лечения вирусов и троянов.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Позволю себе процитировать <a href="http://forum.oszone.net/post-2202223.html#post2202223" style="color: #1772af; text-decoration: none;" target="_blank">его пост</a> в форуме, выделив жирным то, в чем заключается проблема.</div>
<blockquote style="background-color: #f3f3f3; background-image: url(http://www.outsidethebox.ms/blog/wp-content/themes/graphene/images/sprite_master.png); background-position: 0% -475px; background-repeat: no-repeat no-repeat; border: 1px dotted rgb(227, 227, 227); clear: both; font-family: arial; font-size: 12px; margin: 10px 0px 10px 20px; padding: 8px 18px 5px 32px;">
<div style="border: 0px none; color: #2c2b2b; font-size: 13px; line-height: 20px; margin-bottom: 5px; margin-top: 10px; padding: 0px;">
Проблема возникает из-за того, что во взломанных системах используется старая версия ntoskrnl.exe, которую патчер (или сборка) переименовывают в xNtKrnl.exe и прописывают в поле kernel через bcdedit. Это нужно для того, чтобы система работала с драйвером, эмулирующим SLIC-таблицу. Старая версия ядра не совместима с новыми файлами подсистемы Wow64, <b>из-за этого в 64-битной системе 32-битные программы перестают запускаться</b>.</div>
<div style="border: 0px none; color: #2c2b2b; font-size: 13px; line-height: 20px; margin-bottom: 5px; margin-top: 10px; padding: 0px;">
Вины Microsoft здесь нет, они просто не тестировали обновления на ломаных сборках. К слову, если пропатчить новую версию ядра, то система будет работать как положено — это означает, что обновление не нацелено на борьбу с пиратскими системами, просто так сложились звёзды.</div>
</blockquote>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Кстати, <b>simplix</b> ранее <a href="http://www.outsidethebox.ms/9983/#res" style="color: #1772af; text-decoration: none;" target="_blank">предупреждал читателей блога о возможных проблемах г-сборок</a>, в которых заменяются ресурсы.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Возможны и другие причины — Microsoft в настоящее время исследует их.</div>
<h2 style="background-color: white; border-bottom-color: rgb(43, 43, 42); border-style: none none solid; border-width: 0px 0px thin; color: #2b2b2a; font-family: arial; font-size: 18px; margin: 20px 0px 5px; padding: 0px 0px 5px;">
<a href="" name="_Toc364370258" style="border: none; color: #1772af; font-weight: normal; padding-bottom: 5px;"></a>Как исправить проблему</h2>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<img alt="fix_it" class="align-right size-full wp-image-15230" height="101" src="http://www.outsidethebox.ms/blog/wp-content/uploads/fix_it.png" style="border: 0px; float: right; margin: 5px; max-width: 542px; padding: 0px;" width="96" />Если у вас есть основания полагать, что применение обновления на вашей системе может создать проблему, логично не устанавливать обновление. Правда, при этом вы останетесь с незакрытой уязвимостью ядра.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Оба метода исправления сводятся к откату изменений.</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="_Toc364370259" style="color: #1772af;"></a>Удаление обновления KB2859537 из командной строки</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
В командной строке, <a href="http://www.outsidethebox.ms/10629/" style="color: #1772af; text-decoration: none;">запущенной с правами администратора</a>, выполните:</div>
<div style="background-color: white; font-family: arial; font-size: 12px;">
<div class="syntaxhighlighter plain" id="highlighter_536741" style="font-size: 1em !important; margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 555px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 555px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 527px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="plain plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">wusa.exe /uninstall /kb:2859537</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Утилита wusa.exe предназначена для установки и удаления обновлений Windows. Запустите ее с ключом <b>/?</b>, чтобы узнать больше.</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="_Toc364370260" style="color: #1772af;"></a>Откат к точке восстановления системы</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<a href="http://www.outsidethebox.ms/9961/#restore" style="color: #1772af; text-decoration: none;" target="_blank">Запустите восстановление системы</a> и откатитесь к точке до возникновения проблемы. Если не получается или система не загружается, войдите в среду восстановления <a href="http://www.outsidethebox.ms/9959/" style="color: #1772af; text-decoration: none;" target="_blank">Windows 7</a>или <a href="http://www.outsidethebox.ms/14711/" style="color: #1772af; text-decoration: none;" target="_blank">Windows 8</a> и выполните восстановление системы оттуда. И да, эта ситуацию<a href="http://forum.oszone.net/post-2201554.html#post2201554" style="color: #1772af; text-decoration: none;" target="_blank">действительно спасает откат</a>.</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="_Toc3643702601" style="color: #1772af;"></a>Удаление обновления KB2859537 из среды восстановления с помощью DISM</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Этот более сложный вариант имеет смысл применять только в том случае, если первыми двумя способами удалить обновление не удалось.</div>
<ol style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin: 5px 0px 5px 30px; padding: 0px;">
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">Загрузитесь в среду восстановления <a href="http://www.outsidethebox.ms/9959/" style="color: #1772af; text-decoration: none;" target="_blank">Windows 7</a> или <a href="http://www.outsidethebox.ms/14711/" style="color: #1772af; text-decoration: none;" target="_blank">Windows 8</a>.</li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">Запустите командную строку и <a href="http://www.outsidethebox.ms/10432/" style="color: #1772af; text-decoration: none;">определите букву диска, на котором установлена Windows</a>.</li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">В командной строке выполните:<div>
<div class="syntaxhighlighter plain" id="highlighter_605355" style="font-size: 1em !important; margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 525px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 525px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
1</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 495px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="plain plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">DISM /Image:D:\ /Get-Packages</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="border: 0px none; margin-top: 10px; padding: 0px;">
где D — буква диска с системой, которую вы определили на предыдущем шаге.</div>
</li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">В результатах команды найдите пакет, содержащий в названии <strong>KB2859537</strong>. На рисунке имя пакета показано исключительно для примера.<br /><a href="http://www.oszone.net/user_img/vadblog/remove-KB2859537-dism.png" rel="lightbox[15229]" style="color: #1772af; text-decoration: none;" target="_blank"><img alt="remove-KB2859537-dism" border="0" height="237" src="http://www.oszone.net/user_img/vadblog/remove-KB2859537-dism_mini_oszone.png" style="border: 0px; margin: 5px; max-width: 542px; padding: 0px;" width="480" /><br />Увеличить рисунок</a></li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">Выделите имя пакета левой кнопкой мыши и нажмите правую кнопку мыши, чтобы скопировать его в буфер обмена.</li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">В командной строке наберите:<div>
<div class="syntaxhighlighter plain" id="highlighter_313107" style="font-size: 1em !important; margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 525px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 525px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number2 index0 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
2</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 495px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number2 index0 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="plain plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">DISM /Image:D:\ /Remove-Package /PackageName:</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="border: 0px none; margin-top: 10px; padding: 0px;">
и нажмите правую кнопку мыши, чтобы вставить имя пакета. Должна получиться примерно такая команда:</div>
<div>
<div class="syntaxhighlighter plain" id="highlighter_129578" style="font-size: 1em !important; margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 525px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 728px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number3 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
3</div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 698px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number3 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="plain plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">DISM /Image:D:\ /Remove-Package /PackageName:Package_for_KB2859537~31bf3856ad364e35~x86~~6.1.1.3</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
</li>
<li style="border: 0px none; margin: 0px 0px 7px; padding: 0px;">Нажмите <strong>Enter</strong>, чтобы выполнить команду и удалить пакет.</li>
</ol>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<strong>Примечание</strong>. В случае успешного удаления, KB2859537 исчезнет из списка установленных обновлений в панели управления. Однако в журнале установленных обновлений оно будет присутствовать, поскольку установка производилась.</div>
<h2 style="background-color: white; border-bottom-color: rgb(43, 43, 42); border-style: none none solid; border-width: 0px 0px thin; color: #2b2b2a; font-family: arial; font-size: 18px; margin: 20px 0px 5px; padding: 0px 0px 5px;">
<a href="" name="_Toc364370261" style="border: none; color: #1772af; font-weight: normal; padding-bottom: 5px;"></a>Как не допустить возникновения проблемы в будущем</h2>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<img alt="clipboardcheck-96" class="align-right size-full wp-image-12972" height="96" src="http://www.outsidethebox.ms/blog/wp-content/uploads/clipboardcheck-96.png" style="border: 0px; float: right; margin: 5px; max-width: 542px; padding: 0px;" width="96" />Поняв причину неурядиц, нетрудно догадаться, как их избежать.</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="_Toc364370262" style="color: #1772af;"></a>Обеспечьте защиту от вирусов</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Буквально на этой неделе я открыл в блоге обсуждение на тему того,<a href="http://www.outsidethebox.ms/15200/" style="color: #1772af; text-decoration: none;">можно ли работать в Windows без антивируса</a>!</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="_Toc364370263" style="color: #1772af;"></a>Избегайте г-сборок и активаторов</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Надеюсь, вы оцените точность формулировки :) Обязательная ссылка: <a href="http://www.outsidethebox.ms/9983/" style="color: #1772af; text-decoration: none;" target="_blank">Super Mega Zver Black eXtreme 2013 Edition</a>.</div>
<h3 style="background-color: white; border: 0px none; color: #2b2b2a; font-family: arial; font-size: 16px; margin: 20px 0px 5px; padding: 0px;">
<a href="" name="Toc3643702631" style="color: #1772af;"></a>Обратитесь в техническую поддержку</h3>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Владельцы лицензионных систем, столкнувшиеся с проблемой, просто <strong>обязаны обратиться в техподдержку, чтобы Microsoft осознала наличие и масштаб проблемы</strong>. Обладателям ПК с предустановленной Windows следует обращаться в поддержку производителя устройства, который в свою очередь донесет информацию до сведения Microsoft.</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Всем, кто приобрел Windows отдельно, <strong>Microsoft оказывает бесплатную техподдержку при проблемах после установки обновлений</strong>. Вы можете обратиться в компанию с 8 утра до 8 вечера в будни и с 10 утра до 7 вечера в субботу по бесплатному номеру:</div>
<ul style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; list-style-position: outside; list-style-type: none; margin: 10px 0px 10px 25px; padding: 0px;">
<li style="background-image: url(http://www.outsidethebox.ms/blog/wp-content/themes/graphene/images/sprite_master.png); background-position: -658px -468px; background-repeat: no-repeat no-repeat; border: 0px none; margin: 0px 0px 7px; padding: 0px 0px 0px 13px;">Россия: 8 (800) 200-8001</li>
<li style="background-image: url(http://www.outsidethebox.ms/blog/wp-content/themes/graphene/images/sprite_master.png); background-position: -658px -468px; background-repeat: no-repeat no-repeat; border: 0px none; margin: 0px 0px 7px; padding: 0px 0px 0px 13px;">Украина: 0 (800) 308-800</li>
<li style="background-image: url(http://www.outsidethebox.ms/blog/wp-content/themes/graphene/images/sprite_master.png); background-position: -658px -468px; background-repeat: no-repeat no-repeat; border: 0px none; margin: 0px 0px 7px; padding: 0px 0px 0px 13px;">Беларусь: 8 (820) 0071-0003</li>
</ul>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
Вы также можете обратиться за бесплатной поддержкой по электронной почте. Перейдите на <a href="http://support.microsoft.com/get-support/more/" style="color: #1772af; text-decoration: none;" target="_blank">эту страницу</a>, а затем последовательно выберите операционную систему, издание и раздел поддержки:</div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
<a href="http://www.oszone.net/user_img/vadblog/ms-support.png" rel="lightbox[15229]" style="color: #1772af; text-decoration: none;" target="_blank"><img alt="Поддержка Microsoft" border="0" height="206" src="http://www.oszone.net/user_img/vadblog/ms-support_mini_oszone.png" style="border: 0px; margin: 5px; max-width: 542px; padding: 0px;" width="480" /><br />Увеличить рисунок</a></div>
<div style="background-color: white; border: 0px none; color: #2c2b2b; font-family: arial; font-size: 13px; line-height: 20px; margin-top: 10px; padding: 0px;">
После этого вы увидите варианты поддержки, одним из которых является отправка письма посредством формы на сайте.</div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-62885150191298542622013-08-31T05:13:00.001-07:002013-08-31T05:13:22.972-07:00HTTP Redirection in IIS 7 on Windows Server 2008<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
If you have a website and want to change domain names or if you need to change the architecture of your site, you won’t want visitors following links from other sites and search engines such as Google to get an error while visiting your website. This can cause visitors to click away and a loss of rankings in the search engines.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
Luckily there is a fairly simple and straightforward way to remedy the situation through the use of redirects. First, let’s look at the different types of redirects that are available in IIS 7:</div>
<ul style="background-color: #f9f9f9; border-left-color: rgb(238, 238, 238); border-left-style: solid; border-left-width: 3px; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; margin: 7px 30px; outline: none 0px; padding: 10px 20px 10px 30px;">
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">301 – Permanent:</strong> This redirect tells the Web client that the location of the requested resource has moved permanently</li>
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">302 – Standard:</strong> This redirect tells the Web client to issue a new request to the location specified</li>
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">307 – Temporary:</strong> This redirect tells the Web client to resend POST data, which prevents a Web browser from losing data when the browser issues an HTTP POST request</li>
</ul>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
In most circumstances you will want to use a 301 redirect, as this will inform search engines to update their index with the resource’s new location. In some cases a 302 will be appropriate if the change is going to be short term such as a special page that is seasonal.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
For this article I will assume that you already have a site setup on a Windows Server 2008 system setup in a web server role, and are familiar with getting into <a href="http://www.trainsignal.com/blog/web-server-administration-in-iis-70-new-and-improved-iis-manager" style="color: #417ad5; margin: 0px; outline: none 0px; padding: 0px; text-decoration: none;" title="New and Improved IIS Manager">IIS manager</a>.</div>
<h2 style="background-color: white; color: #1c3169; font-family: Arial, Helvetica, sans-serif; font-size: 20px; margin: 0px; outline: none 0px; padding: 10px 10px 0px;">
Redirect to a Different URL</h2>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
The first and most simple of the redirects will go from one domain to another, useful if you are changing domain names. I have setup the following two domains <strong style="margin: 0px; outline: none 0px; padding: 0px;">TSOriginal.com</strong> and<strong style="margin: 0px; outline: none 0px; padding: 0px;">TSRedirect.com</strong> on my test server as you can see:</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 1" border="0" height="375" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect01.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 1" width="500" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
As you can see, we setup the original domain as <strong style="margin: 0px; outline: none 0px; padding: 0px;">TSOriginal.com</strong> and have put a simple index.html file in place that looks like this:</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 2" border="0" height="389" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect02.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 2" width="500" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
Now let’s walk through the steps required to setup a redirect to our target domain<strong style="margin: 0px; outline: none 0px; padding: 0px;">TSRedirect.com</strong>. If it works correctly then we should see the new index.html page below:</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 3" border="0" height="390" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect03.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 3" width="500" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">1. </strong>Open IIS Manager by going to <strong style="margin: 0px; outline: none 0px; padding: 0px;">Start -> Administrative Tools -> IIS Manager</strong></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 4" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect05.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 4" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">2. </strong>Once IIS Manager opens, expand the WebServer, then the <strong style="margin: 0px; outline: none 0px; padding: 0px;">Sites</strong> folder, and choose the domain, in this case <strong style="margin: 0px; outline: none 0px; padding: 0px;">TSOriginal.com</strong>.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 5" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect06.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 5" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">3. </strong>Click on <strong style="margin: 0px; outline: none 0px; padding: 0px;">HTTP REDIRECT</strong> in the main panel</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 6" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect07.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 6" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">4. </strong>Place a check next to <strong style="margin: 0px; outline: none 0px; padding: 0px;">Redirect requests to this destination:</strong> and fill in the target url in the text box below. In this instance it will be <strong style="margin: 0px; outline: none 0px; padding: 0px;">TSRedirect.com</strong>.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 7" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect08.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 7" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">5. </strong>In the <strong style="margin: 0px; outline: none 0px; padding: 0px;">Redirect Behavior</strong> we have several decisions to make about how we want the redirects to work. Let’s explore each of these options.</div>
<ul style="background-color: #f9f9f9; border-left-color: rgb(238, 238, 238); border-left-style: solid; border-left-width: 3px; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; margin: 7px 30px; outline: none 0px; padding: 10px 20px 10px 30px;">
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">Redirect all requests to exact destination</strong> – If this object is checked all requests no matter what the original destination will be redirected to the exact location in the text box above. If unchecked everything will be redirected relative to the destination.</li>
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">Only redirect requests to content in this directory (not subdirectories)</strong> – By default, when you enable redirection, content can be served by subdirectories below the main directory. If you choose this option you can limit requests to just the directory you want without effecting the subdirectories.</li>
<li style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; margin: 7px 0px; outline: none 0px; padding: 0px;"><strong style="margin: 0px; outline: none 0px; padding: 0px;">Status Code</strong> – In this drop down you choose which status code to return when redirecting. As discussed earlier in this article your options are <strong style="margin: 0px; outline: none 0px; padding: 0px;">301</strong>, <strong style="margin: 0px; outline: none 0px; padding: 0px;">302</strong>, and <strong style="margin: 0px; outline: none 0px; padding: 0px;">307</strong>.</li>
</ul>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">6. </strong>For this example we will leave everything unchecked and set a status of <strong style="margin: 0px; outline: none 0px; padding: 0px;">301</strong> in the dropdown menu. Click <strong style="margin: 0px; outline: none 0px; padding: 0px;">Apply</strong> to set the options.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 8" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect09.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 8" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">7. </strong>The changes are now in place and if we navigate to TSOriginal.com it will redirect us to TSRedirect.com.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
To test if the <strong style="margin: 0px; outline: none 0px; padding: 0px;">301</strong> status redirects correctly we will use the live HTTP headers plugin for Firefox. It will allow us to see the status codes. Here are the results for the test:</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 9" border="0" height="362" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect10.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 9" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
As you can see from the highlighted area the status was returned 301.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
All requests now for TSOriginal.com will be sent to TSRedirect.com with a 301 status code relative to the domain name.</div>
<h2 style="background-color: white; color: #1c3169; font-family: Arial, Helvetica, sans-serif; font-size: 20px; margin: 0px; outline: none 0px; padding: 10px 10px 0px;">
Redirect a Single Page to Another Page on the Same Site</h2>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
This type of redirect is especially useful when you might have some temporary changes to a webpage because of seasonal or holiday changes.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
In the case of a seasonal page that will return to normal after a short time, it is best to use a <strong style="margin: 0px; outline: none 0px; padding: 0px;">302</strong>redirect. This lets search engines and other sites know that this change is expected and not to change their index or links.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
For this example we have removed the site redirect we had placed on TSOriginal.com, and added two pages of content to the site:</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">oldpage.html</strong></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 10" border="0" height="375" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect11.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 10" width="501" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">newpage.html</strong></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 11" border="0" height="375" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect12.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 11" width="501" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
Now let’s setup a temporary <strong style="margin: 0px; outline: none 0px; padding: 0px;">302</strong> redirect from oldpage.html to newpage.html while.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">1. </strong>Select the site in IIS manager that you want to set the redirect for.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">2. </strong>In the Features window switch to <strong style="margin: 0px; outline: none 0px; padding: 0px;">Content View</strong>, Right click on the page you want to work with, oldpage.htm in this case, and left click on <strong style="margin: 0px; outline: none 0px; padding: 0px;">Switch to Features View</strong></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 12" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect14.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 12" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">3. </strong>The page now selected in the <strong style="margin: 0px; outline: none 0px; padding: 0px;">Connections Pane</strong>, click on <strong style="margin: 0px; outline: none 0px; padding: 0px;">HTTP Redirect</strong> in the features pane</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 13" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect15.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 13" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">4. </strong>Check the box next to <strong style="margin: 0px; outline: none 0px; padding: 0px;">Redirect requests to this destination</strong>, and fill in the destination page<strong style="margin: 0px; outline: none 0px; padding: 0px;">newpage.htm</strong> and set the dropdown menu to <strong style="margin: 0px; outline: none 0px; padding: 0px;">302</strong>, and click <strong style="margin: 0px; outline: none 0px; padding: 0px;">Apply</strong>.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 14" border="0" height="406" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect16.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 14" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<strong style="margin: 0px; outline: none 0px; padding: 0px;">5. </strong>Now if we navigate to the page <strong style="margin: 0px; outline: none 0px; padding: 0px;">TSOriginal.com/oldpage.htm</strong> we will be redirected to<strong style="margin: 0px; outline: none 0px; padding: 0px;">TSOriginal.com/ newpage.htm</strong>.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
We will again use the Live HTTP Headers plugin for Firefox to view the redirect. As you can see the pages redirect with the correct <strong style="margin: 0px; outline: none 0px; padding: 0px;">302</strong> status code.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
<img align="middle" alt="IIS 7 Redirection - 15" border="0" height="362" src="http://www.trainsignal.com/blog/wp-content/uploads/2008/03/Dave_IIS7_redirect/iisredirect17.png" style="border: none; margin: 0px; outline: none 0px; padding: 0px;" title="IIS 7 Redirection - 15" width="543" /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
You are now ready to do basic redirects in IIS 7 on Windows 2008 server.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; outline: none 0px; padding: 10px;">
These redirects can also be setup using Appcmd.exe at the command line, but this is beyond the scope of this article. If you’re interested check out the <a href="https://addons.mozilla.org/en-US/firefox/addon/3829" style="color: #417ad5; margin: 0px; outline: none 0px; padding: 0px;">Live HTTP plug-in for Firefox.</a></div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-6956590449370738952013-08-31T02:07:00.001-07:002013-08-31T02:07:43.537-07:00The log or differential backup cannot be restored because no files are ready to rollforward.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><span style="font-family: arial;">If you have found this page, it is likely that you encountered the following error when you tried to restore a differential backup using Microsoft SQL Server 2005.</span> <span style="color: red; font-family: arial; font-style: italic; font-weight: bold;">Restore failed for Server '</span><myserver style="font-family: arial;"><span style="color: red; font-style: italic; font-weight: bold;">'. (Microsoft.SqlServer.Smo)</span> <span style="color: red; font-style: italic; font-weight: bold;">Additional Information:</span><span style="color: red; font-style: italic; font-weight: bold;">System.Data.SqlClient.SqlError: The log or differential backup cannot be restored because no files are ready to rollforward. (Microsoft.SqlServer.Smo)</span> What this error is telling you is that there is no database that was left in non-operational mode, and thus has not been cleaned up such that uncommitted transactions have not been rolled back. The easy way to reproduce this error is to backup your database using full recover model, and do full and differential backups. Once you have your full and differential backup files you, if you want to restore your database all you have to do is restore the full backup first, and then one of the differential files (differential backups have all the changes since the last full backup) that brings you up to the point you want to restore to. You will get the above error when you try to restore the differential backup (after you just restored the full backup). Unfortunately, you forgot one critical detail (just like I did at first). You MUST restore all but the last (in this case the full backup) with NORECOVERY option. In the Microsoft SQL Server Management Studio there are three options on the Option "page" when you restore a database. <span style="font-weight: bold;">Option 1 (the default):</span> <span style="font-style: italic;">Leave the database ready to use by rolling back uncommitted transactions. Additional transaction logs cannot be restored.(RESTORE WITH RECOVERY)</span> <span style="font-weight: bold;">Option 2:</span> <span style="font-style: italic;">Leave the database non-operational, and do not roll back uncommitted transactions. Additional transaction logs can be restored.(RESTORE WITH NORECOVERY)</span> To properly restore a database that is backup up using full recovery mode with full and differential backups, here are the steps you need to follow to not get the above error. <span style="font-size: 17px;">Restore Full backup</span></myserver></span><br />
<ol style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;">
<li style="font-family: arial; margin: 0px 0px 0.25em; padding: 0px;">Open the <span style="font-style: italic;">Restore Database</span> window in <span style="font-style: italic;">Microsoft SQL Server Management Studio</span></li>
<li style="font-family: arial; margin: 0px 0px 0.25em; padding: 0px;">Ensure the <span style="font-style: italic;">To database</span> field is filled in with the name you want.</li>
<li style="font-family: arial; margin: 0px 0px 0.25em; padding: 0px;">Choose <span style="font-style: italic;">From device</span> as the <span style="font-style: italic;">Source for restore</span>.</li>
<li style="font-family: arial; margin: 0px 0px 0.25em; padding: 0px;">Choose the full backup file you want to restore. In most cases this is the most recent full backup file.</li>
<li style="font-family: arial; margin: 0px 0px 0.25em; padding: 0px;">Click the <span style="font-style: italic;">Options </span>page on the left navigation.</li>
<li style="margin: 0px 0px 0.25em; padding: 0px;"><span style="font-family: arial;">Choose </span><span style="font-family: arial; font-style: italic; font-weight: bold;">Leave the database non-operational, and do not roll back uncommitted transactions. Additional transaction logs can be restored.(RESTORE WITH NORECOVERY). </span><span style="color: #ff6600; font-family: arial; font-weight: bold;">This is the most important step!!!</span><span style="font-style: italic; font-weight: bold;"></span></li>
</ol>
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><span style="font-family: arial; font-size: 17px;">Restore Differential backup</span></span><br />
<ol style="font-family: arial;">
<li style="margin: 0px 0px 0.25em; padding: 0px;">Open the <span style="font-style: italic;">Restore Database </span>window in <span style="font-style: italic;">Microsoft SQL Server Management Studio</span></li>
<li style="margin: 0px 0px 0.25em; padding: 0px;">Ensure the <span style="font-style: italic;">To database </span>field is filled in with the name you want. The same that you specified in step 2 for the Restore Full backup</li>
<li style="margin: 0px 0px 0.25em; padding: 0px;">Choose <span style="font-style: italic;">From device </span>as the <span style="font-style: italic;">Source for restore</span>.</li>
<li style="margin: 0px 0px 0.25em; padding: 0px;">Choose the differential backup file you want to restore. In most cases this is the most recent differential backup file.</li>
<li style="margin: 0px 0px 0.25em; padding: 0px;">Click the <span style="font-style: italic;">Options </span>page on the left navigation.</li>
<li style="margin: 0px 0px 0.25em; padding: 0px;">Choose the default: <span style="font-style: italic; font-weight: bold;">Leave the database ready to use by rolling back uncommitted transactions. Additional transaction logs cannot be restored.(RESTORE WITH RECOVERY) </span><span style="font-weight: bold;"></span><span style="color: #ff6600; font-weight: bold;">Make sure to choose this if you want to use your database after the restore.</span><span style="font-style: italic; font-weight: bold;"></span></li>
</ol>
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><span style="font-family: arial;">That is it, no more error. If you are lucky :)</span></span></div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-81301626383302520142013-08-31T01:44:00.001-07:002013-08-31T01:44:08.611-07:00Automated differential backup using 7zip for linux/windows<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
There are a lot of ways of doing differential backups, tons of software, freeware of shareware. I want to share one I didn't know about which I liked very much. It is unfair so little information can be found the Net about <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">7-zip</strong> archival tool, which can handle differential backups with ease. Article is for CLI geeks, who understands where to push these commands )</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
<span id="more-512" style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
What are Differential and Incremental backups?</h2>
<h3 style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; margin: 15px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Incremental backup</h3>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
is a backup method in which multiple backups are kept (not just the last one). These backups will be incremental if each original piece of backed up information is stored only once, and then successive backups contain only the information that changed since a previous backup.</div>
<h3 style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; margin: 15px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
Differential backup</h3>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
is a cumulative backup of <em style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">all</em> changes made since the last <em style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">full or normal</em> backup, i.e., the <em style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">differences</em> since the last full backup</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
I am talking about <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></strong><strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Differential backup, </strong>which contains one FULL archive and several DIFFERENTIAL archives on different date each.</div>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
<strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Using 7zip for automated backup</strong></h2>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
Is really great tool for archiving files. Linux and win32 platform support, crossplaform archiving, multi threading support.</div>
<h3 style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; margin: 15px 0px; outline: 0px; padding: 0px; vertical-align: baseline;">
7zip installation</h3>
<ol style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; margin: 15px 30px; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Windows, <a href="http://www.7-zip.org/download.html" style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #555555; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" target="_blank">download</a></li>
<li style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Ubuntu: aptitude install p7zip</li>
</ol>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
<strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">7zip commands to create a backup of files</strong></h2>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
First step is to create<strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"> full backup</strong> which is fairly easy:</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">7za a c:\archive.7z c:\folder_to_archive</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
Next is to create <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">differential backup</strong> with name diff1.7z</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">7za u c:\archive.7z c:\folder_to_archive -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!c:\diff1.7z</pre>
</blockquote>
<ul style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; margin: 15px 30px; outline: 0px; padding: 0px; vertical-align: baseline; z-index: 40;">
<li style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; list-style: circle; margin: 0px 0px 4px; outline: 0px; padding: 0px; vertical-align: baseline;">Where command switches stand for:</li>
<li style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; list-style: circle; margin: 0px 0px 4px; outline: 0px; padding: 0px; vertical-align: baseline;">-mx=9 - best compression</li>
<li style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; list-style: circle; margin: 0px 0px 4px; outline: 0px; padding: 0px; vertical-align: baseline;">-t7z - 7z archive type</li>
</ul>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
<span class="Apple-style-span" style="border: 0px; font-size: 20px; font-weight: bold; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Wtf "-up0q3r2x2y2z0w2!c:\diff1.7z" is ?</span></div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
<strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Actions mask to </strong>determinite 7z behavior</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">p - File exists in archive, but is not matched with wildcard.</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">q - File exists in archive, but doesn't exist on disk.</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">r - File doesn't exist in archive, but exists on disk.</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">x - File in archive is newer than the file on disk.</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">y - File in archive is older than the file on disk.</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">z - File in archive is same as the file on disk</pre>
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">w - Can not be detected what file is newer (times are the same, sizes are different)</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
Number means action:</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">0 Ignore file (don't create item in new archive for this file)
1 Copy file (copy from old archive to new)
2 Compress (compress file from disk to new archive)
3 Create Anti-item (item that will delete file or directory during extracting). This feature is supported only in 7z format</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
More detailes on this switch here:</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
<a href="http://www.bugaco.com/7zip/MANUAL/switches/update.htm" style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #555555; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">http://www.bugaco.com/7zip/MANUAL/switches/update.htm</a></div>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
How to extract files from 7zip differential backup</h2>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
First step is to extract full backup archive:</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">7za.exe x c:\archive.7z -oc:\recovery_path\</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
Next, to extract needed differential backup on top to the same folder</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">7za.exe x c:\archive.7z -aoa -y -oc:\recovery_path\</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
-aoa Overwrite All existing files without prompt.</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
-y (assume Yes on all queries) switch</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
After extraction destination folder will contain exact structure and files on date of backup!</div>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
What is 7zip anti-item</h2>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
When creating differential archive 7zip matches files that have been deleted and creates <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">anti-file entry</strong> which tells <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">7zip</strong> extractor actually do delete file when overriding master archive. Thats why resulting recovery folder will look the same as on archiving stage.</div>
<h2 style="background-color: white; border-bottom-color: rgb(220, 220, 219); border-bottom-style: solid; border-width: 0px 0px 1px; color: #2c2c29; font-family: Vera, Helvetica, Georgia; font-size: 18px; letter-spacing: -1px; margin: 10px 0px 3px; outline: 0px; padding: 0px 0px 3px; vertical-align: baseline;">
7zip backup limitations</h2>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
DO NOT USE the 7-zip format on Linux/Unix for system backup purposes, because of <strong style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">7zip does not store the owner/group</strong> of the file.</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
On Linux/Unix, in order to backup directories you should use tar</div>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
to backup a directory</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">tar cf – directory | 7za a -si directory.tar.7z</pre>
</blockquote>
<div style="background-color: white; border: 0px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 1.2em; line-height: 1.4em; margin-bottom: 15px; margin-top: 1px; outline: 0px; padding: 2px; vertical-align: baseline;">
to restore your backup :</div>
<blockquote style="background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-width: 0px 0px 0px 4px; color: #2c2c29; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; margin: 20px 10px 10px 5px; outline: 0px; padding: 0px 5px; text-align: justify; vertical-align: baseline;">
<pre style="background-color: transparent; border: 0px; margin-bottom: 10px; margin-top: 10px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; width: 519px;">7za x -so directory.tar.7z | tar</pre>
</blockquote>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-33582619958938264042013-08-31T01:24:00.001-07:002013-08-31T01:24:02.600-07:00SQL Server Full Backups<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b><u>Overview</u></b>The most common types of SQL Server backups are complete or full backups, also known as database backups. These backups create a complete backup of your database as well as part of the transaction log, so the database can be recovered. This allows for the simplest form of database restoration, since all of the contents are contained in one backup.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<u><b>Explanation</b></u>A full backup can be completed either using T-SQL or by using SSMS. The following examples show you how to create a full backup.</div>
<hr style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;" />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>Create a full backup of the AdventureWorks database to one disk file</b></div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>T-SQL</b></div>
<table bgcolor="#c0c0c0" border="1" cellpadding="4" cellspacing="0" style="color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; width: 100%px;"><tbody>
<tr><td style="font-size: 10pt;"><pre>BACKUP DATABASE AdventureWorks TO DISK = 'C:\AdventureWorks.BAK'
GO</pre>
</td></tr>
</tbody></table>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>SQL Server Management Studio</b></div>
<ul style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<li>Right click on the database name</li>
<li>Select Tasks > Backup</li>
<li>Select "Full" as the backup type</li>
<li>Select "Disk" as the destination</li>
<li>Click on "Add..." to add a backup file and type "C:\AdventureWorks.BAK" an click "OK"</li>
<li>Click "OK" again to create the backup</li>
</ul>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<img border="0" src="http://www.mssqltips.com/tutorialimages/7_Full2.jpg" style="border: 0px;" /></div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0tag:blogger.com,1999:blog-5606859874105810764.post-46153212063375567092013-08-31T01:23:00.001-07:002013-08-31T01:23:33.928-07:00 SQL Server Differential Backups<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<u><b>Overview</b></u>Another option to assist with your recovery is to create "Differential" backups. A "Differential" backup is a backup of any extent that has changed since the last "Full" backup was created.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<u><b>Explanation</b></u>The way differential backups work is that they will backup all extents that have changed since the last full backup. An extent is made up of eight 8KB pages, so an extent is 64KB of data. Each time any data has been changed a flag is turned on to let SQL Server know that if a "Differential" backup is created it should include the data from this extent. When a "Full" backup is taken these flags are turned off.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
So if you do a full backup and then do a differential backup, the differential backup will contain only the extents that have changed. If you wait some time and do another differential backup, this new differential backup will contain all extents that have changed since the last <u>full</u> backup. Each time you create a new differential backup it will contain every extent changed since the last full backup. When you go to restore your database, to get to the most current time you only need to restore the full backup and the most recent differential backup. All of the other differential backups can be ignored.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
If your database is in the Simple recovery model, you can still use full and differential backups. This does not allow you to do point in time recovery, but it will allow you to restore your data to a more current point in time then if you only had a full backup.</div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
If your database is in the Full or Bulk-Logged recovery model you can also use differential backups to eliminate the number of transaction logs that will need to be restored. Since the differential will backup all extents since the last full backup, at restore time you can restore your full backup, your most recent differential backup and then any transaction log backups that were created after the most recent differential backup. This cuts down on the number of files that need to be restored.</div>
<hr style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;" />
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>Create a differential backup of the AdventureWorks database to one disk file</b></div>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>T-SQL</b></div>
<table bgcolor="#c0c0c0" border="1" cellpadding="4" cellspacing="0" style="color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; width: 100%px;"><tbody>
<tr><td style="font-size: 10pt;"><pre>BACKUP DATABASE AdventureWorks TO DISK = 'C:\AdventureWorks.DIF' WITH DIFFERENTIAL
GO</pre>
</td></tr>
</tbody></table>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<b>SQL Server Management Studio</b></div>
<ul style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<li>Right click on the database name</li>
<li>Select Tasks > Backup</li>
<li>Select "Differential" as the backup type</li>
<li>Select "Disk" as the destination</li>
<li>Click on "Add..." to add a backup file and type "C:\AdventureWorks.DIF" and click "OK"</li>
<li>Click "OK" again to create the backup</li>
</ul>
<div style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<img border="0" src="http://www.mssqltips.com/tutorialimages/9_Diff1.jpg" style="border: 0px;" /></div>
</div>
rpelepeihttp://www.blogger.com/profile/04696078487154469040noreply@blogger.com0