<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Eduardo Laranjeira</title>
	
	<link>http://blog.laranjee.com</link>
	<description />
	<lastBuildDate>Fri, 18 Nov 2011 10:59:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Laranjeira" /><feedburner:info uri="laranjeira" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Git, SSH Agent and PowerShell</title>
		<link>http://feedproxy.google.com/~r/Laranjeira/~3/nGY-d1tcuus/</link>
		<comments>http://blog.laranjee.com/git-ssh-agent-and-powershell/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 17:57:25 +0000</pubDate>
		<dc:creator>Eduardo Laranjeira</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SSH Agent]]></category>

		<guid isPermaLink="false">http://blog.laranjee.com/?p=152</guid>
		<description><![CDATA[I’m writing this post to thank Mark Embling by the insightful post on how to setup SSH Agent inside PowerShell. It saved me a lot of time, and helped me keeping my git workflow inside PowerShell. So, if you are &#8230; <a href="http://blog.laranjee.com/git-ssh-agent-and-powershell/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’m writing this post to thank <a href="http://www.markembling.info/">Mark Embling</a> by the insightful <a href="http://www.markembling.info/view/ssh-agent-in-powershell ">post</a> on how to setup SSH Agent inside PowerShell.</p>
<p>It saved me a lot of time, and helped me keeping my git workflow inside PowerShell. So, if you are still using bash, get his PowerShell <a href="http://gist.github.com/187305">script</a> and give it a try.</p>
<img src="http://feeds.feedburner.com/~r/Laranjeira/~4/nGY-d1tcuus" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.laranjee.com/git-ssh-agent-and-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.laranjee.com/git-ssh-agent-and-powershell/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=git-ssh-agent-and-powershell</feedburner:origLink></item>
		<item>
		<title>How to configure Git on Windows</title>
		<link>http://feedproxy.google.com/~r/Laranjeira/~3/s5kufA7qMs4/</link>
		<comments>http://blog.laranjee.com/how-to-configure-git-on-windows/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 18:01:36 +0000</pubDate>
		<dc:creator>Eduardo Laranjeira</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://sweux.com/blogs/laranjeira/?p=125</guid>
		<description><![CDATA[In the previous article, I’ve shown how to install Git on Windows 7, but before you can start using it, there’s some basic configuration that needs to be done. In this article I’ll show how to setup your user name &#8230; <a href="http://blog.laranjee.com/how-to-configure-git-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://blog.laranjee.com/how-to-install-git-on-windows/">previous article</a>, I’ve shown how to install Git on Windows 7, but before you can start using it, there’s some basic configuration that needs to be done.</p>
<p>In this article I’ll show how to setup your user name and email address, and configuring external tools like <a href="http://notepad-plus.sourceforge.net/">Notepad++</a> and <a href="http://www.scootersoftware.com">Beyond Compare</a> to edit your comments and to visualize changes in your code.</p>
<p>Before proceeding, open Cygwin bash shell (Start –&gt; All Programs -&gt; Cygwin -&gt; Cygwin Bash Shell).</p>
<h4>Setting user name and email</h4>
<p>Git needs to know your user name and email address to properly credit your commits,</p>
<pre class="brush: bash; title: ; notranslate">$ git config --global user.name &quot;Your Name&quot;
$ git config --global user.email your@email.com</pre>
<p>NOTE: The <em>“email”</em> setting doesn’t need to a valid email address, it only needs to match the <em>“user@server</em><em>”</em> naming scheme.</p>
<p>this will setup your user name and email address globally within Git. If you want, you can override this settings on a per-repository basis:</p>
<pre class="brush: bash; title: ; notranslate">$ cd your_repository
$ git config user.name &quot;Your Name&quot;
$ git config user.email your@email.com</pre>
<p> </p>
<h4>Setting the core editor</h4>
<p>To properly use Notepad++ editor, you need to create a wrapper script “git-core-editor.sh” with the content,</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/sh
&quot;C:/Program Files (x86)/Notepad++/notepad++.exe&quot; -multiInst -notabbar -nosession $*</pre>
<p>and save it at the path “C:\Cygwin\usr\local\bin”.</p>
<p>Now, lets proceed with the editor configuration:</p>
<pre class="brush: bash; title: ; notranslate">$ git config --global core.editor /usr/local/bin/git-core-editor.sh</pre>
<p>The next time you commit something,</p>
<pre class="brush: bash; title: ; notranslate">$ git commit</pre>
<p>Notepad++ will show up, type your comments, save and close.</p>
<h4>Setting the diff tool</h4>
<p>Similar to the editor configuration, you also need to create a wrapper script “git-difftool-warpper.sh” with the content,</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/sh
REMOTE=&quot;$(cygpath -w &quot;${1}&quot;)&quot;;
LOCAL=${2};
echo Launching BComp.exe $REMOTE $LOCAL
&quot;C:/Program Files (x86)/Beyond Compare 3/BComp.exe&quot; $REMOTE $LOCAL</pre>
<p>and save it at the path “C:\Cygwin\usr\local\bin”.</p>
<p>Now, lets proceed with diff tool configuration:</p>
<pre class="brush: bash; title: ; notranslate">$ git config --global diff.tool bc3
$ git config --global difftool.bc3.cmd &quot;git-difftool-wrapper.sh \&quot;\$LOCAL\&quot; \&quot;\$REMOTE\&quot;&quot;
$ git config --global difftool.prompt false</pre>
<p>To visualize your code changes</p>
<pre class="brush: bash; title: ; notranslate">$ git difftool &lt;file_name&gt;</pre>
<p>That’s all you need to start using Git.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/How-to-configure-Git-on-Windows"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblog.laranjee.com%2Fhow-to-configure-git-on-windows%2F" style="border:0px"/></a></p>
<img src="http://feeds.feedburner.com/~r/Laranjeira/~4/s5kufA7qMs4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.laranjee.com/how-to-configure-git-on-windows/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.laranjee.com/how-to-configure-git-on-windows/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-configure-git-on-windows</feedburner:origLink></item>
		<item>
		<title>How to install Git on Windows</title>
		<link>http://feedproxy.google.com/~r/Laranjeira/~3/58GgAvW8CI0/</link>
		<comments>http://blog.laranjee.com/how-to-install-git-on-windows/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 18:25:28 +0000</pubDate>
		<dc:creator>Eduardo Laranjeira</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Cygwin]]></category>

		<guid isPermaLink="false">http://sweux.com/blogs/laranjeira/?p=37</guid>
		<description><![CDATA[If you want to install Git on Windows you have two options; using msysgit or Cygwin. Using msysgit is the easiest way and probably the most popular one, but it does not allow you to use the latest version of &#8230; <a href="http://blog.laranjee.com/how-to-install-git-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to install <a href="http://git-scm.com/">Git</a> on Windows you have two options; using <a href="http://code.google.com/p/msysgit/">msysgit</a> or <a href="http://www.cygwin.com/">Cygwin</a>. Using msysgit is the easiest way and probably the most popular one, <span style="text-decoration: line-through;">but it does not allow you to use the latest version of Git as soon as it’s released. This is one of many reasons I prefer Cygwin over msysgit</span> but it shouldn&#8217;t be any limitation if you prefer one option over the other. Since I&#8217;m a Cygwin user, it was a natural choice for me, so fell free to chose the one that suits you best.</p>
<p>That said, I’ll show you how to install Git v1.7.0 using Cygwin v1.7.1-1 on Windows 7.</p>
<h4>Installing Cygwin</h4>
<p>Download Cygwin <a href="http://www.cygwin.com/setup.exe">here</a> and run the setup. Accept the defaults (or customize it if you prefer to install in different place) until you get to the &#8220;Select Packages&#8221; step.</p>
<p>To select a package, change the &#8220;View&#8221; to full, type the name in the search box and press the word “Skip” once. This will select the last available version and all the required package dependencies as shown in the picture:</p>
<p><a href="http://blog.laranjee.com/wp-content/uploads/2010/02/image2.png" target="_blank"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="Select Packages" src="http://blog.laranjee.com/wp-content/uploads/2010/02/image_thumb2.png" border="0" alt="Select Packages" width="244" height="199" /></a></p>
<p>Select the following packages:</p>
<ul>
<li>zlib</li>
<li>openssh</li>
<li>openssl</li>
<li>perl</li>
<li>subversion-perl (if you want to use git-svn)</li>
<li>curl</li>
<li>libcurl-devel</li>
<li>expat</li>
<li>tcltk</li>
<li>make</li>
<li>gcc</li>
<li>ncurses (if you want to use the clear command)</li>
<li>python</li>
</ul>
<p>Click “Next” to download and install. After installation, check the option to add an icon to the Start menu.</p>
<h4>Installing Git</h4>
<p>Open Cygwin bash shell (Start –&gt; All Programs -&gt; Cygwin -&gt; Cygwin Bash Shell) and type the following commands to download and install Git source package:</p>
<pre class="brush: bash; title: ; notranslate">cd /usr/src
curl -O http://kernel.org/pub/software/scm/git/git-1.7.0.tar.gz
tar xzvf git-1.7.0.tar.gz
cd git-1.7.0
./configure --prefix=/usr/local
make
make install
cd ..
which git</pre>
<p>You should see /usr/local/bin/git.</p>
<p>Next, download and install the Git man pages:</p>
<pre class="brush: bash; title: ; notranslate">curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-1.7.0.tar.gz
mkdir /usr/local/man
tar xvf git-manpages-1.7.0.tar.gz -C /usr/local/man</pre>
<p>That’s all. In the next article I’ll write about how to configure Git to integrate with tools like <a href="http://notepad-plus.sourceforge.net/">Notepad++</a> and <a href="http://www.scootersoftware.com/">Beyond Compare</a>.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/How-to-install-Git-on-Windows"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblog.laranjee.com%2Fhow-to-install-git-on-windows%2F" style="border:0px"/></a></p>
<img src="http://feeds.feedburner.com/~r/Laranjeira/~4/58GgAvW8CI0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.laranjee.com/how-to-install-git-on-windows/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://blog.laranjee.com/how-to-install-git-on-windows/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-install-git-on-windows</feedburner:origLink></item>
		<item>
		<title>How to convert WinForms Bitmap to WPF ImageSource</title>
		<link>http://feedproxy.google.com/~r/Laranjeira/~3/CzT11dz-4sU/</link>
		<comments>http://blog.laranjee.com/how-to-convert-winforms-bitmap-to-wpf-imagesource/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 16:39:37 +0000</pubDate>
		<dc:creator>Eduardo Laranjeira</dc:creator>
				<category><![CDATA[Interop]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sweux.com/blogs/laranjeira/?p=44</guid>
		<description><![CDATA[If by chance you’re progressively migrating a legacy WinForms application to WPF, at some point you’ll have to use existing bitmaps and convert them to the WPF equivalent one. It seems this is a FAQ in the forums, and some &#8230; <a href="http://blog.laranjee.com/how-to-convert-winforms-bitmap-to-wpf-imagesource/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If by chance you’re progressively migrating a legacy WinForms application to WPF, at some point you’ll have to use existing bitmaps and convert them to the WPF equivalent one.</p>
<p>It seems this is a FAQ in the forums, and some of the solutions that I saw that use the System.Windows.Interop namespace, have memory leak issues. When creating a GDI bitmap object, we must release its memory as soon as possible and people are missing this important step.</p>
<p>That said, I&#8217;ve decided to share the following code snippet that you can use to convert a Bitmap to an ImageSource.</p>
<pre class="brush: csharp; title: ; notranslate">public static class BitmapExtensions
{
    public static ImageSource ToImageSource(this Bitmap bitmap)
    {
        var hbitmap = bitmap.GetHbitmap();
        try
        {
            var imageSource = Imaging.CreateBitmapSourceFromHBitmap(hbitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(bitmap.Width, bitmap.Height));

            return imageSource;
        }
        finally
        {
            NativeMethods.DeleteObject(hbitmap);
        }
    }
}

public static class NativeMethods
{
    [DllImport(&quot;gdi32&quot;)]
    public static extern int DeleteObject(IntPtr hObject);
}</pre>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Eduardo-Laranjeira-How-to-convert-WinForms-Bitmap-to-WPF-ImageSource"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fsweux.com%2Fblogs%2Flaranjeira%2Findex.php%2Fwpf%2Fhow-to-convert-winforms-bitmap-to-wpf-imagesource%2F" style="border:0px"/></a></p>
<img src="http://feeds.feedburner.com/~r/Laranjeira/~4/CzT11dz-4sU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.laranjee.com/how-to-convert-winforms-bitmap-to-wpf-imagesource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.laranjee.com/how-to-convert-winforms-bitmap-to-wpf-imagesource/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-convert-winforms-bitmap-to-wpf-imagesource</feedburner:origLink></item>
		<item>
		<title>How to get Design Mode property in WPF</title>
		<link>http://feedproxy.google.com/~r/Laranjeira/~3/kgSoLLtCfGE/</link>
		<comments>http://blog.laranjee.com/how-to-get-design-mode-property-in-wpf/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 11:10:31 +0000</pubDate>
		<dc:creator>Eduardo Laranjeira</dc:creator>
				<category><![CDATA[Design Mode]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sweux.com/blogs/laranjeira/?p=13</guid>
		<description><![CDATA[Last day I needed to check if the code was executing in Design Mode but I couldn’t remember how to do it, so I had to Google again for that matter. That said, I decided to blog about it to &#8230; <a href="http://blog.laranjee.com/how-to-get-design-mode-property-in-wpf/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last day I needed to check if the code was executing in Design Mode but I couldn’t remember how to do it, so I had to Google again for that matter. That said, I decided to blog about it to prevent wasting my time in a near future.</p>
<p>Jim Nakashima has a nice post about the subject, you can read it <a href="http://blogs.msdn.com/jnak/archive/2006/10/07/Detecting-Design-Mode.aspx">here</a>, so I wont get into much detail.</p>
<p>The code to get the design mode property in your control looks like this:</p>
<pre class="brush: csharp; title: ; notranslate">using System.ComponentModel;

private bool IsInDesignMode
{
    get
    {
        return DesignerProperties.GetIsInDesignMode(this);
    }
}</pre>
<p>If you don’t have a DependencyObject you can still get the property using the following:</p>
<pre class="brush: csharp; title: ; notranslate">using System.ComponentModel;

private bool IsInDesignMode
{
    get
    {
        return DesignerProperties.GetIsInDesignMode(new DependencyObject());
    }
}</pre>
<p>or</p>
<pre class="brush: csharp; title: ; notranslate">using System.ComponentModel;

private bool IsInDesignMode
{
    get
    {
        return (bool)DesignerProperties.IsInDesignModeProperty
            .GetMetadata(typeof(DependencyObject)).DefaultValue;
    }
}</pre>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Eduardo-Laranjeira-How-to-get-Design-Mode-property-in-WPF"><img style="border-width: 0px;" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fsweux.com%2Fblogs%2Flaranjeira%2Findex.php%2Fwpf%2Fhow-to-get-design-mode-property-in-wpf%2F" alt="Shout it" /></a></p>
<img src="http://feeds.feedburner.com/~r/Laranjeira/~4/kgSoLLtCfGE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.laranjee.com/how-to-get-design-mode-property-in-wpf/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.laranjee.com/how-to-get-design-mode-property-in-wpf/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-get-design-mode-property-in-wpf</feedburner:origLink></item>
	</channel>
</rss>

