tag:blogger.com,1999:blog-17205052540964387082024-03-13T10:46:01.238-06:00DevfunkdAnonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-1720505254096438708.post-28188899065211515152016-03-08T10:50:00.002-07:002016-03-08T10:50:45.981-07:00SQL Query Optimization Tips<div class="MsoNormal">
After spending the past few months working in a SQL heavy application I've discovered there is a lot you can do as a developer to ensure your application stays optimized when calling stored procedures and running queries against your database. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Definitely, these optimization tips don’t guarantee that
your queries won't become your system bottleneck. It will require more
bench-marking and profiling to further optimize your SQL queries. However, the
below optimizations can be utilized by anyone and are good practices to know
when writing queries. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
These have been a good learning experience for me and have helped eliminate a few pesky issues in my own application.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18pt;">Wildcard<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In SQL, wildcard is provided for us with '%' symbol. Using wildcard will definitely slow down your query especially for table that are really huge. We can optimize our query with wildcard by doing a postfix wildcard instead of pre or full wildcard.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>#Full wildcard<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN LIKE '%hello%';<o:p></o:p></span></div>
<div class="MsoNormal">
<b>#Postfix wildcard<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN LIKE 'hello%';<o:p></o:p></span></div>
<div class="MsoNormal">
<b>#Prefix wildcard<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN LIKE '%hello';<o:p></o:p></span></div>
<div class="MsoNormal">
That column must be indexed for such optimize to be applied.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<i>*<span style="font-size: x-small;">Doing a full wildcard in a few million records in a table is equivalent to killing the database.</span></i></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18pt;">COUNT VS EXIST<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Some of us might use COUNT operator to determine whether a particular data exist<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT COLUMN FROM TABLE WHERE COUNT(COLUMN) > 0<o:p></o:p></span></div>
<div class="MsoNormal">
Similarly, this is very bad query since count will search for all record exist on the table to determine the numeric value of field 'COLUMN'. The better alternative will be to use the EXIST operator where it will stop once it found the first record. Hence, it exist.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18pt;">Wildcard VS Substr<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Most developer practiced Indexing. Hence, if a particular COLUMN has been indexed, it is best to use wildcard instead of substr.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>#BAD<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE substr ( COLUMN, 1, 1 ) = 'value'.<o:p></o:p></span></div>
<div class="MsoNormal">
The above will substr every single row in order to seek for the single character 'value'. On the other hand,<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>#BETTER<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN = 'value%'.<o:p></o:p></span></div>
<div class="MsoNormal">
Wildcard query will run faster if the above query is searching for all rows that contain 'value' as the first character. Example,<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>#SEARCH FOR ALL ROWS WITH THE FIRST CHARACTER AS 'E'<o:p></o:p></b></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN = 'E%'.</span></div>
<div class="MsoNormal">
<span style="color: red;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-size: 18pt;">Data Types<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Use the most efficient (smallest) data types possible. It is unnecessary and sometimes dangerous to provide a huge data type when a smaller one will be more than sufficient to optimize your structure. Example, using the smaller integer types if possible to get smaller tables. MEDIUMINT is often a better choice than INT because a MEDIUMINT column uses 25% less space. On the other hand, VARCHAR will be better than longtext to store an email or small details.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Indexes<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Index your column is a common way to optimize your search
result. Nonetheless, one must fully understand how does indexing work in each
database in order to fully utilize indexes. On the other hand, useless and
simply indexing without understanding how it work might just do the opposite.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Symbol Operator<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Symbol operator such as >,<,=,!=, etc. are very
helpful in our query. We can optimize some of our query with symbol operator
provided the column is indexed. For example,<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN
> 16<o:p></o:p></span></div>
<div class="MsoNormal">
Now, the above query is not optimized due to the fact that
the DBMS will have to look for the value 16 THEN scan forward to value 16 and
below. On the other hand, an optimized value will be<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN
>= 15<o:p></o:p></span></div>
<div class="MsoNormal">
This way the DBMS might jump straight away to value 15
instead. It's pretty much the same way how we find a value 15 (we scan through
and target ONLY 15) compare to a value smaller than 16 (we have to determine
whether the value is smaller than 16; additional operation).<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">NOT Operator<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Try to avoid NOT operator in SQL. It is much faster to
search for an exact match (positive operator) such as using the LIKE, IN, EXIST
or = symbol operator instead of a negative operator such as NOT LIKE, NOT IN,
NOT EXIST or != symbol. Using a negative operator will cause the search to find
every single row to identify that they are ALL not belong or exist within the
table. On the other hand, using a positive operator just stop immediately once
the result has been found. Imagine you have 1 million record in a table. That's
bad.<o:p></o:p></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;"> </span></b><span style="color: red;"> </span></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Index Unique Columns<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Some databases such as MySQL search better with column that
are unique and indexed. Hence, it is best to remember to index those columns
that are unique. And if the column is truly unique, declare them as one.
However, if that particular column was never used for searching purposes, it
gives no reason to index that particular column although it is given unique.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Max and Min Operators<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Max and Min operators look for the maximum or minimum value
in a column. We can further optimize this by placing a indexing on that
particular column, We can use Max or Min on columns that already established
such Indexes. But if that particular column is frequently use, having an index
should help speed up such searching and at the same time speed max and min
operators. This makes searching for maximum or minimum value faster. Deliberate
having an index just to speed up Max and Min is always not advisable. It’s like
sacrifice the whole forest for a merely a tree.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Primary Index<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The primary column that is used for indexing should be made
as short as possible. This makes identification of each row easy and efficient
by the DBMS.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">String indexing<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
It is unnecessary to index the whole string when a prefix or
postfix of the string can be indexed instead. Especially if the prefix or
postfix of the string provides a unique identifier for the string, it is
advisable to perform such indexing. Shorter indexes are faster, not only
because they require less disk space, but because they also give you more hits
in the index cache, and thus fewer disk seeks.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Limit The Result<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Another common way of optimizing your query is to minimize
the number of row return. If a table have a few billion records and a search
query without limitation will just break the database with a simple SQL query
such as this.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE<o:p></o:p></span></div>
<div class="MsoNormal">
Hence, don't be lazy and try to limit the result turn which
is both efficient and can help minimize the damage of an SQL injection attack.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE 1 LIMIT 10<o:p></o:p></span></div>
<div class="MsoNormal">
Use Default Value<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
If you are using MySQL, take advantage of the fact that
columns have default values. Insert values explicitly only when the value to be
inserted differs from the default. This reduces the parsing that MySQL must do
and improves the insert speed.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">In Subquery<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Some of us will use a subquery within the IN operator such
as this.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN IN
(SELECT COLUMN FROM TABLE)<o:p></o:p></span></div>
<div class="MsoNormal">
Doing this is very expensive because SQL query will evaluate
the outer query first before proceed with the inner query. Instead we can use
this instead.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE, (SELECT COLUMN
FROM TABLE) as dummytable WHERE dummytable.COLUMN = TABLE.COLUMN;<o:p></o:p></span></div>
<div class="MsoNormal">
Using dummy table is better than using an IN operator to do
a subquery. Alternative, an exist operator is also better.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-size: 18.0pt;">Utilize Union instead of
OR<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Indexes lose their speed advantage when using them in
OR-situations in MySQL at least. Hence, this will not be useful although
indexes is being applied<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN_A =
'value' OR COLUMN_B = 'value'<o:p></o:p></span></div>
<div class="MsoNormal">
On the other hand, using Union such as this will utilize
Indexes.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN_A =
'value'<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: red;">UNION<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: red;">SELECT * FROM TABLE WHERE COLUMN_B =
'value'<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
Hence, run faster.<o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0tag:blogger.com,1999:blog-1720505254096438708.post-86534993958799152582015-12-10T12:19:00.001-07:002016-03-07T12:54:55.151-07:00IoT: Open Sourcing My Aquaponics / Greenhouse Monitoring Platform<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYY5Yfe-2l1dyjaQFfHew1DihWc8bT2iE3gkpXJazcgGvzJilLUDnEqwdNvvRK4fZjCJRdUJRQB8kGeKnJ_DzBFdJGbiUf8nQWu98TWdS0rlYvIFxHspZeAf1Ns56ESc80EG6RF5RfFHI/s1600/AAEAAQAAAAAAAAR0AAAAJDEwOTBlNjg4LWQwN2EtNGE0Yy05MTYxLTU5NjZmYzJiMzBkZA.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYY5Yfe-2l1dyjaQFfHew1DihWc8bT2iE3gkpXJazcgGvzJilLUDnEqwdNvvRK4fZjCJRdUJRQB8kGeKnJ_DzBFdJGbiUf8nQWu98TWdS0rlYvIFxHspZeAf1Ns56ESc80EG6RF5RfFHI/s400/AAEAAQAAAAAAAAR0AAAAJDEwOTBlNjg4LWQwN2EtNGE0Yy05MTYxLTU5NjZmYzJiMzBkZA.jpg" width="400" /></a></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
It's been a while now since I started working on my AquaCulture Monitor project and today it's been released onto GitHub as an open source project for all the IoT developers out there.</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
I started the project some time ago after getting myself a raspberry pi and looking to find something fun and challenging to do with it beyond the standard basic tutorials out there.<br />
<br style="box-sizing: border-box;" />
My wife Jean had started her aquaponic greenhouse and seeing she was spending a great deal of time checking various things such as pH levels in her tank and temperature/humidity levels inside the greenhouse I thought why not build a device that can stream the data in real-time to her iPad and provide her with something that could help her make informed decisions about what her greenhouse was doing.</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
It was a great project to work on and allowed me to dive into programming with Python. </div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #232629; font-family: Georgia, serif; font-size: 18px; font-stretch: inherit; line-height: 32px; margin-bottom: 32px; outline: 0px; padding: 0px; vertical-align: baseline;">
Well the code is now online for anyone to freely use and contribute to.<br />
<br style="box-sizing: border-box;" />
GitHub - Repository<br />
<a href="https://github.com/devfunkd/aquaponic-raspberry-pi" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: #8c68cb; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;" target="_blank">https://github.com/devfunkd/aquaponic-raspberry-pi</a><br />
<br />
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<a href="http://www.kqzyfj.com/i066shqnhp4C8E699D4658CD9E9469A99ACABC555" target="_blank">Tired of Waiting for your Website to Load? $1/ mo Hosting + Free domain!</a><img border="0" src="http://www.awltovhc.com/image-7391448-11670979" height="1" width="1" /></div>
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<br /></div>
<h3 class="r" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: medium; font-weight: normal; line-height: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<a href="http://www.thinkmonkey.ca/" target="_blank">ThinkMonkey - <span style="font-weight: bold;">Web Design</span> Company | Software Company</a></h3>
</div>
Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0tag:blogger.com,1999:blog-1720505254096438708.post-63776701561439720882015-07-12T21:37:00.003-06:002016-03-07T12:54:48.970-07:00<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
</div>
<h2>
<b>HOW TO POST TO YOUR PAGE USING FACEBOOK C# SDK</b></h2>
<br />
1) Create a Facebook App at: <a href="http://developers.facebook.com/" rel="nofollow" style="border: 0px; color: #0c65a5; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;" title="developers.facebook.com">developers.facebook.com</a> and get yourself an APPID and APPSECRET. (there are a lot of tutorials online for doing this so I will skip repeating it)<br />
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
2) Go to: <a href="http://developers.facebook.com/tools/explorer" rel="nofollow" style="border: 0px; color: #0c65a5; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;" title="http://developers.facebook.com/tools/explorer">http://developers.facebook.com/tools/explorer</a> and choose your app from the dropdown and click "generate access token".</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
3) After that do the following steps here: <a href="http://stackoverflow.com/questions/17197970/facebook-permanent-page-access-token" style="border: 0px; color: #0c65a5; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;" title="http://stackoverflow.com/questions/17197970/facebook-permanent-page-access-token">http://stackoverflow.com/questions/17197970/facebook-permanent-page-access-token</a> to get yourself a permanent page token. (I can not stress this enough, follow the steps carefully and thoroughly)*</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
*I have tool I built that does this for me, all I enter is the APPID, APPSECRET and ACCESSTOKEN which the tool then generates a permanent page token for me. Anyone is welcomed to use it and help make it better,</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<a href="https://github.com/devfunkd/facebookpagetokengenerator" rel="nofollow" style="border: 0px; color: #0c65a5; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">https://github.com/devfunkd/facebookpagetokengenerator</a></div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
=======================================================================</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Ok at this point you should have your <strong style="border: 0px; margin: 0px; padding: 0px;">APPID</strong>, <strong style="border: 0px; margin: 0px; padding: 0px;">APPSECRET</strong> and a <strong style="border: 0px; margin: 0px; padding: 0px;">PERMANENT PAGE TOKEN</strong>.</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
=======================================================================</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
In your Visual Studio solution:</div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
4) Using Nuget:<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, sans-serif; font-size: 13px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">Install-Package Facebook</code></div>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
5) Implement the <strong style="border: 0px; margin: 0px; padding: 0px;">Facebook client</strong>:</div>
<pre style="background-color: #eeeeee; border: 0px; color: #222222; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; 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, sans-serif; margin: 0px; padding: 0px; white-space: inherit;">public void PostMessage(string message)
{
try
{
var fb = new FacebookClient
{
AppId = ConfigurationManager.AppSettings.Get("FacebookAppID"),
AppSecret = ConfigurationManager.AppSettings.Get("FacebookAppSecret"),
AccessToken = ConfigurationManager.AppSettings.Get("FacebookAccessToken")
};
dynamic result = fb.Post("me/feed", new
{
message = message
});
}
catch (Exception exception)
{
// Handle your exception
}
}
</code></pre>
<div style="background-color: white; border: 0px; clear: both; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
I hope this helps anyone who is struggling to figure this out.<br />
<br />
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<a href="http://www.kqzyfj.com/i066shqnhp4C8E699D4658CD9E9469A99ACABC555" target="_blank">Tired of Waiting for your Website to Load? $1/ mo Hosting + Free domain!</a><img border="0" src="http://www.awltovhc.com/image-7391448-11670979" height="1" width="1" /></div>
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<br /></div>
<h3 class="r" style="font-family: arial, sans-serif; font-size: medium; font-weight: normal; line-height: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<a href="http://www.thinkmonkey.ca/" target="_blank">ThinkMonkey - <span style="font-weight: bold;">Web Design</span> Company | Software Company</a></h3>
</div>
Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0tag:blogger.com,1999:blog-1720505254096438708.post-15099998335549698562015-01-03T16:57:00.002-07:002016-03-07T12:54:37.798-07:00Remove Malware From Your WordPress Site<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
This step-by-step guide can be used by practically anyone to remove malware from WordPress. However, you must be willing to get your hands a little dirty, and be comfortable with FTP and File Manager.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 1: Scan Your Computer</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
When malware infects your WordPress site it is actually quite common if you don't stay on top the game and update regularly as well monitor your logs. So first things first is to make sure your computer is virus-free. We recommend scanning at least with <a href="http://www.malwarebytes.org/" style="-webkit-transition: all 250ms linear; color: #2daebf; font-size: inherit; font-weight: inherit; line-height: 1.231; text-decoration: none; text-rendering: optimizelegibility; transition: all 250ms linear;" target="_blank">Malware Bytes</a>, and to be doubly safe, another anti-virus such as <a href="http://www.eset.com/" target="_blank">NOD32</a> or <a href="http://www.kaspersky.com/" style="-webkit-transition: all 250ms linear; color: #2daebf; font-size: inherit; font-weight: inherit; line-height: 1.231; text-decoration: none; text-rendering: optimizelegibility; transition: all 250ms linear;" target="_blank">Kaspersky</a>.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 2: Change Your Password</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Now that your computer is virus free, you should change your cPanel and FTP password. Make sure it is something random, with at least 1 special character like ! # & %, a mix of lower and uppercase letters plus numbers. We recommend using a password manager tool such as LastPass to not only generate secure passwords but store and manage them for you too.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 3: Download WordPress</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Download the latest fresh WordPress package from the <a href="http://wordpress.org/download/" style="-webkit-transition: all 250ms linear; color: #2daebf; font-size: inherit; font-weight: inherit; line-height: 1.231; text-decoration: none; text-rendering: optimizelegibility; transition: all 250ms linear;">official site</a>.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 4: Extract Files</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Extract the files from the zip or tar.gz that you have just downloaded onto your computer. Leave those files there for now. We will come back to them later.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 5: Removing The Malware Infection</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Login to your FTP or cPanel > File Manager.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Your WordPress installation files on your web host should look like this:</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
<code style="background: rgb(238, 238, 238); border-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #2daebf; font-size: 14px; line-height: 1.231; text-rendering: optimizelegibility;">wp-admin<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-content<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-includes<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />index.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />license.txt<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />readme.html<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-activate.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-blog-header.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-comments-post.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-config.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-config-sample.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-cron.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-links-opml.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-load.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-login.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-mail.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-settings.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-signup.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-trackback.php<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />xmlrpc.php</code></div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Delete everything you see there <strong style="color: inherit; line-height: 1.231; text-rendering: optimizelegibility;">except</strong> for the <em style="line-height: 1.231; text-rendering: optimizelegibility;">wp-content</em> folder, and the <em style="line-height: 1.231; text-rendering: optimizelegibility;">wp-config.php</em> file.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Now your installation should look like:</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
<code style="background: rgb(238, 238, 238); border-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #2daebf; font-size: 14px; line-height: 1.231; text-rendering: optimizelegibility;">wp-content<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />wp-config.php</code></div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
In your cPanel > File Manager, click on and edit the wp-config.php file. Make sure there are no strange codes or anything unusual. If there is malware in this file, it will generally look like a long string of random text. You can compare it to the wp-config-sample.php file to be sure.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Now go into the <strong style="color: inherit; line-height: 1.231; text-rendering: optimizelegibility;">wp-content</strong> folder. It should look like:</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
<code style="background: rgb(238, 238, 238); border-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #2daebf; font-size: 14px; line-height: 1.231; text-rendering: optimizelegibility;">plugins<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />themes<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />uploads<br style="color: #686873; font-family: Arial, sans-serif; line-height: 1.231; text-rendering: optimizelegibility;" />index.php</code></div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Make a list of the plugins you are currently using, then remove the plugins folder and index.php file. You will need to re-install your plugins after the cleaning process.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Go into the <em style="line-height: 1.231; text-rendering: optimizelegibility;">themes</em> folder, and remove any theme which you are not using. You will then need to individually check each file in your current theme to make sure there is no malware or strange codes in them. If you have a clean backup of your theme somewhere (like on your computer), then to be safe you should just delete the entire themes folder.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Check every directory inside your <em style="line-height: 1.231; text-rendering: optimizelegibility;">uploads</em> folder to make sure there are no php files or anything that you may not have uploaded.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 6: Re-upload WordPress</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
The fresh WordPress files that you extracted earlier in Step 4 can now be uploaded via FTP.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
If you removed your theme you should also re-upload your clean backup theme files.</div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 7: Change WordPress Admin Password and Re-install Plugins</h3>
<div style="margin-bottom: 1.125em; text-rendering: optimizelegibility;">
<span style="background-color: white; color: #686873; font-family: "arial" , sans-serif; font-size: 15px; line-height: 1.125em;">You should now be able to access your dashboard, and change your admin password. <strong style="color: inherit; line-height: 1.231; text-rendering: optimizelegibility;">Always</strong> use a random hard to guess password. Don’t be tempted to use something basic like </span><span style="color: #2daebf; font-family: monospace;"><span style="background-color: #eeeeee; font-size: 14px; line-height: 17.234001159668px;">welcome</span></span><span style="background-color: white; color: #686873; font-family: "arial" , sans-serif; font-size: 15px; line-height: 16.875px;"> </span><span style="font-family: "arial" , sans-serif;"><span style="background-color: white; color: #686873; font-size: 15px; line-height: 1.125em;">or </span><span style="color: #2daebf;"><span style="background-color: #eeeeee; font-size: 14px; line-height: 17.234001159668px;">ilovekittens</span></span></span><span style="color: #686873; font-family: "arial" , sans-serif;"><span style="background-color: white; font-size: 15px; line-height: 1.125em;">(actual passwords used by some of our clients). You </span></span><strong style="background-color: white; color: inherit; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.231; text-rendering: optimizelegibility;">will</strong><span style="color: #686873; font-family: "arial" , sans-serif;"><span style="background-color: white; font-size: 15px; line-height: 1.125em;"> get hacked this way.</span></span></div>
<div style="margin-bottom: 1.125em; text-rendering: optimizelegibility;">
<span style="background-color: white; color: #686873; font-family: "arial" , sans-serif; font-size: 15px; line-height: 1.125em;">If you don’t want to use a random password like <code style="background: rgb(238, 238, 238); border-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #2daebf; font-size: 14px; line-height: 1.231; text-rendering: optimizelegibility;">xSpM82!#3&W</code>, then pick an uncommon phrase with 3 or more words like </span><span style="color: #2daebf; font-family: monospace;"><span style="background-color: #eeeeee; font-size: 14px; line-height: 17.234001159668px;">MyKitten<3sMe</span></span><span style="background-color: white; color: #686873; font-family: "arial" , sans-serif; font-size: 15px; line-height: 1.125em;">. A strong password is one with uncommon words, at least 1 number, 1 special character and a mix of upper and lower case characters.</span></div>
<h3 style="background-color: white; color: #555555; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; line-height: 1.2em; margin-bottom: 0.7em; margin-top: 0.75em; text-rendering: optimizelegibility;">
Step 8: Remove Google Warning</h3>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Now that your site is free of malware, you can submit your site to Google to get the warning “This site may harm your computer” removed. Login or create an account at <a href="http://www.google.com/webmasters/tools/" style="-webkit-transition: all 250ms linear; color: #2daebf; font-size: inherit; font-weight: inherit; line-height: 1.231; text-decoration: none; text-rendering: optimizelegibility; transition: all 250ms linear;" target="_blank">Google Webmaster Tools</a>, add your site, click <em style="line-height: 1.231; text-rendering: optimizelegibility;">Health</em>, and then click <em style="line-height: 1.231; text-rendering: optimizelegibility;">Malware</em>. and finally <em style="line-height: 1.231; text-rendering: optimizelegibility;">Request A Review</em>.</div>
<div style="background-color: white; color: #686873; font-family: Arial, sans-serif; font-size: 15px; line-height: 1.125em; margin-bottom: 1.125em; text-rendering: optimizelegibility;">
Disclaimer: While these steps may help remove malware from your site it is not a complete guide and therefore we are not responsible for any damage or data loss that could happen from attempting to remove malware. We always encourage you to consult a professional who can ensure the correct measures are taken to negate any further damage already caused from a malware infected website.<br />
<br />
For professional malware removal services visit http://www.thinkmonkey.ca<br />
<br />
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<a href="http://www.kqzyfj.com/i066shqnhp4C8E699D4658CD9E9469A99ACABC555" target="_blank">Tired of Waiting for your Website to Load? $1/ mo Hosting + Free domain!</a><img border="0" src="http://www.awltovhc.com/image-7391448-11670979" height="1" width="1" /></div>
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<br /></div>
<h3 class="r" style="color: #222222; font-size: medium; font-weight: normal; line-height: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<a href="http://www.thinkmonkey.ca/" target="_blank">ThinkMonkey - <span style="font-weight: bold;">Web Design</span> Company | Software Company</a></h3>
</div>
Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0tag:blogger.com,1999:blog-1720505254096438708.post-19330324985046365242014-12-16T09:41:00.000-07:002016-03-07T12:54:26.684-07:00Taking Ownership Of What You Deliver<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
<h2>
<b>Taking Ownership Of What You Deliver.</b></h2>
</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
Almost a year ago I started a software development company as a way of creating and delivering projects outside of my full-time job with the desire to keep any intellectual property separate from what I delivered through my 9-to-5.</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
One of my favourite things about software development is being able to put an emphasis on creating working software instead of obsessing over intermediate progress gates and deliverables.</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
Over the past year I've learned a few things along the way, personally these observations have helped myself personally grow towards being more aware of what I am producing and delivering.</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
<strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Quit being lazy!</strong> For many organizations the process has become one where you take the requirements from somebody else perhaps a business analyst, do your best to deliver and make deadlines, and then throw it over the fence for QA, testing, or whoever. In my experience, this makes many people less accountable for what gets pushed to production.</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
<strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Own your work</strong>. Some of the best quality I have ever personally and professionally provided was in an environment where I was the one in charge of understanding the problem, coming up with the appropriate solution, and watching it all the way to production and eventually, the user.</div>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
The key ingredients to this recipe for success:</div>
<ol style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 24px 1.5em; padding: 0px; vertical-align: baseline;">
<li style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Good unit tests</strong> – the benefits of testing are endless, I'll leave this for a future blog post.</li>
<li style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Do Not Fear Refactor! </strong>– if you’re afraid to change code because it might break something, you have problems. Follow <a href="http://lostechies.com/chadmyers/2008/03/08/pablo-s-topic-of-the-month-march-solid-principles/" style="background: transparent; border: 0px; color: #2e9bd2; margin: 0px; padding: 0px; vertical-align: baseline;" title="S.O.L.I.D.">SOLID principles</a> as best as you responsibly can and you’ll have fewer problems here.</li>
<li style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Continuous Integration</strong> – make sure everything is working all the time. It helps in the long run (and by long run, I mean tomorrow). don't commit broken builds, take the time to keep your own house in order.</li>
<li style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Code Ownership</strong> – everybody owns this feature; it’s not just my own. a.k.a. Stop putting yourselves into silos. Also, your victories must be shared, but your failures are also not your own.</li>
<li style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><strong style="background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Deploy As Often As Possible </strong>– The best time to deploy a feature is the moment it’s declared “Done”. The longer you wait between this time and delivery, the more likely it is to fail.</li>
</ol>
<div style="background: rgb(252, 252, 252); border: 0px; color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; margin-bottom: 24px; padding: 0px; vertical-align: baseline;">
Your experience may vary, but these have worked really well for me and I would suggest you try them if you’re having challenges moving quality from concept to deliverables.<br />
<br />
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<a href="http://www.kqzyfj.com/i066shqnhp4C8E699D4658CD9E9469A99ACABC555" target="_blank">Tired of Waiting for your Website to Load? $1/ mo Hosting + Free domain!</a><img border="0" src="http://www.awltovhc.com/image-7391448-11670979" height="1" width="1" /></div>
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;">
<br /></div>
<h3 class="r" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: medium; font-weight: normal; line-height: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<a href="http://www.thinkmonkey.ca/" target="_blank">ThinkMonkey - <span style="font-weight: bold;">Web Design</span> Company | Software Company</a></h3>
</div>
Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0tag:blogger.com,1999:blog-1720505254096438708.post-73962494568257271882013-10-22T19:40:00.001-06:002016-03-07T12:54:19.706-07:00Setting Up NUnit Testing With Azure Deployments From Git<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">A few days ago while deploying my latest build to Windows Azure and looking through the deployment logs I noticed that the deployment wasn't running any of my unit tests.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">So I began with a simple question to someone I respect very much and figured would know the answer better than anyone else I knew. </span><span style="font-family: "verdana" , sans-serif;">(I'll admit I am a fan and wanted an opinion) </span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5uGZB6f07VC1Xr1x2ZfUfgjABDt7oZUP4NIr73qpp1j4JcFOT0NFGBqowajZpdvWhWaCAvuChqzcS10mv7tRoMD8cEgq1sEi6Z0qohVFFMxGpACENN_usM9UohTy93WIjC39O6qiDvSo/s1600/HanTweet.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5uGZB6f07VC1Xr1x2ZfUfgjABDt7oZUP4NIr73qpp1j4JcFOT0NFGBqowajZpdvWhWaCAvuChqzcS10mv7tRoMD8cEgq1sEi6Z0qohVFFMxGpACENN_usM9UohTy93WIjC39O6qiDvSo/s400/HanTweet.PNG" width="400" /></span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">If you haven't heard of Scott than definitely go check out his site <a href="http://www.hanselman.com/">http://www.hanselman.com</a> (perhaps wait till after the article). Scott has done many tutorials on .net topics and I am sure he will have a post in no time on this topic too.<br /><br />Most of the skills and knowledge I've learned now in my first year as a developer have come from Scott and others like him, as well the Virtual Academy. </span><a href="http://www.microsoftvirtualacademy.com/#fbid=6c6vaptZwtl">http://www.microsoftvirtualacademy.com/#fbid=6c6vaptZwtl</a> if you're new to development like <span style="font-family: "verdana" , sans-serif;">me than take a moment to check these resources out</span>. (Don't worry I will wait)</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Alright to be honest his answer didn't surprise me at all given that if Azure had offered the support it would be in one of the many settings or features it offers. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Azure is already an amazingly simple and easy to use platform with one of the most intuitive user experiences ever, given the amount of content and feature rich options it has. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Moving along...</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">A quick Google search revealed well... this, <a href="http://blog.amitapple.com/post/51576689501/testsduringazurewebsitesdeployment">http://blog.amitapple.com/post/51576689501/testsduringazurewebsitesdeployment</a> and it looked fairly straight forward so I grabbed a coffee and started to learn.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">After a few hours and various Azure deployment errors that sometimes made no sense at all it wasn't looking too good for me.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Another few tweets to Scott and he pointed me into the direction of <a class="twitter-timeline-link" data-expanded-url="http://YOURSITE.scm.azurewebsites.net/DebugConsole" dir="ltr" href="http://t.co/v3RZUonutZ" rel="nofollow" style="background-color: whitesmoke; color: #72412c; line-height: 18px; text-decoration: none; white-space: pre-wrap;" target="_blank" title="http://YOURSITE.scm.azurewebsites.net/DebugConsole"><span class="js-display-url" style="background-color: whitesmoke; color: #72412c; line-height: 18px; text-decoration: none; white-space: pre-wrap;">YOURSITE.scm.azurewebsites.net/DebugConsole</span><span style="background-color: whitesmoke; color: #72412c; line-height: 18px; text-decoration: none; white-space: pre-wrap;"><span class="invisible" style="background-color: whitesmoke; line-height: 0; white-space: pre-wrap;"></span></span><span class="tco-ellipsis" style="background-color: whitesmoke; color: #72412c; line-height: 18px; text-decoration: none; white-space: pre-wrap;"><span class="invisible" style="line-height: 0;"> </span></span></a></span></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Once I had logged in and taken a look around I went into the deployments\tools folder and saw the deploy.cmd file Azure uses. (At least when you don't provide one)</span><br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">The guide showed me how to output the deploy.cmd file from the Azure command line tool onto my local machine and that was great except one thing... it wouldn't deploy.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Why would the generated deploy.cmd not deploy? I mean it was generated by the tool and intended to give you a working deployment. So I compared it to the one in the deployment\tools folder and noticed the project folder was wrong.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">I looked at my local folder structure and discovered that the solution (.sln) wasn't at the root or top level folder. The assumption would be that the deploy file would still work considering every deployment up to this point had.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Either way a few quick moves and re-organizing of the solution folder and I tried again... and again... and again.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Now what! I thought, seriously this was going into the night and my caffeine intake was depleted as was my patience. The issue now was my nuget packages were not deploying and once more I didn't understand why, because up to this point I had not even modified the deploy file once.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Looking inside my nuget.targets file I saw "restore packages" and "download nuget if missing" were both set to false, quick edit to true and... they started to load.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Ok at this point the deployment was working and after one full day of work just to get the auto generated deployment file working it... I added the unit testing commands and watched as Azure deployed with unit tests. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">So after all this there are a few things to consider that could cause issues.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- Azure does not seem to work ideally if your solution isn't in the root or top level folder. This was the case with my first issue.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- If you are using package restore in your project as I am, make sure your nuget targets file in the .nuget folder has "restore-packages" and "download-nuget-if-missing" set to true. It's not required, as you can check in nuget.exe instead (up to you)</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- Make sure your tests are working, also if any are ignored tried commenting them out completely. (I had one deployment fail because I ran an ignored test)</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><b>WHAT I AM USING</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- Visual Studio 2012</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- BitBucket (Git Repository)</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- ASP.Net MVC4 Application</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">- NUnit Testing Framework</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><b>HOW TO:</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Begin by deploying a clean working deployment to Azure. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr614ESc2WODVqbPG3IVZZQKNmZ0LBIbfVU9XBPXdX9uFF6G9VgvPp4dkKT8R9gBmhf9tAwMN6SSNf2tm1-2Juqjw7A4YwLVdnDya7yfomADBCDT0ti7vKSAkAKrli1e_MULu-Sw2qDFI/s1600/deployment-screen.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr614ESc2WODVqbPG3IVZZQKNmZ0LBIbfVU9XBPXdX9uFF6G9VgvPp4dkKT8R9gBmhf9tAwMN6SSNf2tm1-2Juqjw7A4YwLVdnDya7yfomADBCDT0ti7vKSAkAKrli1e_MULu-Sw2qDFI/s640/deployment-screen.PNG" width="640" /></span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">It's important that you have an active deployment as this indicates the Azure deploy.cmd is working on the server. So with an active deployment we can begin.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: large;"><b>== STEP 1 ======</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Grab the Azure Command Line Tool</span></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://www.windowsazure.com/en-us/manage/install-and-configure-cli/"><span style="font-family: "verdana" , sans-serif;">http://www.windowsazure.com/en-us/manage/install-and-configure-cli/</span></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">After the Azure CLI is installed open a command prompt and navigate to your solution folder then run this command,</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><span style="background-color: black; color: white; line-height: 24px;">azure site deploymentscript --aspWAP </span><span style="background-color: black; color: white; font-style: inherit; line-height: 19px;">{PROJECT-FOLDER}</span><span style="background-color: black; color: white; line-height: 24px;">\</span><span style="background-color: black; color: white; line-height: 19px;">{PROJECT-NAME}</span><span style="background-color: black; color: white; line-height: 24px;">.csproj -s </span></span><span style="background-color: black; color: white; font-family: "verdana" , sans-serif; line-height: 19px;">{SOLUTION-NAME}</span><span style="font-family: "verdana" , sans-serif;"><span style="background-color: black; color: white; line-height: 24px;">.sln</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<span style="font-family: "verdana" , sans-serif;">Make sure you replace <span style="background-color: black; color: white; line-height: 19px;">{PROJECT-FOLDER}</span></span><span style="font-family: "verdana" , sans-serif;"> </span><span style="background-color: black; color: white; font-family: "verdana" , sans-serif; line-height: 19px;">{SOLUTION-NAME}</span><span style="font-family: "verdana" , sans-serif;"> and </span><span style="background-color: black; color: white; font-family: "verdana" , sans-serif; line-height: 19px;">{PROJECT-NAME}</span><span style="font-family: "verdana" , sans-serif;"> with the correct names. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Verify the files were generated in the solution folder (<span style="background-color: black; color: white; line-height: 19px;">.deployment</span> & <span style="background-color: black; color: white; line-height: 19px;">deploy.cmd</span>)</span><br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: large;"><b>== STEP 2 ======</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Let's verify the deploy.cmd matches what Azure uses (mine ended up being different and caused a few headaches). </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Go to <a class="twitter-timeline-link" data-expanded-url="http://YOURSITE.scm.azurewebsites.net/DebugConsole" dir="ltr" href="http://t.co/v3RZUonutZ" rel="nofollow" style="background-color: whitesmoke; color: #72412c; line-height: 18px; white-space: pre-wrap;" target="_blank" title="http://YOURSITE.scm.azurewebsites.net/DebugConsole"><span class="js-display-url" style="color: #72412c;">YOURSITE.scm.azurewebsites.net/DebugConsole</span><span style="color: #72412c;"><span class="invisible" style="line-height: 0;"></span></span><span class="tco-ellipsis" style="color: #72412c;"><span class="invisible" style="line-height: 0;"> </span></span></a> and login using your deployment credentials. If you experience issues logging in, go to your Azure Website dashboard and reset your deployment credentials.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAR54nnD53PN3gPHa9rsawO56AaKiLCW1UIKSD2JthagQFjhXKYgjkWabd1cax-l2DSvHqFsRRchL_Pw-pHkQ4lVnWdK1K0lmHSb83WmRFGxzKiUpl9hcpSHIkSv5coHO2HN_v4ObIvR0/s1600/Azure-dashboard.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" height="378" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAR54nnD53PN3gPHa9rsawO56AaKiLCW1UIKSD2JthagQFjhXKYgjkWabd1cax-l2DSvHqFsRRchL_Pw-pHkQ4lVnWdK1K0lmHSb83WmRFGxzKiUpl9hcpSHIkSv5coHO2HN_v4ObIvR0/s640/Azure-dashboard.PNG" width="640" /></span></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Once you've successfully logged into the debug console navigate to <span style="background-color: black; color: white; line-height: 19px;">deployments\tools</span> and click on the edit icon for the <span style="background-color: black; color: white; line-height: 19px;">deploy.cmd</span> file.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: large;"><b>== STEP 3 ======</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Copy this into a text editor on your machine and look at the <b><i>Deployment</i></b> section of the script to verify the paths match the ones inside the <span style="background-color: black; color: white; line-height: 19px;">deploy.cmd</span> in the project folder which we generated earlier using the Azure CLI.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">At this point I recommend you check-in the file to your git repository and verify it deploys. This will save many headaches and ensure any further errors truly are the developers'. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: large;"><b>== STEP 4 ======</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Now that we know the deployment works, hopefully... we can continue onto the important step and the that is setting up your build for the test project and deploying the test runner.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Find This Line.</span></div>
<pre style="background-color: black; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: #4c4c4c; line-height: 19px; margin-bottom: 20px; outline: 0px; overflow: auto; padding: 10px; vertical-align: baseline;"><code style="border: 0px; color: white; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: "verdana" , sans-serif;">:: 1. Build to the temporary path</span></code></pre>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Copy the following and paste it a few lines below after the <span style="background-color: black; color: white; font-style: inherit; line-height: 19px;">IF !ERRORLEVEL! NEQ 0 goto error</span></span></div>
<pre style="background-color: black; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; color: #4c4c4c; line-height: 19px; margin-bottom: 20px; outline: 0px; overflow: auto; padding: 10px; vertical-align: baseline;"><code style="border: 0px; color: white; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: "verdana" , sans-serif;">:: 2. Building test project
echo Building test project
"%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\{TEST-PROJECT-FOLDER}\{TEST-PROJECT-NAME}.csproj"
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. Running tests
echo Running tests
vstest.console.exe "%DEPLOYMENT_SOURCE%\<span style="font-style: inherit;">{TEST-PROJECT-FOLDER}</span><span style="font-style: inherit;">\bin\Debug\</span><span style="font-style: inherit;">{TEST-PROJECT-NAME}</span><span style="font-style: inherit;">.dll"</span><span style="font-style: inherit;">
</span>IF !ERRORLEVEL! NEQ 0 goto error
</span></code></pre>
<span style="font-family: "verdana" , sans-serif;">Make sure again of course that you replace the placeholder <span style="background-color: black; color: white; line-height: 19px;">{TEST-PROJECT-FOLDER}</span> and <span style="background-color: black; color: white; line-height: 19px;">{TEST-PROJECT-NAME}</span> respectively to the correct values.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Your <span style="background-color: black; color: white; line-height: 19px;">%DEPLOYMENT_SOURCE%</span> folder usually points to the location of your solution file so use this as a reference in where you are in the folder tree. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The </span><span style="background-color: black; color: white; font-family: "verdana" , sans-serif; line-height: 19px;">vstest.console.exe</span><span style="font-family: "verdana" , sans-serif;"><span style="background-color: white; color: #4c4c4c; line-height: 24px;"> </span><span style="background-color: white; line-height: 24px;">is the test runner supplied in VS 2012 and will run most testing frameworks mstest, xunit or nunit which we are using.</span></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div style="background-color: white; border: 0px; line-height: 24px; margin-bottom: 20px; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="background-color: black; color: white; font-family: "verdana" , sans-serif; line-height: 19px;">vstest.console.exe</span><span style="font-family: "verdana" , sans-serif;"><span style="color: #4c4c4c;"> </span>will recognize any test that exists in the supplied test assembly and will run it whether the test is mstest, xunit or nunit, and they could all be in the same assembly.</span></div>
<span style="font-family: "verdana" , sans-serif;">You're done, commit your modified deploy scripts into your git repository and try your deployment.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Azure is always updating with new features and the efforts from the Azure team are amazing. I know one day deploying a TDD application will be a much easier task than it currently is.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">It's a lot of work I know and I'll admit many junior developers may not want to challenge themselves with a task like this, for me personally it's becoming a passionate mindset.</span>
<br />
<br />
<a href="http://www.kqzyfj.com/i066shqnhp4C8E699D4658CD9E9469A99ACABC555" target="_blank">Tired of Waiting for your Website to Load? $1/ mo Hosting + Free domain!</a><img border="0" src="http://www.awltovhc.com/image-7391448-11670979" height="1" width="1" /><br />
<br />
<h3 class="r" style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: medium; font-weight: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<a href="http://www.thinkmonkey.ca/" target="_blank">ThinkMonkey - <span style="font-weight: bold;">Web Design</span> Company | Software Company</a></h3>
<br />
<div class="g-plusone" data-annotation="inline" data-width="300">
</div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>Anonymoushttp://www.blogger.com/profile/17329076714415641801noreply@blogger.com0