Warning: include(/nfs/c01/h14/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache-base.php) [function.include]: failed to open stream: No such file or directory in /nfs/c01/h07/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 65

Warning: include() [function.include]: Failed opening '/nfs/c01/h14/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache-base.php' for inclusion (include_path='.:/usr/local/php-5.3.29/share/pear') in /nfs/c01/h07/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 65

Warning: include_once(/nfs/c01/h14/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/ossdl-cdn.php) [function.include-once]: failed to open stream: No such file or directory in /nfs/c01/h07/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 82

Warning: include_once() [function.include]: Failed opening '/nfs/c01/h14/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/ossdl-cdn.php' for inclusion (include_path='.:/usr/local/php-5.3.29/share/pear') in /nfs/c01/h07/mnt/6138/domains/ellisweb.net/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 82
Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
using (var pc = new PrincipalContext(ContextType.Domain))
{
    // get the user's directory entry
    var up = UserPrincipal.FindByIdentity(pc, userName);
    var de = (DirectoryEntry)up.GetUnderlyingObject();
    
    // get manager directoryEntry
    var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
    var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
    
    // get the manager's distinguished name
    string managerDN = managerDe.Properties["distinguishedName"][0].ToString();

    // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
    de.Properties["manager"].Value = managerDN;
    de.CommitChanges();
}
However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
A constraint violation occurred
Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
    object managerDN = managerDe.Properties["distinguishedName"][0];

    // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
    de.Properties["manager"].Value = managerDN;
Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

Release Notes:

  • First public nuget release of v3.0
  • Includes new nuget package updates:
  • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
  • Lots of bug fixing, performance enhancements
  • Move from the old location to here.
  • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
  • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
    • Will store in all listed, retrieve from the first possible location where there is a match
    • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
    • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
  • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
  • Updated for newest versions of SqlCe and SqlLite
I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
  • GetGematriaValue
    • Calculates the gematria value for all Hebrew letters in the given string.
    • Ignores all characters that are not Hebrew letters.
  • GetNumericGematriaValue
    • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
    • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
    • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
    • Ignores non-Hebrew characters and punctuation in the given word.
  • ConvertToGematriaNumericString
    • Convert a number into its Gematria Numeric Representation
As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
  1. Absolute Value (מספר הכרחי):
    • Alef (א) through Tet (ט) are 1-9
    • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
    • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
    • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
    • This is the most standard method, used by default
  2. Absolute Alternate Value
    • The same as the Absolute Value, except that the Final Forms continue from 500-900
  3. Ordinal Value (מספר סידורי)
    • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
  4. Reduced Value (מספר קטן)
    • Calculated the value of each letter using the absolute system, truncating all zeros
    • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
The code is released under the MIT License]]>
http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <!-- Begin Remove -->
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    <!-- End Remove -->
  </assemblyBinding>
</runtime>
I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
  1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
  2. Set "text/html" as an accepted media type for this formatter
WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
protected void Application_Start()
{
    ...

    JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
    serializerSettings.Converters.Add(new IsoDateTimeConverter());
    GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));

    ...
}
Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
protected void Application_Start()
{
    ...

    JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
    serializerSettings.Converters.Add(new IsoDateTimeConverter());
    var jsonFormatter = new JsonNetFormatter(serializerSettings);
    jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
    GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);

    ...
}
]]>
http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = $2200, 50 named users in Code Collaborator = $24,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Ellis Web Development http://ellisweb.net Thoughts & Articles on ASP.net, C#, Software Development and Technology by Yaakov Ellis Tue, 09 Sep 2014 08:32:42 +0000 en-US hourly 1 http://wordpress.org/?v=4.0.13 Setting a User’s `manager` Property in DirectoryServices http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/ http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/#comments Tue, 09 Sep 2014 08:32:42 +0000 http://ellisweb.net/?p=591 Continue reading ]]> manager in ActiveDirectory using System.DirectoryServices, C#. I had code that did the following (actual code has a bunch of reusable methods for doing things like loading up UserPrincipal and DirectoryEntry objects, saving values, not hard coding key names etc - I am simplifying it here to get it all in one place):
    using (var pc = new PrincipalContext(ContextType.Domain))
    {
        // get the user's directory entry
        var up = UserPrincipal.FindByIdentity(pc, userName);
        var de = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get manager directoryEntry
        var managerUp = UserPrincipal.FindByIdentify(pc, managerUserName);
        var managerDe = (DirectoryEntry)up.GetUnderlyingObject();
        
        // get the manager's distinguished name
        string managerDN = managerDe.Properties["distinguishedName"][0].ToString();
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
        de.CommitChanges();
    }
    However, when I ran this, I got a System.DirectoryServices.DirectoryServicesCOMException telling me:
    A constraint violation occurred
    Eventually, I was able to figure out the issue (leading to this post, which will hopefully help someone else out in the future): when setting the `manager` property of a DirectoryEntry, you should not set it to a string that includes the DistinguishedName of the manager. Rather, you want to retrieve the object returned by DirectoryServices for the DistinguishedName of the manager, and set that object value directory. So the end of the code excerpt should look like this:
        object managerDN = managerDe.Properties["distinguishedName"][0];
    
        // set the manager's distinguished name as the value for the `manager` property on the users DirectoryEntry and save
        de.Properties["manager"].Value = managerDN;
    Once I changed it to use the object value of the Distinguished name, I was able to CommitChanges to Active Directory successfully.]]>
    http://ellisweb.net/2014/09/setting-users-manager-property-directoryservices/feed/ 0
    MiniProfiler v3.0.10-beta1 Released http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/ http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/#comments Wed, 05 Feb 2014 09:35:58 +0000 http://ellisweb.net/?p=570 Continue reading ]]> MiniProfiler since soon after its initial release, so soon after I joined Stack Exchange (2013-10), I made an effort to try to get involved with the development work. Lots of work had been completed already by Jarrod Dixon, Marc Gravell, Matt Jibson, Sam Saffron, Nick Craver and the other members of the team to get MiniProfiler to version 3, and this has been in use for a number of months already on the Stack Exchange sites (including Stack Overflow). A few items remained on the ToDo list before the new version could be released on nuget, and I volunteered to work on these. All of the remaining items have now been completed and a few minutes ago I pushed the new 3.0.10-beta release up to nuget.org. Note: if you are going to install the pre-release beta nugets, be sure to include "-pre" in your command: PM> Install-Package MiniProfiler -Pre

    Release Notes:

    • First public nuget release of v3.0
    • Includes new nuget package updates:
    • CustomTiming replaces SqlTiming as the general timing storage. Sql is now just one case. More adaptable for different timing types.
    • Lots of bug fixing, performance enhancements
    • Move from the old location to here.
    • SqlServerStorage is rewritten to use different tables, corresponding to new CustomTiming approach. If you used SqlServerStorage in v2.0 this is a breaking change. In this case be sure to see the newtable creation script
    • Add MultiStorageProvider as new option for being able to designate multiple storage locations.
      • Will store in all listed, retrieve from the first possible location where there is a match
      • Implements IStorage so it can be set for the session using MiniProfiler.Settings.Storage, or for the individual request.
      • Set MiniProfiler.Current.Storage to any IStorage (including MultiStorageProvider) to customize the storage for any single request (example)
    • New nuget for Entity Framework 6. Initialize in with MiniProfilerEF6.Initialize();
    • Updated for newest versions of SqlCe and SqlLite
    I also just updated the MiniProfiler.com site to include up to date information (based on the new release) on nugets and basic usage, and changed up the UI a tiny bit (now using Bootstrap). Issues and Pull Requests are welcome on GitHub, and any feedback is also welcome on the community site.]]>
    http://ellisweb.net/2014/02/miniprofiler-v3-0-10-beta1-released/feed/ 0
    Gematria Class Library on GitHub http://ellisweb.net/2013/02/gematria-class-library-on-github/ http://ellisweb.net/2013/02/gematria-class-library-on-github/#comments Wed, 13 Feb 2013 08:43:01 +0000 http://ellisweb.net/?p=554 Continue reading ]]> Gematria (Gematriya). Gematria is a .Net Class Library for calculating the Gematria value of strings of Hebrew text, or convert numbers into Hebrew Text.
    Gematria or gimatria (Hebrew: גימטריא/גימטריה‎ gēmaṭriyā) is a traditional Jewish system of assigning numerical value to a word or phrase (Wikipedia)
    You can learn more about Gematria in one of these sites (1, 2) This library exposes the following methods, all available through the static Calculator class:
    • GetGematriaValue
      • Calculates the gematria value for all Hebrew letters in the given string.
      • Ignores all characters that are not Hebrew letters.
    • GetNumericGematriaValue
      • Calculates the gematria value for a string that is intended to represent a number (example: a year in the Hebrew calendar or page in a Hebrew book).
      • This function expects that the given string will contain only one word, and will throw an error if more than one word is included
      • (this is because a string of Hebrew characters representing a number will never consist of multiple words).
      • Ignores non-Hebrew characters and punctuation in the given word.
    • ConvertToGematriaNumericString
      • Convert a number into its Gematria Numeric Representation
    As explained in the links above, there are different systems that can be used for translating Hebrew letters into numeric equivalents. The Gematria library allows use of the following four methods:
    1. Absolute Value (מספר הכרחי):
      • Alef (א) through Tet (ט) are 1-9
      • Yud (י) through Tzadik (צ) are 10-90, increasing in increments of 10
      • Kuf (ק) through Tav (ת) are 100-400, increasing in increments of 100
      • The five final forms (sofiyot | סופיות) in the alphabet are given the equivalent values to their non-final analogs
      • This is the most standard method, used by default
    2. Absolute Alternate Value
      • The same as the Absolute Value, except that the Final Forms continue from 500-900
    3. Ordinal Value (מספר סידורי)
      • Alef starts at 1. Each following letter continues in sequence, with the final forms continuing the sequence (Tav = 22, Final Tzadik = 27)
    4. Reduced Value (מספר קטן)
      • Calculated the value of each letter using the absolute system, truncating all zeros
      • Leads to a sequence of values in order of letters: 1-9, 1-9, 1-9
    The code is released under the MIT License]]>
    http://ellisweb.net/2013/02/gematria-class-library-on-github/feed/ 0
    Could not load type ‘System.Web.Razor.Parser.SyntaxTree.CodeSpan’ from assembly ‘System.Web.Razor http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/ http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/#comments Mon, 23 Apr 2012 12:54:19 +0000 http://ellisweb.net/?p=544 Continue reading ]]> "Could not load type 'System.Web.Razor.Parser.SyntaxTree.CodeSpan' from assembly 'System.Web.Razor" Eventually, I was able to resolve the error by removing the following from my web.config and app.config files:
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Begin Remove -->
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <!-- End Remove -->
      </assemblyBinding>
    </runtime>
    I would guess that one of the packages that I installed added this reference, which had a conflict with a different version of the same assembly in the GAC. In any event, it fixed the error (and did not cause any apparent new errors). Posting in case it may help you out with a similar error.]]>
    http://ellisweb.net/2012/04/could-not-load-type-system-web-razor-parser-syntaxtree-codespan-from-assembly-system-web-razor/feed/ 0
    Force WebAPI to return JSON by Default for Html GET Requests http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/ http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/#comments Mon, 23 Apr 2012 06:04:38 +0000 http://ellisweb.net/?p=536 Continue reading ]]> source - this is mentioned by Hanselman towards the end of the post). However, if you want to activate this right now, how should you do it? Two steps:
    1. Set a JSON formatter as the first Formatter in the Web API Config Formatters collection
    2. Set "text/html" as an accepted media type for this formatter
    WebAPI includes a JSON Serializer by default: DataContractJsonSerializer. However, no one wants to use it, and for good reason: lots of issues with different types, slow performance, bad date formatting and more. Thankfully, WebAPI allows you to switch customize the data formatters used for different content types. Bloggers have recommended a number of different approaches. What seems to be the most promising is Henrik Nielsen's JsonNetFormatter (using Json.NET to handle the JSON serialization) combined with a fix for a DateTime serialization issue (Hanselman also implies that this will be the default in post-beta WebAPI). After you add the code for the JsonNetFormatter, you can set this up as the default Json data formatter by doing the following:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonNetFormatter(serializerSettings));
    
        ...
    }
    Once you have done this, any request that comes in to the API that asks for json (setting a header to accept content of type application/json, utilizing the facility in WebAPI for content negotiation) will receive Json content formatter using the JsonNetFormatter class. However, if you want to just test this out in your browser, you will still get XML content. This is because a plan request from your browser is for type text/html, which translates to xml in the Web API universe. Though the Json will be returned automatically if you explicitly request json content (or if you use a function that requests this content type, like the $.ajax function in jQuery), if you want to test out the json in your browser, you will be out of luck using the standard configuration. To get around this, you need to set the JsonNetFormatter to support the "text/html" media type. This will allow it to respond to requests made from the browser (and since the JsonNetFormatter is now the first Formatter in the Formatters collection, it will be used by default). You can do this as follows:
    protected void Application_Start()
    {
        ...
    
        JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
        serializerSettings.Converters.Add(new IsoDateTimeConverter());
        var jsonFormatter = new JsonNetFormatter(serializerSettings);
        jsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        GlobalConfiguration.Configuration.Formatters.Insert(0, jsonFormatter);
    
        ...
    }
    ]]>
    http://ellisweb.net/2012/04/force-webapi-to-return-json-by-default-for-html-get-requests/feed/ 1
    Google Translating Search Queries on the Fly http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/ http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/#comments Thu, 01 Mar 2012 19:07:02 +0000 http://ellisweb.net/?p=532 Continue reading ]]> Where Does Google Chrome Store User History, Profile and Bookmarks. I had the good luck to be the first person on the Internet to post an answer to this question (even before Google did so in their documentation), just a few days into the original Chrome Beta release. The vast majority of hits come from Google searches that include one or more of the following keywords: Chrome, History, Profile, Bookmarks, Cookies, Save. I mention this because I saw something very interesting in my site stats today. Someone got to this page by searching for "שמירת סימניות בכרום". This is Hebrew for "Save Bookmarks in Chrome". If you searched for this term in English you would see a link to my post on the subject somewhere in the range of the 5th-10th link. However, they searched in Hebrew, and even so, a link to this post showed up (number 8 in the results when I tried it). So they must be taking the Hebrew, and while they are processing results in Hebrew, the search algorithm also translates it on the fly, searches on the term translated into English, and integrates relevant English results into the result set. This is very cool, and in a world where the bulk of technical literature and answers to questions like this are in English, it is very smart. There is a good chance that someone searching for this in Hebrew will still find an answer in English to be useful. Looks like the Google Search team still has a few tricks up their collective sleeve.]]> http://ellisweb.net/2012/03/google-translating-search-queries-on-the-fly/feed/ 0 Error Loading MVC 3 Project after MVC 4 is Installed or in VS 2011 http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/ http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/#comments Tue, 28 Feb 2012 12:29:44 +0000 http://ellisweb.net/?p=525 Continue reading ]]>
  • In the Solution Explorer, right click on the project that wont load and click on "Edit [ProjectName].csproj". This will open up the project definition file in VS. You can also edit this manually using your favorite text editor, opening the file through Windows Exporer.
  • Find the line in the file that starts with ProjectTypeGuids and remove the entry "{E53F8FEA-EAE0-44A6-8774-FFD645390401}" from the list (this is code that tells Visual Studio that it is an MVC 3 project - for some reason, including this in the project file after installing MVC 4 messes things up).
  • Save the .csproj. file and [Reload] the project through the Right Click menu in Solution Explorer.
  • The project should now load properly (if the MVC project has been the startup project for the solution, you may have to reset this as well).]]>
    http://ellisweb.net/2012/02/error-loading-mvc-3-project-after-mvc-4-is-installed-or-in-vs-2011/feed/ 2
    I Love it When Technical Book Authors Have a Sense of Humor http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/ http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/#comments Mon, 27 Feb 2012 20:27:40 +0000 http://ellisweb.net/?p=520 Continue reading ]]> Pro ASP.NET MVC 3 Framework by Adam Freeman and Steven Sanderson (@StevenSanderson) (Apress). Enjoying it so far - good technical writing, good level of detail mixed with useful examples of different implementation options. And most importantly, they have a good sense of humor. From Page 381 (my highlights):

    Quote from Pro ASP.NET MVC 3 (Sanderson & Freeman), page 381

    If you don't want to click on the link, they are talking about best practices for url schemas using MVC, and give an example of a link to Amazon as something not to do (I realize the irony of my linking to Amazon above). They then include in an aside:

    Note To be very clear, we have only the highest respect for Amazon, who sells more of our books than everyone else combined. We know for a fact that each and every member of the Amazon team is a strikingly intelligent and beautiful person. Not one of them would be so petty as to stop selling our books over something so minor as criticism of their URL format. We love amazon. We adore Amazon. We just wish they would fix their URLs

    .Another good one: The authors are talking about using MVC to create a REST API, where the same action name in a given controller can be overridden to handle HTTP Get/Post/Delete requests (page 476, my emphasis):

    Now each StaffMember entity in our application can be uniquely addressed using a URL of the form Staff/123, and a client can use the GET, POST, and DELETE HTTP methods to perform operations on those addresses. This is called a RESTful API, except by people who claim to be experts in REST, who will tell you that nothing is truly RESTful except their own code. (We joke—sort of).

    Gotta love it.

    ]]>
    http://ellisweb.net/2012/02/i-love-it-when-technical-book-authors-have-a-sense-of-humor/feed/ 0
    Crucible Code Review Wishlist http://ellisweb.net/2012/02/crucible-code-review-wishlist/ http://ellisweb.net/2012/02/crucible-code-review-wishlist/#comments Mon, 27 Feb 2012 12:41:52 +0000 http://ellisweb.net/?p=515 Continue reading ]]> Crucible Code Review software from Atlassian (halfway through the trial) with a number of teams in my department. The competition in this area is pretty sparse, and each one has its other issues:
    • Kiln only works for Mercurial (which we may move to some day, but for now we are using SVN so we need a solution that works with that as also)
    • Review Board seems to be very popular, but just looking at the list of the dependencies gives me indigestion when considering an install on our Windows Server environment.
    • Code Collaborator is way too expensive without giving much extra (50 users in Crucible = 00, 50 named users in Code Collaborator = ,450)
    • Code Review Tool doesn't have a very professional looking site, hardly any documentation and no plugin potential and no Mercurial support
    • Specatare's and Parasoft's websites are even sparser and gives almost no info (aside from a few screenshots) - not enough to make me spend the time trying it out.
    On the other hand, thus far Crucible has delivered on the main functionality: establishing a medium for easily performing code reviews. The price is very fair and there is very decent documentation. We will probably go with it, just for those reasons alone. That said, I have a number of issues with Crucible - posting them here in the hopes that someone from Atlassian will see this and can do something about some or all of them.
    1. Design: The marketing website is professionally designed, from a usability perspective. The software is not. It looks like I (or someone with their head in code all day) designed it. For new users, it is just not so intuitive to use. What is the difference between Source and Projects? Where do I need to go to get things done? Where are the important items? After spending some time, we can figure it out, but a better design would go a long way. If you need some hints, just check out Team City. They have figured this out pretty well.
    2. Installation: I was able to get it running on Windows Server with Sql Server as a backend, without too much pain (note: there was some pain involved). However, thus I am only able to launch it from the command line. Instructions for setting it up as a Windows Service did not work. If we end up purchasing a license, I will have to bite the bullet and get it working somehow. But this needs to be fixed. Both Team City and Fog Creek (and I am sure, many others) have figured out how to bundle the installation of a windows service into an Installation Setup routine. Please see to this (and for upgrades as well). Same with documentation relating to getting Crucible to bind to the domain name properly. I eventually figured it out, but more guidance around this could have been given (hint: HTTP bind to the IP address on port 80, set the Proxy Host to the domain name without "http://" and set the site url to the domain name with "http://").
    3. Repository Administration: A lot of little things here could be changed to make this easier (again, check out Team City - they have nailed this). Off the top of my head:
      1. Why can't I change the name of a repository after it has been created?
      2. Please give me some concrete examples about how Include/Exclude paths work in a repository. I want to use these but don't want to put in a couple of hours trying it out (especially when the only way to try it is to re-index the whole repository, something that can take a really long time).
      3. Why can't I create a new repository based off of the settings used in a different repository, or better yet, have one base repository root, from which I define other repositories based on their relative paths (like in TC)? We have one big SVN repository, and Crucible, our individual repositories are all subdirectories somewhere down from this root. Right now it is really annoying to create new repositories - this could be made less painful.
    4. Workflows & Permission Schemes: Bit of a learning curve here - so many options. Some more explanation and help with setting these up would be good. Maybe more default setups available out of the box. And the one preset Permission Scheme that was given (agile) was setup by default to make the contents and reviews of all associated projects public to all users, including users who have not logged in (not so cool).
    5. Better Notifications: Right now it is easy for notifications to get lost in the different dashboards. I want to be able to set up a way for notifications regarding certain types of SCM updates to be elevated in prominence. For example, let me give a path or pattern match within a repository so that whenever code is committed to this path, I will get some loud notifications about these. Or when a specific user commits code to a specific project. There are so many commits, that I am not always able to review every single one - this is something to strive for, but I am  not there yet. However, there are some areas in my projects (or some users) where I always want to review every line of code that they put in. I don't want to lose these in the haystack. Give me a way to do this better and I will be very appreciative.
    Looking at the market for code review software, it definitely seems like it is a third-class citizen, not getting as much attention as its bigger cousins in the realm of Continuous Integration or Bug Tracking (it is obvious even from looking at the list of different Twitter accounts used by @Atlassian, or the popular tags on their blog - Crucible or Fisheye are naught to be seen). Still, this lower status can also present an opportunity to really claim the mantle as the best in the business (and a note to competitors, existing or potential: not a high barrier to entry right now).]]>
    http://ellisweb.net/2012/02/crucible-code-review-wishlist/feed/ 0
    Horrible Page Design at JPost.com http://ellisweb.net/2012/02/horrible-page-design-at-jpost-com/ http://ellisweb.net/2012/02/horrible-page-design-at-jpost-com/#comments Sun, 26 Feb 2012 14:19:48 +0000 http://ellisweb.net/?p=507 Continue reading ]]> 20% of food purchases in Israel will be online. However, when I loaded the link, it took me a minute to actually find the content. Can you see the problem here? To make it a little bit clearer, I have added highlights - Ads are in yellow, In-site navigation is in green, and the content is in blue. The content occupies a tiny strip down the center of the page (maybe 30-40% of the total width of the page). This is surrounded on all sides several layers:
    1. The first layer has a set of Ads (Yellow - all advertising the same thing) and goes around the entire perimeter, switching vertical alignment to fit the ad into a narrow width going up each side (not to mention the completely irrelevant ad for investing in Brazilian agriculture - what is that about?). These are loud and completely distract the user's attention.
    2. The next layer is a mixture of ads (Yellow) and navigation links (Blue). The ads here are either irrelevant AdSense style ads, or ads from the Jerusalem Post advertising your ability to advertise on jpost.com (I wonder what the ROI is on that).
    3. The worst part though are the strips of internal navigation links going up and down either side of the page. They all relate to different subcontent areas of the site (things other than news) and each one has a very similar looking graphics. The overall affect is that the graphics make it hard to tell the difference between the different sections, and I am completely turned off from clicking here.
    Though these ads may add a bit of revenue in the short-term, in the long term the poor usability and design of this page will probably lead to lower traffic, shorter visits by users (in terms of both number of pages visited and overall time spent on the site) and fewer repeat visitors. It also reflects rather poorly on the professionalism of the site (and I would think that conveying an air of professionalism would be quite important in the online news-delivery market space). Fixing these problems would require:
    1. Rethinking the ad strategy for the site:
      • Do you really need those vertically aligned ads surrounding the whole page? What is that Brazil ad doing all the way out there? Are those AdSense style ads actually getting clicks? The ads should not distract users from the main purpose of the site. Doing so will not get you clicks, they will only end up annoying users.
    2. Smarter Navigation:
      • The navigation links that I would find the most useful (links to other news sections) are the least pronounced and emphasized links on the whole page. Make these easier to use.
      • Where are the tags? Links to similar articles? Links to most popular articles and most emailed articles? If I saw these, I might spend more time on your site?
      • Those ads going up and down each side of the content are totally useless. How about using a well designed expanding menu that can include links to all of these areas without taking up so much room and without being such an eyesore? And if you really have to see all of those links at once, do something about the graphics.
    3. Standards-Based Design:
      • Looking at the source for the site, it is a big mess. Definitely not built using web standards. Lots of table-based design. I imagine that this is very hard to maintain and does not play nicely on some or all mobile platforms. And that is not even starting with accessibility.
      • I have a fast Internet connection and I presumably located very close to the servers. Fully loading the page took about 25 seconds, and includes 37 HTML Get/Post requests, 20 separate CSS files, 104 different JS files, 119 different images - a total of around 290 separate requests. Total downloaded off of a fresh load: 2.5MB (imaging this on a slower connection). Reloading the page still took 240 requests and 19 seconds. This is just not acceptable. It is really bad.
    (To anyone at jpost.com who is reading this - I have nothing personal against you guys, and I do enjoy reading some of your content. But your site design is so poor, getting to the content is just too hard and too much of a strain on my eyes).]]>
    http://ellisweb.net/2012/02/horrible-page-design-at-jpost-com/feed/ 1