<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nico&#039;s CRM &#187; Tricks</title>
	<atom:link href="http://blog.nicocrm.com/category/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nicocrm.com</link>
	<description>Programming, technology, and CRM - from a Belgian programmer exiled to Missouri</description>
	<lastBuildDate>Sun, 15 Aug 2010 15:57:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compress database backups with Powershell</title>
		<link>http://blog.nicocrm.com/2010/01/18/compress-database-backups-with-powershell/</link>
		<comments>http://blog.nicocrm.com/2010/01/18/compress-database-backups-with-powershell/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 16:43:25 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.nicocrm.com/?p=318</guid>
		<description><![CDATA[Disk space may be cheap but it is still not free!  And, while SQL Server 2008 supports online compression of backups, it is only available in the Enterprise edition.  So I wrote a simple powershell script (more like a snippet) to compress any backup (.bak and .trn files) older than 2 days.

cd E:\MSSQL\BACKUP\SalesLogix
dir [...]]]></description>
			<content:encoded><![CDATA[<p>Disk space may be cheap but it is still not free!  And, while SQL Server 2008 supports online compression of backups, it is only available in the Enterprise edition.  So I wrote a simple powershell script (more like a snippet) to compress any backup (.bak and .trn files) older than 2 days.</p>
<p><code><br />
cd E:\MSSQL\BACKUP\SalesLogix<br />
dir *.trn,*.bak | where { $_.CreationTime.CompareTo([DateTime]::Now.AddDays(-2)) -lt 0 } |% `<br />
	{ &#038; 'C:\Program Files\7-Zip\7z.exe' a "$_.zip" $_; rm $_ }<br />
</code></p>
<p>Could replace &#8220;.zip&#8221; with &#8220;.7z&#8221; to do a 7-zip compression &#8211; it will take a bit less disk space but more cpu.  Could also be tweaked a bit to support recursion.</p>
<p>I saved that to E:\MSSQL\Backup\ZipBackups.ps1 and created a schedule task to invoke &#8220;powershell E:\MSSQL\Backup\ZipBackups.ps1&#8243;.  This requires the execution policy to be set on powershell, to allow unsigned local scripts:</p>
<p><code><br />
set-executionpolicy RemoteSigned<br />
</code></p>
<p>I am still working on getting more familiar with powershell as it can be a nifty tool (and is becoming more and more standard on Windows servers as it is bundled with other packages)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2010/01/18/compress-database-backups-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heap Table are Teh Suck</title>
		<link>http://blog.nicocrm.com/2008/01/30/heap-table-are-teh-suck/</link>
		<comments>http://blog.nicocrm.com/2008/01/30/heap-table-are-teh-suck/#comments</comments>
		<pubDate>Wed, 31 Dec 1969 18:00:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=34</guid>
		<description><![CDATA[Today, converted 2 heap tables to clustered ones, and halved the database size.  Heap tables get so fragmented that they will have a gigantic amount of unused space.  Here is a link to a great script to find out which tables are using up your disk space in SQL server &#8211; if the [...]]]></description>
			<content:encoded><![CDATA[<p>Today, converted 2 heap tables to clustered ones, and halved the database size.  Heap tables get so fragmented that they will have a gigantic amount of unused space.  <a href="http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=10932">Here is a link to a great script to find out which tables are using up your disk space in SQL server</a> &#8211; if the &#8220;Unused&#8221; space is abnormally large, you may have a fragmentation problem, and one of the best thing you can do is get rid of heap tables, by creating a clustered index or a primary key:<br />
<code><br />
ALTER TABLE Customer ADD PRIMARY KEY (SID);<br />
</code><br />
or<br />
<code><br />
CREATE CLUSTERED INDEX IX_TABLE ON TABLE(COLUMN)<br />
</code></p>
<p>There are a few other ways to defragment tables &#8211; but they may not work well (or at all) on heap tables.</p>
<p>PS: If the above script is gone, google &#8220;Bill Graziano BigTables&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2008/01/30/heap-table-are-teh-suck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The unicode BOM (or, what are these funny characters at the beginning of my file and how did they get there)</title>
		<link>http://blog.nicocrm.com/2008/01/27/the-unicode-bom-or-what-are-these-funny-characters-at-the-beginning-of-my-file-and-how-did-they-get-there/</link>
		<comments>http://blog.nicocrm.com/2008/01/27/the-unicode-bom-or-what-are-these-funny-characters-at-the-beginning-of-my-file-and-how-did-they-get-there/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 02:22:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=31</guid>
		<description><![CDATA[Alright, this isn&#8217;t much, and is pretty old news, but it was pretty aggravating to look for it this week-end so I might as well jot it down for later.
Somehow last week I started getting some &#8220;Invalid Character&#8221; errors all over the place (or maybe I just started noticing them, I don&#8217;t know).  Some [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, this isn&#8217;t much, and is pretty old news, but it was pretty aggravating to look for it this week-end so I might as well jot it down for later.</p>
<p>Somehow last week I started getting some &#8220;Invalid Character&#8221; errors all over the place (or maybe I just started noticing them, I don&#8217;t know).  Some came up in msbuild scripts, and some in Javascript files.  They just looked like 1 or 3 gibberish characters at the very beginning of the file.  I kind of dismissed it because the errors went away after I opened the file in vim and re-saved it, but they came back with a vengeance last week-end when I found out that was the ultimate cause for my Django templates messing up.  I really found out I had a bona fide Django bug there for a moment, but it was just copying the &#8220;BOM&#8221; (byte order mark) from my source files.</p>
<p>So what is this BOM anyway?  Simply put they are a few bytes inserted at the beginning of a (unicode) file to help the computer determine how to read it.<br />
It doesn&#8217;t really make sense for UTF-8 (the most common default encoding) because the order in those is fixed!  But for a double-byte encoding like UTF-16 you have to know whether to put the first byte first or last (there is a longer story to this &#8220;endianness&#8221; as they call it but let&#8217;s cut short here).  ANYWAY, some programs will still put a BOM in UTF-8 file, consisting of the 3 bytes 0xEF, 0xBB, 0xBF.  And some programs will manage to choke on it.  OR, it will have some strange effect when you try to do some things to the files like concatenate them or whatever.</p>
<p>Where do they come from?  It seems like Notepad (not Notepad2) will insert them automatically depending on your encoding settings.</p>
<p>To get rid of them, use &#8220;:set nobomb&#8221; in vim and save, or in Notepad2 change the encoding to &#8220;UTF-8&#8243; (instead of &#8220;UTF-8 with signature&#8221;).</p>
<p>Here is the <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark">Wikipedia article</a> which explains this in much more detail.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2008/01/27/the-unicode-bom-or-what-are-these-funny-characters-at-the-beginning-of-my-file-and-how-did-they-get-there/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Got Grep!</title>
		<link>http://blog.nicocrm.com/2007/11/19/windows-got-grep/</link>
		<comments>http://blog.nicocrm.com/2007/11/19/windows-got-grep/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 00:25:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=16</guid>
		<description><![CDATA[Well, almost.
May be old news to a lot of people, but I found out the FINDSTR utility which is installed standard on Win XP machines (probably Win 2k3 as well) has enough options to be a decent replacement to grep in the common cases.  Even makes it easier for some things &#8211; for example [...]]]></description>
			<content:encoded><![CDATA[<p>Well, almost.</p>
<p>May be old news to a lot of people, but I found out the FINDSTR utility which is installed standard on Win XP machines (probably Win 2k3 as well) has enough options to be a decent replacement to grep in the common cases.  Even makes it easier for some things &#8211; for example use /S for a recursive search instead of having to build it with find.</p>
<p>For myself I still prefer using grep/find instead (on cygwin)&#8230;  but will be useful when working on other boxes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2007/11/19/windows-got-grep/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML and JavaScript syntax Highlighting for Vim</title>
		<link>http://blog.nicocrm.com/2007/05/11/html-and-javascript-syntax-highlighting-for-vim/</link>
		<comments>http://blog.nicocrm.com/2007/05/11/html-and-javascript-syntax-highlighting-for-vim/#comments</comments>
		<pubDate>Fri, 11 May 2007 15:23:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=68</guid>
		<description><![CDATA[This works beautifully:

Install the javascript.vim from http://www.vim.org/scripts/script.php?script_id=1491
As indicated on that page (but you have to look in the version history comments), edit html.vim and comment out the 2 lines:

HtmlHiLink javaScript Special
HtmlHiLink javaScriptExpression javaScript



Thanks to Yi Zhao!!!
]]></description>
			<content:encoded><![CDATA[<p>This works beautifully:</p>
<ul>
<li>Install the javascript.vim from <a href="http://www.vim.org/scripts/script.php?script_id=1491">http://www.vim.org/scripts/script.php?script_id=1491</a></li>
<li>As indicated on that page (but you have to look in the version history comments), edit html.vim and comment out the 2 lines:
<ul>
<li>HtmlHiLink javaScript Special</li>
<li>HtmlHiLink javaScriptExpression javaScript</li>
</ul>
</li>
</ul>
<p>Thanks to Yi Zhao!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2007/05/11/html-and-javascript-syntax-highlighting-for-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instructions for SVN+SSH on Windows (short version)</title>
		<link>http://blog.nicocrm.com/2007/05/10/instructions-for-svnssh-on-windows-short-version/</link>
		<comments>http://blog.nicocrm.com/2007/05/10/instructions-for-svnssh-on-windows-short-version/#comments</comments>
		<pubDate>Thu, 10 May 2007 18:16:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=67</guid>
		<description><![CDATA[
Go download putty.  Install the big installer.
Install subversion, and install TortoiseSVN.
Use puttygen to generate a key.  Make sure you specify a pass phrase!  Save the private key on Windows, and paste the OpenSSH stuff into authorized_keys in Linux.
Have pageant run at startup: create a shortcut under the startup menu and have this [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Go download putty.  Install the big installer.</li>
<li>Install subversion, and install TortoiseSVN.</li>
<li>Use puttygen to generate a key.  Make sure you specify a pass phrase!  Save the private key on Windows, and paste the OpenSSH stuff into authorized_keys in Linux.</li>
<li>Have pageant run at startup: create a shortcut under the startup menu and have this command in it:<code>"C:\Program Files\PuTTY\pageant.exe" "E:\Documents\SSH\putty_key.ppk"</code><br />
(replace with appropriate path, but don&#8217;t remove the quotes)</li>
<li>Start PageAnt, or preferably relog into Windows to make sure it starts automatically.</li>
<li>Now right click in a windows explorer windows and start the tortoiseSVN repo-browser.  As the address, specify something like this:<br />
<code>svn+ssh://username@host/home/nether/SVN</code></li>
</ol>
<p>UPDATE &#8211; this method is so damn slow over the LAN I really can&#8217;t recommend it anymore (I am running a local svnserve now).  BUT, I think it might be OK over the web &#8211; I believe the issue is there is a huge overhead in establishing the connection, and TortoiseSVN does that (spawning a new SSH or something&#8230;) every time I open a folder.  It feels like VSS, if you know what I mean.  Meanwhile over the internet there is a bigger latency to deal with so the overhead of opening the SSH may not be that noticeable.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2007/05/10/instructions-for-svnssh-on-windows-short-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>App List</title>
		<link>http://blog.nicocrm.com/2007/04/26/app-list/</link>
		<comments>http://blog.nicocrm.com/2007/04/26/app-list/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 21:54:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=64</guid>
		<description><![CDATA[Master list &#8211; check here: http://www.hanselman.com/blog/ScottHanselmans2005UltimateDeveloperAndPowerUsersToolList.aspx
Download:

Paint.Net
TaskSwitchXP
Cropper
Launchy
TestDriven.net
Vim
slickrun
autoruns
putty





]]></description>
			<content:encoded><![CDATA[<p>Master list &#8211; check here: http://www.hanselman.com/blog/ScottHanselmans2005UltimateDeveloperAndPowerUsersToolList.aspx</p>
<p><strong>Download:</strong></p>
<ul>
<li>Paint.Net</li>
<li>TaskSwitchXP</li>
<li>Cropper</li>
<li>Launchy</li>
<li>TestDriven.net</li>
<li>Vim</li>
<li>slickrun</li>
<li>autoruns</li>
<li>putty</li>
</ul>
<dl>
<dt>
</dt>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2007/04/26/app-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opening CHM from network</title>
		<link>http://blog.nicocrm.com/2007/04/05/opening-chm-from-network/</link>
		<comments>http://blog.nicocrm.com/2007/04/05/opening-chm-from-network/#comments</comments>
		<pubDate>Thu, 05 Apr 2007 02:15:00 +0000</pubDate>
		<dc:creator>Nicolas Galler</dc:creator>
				<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://blog.chivinou.net/?p=63</guid>
		<description><![CDATA[Set this in registry (create the key if it does not already exist):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
&#8220;MaxAllowedZone&#8221;=dword:00000004
]]></description>
			<content:encoded><![CDATA[<p>Set this in registry (create the key if it does not already exist):</p>
<p>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]<br />
&#8220;MaxAllowedZone&#8221;=dword:00000004</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nicocrm.com/2007/04/05/opening-chm-from-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
