<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://lunarmedia.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Lunarmedia Blog</title><subtitle type="html">Personal blog by Anders Vindberg filled with dissimilar things ranging from molecular cooking sessions to innovation theories and web development combined with interesting daily thoughts all served with a dried academic tongue. Some of it may be indecipherable as my original tongue is Danish (no excuse) but do try and keep me entertained by commenting my tangled words.</subtitle><id>http://lunarmedia.com/blogs/lunarmedia_blog/atom.aspx</id><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/default.aspx" /><link rel="self" type="application/atom+xml" href="http://lunarmedia.com/blogs/lunarmedia_blog/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20416.853">Community Server</generator><updated>2009-07-15T13:14:00Z</updated><entry><title>Web Deploy: (401) Unauthorized</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2012/01/17/web-deploy-401-unauthorized.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2012/01/17/web-deploy-401-unauthorized.aspx</id><published>2012-01-17T12:20:00Z</published><updated>2012-01-17T12:20:00Z</updated><content type="html">&lt;p&gt;If you are getting the 401 Unauthorized error from Visual Studio when trying to use Web Deploy, then (because of a Bug in Web Deploy (also version 2)) add this to your regedit:&lt;/p&gt;&lt;p&gt;at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System &lt;/p&gt;&lt;p&gt;add DWORD: LocalAccountTokenFilterPolicy with value: 1.&lt;/p&gt;&lt;p&gt;Now you can use a windows user that is a member of your admin group (not the native admin) to deploy your content! &lt;br&gt;&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124429" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>IIS6: The service did not respond to the start or control request in a timely fashion</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/11/25/iis6-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/11/25/iis6-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion.aspx</id><published>2011-11-25T19:14:00Z</published><updated>2011-11-25T19:14:00Z</updated><content type="html">
&lt;p&gt;After a Windows Update on our Win2003 server, we suddently received this message when trying to stop or start an app pool or website.&lt;/p&gt;
&lt;p&gt;For our particular situation I found the answer on &lt;a href="http://www.jesswatts.com/it/iis-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion" mce_href="http://www.jesswatts.com/it/iis-the-service-did-not-respond-to-the-start-or-control-request-in-a-timely-fashion"&gt;JessWatts.com&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;"&lt;i&gt;It is possible that a shared dll that IIS 6 relies on has become unregistered.&lt;br&gt;
Try running the following command: regsvr32 qmgr.dll&lt;br&gt;
Then reboot the server and start the failed websites.&lt;/i&gt;" &lt;/p&gt;
&lt;p&gt;Thanks Jess! &lt;br&gt;&lt;/p&gt;
&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124419" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Solr delete/clear index</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/10/19/solr-delete-clear-index.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/10/19/solr-delete-clear-index.aspx</id><published>2011-10-19T06:13:00Z</published><updated>2011-10-19T06:13:00Z</updated><content type="html">&lt;p&gt;To delete/clear the solr index.&lt;br&gt;&lt;br&gt;Simply run both of these in the browser (change the "solr" name and port to your specific solr instance name if the default wasn't used):&lt;br&gt;&lt;br&gt;1. http://localhost:8080/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&lt;br&gt;2. http://localhost:8080/solr/update?stream.body=%3Ccommit/%3E&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124418" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Performance with Entity Framework</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/09/23/performance-with-entity-framework.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/09/23/performance-with-entity-framework.aspx</id><published>2011-09-22T20:22:00Z</published><updated>2011-09-22T20:22:00Z</updated><content type="html">
&lt;p&gt;&amp;nbsp;Here are some links to great resources if you are looking to build high-performance enterprise website solutions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.asp.net/entity-framework/tutorials/maximizing-performance-with-the-entity-framework-in-an-asp-net-web-application" mce_href="http://www.asp.net/entity-framework/tutorials/maximizing-performance-with-the-entity-framework-in-an-asp-net-web-application"&gt;http://www.asp.net/entity-framework/tutorials/maximizing-performance-with-the-entity-framework-in-an-asp-net-web-application&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/adonet/archive/2011/01/27/using-dbcontext-in-ef-feature-ctp5-part-1-introduction-and-model.aspx" mce_href="http://blogs.msdn.com/b/adonet/archive/2011/01/27/using-dbcontext-in-ef-feature-ctp5-part-1-introduction-and-model.aspx"&gt;http://blogs.msdn.com/b/adonet/archive/2011/01/27/using-dbcontext-in-ef-feature-ctp5-part-1-introduction-and-model.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Microsoft is moving fast these days. The entity framework is getting more functionality and structure as it progresses. It seems to be implementing several best practice patterns such as repository and unit of work patterns among others.&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124417" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Sql Profiler - Analyzing number of database calls</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/01/20/sql-profiler-analyzing-number-of-database-calls.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2011/01/20/sql-profiler-analyzing-number-of-database-calls.aspx</id><published>2011-01-20T13:33:00Z</published><updated>2011-01-20T13:33:00Z</updated><content type="html">&lt;p&gt;Is your pageload taking more than 0.2 seconds! its time to investigate how many database roundtrips your webapplication is making. If you haven't got Sql Profiler (with MS Sql Server) go download AnjLab Sql Profiler its free.
&lt;/p&gt;&lt;p&gt;
To identify database roundtrips from an application, Setup the following events:
&lt;/p&gt;&lt;p&gt;
RPC:Completed
SQL:BatchCompleted
&lt;/p&gt;&lt;p&gt;
And this filter:
TextData Not Like exec sp_reset_connection%
&lt;/p&gt;&lt;p&gt;
Source: Jeremy Jameson - http://blogs.msdn.com/b/jjameson/archive/2010/09/03/analyzing-database-roundtrips-with-sql-server-profiler.aspx
&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124416" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>IIS Application Pool Queue Length Settings</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/12/06/iis-application-pool-queue-lenght-settings.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/12/06/iis-application-pool-queue-lenght-settings.aspx</id><published>2010-12-06T13:16:00Z</published><updated>2010-12-06T13:16:00Z</updated><content type="html">&lt;p&gt;This is hard to find information:
&lt;/p&gt;&lt;p&gt;The default limit for an application pool is 4000 requests. On a moderately sized server with a few application pools configured, this might be a good value. However, on a server with multiple CPUs and lots of RAM, this value might be too low. On a server with limited resources or many application pools configured, this value might be too high. Here you might want to use a formula of Memory Size in Megabytes x Number of CPUs x 10 divided by Number of Configured Application Pools to determine what the size of the average request queue should be. This is meant to be a guideline to give you a starting point for consideration and not an absolute rule. For example, on a server with two CPUs, 1024 MB of RAM, and twenty configured application pools, the size of the average request queue limit would be around 1,000 requests. You might have some application pools configured with request queue limits of 750 and others with request queue limits of 1,250. However, if the same server had only one configured application pool, you probably wouldn’t configure a request queue limit of 10,000. 
&lt;/p&gt;
&lt;p&gt;
Source: http://forums.asp.net/p/623323/623323.aspx (Matthew, Microsoft).&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124415" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Dealing with TC/CS DateFormats</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/11/02/dealing-with-tc-cs-dateformats.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/11/02/dealing-with-tc-cs-dateformats.aspx</id><published>2010-11-02T15:53:00Z</published><updated>2010-11-02T15:53:00Z</updated><content type="html">&lt;p&gt;
Defining a specific date format in TC (and CS (Community Server)) can be tricky. An example could be: "30 september, 2003" or "01-01-2010". &lt;br&gt;&lt;br&gt;First you need to know that all the users you may have registered in your database will not be affected by changes made to the default date format defined in the controlpanel. They each need to select a new date format in their profile settings to get a new date format.&lt;br&gt;&lt;br&gt;Working with a new TC website you should define the preferred date format before any users are registered:&lt;br&gt;
&lt;/p&gt;&lt;ol&gt;
&lt;li&gt;Search for "Utility_DateFormatDropDownList_F1" in your language files located in the "languages" folder.&lt;/li&gt;
&lt;li&gt;Edit one or more of the defined date formats if your preferred format is not already defined. Reset the application pool (iisreset).&lt;br&gt;&lt;/li&gt;
&lt;li&gt;Goto yourwebsite.com/controlpanel/Settings/Setup.aspx and select the preferred date format. Press "Save".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From this time forward new users will be preselected to use the date format selected. They can still at any time goto their profile settings to select a different format from the dropdown list unless you simply remove this from the template :).&lt;/p&gt;
&lt;p&gt;The defaultDate defined in the web.config file can be disregarded.&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124414" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Scandinavian letters (ÆØÅ) in javascript formatting!</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/09/09/scandinavian-letters-198-216-197-in-javascript-formatting.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/09/09/scandinavian-letters-198-216-197-in-javascript-formatting.aspx</id><published>2010-09-09T07:53:00Z</published><updated>2010-09-09T07:53:00Z</updated><content type="html">&lt;p&gt;For future reference I am writing this post: ÆØÅ in JavaScript - simply save .js file as UTF-8 formatting! On how to save in UTF-8 encoding in Visual Studio 2010 see this answer: &lt;a href="http://stackoverflow.com/questions/2268037/visual-studio-2010-and-utf-8-encoding/4955304#4955304"&gt;UTF-8 Encoding&lt;/a&gt; at Stackoverflow. &lt;/p&gt;
&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124413" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>TC 5.5 Localization</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/08/12/tc-5-5-localization.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/08/12/tc-5-5-localization.aspx</id><published>2010-08-12T12:33:00Z</published><updated>2010-08-12T12:33:00Z</updated><content type="html">&lt;p&gt;Everything in Telligent Community is becoming increasingly complex. A simple feature as localization has once again been filtered into the database. Its important to know if you are translating TC into a none-english language that profile field names and profile widget headlines are located in controlpanel (Membership) and not in the language files where they belong! &lt;/p&gt;&lt;p&gt;UPDATE: The widget headlines can be defined in codebehind and thus reference the language files. The profile fields can also reference the language file if defined in the theme.config file! Adding them adhoc is still an issue. &lt;br&gt;&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124316" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>CSControl:Pager Template Styling</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/07/28/cscontrol-pager-template-styling.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/07/28/cscontrol-pager-template-styling.aspx</id><published>2010-07-28T07:44:00Z</published><updated>2010-07-28T07:44:00Z</updated><content type="html">&lt;p&gt;Styling the pager control in Community Server always escapes me so here is an example:&lt;/p&gt;&lt;p&gt;&lt;font face="courier new,courier"&gt;&amp;lt;CSControl:Pager id="pager" runat="Server" Tag="div" style='text-align: center;'&amp;gt;&lt;br&gt;&amp;lt;FirstLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData LinkTo="Link" LinkCssClass="TextButton" 
runat="server"&amp;gt;&amp;lt;ContentTemplate&amp;gt;&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;Newest&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/ContentTemplate&amp;gt;&amp;lt;/CSControl:CSLinkData&amp;gt;&lt;br&gt;&amp;lt;/FirstLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;PreviousLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData LinkTo="Link" LinkCssClass="TextButton" 
runat="server"&amp;gt;&amp;lt;ContentTemplate&amp;gt;&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;Newer&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/ContentTemplate&amp;gt;&amp;lt;/CSControl:CSLinkData&amp;gt;&lt;br&gt;&amp;lt;/PreviousLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;PageLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData LinkTo="Link" Property="Text" 
Text="&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;{0}&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;" 
LinkCssClass="TextButton" runat="server" /&amp;gt;&lt;br&gt;&amp;lt;/PageLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;CurrentPageLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData Tag="Span" CssClass="TextButtonDisabled" 
Property="Text" 
Text="&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;{0}&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;" 
runat="server" /&amp;gt;&lt;br&gt;&amp;lt;/CurrentPageLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;SeparatorTemplate&amp;gt;&amp;lt;/SeparatorTemplate&amp;gt;&lt;br&gt;&amp;lt;NextLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData LinkTo="Link" LinkCssClass="TextButton" 
runat="server"&amp;gt;&amp;lt;ContentTemplate&amp;gt;&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;Older&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/ContentTemplate&amp;gt;&amp;lt;/CSControl:CSLinkData&amp;gt;&lt;br&gt;&amp;lt;/NextLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;LastLinkTemplate&amp;gt;&lt;br&gt;&amp;nbsp;
 &amp;lt;CSControl:CSLinkData LinkTo="Link" LinkCssClass="TextButton" 
runat="server"&amp;gt;&amp;lt;ContentTemplate&amp;gt;&amp;lt;span&amp;gt;&amp;lt;span&amp;gt;Oldest&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/ContentTemplate&amp;gt;&amp;lt;/CSControl:CSLinkData&amp;gt;&lt;br&gt;&amp;lt;/LastLinkTemplate&amp;gt;&lt;br&gt;&amp;lt;/CSControl:Pager&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Source: &lt;a href="http://getben.com/archive/2007/01/30/introduction-to-chameleon-questions-and-answers.aspx" mce_href="http://getben.com/archive/2007/01/30/introduction-to-chameleon-questions-and-answers.aspx"&gt;http://getben.com/archive/2007/01/30/introduction-to-chameleon-questions-and-answers.aspx &lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=124315" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Visual Studio (VS) 2010 Build Configuration dropdown</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/04/22/visual-studio-vs-2010-build-configuration-dropdown.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/04/22/visual-studio-vs-2010-build-configuration-dropdown.aspx</id><published>2010-04-22T14:41:00Z</published><updated>2010-04-22T14:41:00Z</updated><content type="html">&lt;p&gt;If you happen to be missing the Build configuration dropdown menu from your toolbar in Visual Studio 2010 and can't find it in the Build toolbar here is how you add it back in:&lt;/p&gt;&lt;p&gt;Tools -&amp;gt; Customize -&amp;gt; Commands (tab). Select "Toolbar:" and then select "Build" from the dropdown. &lt;/p&gt;&lt;p&gt;Click on "Add Command", select "Build" in Categories and find "Solution Configurations" (at the bottom). Click "Ok" and it is back in the "Build" toolbar!&lt;br&gt;&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=123873" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Entity Framework 4.0 RC: Cannot insert the value NULL into column '*_Id', table 'Paragraphs'; column does not allow nulls. INSERT fails. The statement has been terminated.
</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/04/08/entity-framework-4-0-rc-cannot-insert-the-value-null-into-column-id-table-paragraphs-column-does-not-allow-nulls-insert-fails-the-statement-has-been-terminated.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/04/08/entity-framework-4-0-rc-cannot-insert-the-value-null-into-column-id-table-paragraphs-column-does-not-allow-nulls-insert-fails-the-statement-has-been-terminated.aspx</id><published>2010-04-08T12:34:00Z</published><updated>2010-04-08T12:34:00Z</updated><content type="html">&lt;p&gt;Entity Framework 4.0 RC bug. Usually after an "update model from database" I encounter this error message:  Cannot insert the value NULL into column '*_Id', table 'column does not allow nulls. INSERT fails. The statement has been terminated.&lt;/p&gt;&lt;p&gt;To fix the association between the many-to-one relationship (in my case Paragraphs to Translation), you need to edit the .edmx model file and remove StoreGeneratedPattern="Identity" from the Paragraphs node.&lt;/p&gt;&lt;p&gt;See more here: &lt;a href="http://stackoverflow.com/questions/2243618/how-do-you-insert-or-update-many-to-many-tables-in-net-entity-framework/2339834#2339834" mce_href="http://stackoverflow.com/questions/2243618/how-do-you-insert-or-update-many-to-many-tables-in-net-entity-framework/2339834#2339834"&gt;http://stackoverflow.com/questions/2243618/how-do-you-insert-or-update-many-to-many-tables-in-net-entity-framework/2339834#2339834 &lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=123836" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>LINQ to Entities - Common queries (.Net 4.0)</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/03/13/linq-to-entities-common-queries-net-4-0.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/03/13/linq-to-entities-common-queries-net-4-0.aspx</id><published>2010-03-13T09:08:00Z</published><updated>2010-03-13T09:08:00Z</updated><content type="html">
&lt;h3&gt;T-Sql "WHERE IN":&lt;/h3&gt;&lt;p&gt;&lt;font face="arial"&gt;&lt;font color="#000000"&gt;Sql:&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;SELECT * FROM People &lt;br&gt;WHERE Firstname IN ('Peter', 'Steve', 'John', 'Bruno')&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="arial"&gt;&lt;font color="#000000"&gt;LINQ:&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt; names = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt;[] { &lt;font color="#a31515"&gt;"Peter"&lt;/font&gt;, &lt;font color="#a31515"&gt;"Steve"&lt;/font&gt;, &lt;font color="#a31515"&gt;"John"&lt;/font&gt;, &lt;font color="#a31515"&gt;"Bruno"&lt;/font&gt; };&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt; matches = &lt;font color="#0000ff"&gt;from&lt;/font&gt; person &lt;font color="#0000ff"&gt;in&lt;/font&gt; people &lt;br&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;where&lt;/font&gt; names.Contains(person.Firstname) &lt;br&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;select&lt;/font&gt; person;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=123805" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>Encrypting connectionstrings.config in IIS 6.0</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/02/09/encrypting-connectionstring-config-in-iis-6-0.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2010/02/09/encrypting-connectionstring-config-in-iis-6-0.aspx</id><published>2010-02-09T10:09:00Z</published><updated>2010-02-09T10:09:00Z</updated><content type="html">&lt;p&gt;Simply call these two commands in cmd prompt:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;C:\WINDOWS\microsoft.net\Framework64\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" C:\MyWebsiteFolder&lt;/li&gt;
&lt;li&gt;C:\WINDOWS\microsoft.net\Framework64\v2.0.50727\aspnet_regiis -pa "NetFrameworkConfigurationKey" "Network Service"&lt;br&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you still get a: "&lt;i&gt;Failed
 to decrypt using provider 'RsaProtectedConfigurationProvider'. Error 
message from the provider: The RSA key container could not be opened.&lt;/i&gt;" Then call the second command again but replace "Network Service" with "ASPNET".&lt;/p&gt;
&lt;p&gt;Source: MS Patterns &amp;amp; Practices: &lt;a href="http://msdn.microsoft.com/en-us/library/ms998283.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms998283.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms998283.aspx&lt;/a&gt;&lt;br&gt;&lt;/p&gt;
&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=123804" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry><entry><title>T-SQL Dynamic Sorting and Order By</title><link rel="alternate" type="text/html" href="http://lunarmedia.com/blogs/lunarmedia_blog/archive/2009/07/15/t-sql-dynamic-sorting-and-order-by.aspx" /><id>http://lunarmedia.com/blogs/lunarmedia_blog/archive/2009/07/15/t-sql-dynamic-sorting-and-order-by.aspx</id><published>2009-07-15T09:14:00Z</published><updated>2009-07-15T09:14:00Z</updated><content type="html">&lt;p&gt;Using the CASE expression its possible to do efficient sorting and ordering by different parameters in one query. Here is an example from &lt;a href="http://gregbeech.com/blogs/tech/archive/2008/07/21/dynamic-sorting-and-paging-in-sql-server-with-the-case-expression.aspx" mce_href="http://gregbeech.com/blogs/tech/archive/2008/07/21/dynamic-sorting-and-paging-in-sql-server-with-the-case-expression.aspx"&gt;Greg Beech's Tech Blog&lt;/a&gt; which also includes paging:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;DECLARE @SortType TINYINT, @SortAscending BIT, @FirstRow INT, @MaxRows INT;&lt;br&gt;SELECT @SortType = 2, @SortAscending = 0, @FirstRow = 10, @MaxRows = 10;&lt;br&gt;&lt;br&gt;WITH FoundCustomers AS&lt;br&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROW_NUMBER() OVER&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORDER BY &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE WHEN @SortType = 0 AND @SortAscending = 1 THEN c.ContactName END ASC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,CASE WHEN @SortType = 0 AND @SortAscending = 0 THEN c.ContactName END DESC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,CASE WHEN @SortType = 1 AND @SortAscending = 1 THEN c.CompanyName END ASC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,CASE WHEN @SortType = 1 AND @SortAscending = 0 THEN c.CompanyName END DESC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,CASE WHEN @SortType = 2 AND @SortAscending = 1 THEN c.Country END ASC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,CASE WHEN @SortType = 2 AND @SortAscending = 0 THEN c.Country END DESC&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) AS RowNumber&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,c.*&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbo.Customers c&lt;br&gt;)&lt;br&gt;SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc.*&lt;br&gt;FROM&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FoundCustomers fc&lt;br&gt;WHERE&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc.RowNumber BETWEEN @FirstRow AND @FirstRow + @MaxRows - 1&lt;br&gt;ORDER BY&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc.RowNumber;&lt;/pre&gt;
&lt;img src="http://lunarmedia.com/aggbug.aspx?PostID=123693" width="1" height="1"&gt;</content><author><name>Anders Vindberg</name><uri>http://lunarmedia.com/members/Anders-Vindberg.aspx</uri></author></entry></feed>
