tag:blogger.com,1999:blog-319479452024-03-16T02:09:30.265+01:00Developer Tip of the DayWeb developer tip of the day gathered from around the web by Alex KeySmith, to help you be more productive.
Alex KeySmith is a principal full stack developer based in the UK.Unknownnoreply@blogger.comBlogger23125tag:blogger.com,1999:blog-31947945.post-35605434836054875092015-05-31T18:55:00.000+01:002015-05-31T19:01:57.697+01:00Combine png / jpg into pdf on windows from the command line for free.<p>There seems to be a hell of a lot of utilities to combine images (png's, jpgs etc) to form pdfs. But as a savvy user you've probably formed a distrust of shareware or similar.<br />
</p><p>If you're like me, you've installed a few to find you need to register to get the features you need! Frustrating!<br />
</p><p>Fortunately it's ridiculously easy with <a href="http://www.graphicsmagick.org/">GraphicsMagick</a>, an open source command line image manipulation power house (for free)!<br />
</p><ol><li>Install GraphicsMagick, doing so via chocolately is the easiest using <kbd>cinst graphicsmagick</kbd> from an admin command prompt (if you're not using <a href="https://chocolatey.org/">chocolatey</a> - you should!)</li>
<li>Open a command prompt in the directory where your images are in</li>
<li><kbd>gm convert *.png yournewpdf.pdf</kbd> where *.png can be another image format or a list of images</li>
</ol><br />
<p>If "gm" isn't working, try opening a new command prompt to allow the path to be refreshed.</p><br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-32771314623903235442014-05-10T22:20:00.000+01:002014-05-10T22:36:41.416+01:00nDepend - the code analysis super tool<p>Patrick from nDepend kindly sent me over a copy of nDepend to try out.<br />
</p><p>nDepend is a code coverage tool with a hell of a lot to give. Think of it like FxCop / Visual Studio's Analysis tools but with a whole suite of tools to support the analysis.<br />
</p><p>It's a great fit if you're looking to refactor your code, it can analyse it for problem areas (similar to FxCop) but it also has the capability to define your own metrics using "Code Query over Linq" (clever stuff indeed).<br />
</p><p>One of my favourite features is the ability to get a grasp of existing architecture, as we all know that even though your team's documentation should of been written early on, it often becomes a low priority as soon as it hits production. <br />
</p><p>It's also a nice way to explore open source projects and to take a look at the architecture the big players are using.<br />
</p><p>Here is an example of examining the popular open source .net CMS DNN (previously DotNetNuke), we can see highlighted that the method 'RewriteUrl' is perhaps overly complicated. Clicking the function name opens visual studio directly with the file open in the right place (nicely polished - it even has Visual Studio integration). Reading over the <a href="https://dotnetnuke.codeplex.com/SourceControl/latest#Trunk/Content/Community/HttpModules/UrlRewrite/BasicUrlRewriter.cs">RewriteUrl method</a> it's a bit of a beast and could become a maintenance problem so could be a future task to refactor (for example).<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD0aHhjZjNa4DS6c8beZe-fUjPYBQ1Z5T40qVhl2WGD_DdjYnWnYxkZiB2mjOe9mBjcQnSuxtquFT72yvm5Q4PK7Yph2xDQYkgYO9JnLdUN9d639eDzGIAsH3K_4-PhsjuMv2x/s1600/2014-05-10+21_34_42-DotNetNuke+(Temporary)++(analysis+done+Sat+10+May++21_08+most+recent).png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD0aHhjZjNa4DS6c8beZe-fUjPYBQ1Z5T40qVhl2WGD_DdjYnWnYxkZiB2mjOe9mBjcQnSuxtquFT72yvm5Q4PK7Yph2xDQYkgYO9JnLdUN9d639eDzGIAsH3K_4-PhsjuMv2x/s1600/2014-05-10+21_34_42-DotNetNuke+(Temporary)++(analysis+done+Sat+10+May++21_08+most+recent).png" height="380" width="640" /></a></div></p><p>The screenshot may look complex as it's a power user tool, but nDepend is a very friendly tool offering contextual help along the way. A short blog post can't do it justice, if you're dabbling with refactoring and want something more powerful than the built in tools, I'd recommend taking a look at the <a href="http://www.ndepend.com/">nDepend</a> website to learn more.<br />
</p><br />
<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-33951715312569836392012-10-29T22:36:00.001+01:002012-10-29T23:20:04.813+01:00Read CSV with LinqPad<p>
This is a super simple way of reading CSV in <a href="http://www.linqpad.net" target="_blank">linqpad</a>, it won't handle every situation (I'll cover more ways in future posts), but it's pretty handy.
</p>
<p>
Lets say we have the following CSV:
</p>
<code>
<pre>
ID,Name,Email
1,alex,alex@example.org
2,bob,bob@example.org
3,fred,fred@example.org
</pre>
</code>
<p>
The first step is to click "my extensions" on the bottom left hand corner of linqpad.
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEuI660XGfui0SlONOkJn5-yI4026X16tb1RIvfvG0vuv7S636jmJ4-nH9LIGzmyRdtmhd5YkniyEuZ50BcTbI6wqUJz2S9Rrom7jxz1pegwiorQDe7teRwmw86OcgNqdjHoMQ/s16000/my+extensions.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="459" width="678" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEuI660XGfui0SlONOkJn5-yI4026X16tb1RIvfvG0vuv7S636jmJ4-nH9LIGzmyRdtmhd5YkniyEuZ50BcTbI6wqUJz2S9Rrom7jxz1pegwiorQDe7teRwmw86OcgNqdjHoMQ/s678/my+extensions.png" /></a></div>
</p>
<p>
Now copy the following c# code (sourced from: <a href="http://stackoverflow.com/a/1271236/141022" target="_blank">stackoverflow</a>) in the "my extensions" class in linqpad: <br />
The advantage of this rather than simply reading all lines is that it will load the file line by line and using the yield keyword will stop if finds what you need (rather than reading the whole file).
</p>
<code style="display:block; background-color:white; padding:20px; margin:20px; color:black">
<pre>
public static IEnumerable<string> ReadFrom(string file)
{
string line;
using(var reader = File.OpenText(file))
{
while((line = reader.ReadLine()) != null)
{
yield return line;
}
}
}
</pre>
</code>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsf3Y0a0UhvDYveTr1kKrpwRj2fZfZfwPI8Q0Ah5bTEKhidKAUUoCR0djOKwwQymZj0R4lTQq5xjuy5SY_SWkJ3DaDz9fP6RByVussMREtab4-yonOxhaKnSpyLU3oo_iFeJ4S/s1600/readfrom+extension.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="463.25" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsf3Y0a0UhvDYveTr1kKrpwRj2fZfZfwPI8Q0Ah5bTEKhidKAUUoCR0djOKwwQymZj0R4lTQq5xjuy5SY_SWkJ3DaDz9fP6RByVussMREtab4-yonOxhaKnSpyLU3oo_iFeJ4S/s600/readfrom+extension.png" /></a></div>
<blockquote><em>Remember to press F5 in the my expressions window to compile it.</em></blockquote>
<p>
You can now very easily read the CSV in linqpad using the following linq query (in expression syntax):
<br />
Hover over to see descriptions
</p>
<code style="display:block; background-color:white; padding:20px; margin:20px; color:black">
<pre>
var csvData =
from row in MyExtensions.ReadFrom(@"c:\sample.csv")<span style="border-bottom:dotted 1px #4d4d4d" title="skip the heading row">.Skip(1)</span>
<span style="border-bottom:dotted 1px #4d4d4d" title="the let keyword allows us to store a variable per row">let</span> columns = row.Split(',')
select <span style="border-bottom:dotted 1px #4d4d4d" title="create a anonymous type">new</span>
{
<span style="border-bottom:dotted 1px #4d4d4d" title="set's ID as a property available in intellisense">ID</span> = int.Parse(columns[0]),
Name = columns[1],
Email = columns[2]
};
<span style="border-bottom:dotted 1px #4d4d4d" title="display the data in linqpad's output window">csvData.Dump();</span>
</pre>
</code>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzKIJjCx1nxkDyz5dnrFJkUB600z1qmFeywCs-gLmAKTtj59pHzNTOrojDsbKdLKnvQzU1zP-fH6aASQ3dXt1oO43hSm9i3jhaam0khhNtNo2_PsViIQvhQ_F7tkSeJLiA89Jp/s1600/read+csv+code.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzKIJjCx1nxkDyz5dnrFJkUB600z1qmFeywCs-gLmAKTtj59pHzNTOrojDsbKdLKnvQzU1zP-fH6aASQ3dXt1oO43hSm9i3jhaam0khhNtNo2_PsViIQvhQ_F7tkSeJLiA89Jp/s600/read+csv+code.png" /></a></div>
<p>Now when you press F5 in LinqPad your CSV will be displayed in a nicely formatted table:</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifKIHCRFAOVnzEn-SbIXsuc-0CqPORana2B5SnVadFBGuPskyBbIkvrD2jIFvh18fw4xEjSvMrUFEX3PBYnAYaIsvUq684HGxaAZcNF1N_nR6clcUJrdnw3vhj9bmSCWJYDqBl/s1600/linqpad+output+csv.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="253" width="368" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifKIHCRFAOVnzEn-SbIXsuc-0CqPORana2B5SnVadFBGuPskyBbIkvrD2jIFvh18fw4xEjSvMrUFEX3PBYnAYaIsvUq684HGxaAZcNF1N_nR6clcUJrdnw3vhj9bmSCWJYDqBl/s400/linqpad+output+csv.png" /></a></div>
<p>
You can then parse the CSV in with normal linq queries, for example this simple linq expression will find people whose name "alex". Please note the intellisense drop down will only in linqpad pro edition (certainly worth the money if you ask me!)
</p>
<code style="display:block; background-color:white; padding:20px; margin:20px; color:black">
<pre>
var alexs = from csv in csvData
where csv.Name.Contains("alex")
select csv;
</pre>
</code>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUaKmM7BOshJcjCk_lQPJB98sXxr0oByNEKVecEQzTf6uTraIKfWFIddypxIRcNhen5XTtO8NRaIiIwTcp4EY0Wg0Fp2BXE9X7c36Oca99NGp3a7oJiTlZU9FM-eEYEZF-aK9O/s1600/linqpad+alex.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="240" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUaKmM7BOshJcjCk_lQPJB98sXxr0oByNEKVecEQzTf6uTraIKfWFIddypxIRcNhen5XTtO8NRaIiIwTcp4EY0Wg0Fp2BXE9X7c36Oca99NGp3a7oJiTlZU9FM-eEYEZF-aK9O/s400/linqpad+alex.png" /></a></div>
<p>
I have found this sort of technique especially useful when comparing on an adhoc basis if CSV data was successfully imported via <acronym title="sql server information services">SSIS</acronym> etc. This technique won't handle quoted CSV, but let me know and I'll post a follow up with more in-depth CSV handling techniques or perhaps if you want me to cover linqpad further.
</p>
Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-31947945.post-28899121028622645722012-10-28T16:44:00.001+01:002012-10-28T16:44:28.696+01:00[SOLVED] Sql restore error: database is in use.<p>
Sometimes you are trying to restore a sql server database and you'll get the error:<br />
<quote>"<strong>Exclusive access could not be obtained because the database is in use.</strong>"</quote>
</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXx1Cz8XHrOQbUhxF0SIQcxhDGD-O-vHJEioWfDN_x-Rke9K4HHYjC0SrAPnBJ5t1GKVblsGD9RWybFj692q2dTjYYXwrYC8sJOhfZKA3X21ZOCDWntsS2OAJCx5ETEAegRU51/s1600/database+restore+error.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="176" width="626" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXx1Cz8XHrOQbUhxF0SIQcxhDGD-O-vHJEioWfDN_x-Rke9K4HHYjC0SrAPnBJ5t1GKVblsGD9RWybFj692q2dTjYYXwrYC8sJOhfZKA3X21ZOCDWntsS2OAJCx5ETEAegRU51/s626/database+restore+error.png" alt="Exclusive access could not be obtained because the database is in use." /></a></div>
<p>
This simple one-liner will kick everyone off SQL Server (including any inadvertant connections from yourself e.g. edit table connections).
</p>
<code style="margin:10px;margin-top:20px; padding:20px;background-color:white;color:black; display:inline-block; border:solid 1px green;">
<pre>
USE MASTER;
ALTER DATABASE [dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
</pre>
</code>
<p>
This technique works fine on Microsoft SQL Server 2005 / 2008 and Express Editions (probably works on more versions). It works very quickly and allows you to restore you database straight away afterwards.
</p>
<p>
This excellent tip was found on <a href="http://dba.stackexchange.com/a/6041">dba stackexchange</a>. Please let me know if you found this tip helpful.
</p>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31947945.post-91808759805049083502012-09-15T18:08:00.000+01:002012-09-15T18:08:11.955+01:00Free Online SQL Editor<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoyQCOQs5HC404We2IxoVuu2KR8oUiCRmWFK3yZZuWWWvkOZHEaDUJvWBiCUo9cZKap4V5OavxBLCyFJNMN1s_YD7UhQNVnvnrCx6a7Ho6WwGPJbxegj25NPn1zAXfyPpRq5nX/s1600/Screen+Shot+2012-09-15+at+18.06.11.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="339" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoyQCOQs5HC404We2IxoVuu2KR8oUiCRmWFK3yZZuWWWvkOZHEaDUJvWBiCUo9cZKap4V5OavxBLCyFJNMN1s_YD7UhQNVnvnrCx6a7Ho6WwGPJbxegj25NPn1zAXfyPpRq5nX/s600/Screen+Shot+2012-09-15+at+18.06.11.png" /></a></div>
<p>I came across a little gem; if you are ever stuck with some SQL and ask for some help in a forum etc, this <a href="http://sqlfiddle.com/">free
online sql editor called SQL Fiddle</a> will allow you to create tables, run sql etc all online - ready to share with fellow developers.</p>
<p>
If you are familiar with it's JavaScript cousin <a href="http://jsfiddle.net/">jsFiddle</a>, then this is a welcome addition to your tool belt.</p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31947945.post-83149579295733658132011-07-17T22:05:00.005+01:002011-07-17T22:12:05.170+01:00Empty folders in Git / Mecurial<blockquote>Git / Mecurial do not track empty directories, but there is a useful tool to help.<br />
</blockquote><p>To track empty directories, you need to simply create place holder / dummy files in those directories e.g. a simple txt file.<br />
</p><p>If you have many folders or are importing an existing project into source control it can be a pain to create all the place holder files.<br />
</p><p>Fortunately there is an easy to use command line tool that will scan through all your directories and generate dummy files for you at the bottom depth. Even better if you directory structure changes and a folder is not longer empty it will delete them for you.<br />
</p><p>You can download the open source / free tool from the <a href="http://code.google.com/p/markemptydirs/" target="_target">makeemptydirs website</a><br />
</p>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-31947945.post-55979957970435748132011-07-08T22:13:00.001+01:002011-07-08T22:16:10.835+01:00firebug frame - tips<p>Here are a few tips for using firefox's firebug and frames:<br />
</p><p>An example of a frameset:<br />
</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUbKKq01CdPV0gHfrrLlPEAxEAUqBpP0NdJ_GbmaSBV2wnK5SSFE8_8VLAx87YLBgtF7N9_YDtA8pGKtIVw8L0bgTfc0vmWPhclZgr6X1MIe-B5B77J8OgXbPG0WrDluXY7ZNv/s1600/Screen+shot+2011-07-08+at+21.34.49.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="590" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUbKKq01CdPV0gHfrrLlPEAxEAUqBpP0NdJ_GbmaSBV2wnK5SSFE8_8VLAx87YLBgtF7N9_YDtA8pGKtIVw8L0bgTfc0vmWPhclZgr6X1MIe-B5B77J8OgXbPG0WrDluXY7ZNv/s1600/Screen+shot+2011-07-08+at+21.34.49.png" width="575" alt="screenshot of a frameset rendered in firefox"/></a></div><br />
<pre><code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Frameset example</title>
</head>
<frameset rows="50%, 50%">
<frame src="frame1.html" id="frame1" name="frame1"/>
<frame src="frame2.html" id="frame2" name="frame2"/>
</frameset>
</html>
</code>
</pre><p>By default firebug is relative to the "window", to make commands relative to a frame instead, you can use the "cd" command in the console pane, for example:<br />
</p><br />
<code>cd(window.frames["frame1"])</code><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge6cYczfk5umUSujLigceh9KnFVoE8U5mKacXQXXWz6tzlv4gD_WQ2YNsiAGcNy5Mzb_74g9LfQ1IrYtzSedkuwwQ515YixsNywBo2Ri57Kok6eAFyz5sLU6IiAMkMv3rx70tF/s1600/Screen+shot+2011-07-08+at+21.55.12.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="590" width="575" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge6cYczfk5umUSujLigceh9KnFVoE8U5mKacXQXXWz6tzlv4gD_WQ2YNsiAGcNy5Mzb_74g9LfQ1IrYtzSedkuwwQ515YixsNywBo2Ri57Kok6eAFyz5sLU6IiAMkMv3rx70tF/s1600/Screen+shot+2011-07-08+at+21.55.12.png" alt="a command typed into firebug command line in firefox"/></a></div><p>Now when you execute command it will be relative to the window instead.<br />
<br /> So for example if you had this code in frame1:<br />
</p><br />
<pre><code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>frame1</title>
<script type="text/javascript">
function hello() {
alert("hello")
}
</script>
</head>
<body>
frame1
</body>
</html>
</pre></code><br />
<br />
You can run the function in the firebug command line simply by running the function: <code>hello()</code><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIuVHnKc6KgmlZdgjTC6S0fLoTTzSvTKTFrsAyG17OqieZabi3liuFPyqJI3ei4b_RxTPIhrRgD4-1SD3xmBO4BhxuBNdylum27o0-OL0D5VUgeZHgp8PSexTalZexsUKhMBMC/s1600/Screen+shot+2011-07-08+at+21.57.42.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="590" width="575" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIuVHnKc6KgmlZdgjTC6S0fLoTTzSvTKTFrsAyG17OqieZabi3liuFPyqJI3ei4b_RxTPIhrRgD4-1SD3xmBO4BhxuBNdylum27o0-OL0D5VUgeZHgp8PSexTalZexsUKhMBMC/s1600/Screen+shot+2011-07-08+at+21.57.42.png" alt="an alert box being triggered within a frameset from the outer window via the firebug commandline"/></a></div><br />
<p>Similarly you can also use this alternative syntax to get to the frames:<br />
</p><p><code>cd(window.top)</code><br />
Back to the default root window<br />
</p><p><code>cd(document.getElementById("frame1").contentWindow</code><br />
To reference the frame by id<br />
</p><p><code>cd(document.frames[0]</code><br />
To reference the frame by number<br />
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-58523969443886617552011-07-04T20:40:00.002+01:002011-07-04T20:41:54.890+01:00Incorrect syntax near the keyword 'OPTION'. When using CTE's inside a UDF.<p>It is useful to use common table expressions (CTE) to perform recursive calls.<br />
</p><p>Normally recursion is limited by default to 100 recursions, this is to stop infinite loops.<br />
</p><p>You can normally override the default using the MAXRECURSION query hint. e.g. <br />
</p><div style="background-color:white; border:solid 2px red; color:black; padding:5px;"><code><br />
OPTION (MAXRECURSION 200); <span style="color:green;">-- overrides with 200 recursions, but will break inside UDFs</span><br />
</code><br />
</div><p>Unfortunately if you set this inside a UDF, you will get the error: <em>Incorrect syntax near the keyword 'OPTION'</em>. This is a known issue mentioned in <a href="http://connect.microsoft.com/SQLServer/feedback/details/124653/allow-maxrecursion-limit-values-other-than-100-for-views-and-udfs" target="_blank">microsoft connect</a>.<br />
</p><h3>A simple solution</h3><p>Fortunately if you have control of the outer SQL, it is simply a case of setting MAXREECURSION on the SQL calling the UDF e.g<br />
</p><div style="background-color:white; border:solid 2px green; padding:5px; color:black"><code>SELECT X FROM YourUDF(Parameter) <strong style="text-decoration:underline;">OPTION(MAXRECURSION 0)</strong></code><br />
</div><p>Of course this solution is only applicable in some situations, some of you really need to be able to configure the recursion within the UDF. But when I came across this, it helped me.<br />
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-12082517609153872682011-06-29T22:03:00.000+01:002011-06-29T22:03:31.976+01:00Exclude folders (.hg / .git) from Visual Studio search<p>When doing a find in files in a source controlled project in Visual Studio, the source control folder i.e. .hg (Mecurial) / .git (git) will appear in the search results (which is not what you want!)<br />
</p><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilA0lRoXLRVTlATjrT_cC5Ufo_mZ1e7AJVAa0wWYegpDzXhUHs-FuiyXYBz2Knu814I8VYnSjIcOGPj_UNTw-vZVpHsDD_IZRDrtWUzIqQAm6eITT9GvZjSXVW-6vq9wVrrmaA/s1600/showing-hg-folder-in-visual-studio.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="439" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilA0lRoXLRVTlATjrT_cC5Ufo_mZ1e7AJVAa0wWYegpDzXhUHs-FuiyXYBz2Knu814I8VYnSjIcOGPj_UNTw-vZVpHsDD_IZRDrtWUzIqQAm6eITT9GvZjSXVW-6vq9wVrrmaA/s600/showing-hg-folder-in-visual-studio.png" alt="hg folder in visual studio"/></a></div><br />
<br />
<br />
<br />
<p>You can hide folders in Visual Studio in two different ways:<br />
</p><p><strong>For websites i.e. "open website" style projects</strong><br /><br />
Simply browse to the folder in windows explorer and mark the folder as hidden in the folder properties.<br />
</p><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW_a4vgzan9P-eM4LrKUkZxRiuqPnh-N2gwKeILkhsokqELAclPZDl_3-pYKKoG24YqjSwP0FDxhW7HHQsFVCGZ89fhgz5qqNHL896N0qAGnoKYDEkcxj5ne_Op8r-eY3L3IaH/s1600/set-hg-folder-as-hidden.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="485" width="377" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW_a4vgzan9P-eM4LrKUkZxRiuqPnh-N2gwKeILkhsokqELAclPZDl_3-pYKKoG24YqjSwP0FDxhW7HHQsFVCGZ89fhgz5qqNHL896N0qAGnoKYDEkcxj5ne_Op8r-eY3L3IaH/s600/set-hg-folder-as-hidden.png" alt="set the folder as hidden in the folder properties via windows explorer"/></a></div><br />
<br />
<p>You may need to refresh the solution explore in Visual Studio to see the change.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-9Kv-VL7AW6VN12SKlTXkeHEl2oBqBifpvoDLCi2wjWXzo5Z_0PCxpKzgHGVyVwnvassn5iIGe8dfDKyyCRNx4Oj6UAdPoIPEIEG4wxpCcexTkEFLHI5KORjaFGFIoeahoqHl/s1600/hg-folder-hidden.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="493" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-9Kv-VL7AW6VN12SKlTXkeHEl2oBqBifpvoDLCi2wjWXzo5Z_0PCxpKzgHGVyVwnvassn5iIGe8dfDKyyCRNx4Oj6UAdPoIPEIEG4wxpCcexTkEFLHI5KORjaFGFIoeahoqHl/s600/hg-folder-hidden.png" alt="the folder should now be hidden"/></a></div><br />
<br />
<p>This has been tested in Visual Studio 2008 and 2010 and is useful for hiding .git and .hg folder, but can be used to hide any folder.<br />
</p><br />
<p><em>For other projects type in visual studio (class library, web application etc). you can simply right click on the folder in the solution explorer and click exclude.</em><br />
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-10475520563031105732011-06-27T21:24:00.001+01:002011-06-27T21:38:36.425+01:00Encrypt SQL statements<p>If you distribute your SQL code to third parties (perhaps in runs on other peoples servers), you may wish to help protect your intellectual property by encrypting your SQL statements.<br />
</p><p>Simply using "WITH ENCRYPTION" at the end of your normal CREATE PROCEDURE will stop the definition of your sql statements being returned. The statement will be automatically decrypted on the fly.<br />
</p><code style="background-color:white; padding:20px; display:block; width:300px; height:200px; color:black;"><br />
CREATE PROCEDURE AlexTestProcedure<br />
<strong>WITH ENCRYPTION</strong><br />
AS<br />
SET NOCOUNT ON;<br />
SELECT Firstname, Surname, Email <br />
FROM Users;<br />
GO<br />
</code><br />
<br />
<p>After having a quick look around the internet on the merits of the added security;<br />
In SQL server 2000, the de-obfuscated text is stored in the SYSCOMMENTS table before it is executed. So you may wish to consider this as a preventative measure for the casual nosey parker, but not a bullet proof solution. However the equivalent MSDN page for SQL 2008 R2 doesn't mention this.<br />
</p><p><a href="http://msdn.microsoft.com/en-us/library/ms187926.aspx" target="_blank">MSDN article on CREATE PROCEDURE sql server 2008 r2</a><br />
<br />
<a href="http://msdn.microsoft.com/en-us/library/aa258259(v=sql.80).aspx" target="_blank">MSDN article on created procedure sql server 2000</a><br />
</p><br />
<p><em>Interesting things you learn whilst talking to DBA's (thanks Solomon!)</em><br />
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-38133741421639881512011-01-06T22:34:00.001+01:002011-01-06T22:52:17.005+01:00NULL shortcut key in Sql Server Management Studio (SSMS)<p>Sometimes you are manually editing a row in the table pane in Sql Server Management Studio (SSMS) and you need to put NULL in a column. An easy shortcut key is, whilst the cursor is in the column:<br />
</p><p><kbd>CTRL</kbd> + <kbd>0</kdb><br />
</p><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGFA6vZINqQZnE7jhTgUVN1HIKerTVYKejL5GGyelnle9OjZ8Jsi0XcPEU9bSihUqwrCJhy8dIgLXnhwrjB1704H_6Di5i_dWcOUji6OGwhvHE0V6v17FWmqkLgnyR_GasI9cy/s1600/ssms_null.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGFA6vZINqQZnE7jhTgUVN1HIKerTVYKejL5GGyelnle9OjZ8Jsi0XcPEU9bSihUqwrCJhy8dIgLXnhwrjB1704H_6Di5i_dWcOUji6OGwhvHE0V6v17FWmqkLgnyR_GasI9cy/s1600/ssms_null.png" /></a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-36964951679362799512010-12-20T08:00:00.000+01:002010-12-19T23:23:59.322+01:00Website screen resolution test in Internet Explorer<p>It's easy to simulate various screen resolutions (screen sizes) in Internet Explorer using the built in developer tool (built in since IE7). Allowing you to test your webpages in various screen sizes.<br />
</p><p>Simply go to the menu item as illustrated below or press the keyboard shortcut <kbd>F12</kbd> to load the developer tool.<br />
</p><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV7mb0PdMT0ese4hALASVs3ly5ZIZPNFvuxXcIH014MDni4Aqtwoq9AzGcSghLX8Hf4kcQmtUKna7Oku-N7j1wxUJRXb5Z_hNR2glnmg39jVpMbpmkYj8icQuhHUooC78rcohY/s1600/open-developer-tools.png" imageanchor="1"><img alt="To open the developer tool in Internet Explorer 8; click the cog icon in the top right hand size, then click 'developer tool'" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV7mb0PdMT0ese4hALASVs3ly5ZIZPNFvuxXcIH014MDni4Aqtwoq9AzGcSghLX8Hf4kcQmtUKna7Oku-N7j1wxUJRXb5Z_hNR2glnmg39jVpMbpmkYj8icQuhHUooC78rcohY/s1600/open-developer-tools.png" /></a></div><p>The built-in IE developer tool should now open, as illustrated below.<br />
</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3xVThB5gsRvE0x7lav2Srpby9U0EJbC29IVg6Tl3cLHTUsD12TxuMssF6KoPaxkijh27dJ83hRh-_2Tw5W4PKMed9D56r0Xvh_Ho4yc9Kzhxn4evmRMZY-EwTgmhZJHcP4Jc6/s1600/developer-tools-open.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3xVThB5gsRvE0x7lav2Srpby9U0EJbC29IVg6Tl3cLHTUsD12TxuMssF6KoPaxkijh27dJ83hRh-_2Tw5W4PKMed9D56r0Xvh_Ho4yc9Kzhxn4evmRMZY-EwTgmhZJHcP4Jc6/s1600/developer-tools-open.png" /></a></div><p>With the developer tool now open; in the menu click "Tools" > "Resize" and select the screen resolution of your choice. By default you can simulate, 800x600, 1024x768, 1280x768 and 1280x1024, which covers the most popular resolutions. However you can also provide your own custom resolutions.<br />
</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLnoWP6hfg75D3XcaKC3qTdCvOLZ66exIGuwEfBdBH0MSJJ37CtjcYV82nw9X8lykK09ULQCFLy2cKmWZCJ7KSPgtQbt6NjC3-3XFW-CTd7anr-kcxmwojd5nSgpd29VM3Oyaj/s1600/developer-tools-screen-resolution.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLnoWP6hfg75D3XcaKC3qTdCvOLZ66exIGuwEfBdBH0MSJJ37CtjcYV82nw9X8lykK09ULQCFLy2cKmWZCJ7KSPgtQbt6NjC3-3XFW-CTd7anr-kcxmwojd5nSgpd29VM3Oyaj/s1600/developer-tools-screen-resolution.png" alt="Once the developer tools are open, click "Tools" > "Resize" and select the screen resolution of your choice" /></a></div><p>Notably, this is only a simulation of screen resolutions. It does <em>not</em> show you exactly what a person using these screen resolutions will see. It will only change the height/width of your browser window and will not effect font sizes etc etc. But it is far faster than changing your own monitor resolution each time you wish to test.<br />
</p><p>The resolution simulation is therefore very useful for testing CSS layouts, but perhaps not as useful if your testing for accessibility compliance etc. You could use this technique for day-to-day testing, coupled with actually changing your monitor resolution (more time consuming) for more in-depth testing. <br />
</p><p>This tip has been written for Internet Explorer 8 under Vista, but it should be very similar for IE7+ under XP+.<br />
</p>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-31947945.post-72890508566090078562010-12-19T00:21:00.012+01:002011-07-03T21:40:29.157+01:00Simulate a slow internet connection in web browsers (Internet Explorer, Firefox, Chrome etc)<p>You can easily simulate a slow internet connection, by using a tool called "fiddler". </p><p>Perhaps you are trying to debug a web application that is behaving strangely on other peoples computers (but is working fine on your own?!). Perhaps you wish to simulate a slow modem or a slow corporate VPN. <p>The fiddler is a web debugging proxy which logs all HTTP traffic between your computer and the internet. The fiddler has a setting to temporarily throttle your internet connection, to make your connection behave like a slow modem. The great thing about the fiddler is that it "automagically" sits in between all your web browsers and the internet, so it works with firefox, internet explorer, chrome etc etc. <p>Firstly you need to install "fiddler", just go to <a href="http://www.fiddler2.com/" target="_blank">http://www.fiddler2.com</a>, download it and install it. It installs in seconds and has a getting started guide if you need it. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0k2LXjEYxji5rO-AOBNN7xOC0IX5_yq339QCYzmH0nIDQse8kdkqpfG9Sgo8MqRWO-tLxLkdP5ewZvmNA4A3DI8OgXAkimuxfw3dXjKlnW1OZ3IXJPehxHbrkwxNzLuAnM6sW/s1600/fiddler-homepage.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="a screen shot of fiddler2.com" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0k2LXjEYxji5rO-AOBNN7xOC0IX5_yq339QCYzmH0nIDQse8kdkqpfG9Sgo8MqRWO-tLxLkdP5ewZvmNA4A3DI8OgXAkimuxfw3dXjKlnW1OZ3IXJPehxHbrkwxNzLuAnM6sW/s1600/fiddler-homepage.jpg" /></a></div><p>Once you have the fiddler installed, open it and once loaded you should see a window similar to below. It should automatically act as a proxy, so if you browse to a website in any browser you should see it being logged in the fiddler. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifITyfSLBYqat4CTSbIoD7uaxmfqGaLihYZoKa3j5Lelbw2KEPI7dgll1gaQoKYP913OkbognEmVyadzn6Vpb9AvDGVMOH-mutsBf9-zrNhqM9akztb7Cbtc0pacHmt5fV96r-/s1600/fiddler-frontpage.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifITyfSLBYqat4CTSbIoD7uaxmfqGaLihYZoKa3j5Lelbw2KEPI7dgll1gaQoKYP913OkbognEmVyadzn6Vpb9AvDGVMOH-mutsBf9-zrNhqM9akztb7Cbtc0pacHmt5fV96r-/s1600/fiddler-frontpage.jpg" alt="the first page of the tool: fiddler. With a few HTTP requests logged."/></a></div><p>To switch on "simulate slow modem speeds" mode in the fiddler (as illustrated in the screen shot below): </p><ol><li>If not already opened, open the fiddler.</li>
<li>Click "Rules" on the top menu.</li>
<li>Then go to "performance".</li>
<li>Click "simulate modem speeds"</li>
</ol><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuL_5GYniF7W7dV15tbsS_O-nxsPyvOIPeqBUKpW8H97zLCc1z49QQzRum5OGrnwO-zmA4z0yULtqM02_ZLaFy1YrdbR4b_ZixmF23Mpl2Hv6p01suigmwtwdHcqtudEOwTuit/s1600/fiddler-simulate-modem-speeds.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="a screen shot illustrating how to turn on simulate modem speeds in the application called fiddler." border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuL_5GYniF7W7dV15tbsS_O-nxsPyvOIPeqBUKpW8H97zLCc1z49QQzRum5OGrnwO-zmA4z0yULtqM02_ZLaFy1YrdbR4b_ZixmF23Mpl2Hv6p01suigmwtwdHcqtudEOwTuit/s1600/fiddler-simulate-modem-speeds.jpg" /></a></div><p>Now any web browser that is using fiddler (should be all web browsers by default), will temporary be slow (until you turn it off) </p><p>This is only scratching the surface of what the fiddler is useful for. There is plenty more information and an introductory video in the <a href="http://www.fiddler2.com/Fiddler/help/">fiddler help section</a>. </p>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-31947945.post-64208079998863695262010-12-14T21:34:00.015+01:002010-12-14T23:14:19.565+01:00<script> tag: type="text/javascript" vs language="javascript"When adding JavaScript to a webpage using the <code><script></code> tags, should you use the <code>type</code> attribute, the <code>language</code> attribute or both? The answer is below...
<pre style='color:#000000;background:#ffffff;width:330px;'><span style='color:#808030; '><</span>script type<span style='color:#808030; '>=</span><span style='color:#0000e6; '>"text/javascript"</span><span style='color:#808030; '>></span><span style='color:#808030; '><</span><span style='color:#808030; '>/</span>script<span style='color:#808030; '>></span>
</pre>
OR
<pre style='color:#000000;background:#ffffff;width:330px;'><span style='color:#808030; '><</span>script language<span style='color:#808030; '>=</span><span style='color:#0000e6; '>"javascript"</span><span style='color:#808030; '>></span><span style='color:#808030; '><</span><span style='color:#808030; '>/</span>script<span style='color:#808030; '>></span>
</pre>
OR
<pre style='color:#000000;background:#ffffff;width:510px;'><span style='color:#808030; '><</span>script language<span style='color:#808030; '>=</span><span style='color:#0000e6; '>"javascript"</span> type<span style='color:#808030; '>=</span><span style='color:#0000e6; '>"text/javascript"</span><span style='color:#808030; '>></span><span style='color:#808030; '><</span><span style='color:#808030; '>/</span>script<span style='color:#808030; '>></span>
</pre>
<h5 style="background-color:yellow; color:black;">The simple answer is you should be using the <code>type</code> attribute for script tags</h5>
<pre style='color:#000000;background:#ffffff;width:330px'><span style='color:#808030; '><</span>script type<span style='color:#808030; '>=</span><span style='color:#0000e6; '>"text/javascript"</span><span style='color:#808030; '>></span><span style='color:#808030; '><</span><span style='color:#808030; '>/</span>script<span style='color:#808030; '>></span>
</pre>
<p>
You do not need to use the <code>language</code> attribute because the attribute has been deprecated since HTML 4.01, this can be seen in the <a href="http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1">"Designing documents for user agents that support scripting" section in the HTML 4.01 Specification.</a>
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-80175839507750409232010-12-14T20:56:00.006+01:002010-12-14T22:17:24.618+01:00Log to the built-in IE developer consoleRather than using JavaScript <code>alert</code>()'s to see the value of variables and alike, the IE developer tools allows you to output to IE's JavaScript console.
<br />
To open the IE developer tools, simply press <kbd>F12</kbd>
<p>
The console log command is simply:<br />
<code>console.log()</code>
</p>
<p>
So for example:
<br />
<pre style="background: #ffffff; color: black; width:270px;"><span style="color: #808030;"><</span>script type<span style="color: #808030;">=</span><span style="color: #0000e6;">"text/javascript"</span><span style="color: #808030;">></span>
<span style="color: maroon; font-weight: bold;">for</span> <span style="color: #808030;">(</span><span style="color: maroon; font-weight: bold;">var</span> i <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: purple;">;</span> i <span style="color: #808030;"><</span> <span style="color: #008c00;">5</span><span style="color: purple;">;</span> i<span style="color: #808030;">++</span><span style="color: #808030;">)</span> <span style="color: purple;">{</span>
console<span style="color: #808030;">.</span><span style="color: maroon; font-weight: bold;">log</span><span style="color: #808030;">(</span><span style="color: #0000e6;">"hello"</span> <span style="color: #808030;">+</span> i<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: purple;">}</span>
<span style="color: #808030;"><</span><span style="color: #808030;">/</span>script<span style="color: #808030;">></span>
</pre>
</p>
<p>
Would output something like this:
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQRYOD70PKFNA53YfbPD0MWVbwZVEIPPlaMOy47CVx2p9CqLcc8YSzZ7hPu_nwbMX6ygJ-CGE-M4m7tFqMAHSNj3bCBNoXVVkMc-ZRpNrKO1MZkEW0TZnSHJoWxgliwZbXZLU_/s1600/ie-javascript-console-logging.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQRYOD70PKFNA53YfbPD0MWVbwZVEIPPlaMOy47CVx2p9CqLcc8YSzZ7hPu_nwbMX6ygJ-CGE-M4m7tFqMAHSNj3bCBNoXVVkMc-ZRpNrKO1MZkEW0TZnSHJoWxgliwZbXZLU_/s1600/ie-javascript-console-logging.jpg" /></a>
</p>
<p>
This is a rudimentary example, but s is especially useful if you want to know the value of many variables at a glance (rather than keep having to press OK for each alert()!)
</p>
<h4>
Watch out for...</h4>
<p>
One gotcha is that your JavaScript will error in IE if your console is not open, because the console object will not be found, the simplest way around this is to remove your console commands after you have finished with them. I will post a workaround for this at a later date.
</p>
<p>
Of course using breakpoints and stepping through the debugging, is more often a better option (I'll do a quick post on how to do this at a later date), but in many situations outputting to the console is very useful.
</p>
<p>
The IE developer tool bar is built into Internet Explorer 7+ (I pressume it will also be in IE9+). As mentioned above you can access it by pressing F12 (or by using the menu).
</p>
<h4>
More information</h4>
<p>
There are many variations of console.log, more information available on the MSDN site: <a href="http://msdn.microsoft.com/en-us/library/dd565625(v=vs.85).aspx#consolelogging">Using Console for Logging Alerts and Error Messages</a>
</p>
<p>
These posts are only here to give you quick and easy tips... however if web development is your day to day role, I'd highly recommend getting familiar with the built-in IE developer tools. More information is available on the MSDN site: <a href="http://msdn.microsoft.com/en-us/library/dd565622(v=VS.85).aspx">IE Developer Tools tutorials</a>
</p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31947945.post-67852936871981569992010-08-27T21:18:00.001+01:002010-10-29T23:23:22.256+01:00Incremental search in Visual Studio<span class="Apple-style-span" style="font-family: Arial; font-size: small;"><span class="Apple-style-span" style="font-size: 13px;"><div>If you have a long piece of code and your're finding that you are constantly scrolling up and down...</div><div><br />
</div><div>You can do a "<b>search as you type</b>" in Visual Studio 2010 to find what you need very quickly.</div><div><br />
</div><div>With a code file open press:</div><div><br />
</div><div><kbd>Ctrl</kbd> + <kbd>i</kbd></div><div><br />
</div><div>And then begin typing in what you are looking for (it will begin searching on the first letter).</div><div><br />
</div><div>To go to the <strong>next result</strong>, press <kbd>Ctrl</kbd> + <kbd>i</kbd> <strong>again</strong>.</div><div><br />
</div><div>To <strong>search upwards</strong>, press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>i</kbd></div><div><br />
</div><div>If you have misspelled, simply press backspace (it doesn't delete your code as you'd first think).</div><div><br />
</div><div>Great for quickly moving around a single file of code.</div></span></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-85159481637666761132010-08-19T20:54:00.003+01:002010-10-29T23:11:34.589+01:00Visual Studio - convert text to upper case short cut keyIn visual studio you can quickly make text upper case, by selecting the text and simply press:<br />
<br /><br />
<kbd>Ctrl</kbd> + <kbd>shift</kbd> + <kbd>u</kbd><br />
<br /><br />
<br />
It can also be found in the menu edit > advanced > make upper case.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-81945292040023174442010-08-18T21:08:00.000+01:002010-08-18T21:08:29.394+01:00Management Studio - invaluable add-on: SSMS Tools PackI'd highly reccomend anyone who uses Sql Server Management Studio day to day, to install a free add-on pack called "SSMS Tools Pack" available here <a href="http://www.ssmstoolspack.com/">www.ssmstoolspack.com</a><br />
<br />
I won't go into to much detail, as the site sells itself.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-34565307000878727302010-08-16T21:06:00.001+01:002010-08-16T21:09:39.526+01:00Get database ID from MS Sql ServerIf you need to get the database ID quickly (for example you are using SQL profiler and need to filter by database ID)<br />
<div><br />
</div><div>One of the quickest ways I have found is to execute the following built-in function:</div><div><br />
</div><div><div class="MsoNormal" style="background-color:white; display:inline; padding:0 5px 2px 5px; margin-top:5px;"><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">select</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: magenta;">db_id</span><span style="color: grey;">(</span><span style="color: red;">'yourdatabasename'</span><span style="color: grey;">)</span></span><o:p></o:p></div><div class="MsoNormal"><span style="font-family: 'Courier New'; font-size: 10pt;"><span style="color: grey;"><br />
</span></span></div><div class="MsoNormal"><span style="font-family: 'Courier New'; font-size: 10pt;"><span style="color: grey;"><br />
</span></span></div></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-31947945.post-91939857265719566252010-08-04T22:12:00.000+01:002010-08-04T22:12:54.658+01:00Filtering tables in SQL Server Management StudioYou can filter your list of tables in SQL Server Management Studio by doing the following (below).<br />
<br />
This is especially useful if you have lots of related tables and your only interested in a particular set of them e.g. every table with "user" in the table name.<br />
<br />
<ol><li>Right click on the tables folder</li>
<li>Choose Filter > Filter settings</li>
<li>This brings up a dialog window allowing you to choose your search criteria (only simple criteria can be user e.g. name, owner, so you cannot use OR/AND etc).</li>
<li>After clicking enter your tables are filtered (in the example by all table names with the word "user" in them).</li>
<li>Happy developer</li>
</ol><div>This example is in Sql Server Management Studio 2008 R2 (but it should work in 2005 and perhaps lower).<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhctn8C2Q8EGhi2KDOgtbjpCFQHc2MLzvAb4qOg5Jrm6e7CV0uOUx-Uu63TD3ugN9HArxPok3CUavO_PXPyanFs0QMMykv69vud2g-95EpLdqtu6TnDIFV4tu9pKliCuEPFT9wD/s1600/filter-table.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="1238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhctn8C2Q8EGhi2KDOgtbjpCFQHc2MLzvAb4qOg5Jrm6e7CV0uOUx-Uu63TD3ugN9HArxPok3CUavO_PXPyanFs0QMMykv69vud2g-95EpLdqtu6TnDIFV4tu9pKliCuEPFT9wD/s1238/filter-table.png" width="600" /></a></div><br />
</div><div><br />
</div><div class="separator" style="clear: both; text-align: center;"></div><div><br />
</div><div><br />
</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31947945.post-82658048474407682152010-08-03T20:14:00.000+01:002010-08-03T20:14:14.572+01:00Code snippet for class propertyTyping out class property's is necessary but repetitive (and boring), as a quick shortcut you can use the property code snippet:<br />
<ol><li>start typing <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">prop</span></li>
<li>press <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">tab</span> twice</li>
<li>you then get a template property</li>
<li>pressing tab will allow you to quick fill in the type and property name</li>
</ol><div><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCIUluBdxC53zt87-d9n8ZN8_seHcXbcMShxYLZ8p_CNKtb52LaQJmZwb-7HF5IX83bIcfUmggI64lkCS7GhjIwoo4n2L21aIYkxHnYEqPbgIZJMVOhaJzKKcBLwED4wDKOgmX/s1600/property.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCIUluBdxC53zt87-d9n8ZN8_seHcXbcMShxYLZ8p_CNKtb52LaQJmZwb-7HF5IX83bIcfUmggI64lkCS7GhjIwoo4n2L21aIYkxHnYEqPbgIZJMVOhaJzKKcBLwED4wDKOgmX/s640/property.png" width="572" /></a></div><div><br />
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31947945.post-60885744599615280902010-08-02T21:10:00.002+01:002010-08-02T21:29:48.971+01:00Visual Studio - Find a file auto-completeIn Visual Studio you can find files quickly by using a built in auto-complete feature (particularly useful to find files in large projects worked on in teams where you may not know the complete structure)<br />
<ol><li>press: <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">CTRL + /</span></li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span>type: <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">of</span></li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span>Then start typing in the filename (of the file you wish to open)</li>
<li>Select the filename from the drop down box and press enter</li>
<li>The file opens (happy developer)</li>
</ol><div>This is tested to work in Visual Studio Professional 2008 / 2010 and Visual Web Developer Express 2010</div><div><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkLqiytmOoktZOiew-A9Mcw9a1cE480t_tCwHTdkfP10ZMauXLUzaYVsYBBpynYstEoJGpsJIjtKCQAaadWbI-J54kPj43EC7b8l3V5BlmeLwGcvn86z-bvcB0o7mSHyaR8svU/s1600/ctrl-forward-slash.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="494" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkLqiytmOoktZOiew-A9Mcw9a1cE480t_tCwHTdkfP10ZMauXLUzaYVsYBBpynYstEoJGpsJIjtKCQAaadWbI-J54kPj43EC7b8l3V5BlmeLwGcvn86z-bvcB0o7mSHyaR8svU/s640/ctrl-forward-slash.png" width="640" /></a></div><div><br />
</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-31947945.post-21849695327003357442010-07-31T19:08:00.017+01:002010-08-02T21:30:06.469+01:00Shortcut Key for Table Details in Sql Server Management StudioIf you select a table name in the query window of Sql Server Management Studio<br />
and press <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>ALT + F1</b></span> it will display the details of that table.<br />
<br />
In the background shortcut key will execute sp_help on your behalf, so in this example it executes: <i>sp_help users</i>, which is much quicker than typing it.<br />
<br />
I'm running Sql Server Management Studio 2008 R2 (but i'm pretty sure it'll work with earlier versions)<br />
<br />
<div class="separator" style="clear: both; margin: 20px 0; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgrQyw7AGMiHf7H-3AIHFJeY7AdunwD1hL_zQmskUQWP7SKFV78ayVdUk7QHDh9j4WjQ9Y9b9oYrt3n7Zd3TDkNafPQ39pymFpxFnOV9dHRlyAjavD0GemW3kshU8KpwBitMVI/s1600/sp_help-ssms-shortcut.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="625" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgrQyw7AGMiHf7H-3AIHFJeY7AdunwD1hL_zQmskUQWP7SKFV78ayVdUk7QHDh9j4WjQ9Y9b9oYrt3n7Zd3TDkNafPQ39pymFpxFnOV9dHRlyAjavD0GemW3kshU8KpwBitMVI/s640/sp_help-ssms-shortcut.png" width="640" /></a></div>Unknownnoreply@blogger.com10