A non definitive list of 64 html escape characters for currency
I recently had to integrate html escape characters for currency symbols on a project, and much to my surprise I could not find any good definitive list html escape characters for currency codes. These are also known as escape characters, character entities or extended characters. I had to find them all more or less one […]
How to fix problems with ReSharper LINQ Intellisense
The Problem Resharper’s Intellisense, while generally awesome, does not find navigation properties in Linq statements The Cause: No Idea The Solution Switch back to Visual Studio 2012’s Intellisense, then go to Resharper > Options > Environment > General and make sure that the “Store Caches in the System Temp Folder Close and Reopen Visual Studio […]
How to create a Cron job with MySqlDump, and use GZip Compression
Full Disclosure: I am a long-term Microsoft Windows user and developer and I haven’t used any sort of Cron job in about 12 years, so all this was new to me. What is a Cron job? It’s just something that runs chronically, i.e. an automated procedure on the server that runs every day or hour. […]
How to programatically set the sql server database used by entity framework
The Problem: For one reason or another you need to set the database used by entity framework programatically. The more common way of doing such a thing is to set the database in your web.config class, but for whatever reason you need to set it in actual C# code. The Cause: There is no cause […]
How to make a random name generator in C#
I recnetly came up with a simple random name generator to do an initial seed of a database for testing using real names,a nd I thought I would share. Here is my NameGenerator.cs file. It’s fairly simple, it just picks a name at random out of the top 100 first names and the top 100 […]
How to use UI Hints and Display Templates in ASP.net MVC 3
Surprisingly there is very little information about UI Hints and Display templates for ASP.net MVC 3, so I thought I would share what I have learned. What are Display Templates? Display Templates are lovely features of ASP.net MVC 3 that allow you to have a common formatting for certain properties of your objects. For example, […]
How to do a cool flash notification message in asp.net mvc 3 in 6 easy steps
I pieced all of this together from various sources online, so the code is a bit rough, but here it is: 1. Create a partial razor view, call it _NotifyBar.cshtml, it contains this: @if (Request.Cookies[“NotifyBar”]!=null) { @Request.Cookies[“NotifyBar”].Value.ToString() X var c = new HttpCookie(“NotifyBar”); c.Expires = DateTime.Now.AddDays( -1 ); Response.Cookies.Add( c ); } 2. Put this […]
The most time-saving sql code I have ever written
photo © 2007 gnizr | more info (via: Wylio) I decided to update my JargonDatabase.com web property last month started to update define the user-submitted jargon terms. Much to my surprise users had submitted over 15,000 unique undefined jargon terms. Some of them were conceptual duplicates, like “whites of their eyes” and “the whites of their […]
How to prevent images and photos from being stolen your site
The Problem: You need to prevent people from saving images and photos that are featured on your website The Cause: There is no real solution to this – if you can see it online, you can copy it, but you can make it more difficult. The Solution: Insert this bit of code in your BODY […]
How to fix the copy file problem in C#
photo © 1918 National Library of Scotland | more info (via: Wylio)The Problem: You need to copy a file from one location on the server to another and cannot remember how. The Cause: It is too short and simple, and easily forgotten The Solution: Just use the following code: public static void CopyAndRenameFile(string OldPath, string OldFileName, string NewPath, string NewFileName) { if (File.Exists(OldPath + OldFileName)) { File.Copy(OldPath + OldFileName, NewPath + NewFileName, true); } } That’s […]