<?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>Everything old is new again &#187; Visual Studio</title>
	<atom:link href="http://www.svendtofte.com/tag/visual-studio/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.svendtofte.com</link>
	<description>rantings &#38; scraps on code and web development</description>
	<lastBuildDate>Sat, 06 Nov 2010 20:55:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting up NHibernate 2.0</title>
		<link>http://www.svendtofte.com/serverside/setting-up-nhibernate-20/</link>
		<comments>http://www.svendtofte.com/serverside/setting-up-nhibernate-20/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 20:52:47 +0000</pubDate>
		<dc:creator>Svend</dc:creator>
				<category><![CDATA[Serverside]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[or mapping]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.svendtofte.com/?p=102</guid>
		<description><![CDATA[I&#8217;ve spent several long hours over the last week, trying to get Hibernate for .NET to even just work in Visual Studio. The changed configuration format has been, since I&#8217;m not seeing any real examples of how to setup NHibernate 2.0 (Beta 2, which will probably be going release later this month) on the net, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent several long hours over the last week, trying to get <a href="http://www.nhibernate.org/">Hibernate for .NET</a> to even just work in Visual Studio. The changed configuration format has been, since I&#8217;m not seeing any real examples of how to setup NHibernate 2.0 (Beta 2, which will probably be going release later this month) on the net, I&#8217;m just putting it out there now, since I&#8217;m trying to learn the whole framework, and so far this was my biggest stumbling point.</p>
<p>Important to note that this isn&#8217;t a <em>true example</em> by any measure. It merely shows what to put in your <code>App.config</code> (especially since the official documentation mostly covers the Java version, which naturally has no idea what <code>App.config</code> is. And what <a href="http://www.hibernate.org/362.html">little there is</a> for NHibernate, is for the last release. </p>
<p><span id="more-102"></span></p>
<p>The example is very simple, it mainly shows:</p>
<ul>
<li>
<p>The contents of <code>App.config</code></p>
</li>
<li>
<p>An example <code>*.hbm.xml</code> file for the sample <code>User</code> class.</p>
</li>
<li>
<p>If you should wish, the whole Visual Studio 2008 Solution file</p>
</li>
</ul>
<p>I used <a href="http://www.microsoft.com/express/vcsharp/">Visual C# 2008 Express Edition</a> and for the database I used <a href="http://www.microsoft.com/express/sql/download/default.aspx">SQL Server Express 2005</a> (make sure to get both &#8220;Microsoft SQL Server 2005 Express Edition &#8221; and  &#8220;SQL Server Management Studio Express&#8221;, the latter part is the GUI to manage the database, unless talking pure SQL into one end of a pipe satisfies you).</p>
<p><a href="http://www.svendtofte.com/wp-content/uploads/2008/07/nhibernatetest.zip">Download the entire VS 2008 Solution.</a></p>
<h2>Configs, etc</h2>
<p>The <code>App.config</code> looks like</p>
<pre>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
  &lt;configSections&gt;
    &lt;section name="hibernate-configuration"
             type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /&gt;
  &lt;/configSections&gt;
  &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" &gt;
    &lt;session-factory&gt;
      &lt;property name="dialect"&gt;
        NHibernate.Dialect.MsSql2005Dialect
      &lt;/property&gt;
      &lt;property name="connection.provider"&gt;
        NHibernate.Connection.DriverConnectionProvider
      &lt;/property&gt;
      &lt;property name="connection.driver_class"&gt;
        NHibernate.Driver.SqlClientDriver
      &lt;/property&gt;
      &lt;property name="connection.connection_string"&gt;
        Server=SVENDSDESKTOP\SQLEXPRESS;
        Database=NHibernate;
        Integrated Security=True;
      &lt;/property&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
&lt;/configuration&gt;</pre>
<p>The <code>NHibernateTest.User.hbm.xml</code>:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernateTest"&gt;
  &lt;class name="User, NHibernateTest" table="users"&gt;
    &lt;id name="Id" column="LogonId" type="String" length="20"&gt;
      &lt;generator class="assigned" /&gt;
    &lt;/id&gt;
    &lt;property name="UserName" column="Name" type="String" length="40"/&gt;
    &lt;property name="Password" type="String" length="20"/&gt;
    &lt;property name="EmailAddress" type="String" length="40"/&gt;
    &lt;property name="LastLogon" type="DateTime"/&gt;
  &lt;/class&gt;
&lt;/hibernate-mapping&gt;</pre>
<p>And the startup code is the following.</p>
<pre>static void Main(string[] args)
{
    Configuration cfg = new Configuration();
    cfg.AddXmlFile("NHibernateTest.User.hbm.xml");

    ISessionFactory factory = cfg.BuildSessionFactory();
    ISession session = factory.OpenSession();
    ITransaction transaction = session.BeginTransaction();

    User newUser = new User();
    newUser.Id = "joe_cool";
    newUser.UserName = "Joseph Cool";
    newUser.Password = "abc123";
    newUser.EmailAddress = "joe@cool.com";
    newUser.LastLogon = DateTime.Now;

    // Tell NHibernate that this object should be saved
    session.Save(newUser);

    // commit all of the changes to the DB and close the ISession
    transaction.Commit();
    session.Close();
}</pre>
<p>Annnd, the SQL needed would be the following. Note that the database used is &#8220;NHibernate&#8221;.</p>
<pre>USE [NHibernate]
GO
/****** Object:  Table [dbo].[users]    Script Date: 07/23/2008 22:32:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[users](
	[LogonID] [nvarchar](20) NOT NULL DEFAULT ('0'),
	[Name] [nvarchar](40) NULL DEFAULT (NULL),
	[Password] [nvarchar](20) NULL DEFAULT (NULL),
	[EmailAddress] [nvarchar](40) NULL DEFAULT (NULL),
	[LastLogon] [datetime] NULL DEFAULT (NULL),
PRIMARY KEY CLUSTERED
(
	[LogonID] ASC
)WITH (PAD_INDEX  = OFF,
       STATISTICS_NORECOMPUTE  = OFF,
       IGNORE_DUP_KEY = OFF,
       ALLOW_ROW_LOCKS  = ON,
       ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.svendtofte.com/serverside/setting-up-nhibernate-20/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Useful shortcuts for Visual Studio</title>
		<link>http://www.svendtofte.com/visual-studio/useful-shortcuts-for-visual-studio/</link>
		<comments>http://www.svendtofte.com/visual-studio/useful-shortcuts-for-visual-studio/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 20:06:26 +0000</pubDate>
		<dc:creator>Svend</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[keyboard]]></category>

		<guid isPermaLink="false">http://www.svendtofte.com/?p=29</guid>
		<description><![CDATA[I&#8217;ve been using Visual Studio for quite some time now, but I&#8217;ve never really bothered to investigate this important tool too much. I&#8217;ve finally gotten around to check things out, and am I&#8217;m gonna try to learn some techniques to increase effieincy a little bit (almost seems like heresy). First round, I&#8217;ll focus on keyboard [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Visual Studio for quite some time now, but I&#8217;ve never really bothered to investigate this important tool too much. I&#8217;ve finally gotten around to check things out, and am I&#8217;m gonna try to learn some techniques to increase effieincy a little bit (almost seems like heresy). First round, I&#8217;ll focus on keyboard shortcuts. I&#8217;ve grouped them into 4 categories, navigation, debugging, editing and others, hopefully they are fairly explanatory. Now mind you that these are the default short cuts for Visual Studio for C#, for C++ and VB they may not work (you&#8217;ll have to customize the binding yourself).</p>
<p><span id="more-29"></span></p>
<h3>Navigation</h3>
<style type="text/css">td {height:2.5em;}</style>
<p> <!-- no margins allowed on table cells makes baby jebsu cry --></p>
<table cellspacing="0">
<tr>
<td><span class="keyboard">f12</span></td>
<td>Go to declaration</td>
</tr>
<tr>
<td><span class="keyboard">f7</span></td>
<td>Switch to code view (if applicable)</td>
</tr>
<tr>
<td><span class="keyboard">shift</span>+<span class="keyboard">f7</span></td>
<td>Switch to Switch to designer view (if applicable) </td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">i</span></td>
<td>Incremental Search (only current document)</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">shift</span>+<span class="keyboard">i</span></td>
<td>Reverse incremental search (only current document)</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">m</span>,<span class="keyboard">ctrl</span>+<span class="keyboard">m</span></td>
<td>Toggle outline</td>
</tr>
</table>
<h3>Debug</h3>
<p></p>
<table>
<tr>
<td><span class="keyboard">f5</span></td>
<td>Run with debugging</td>
</tr>
<tr>
<td><span class="keyboard">shift</span>+<span class="keyboard">f5</span></td>
<td>Stop debugging</td>
</tr>
<tr>
<td><span class="keyboard">f10</span></td>
<td>Step over</td>
</tr>
<tr>
<td><span class="keyboard">f11</span></td>
<td>Step into</td>
</tr>
<tr>
<td><span class="keyboard">shift</span>+<span class="keyboard">f11</span></td>
<td>Step out</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">f10</span></td>
<td>Run to cursor</td>
</tr>
<tr>
<td><span class="keyboard">f9</span></td>
<td>Toggle a breakpoint</td>
</tr>
</table>
<h3>Editing</h3>
<p></p>
<table>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">-</span></td>
<td>Move to previous edit point (back)</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">alt</span>+<span class="keyboard">i</span></td>
<td>Switch to the Immediate window</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">space</span></td>
<td>Intellisense-menu</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">k</span>, <span class="keyboard">ctrl</span>+<span class="keyboard">c</span></td>
<td>Comment selection</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">k</span>, <span class="keyboard">ctrl</span>+<span class="keyboard">u</span></td>
<td>Uncomment selection</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">shift</span>+<span class="keyboard">l</span></td>
<td>Delete line</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">.</span></td>
<td>Resolve namespaces</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">k</span>,<span class="keyboard">ctrl</span>+<span class="keyboard">f</span></td>
<td>Prettify code</td>
</tr>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">k</span>,<span class="keyboard">ctrl</span>+<span class="keyboard">s</span></td>
<td>Snippets (also around selection)</td>
</tr>
</table>
<h3>Other</h3>
<p></p>
<table>
<tr>
<td><span class="keyboard">ctrl</span>+<span class="keyboard">shift</span>+<span class="keyboard">b</span></td>
<td>Build solution</td>
</tr>
</table>
<p>&nbsp;</p>
<h2>Configuring shortcuts</h2>
<p> I&#8217;m using a danish keyboard, so the <code>ctrl+-</code> shortcut does not work for me for whatever reason. You can customize your shortcuts by going Tools -> Customize -> Keyboard &#8230; Which brings you to the following dialog. </p>
<div id="attachment_70" class="wp-caption alignnone" style="width: 660px"><a href="http://www.svendtofte.com/wp-content/uploads/2008/07/vs-kbd-custom.png"><img src="http://www.svendtofte.com/wp-content/uploads/2008/07/vs-kbd-custom.png" alt="Visual Studio keyboard customization dialog" title="vs-kbd-custom" width="650" height="351" class="size-full wp-image-70" /></a><p class="wp-caption-text">Visual Studio keyboard customization dialog</p></div>
<p>You&#8217;ll need to locate the shortcut your want to configure first (and there&#8217;s loads). Type in &#8220;back&#8221; into the &#8220;Show commands containing:&#8221;. You should find &#8220;View.NavigateBackwards&#8221; a bit down the last. You can bind it to something else, I use <code>ctrl+´</code>, but whatever works for you.</p>
<h2>Other shortcuts</h2>
<p>As you can see from the list, the amount of bindable actions is very large, and as far as I know not documented at all. Further, they also assume a US keyboard layout (and despite of <a href="http://www.svendtofte.com/wp-content/uploads/2008/07/ibm-model-m-desk.jpg" title="My IBM Model M keyboard">old faithfull </a>, I&#8217;m currently on a Danish keyboard, as it just does make some things easier). But that said, <a href="http://www.codinghorror.com/blog/archives/000412.html">Coding Horror has a great script</a> that will enumerate all of the short cuts, their name, and what object they belong to (View, Edit, etc). Microsoft also has some great looking posters for VB, C# and C++</p>
<ul>
<li>
<p><a href="http://www.microsoft.com/downloadS/details.aspx?FamilyID=e5f902a8-5bb5-4cc6-907e-472809749973&#038;displaylang=en">Visual C# 2008 Keybinding Reference Poster</a> (and for <a href="http://www.microsoft.com/downloadS/details.aspx?familyid=C15D210D-A926-46A8-A586-31F8A2E576FE&#038;displaylang=en">2005</a>)</p>
</li>
<li>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=255b8cf1-f6bd-4b55-bb42-dd1a69315833&#038;DisplayLang=en">Visual Basic 2008 Keybinding Reference Poster</a></p>
</li>
<li>
<p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=4411BBFC-0E3C-42B3-BD05-AF1D292C986F&#038;displaylang=en">Visual C++ 2008 Keybinding Reference Poster</a></p>
</li>
</ul>
<p>But since those aren&#8217;t editable, and I&#8217;m just not sure I need <em>that many</em> short cuts, I&#8217;ve compiled <a href="http://www.svendtofte.com/wp-content/uploads/2008/07/vs-shortcuts.doc">my own little Word document</a> I&#8217;ll print out, and also list my own bindings in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.svendtofte.com/visual-studio/useful-shortcuts-for-visual-studio/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

