Scott Hanselman

Exploring cross-browser math equations using MathML or LaTeX with MathJax

June 24, 2014 Comment on this post [12] Posted in Tools
Sponsored By

Let me just start by saying that I got a C in Calculus. It just didn't click for me. I'm aces at basic math, but you lost me at limits. That said, I have always found MathML to be fascinating, and I'm surprised that even now over 15 years after MathML's first release that is has such minimal browser support. Other than Firefox, and surprisingly iOS Safari, there's basically no widely available native support.

Perhaps it's because MathML is, well, XML. You wanna express something simple like 2+2, except stacked up with a line? Here's that:

<mstack>
<mn>2</mn>
<msrow> <mo>+</mo> <none/> <mn>2</mn> </msrow>
<msline/>
</mstack>

That's rather verbose. Most math folks that I've talked to (including a very nice Stanford professor I met on a plane recently) use LaTeX to express Math. The professor I met edited whole academic papers in raw LaTeX and compiled them to PDF. He was surprised when I explained that he was a programmer but perhaps didn't realize it!

LaTeX looks like this, for the 2+2 example:

\(2+2\)

I'd show you some more complex MathML examples but it would get pretty crazy very quickly.

The landscape for writing equations easily online using either MathML or LaTeX is, from my untrained eye, rather chaotic, link-rotty, and messy. Many Math and MathML online resources are full of link rot or their apps have been forgotten. While looking for a MathML to LaTeX convertor I found four different sits that promised to deliver only to discover that their back end systems are gone.

It seems that there are two places online that are shining examples of online Math rendering and that's MathJax and Math.StackExchange.com. MathJax is "an open source JavaScript display engine for mathematics that works in all browsers" and Math.StackOverflow.com is well, StackOverflow for Math people. What's special about Math.SO is that it's integrated MathJax's fantastic library into it's main editor.

NOTE: Not all StackExchange sites have the integrated math preview due to the size of the libraries involves. It's not something that you just "throw in just in case."

Here's an example where I'm typing some LaTeX into StackOverflow's site. In this case, I'm using Chrome.

image

They are using MathJax's library here. I can right-click on the equation, and ask "show math as MathML" and get this popup:

image

How does MathJax manage all this without actual browser support for MathML (or LaTeX?)

You configure MathJax like this, telling it what to look for when doing inline math. Sometimes it's bracketed by $ and $ and sometimes by \( and \).

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
});
</script>
<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>

For Tex as in this example, MathJax is using HTML and CSS, generating the inline Math equations into a series of DOM elements.

image

When using MathML proper, you can configure MathJax to use native MathML rendering when it's available. Only FireFox really supports that. This page lets you switch between HTML-CSS using Web Fonts, MathML, or SVG. SVG looks a little rough to me, but HTML-CSS always looks nice.

image

Bottom line, if you have a need to express mathematical equations of any kind online, you're going to want to use MathJax. Love them, thank them, appreciate them.

NOTE via Wikipedia: The MathJax project was founded by the American Mathematical Society, Design Science, and the Society for Industrial and Applied Mathematics and is supported by numerous sponsors such as the American Institute of Physics and Stack Exchange.

Oh, and if you're English, "Maths."


Sponsor: Many thanks to our friends at Octopus Deploy for sponsoring the feed this week. Did you know that NuGet.org deploys with Octopus? Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Download Visual Studio Express

June 19, 2014 Comment on this post [32] Posted in Tools
Sponsored By

http://downloadvisualstudio.com

visual-studio-2013-logoYou liked http://downloadsqlserverexpress.com, so, here's http://downloadvisualstudio.com because I like you so much.

Here are the direct links to all the Express SKUs for Visual Studio. They are all completely free.

NOTE: I wrote this post on my own, and not as a representative of Microsoft. That's their copyrighted logo over there on the right, and these downloads are all Microsoft's.

MASSIVE UPDATE!

You're not going to believe this, but there is no reason for this post anymore! There is now a FREE and very complete (basically Pro) version of Visual Studio called Visual Studio Community. It even supports Visual Studio extensions!

No need for Visual Studio Express! Download the new "Visual Studio Community" NOW at http://www.visualstudio.com/free.

Seriously. I'll only keep these links up for a little while longer. Visual Studio Community is a single download and supports EVERYTHING you see below and LOTS more. It's better.

Visual Studio 2013 Express for Web

Visual Studio Express 2013 for Web provides the core tools for creating compelling, innovative web applications and services. This includes the ASP.NET editors for HTML5, CSS3, JavaScript, etc.

Visual Studio 2013 Express for Windows (Desktop)

Visual Studio Express 2013 for Windows Desktop enables the creation of desktop apps in C#, Visual Basic, and C++, and supports Windows Presentation Foundation (WPF), Windows Forms, and Win32.

Visual Studio 2013 Express for Windows (Store)

The tools include a full-featured code editor, a powerful debugger, a focused profiler, and rich language support that you can use to build apps that you write in HTML5/JavaScript, C++, C#, or Visual Basic. Visual Studio Express 2013 for Windows also includes tools for Windows Phone 8.0 development and Windows Phone emulators that you can use to test how your Windows Phone apps will run on different devices.

Microsoft Visual Studio Team Foundation Server Express 2013

Visual Studio Team Foundation Server Express 2013 is a source-code-control, project-management, and team-collaboration platform at the core of the Microsoft suite of Application Lifecycle Management (ALM) tools.

Hope this helps! All these links were dug out of http://www.visualstudio.com/downloads/download-visual-studio-vs with Fiddler.

Thanks to Tobias Schmidbauer for help with the Update 3 links!

Also, if you already have Visual Studio 2013, you might just want Visual Studio 2013 Update 3 (That's 2013.3)


Sponsor: A big thank you to my friends at Octopus Deploy. They are sponsoring the blog feed this week. Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Download SQL Server Express

June 17, 2014 Comment on this post [62] Posted in Tools
Sponsored By

There's a funny blog post about how to download SQL Server Express from Long Zheng. It surprisingly how complex some companies make downloading things. I've always thought that a giant Download Now button is the best way, but perhaps that's just me?

Downloading SQL Server Express is unnecessarily hard, and it's made harder by the new Microsoft Download Center "download multiple files" interface that doesn't include descriptions or primary file recommendations. It should be a list of links, and you should be able to right click and Save As.

Introducing http://downloadsqlserverexpress.com 
(this short link goes directly to this post)

SQL Server 2022 Express Edition (English)

SQL Server 2019 Express Edition (English):

SQL Server 2017 Express Edition (English):

SQL Server 2016 with SP2 Express Edition (English):

SQL Server 2016 with SP1 Express Edition (English):

I've done the HTTP sniffing and work, and written this blog post in the hopes that it helps you (and I'm bookmarking it for myself, for the future).

Download SQL Server 2017 Express

Download SQL Server Management Studio 17.3

Download SQL Server 2016 Express

*This release of SQL Server no longer bundles tools with SQL Server. Tools are a separate install.

Download SQL Server 2016 Management Studio (August 2017) - 17.2 

Download SQL Server Management Studio 17.2 Upgrade Package (upgrades 17.x to 17.2)

Download SQL Server 2016 Management Studio (June 2016 release)

*The installer works for both 32-bit and 64-bit machines and installs Management studio as well as command-line tools needed to manage SQL Server.

Download SQL Server 2014 Express

Download SQL Server 2012 Express

Download SQL Server 2008 Express R2 SP2

You can get back here via downloadsqlserverexpress.com. Tell your friends.


Sponsor: A big thank you to my friends at Octopus Deploy. They are sponsoring the blog feed this week. Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Thinktecture.IdentityManager as a replacement for the ASP.NET WebSite Administration tool

June 17, 2014 Comment on this post [13] Posted in ASP.NET | Open Source
Sponsored By

In ASP.NET 2005 (v2 timeframe) there was a web-based tool called ASP.NET Website Administration tool that folks could use the edit users and generally administer the ASP.NET Membership database. This useful tool was removed in 2012 and is still missed.

Since then, ASP.NET has introduced ASP.NET Identity and community member Brock Allen created IdentityReboot with some significant improvements and extensions. Brock Allen and Dominick Baier have gone even further and created Thinktecture IdentityManager. It's the beginnings of a nice bootstrapped replacement for the missing ASP.NET Website Administration Tool. It's nicely factored and supports both ASP.NET Identity and their alternative called MembershipReboot.

I cloned Thinktecture.IdentityManager and ran it under Visual Studio 2013.2. It's nice when projects just clone cleanly and build. You'd be surprised how often that's not the case.

Thinktecture.IdentityManager plugs into the ASP.NET middleware pipeline, so switching the sample host to use ASP.NET Identity rather than their alternative MembershipReboot was as easy as commenting out a line and adding a line as seen below.

public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseIdentityManager(new IdentityManagerConfiguration()
{
//UserManagerFactory = Thinktecture.IdentityManager.MembershipReboot.UserManagerFactory.Create
UserManagerFactory = Thinktecture.IdentityManager.AspNetIdentity.UserManagerFactory.Create
});
}
}

Just run it and you'll get a nice Bootstrapped interface for creating, editing, and deleting users from your Identity database.

Identity Manager

Here you can see those same users in the SQL database that ASP.NET Identity uses.

There's the users created in the identity database

The whole application is written as a Single Page Application with an ASP.NET Web API handling the backend with Angular.js on the frontend.. You could run this application as it's own site and lock it down, of course, or host it within your existing website at something like /admin.

Serving Embedded Assets

Unrelated to the core functionality of Thinktecture.IdentityManager, one cool piece of functionality worth noting is how they are storing the HTML, CSS and other resources as embedded resources inside the Thinktecture.IndeityManager.Core assembly. This is not something you'd necessarily want to do yourself, but considering that they've got a nice embedded "manager" that they'll want to plug into other websites easily without causing issues with file dependencies, it's quite clever.

Here's the static page controller:

public class PageController : ApiController
{
[Route("")]
[HttpGet]
public IHttpActionResult Index()
{
return new EmbeddedHtmlResult(Request, "Thinktecture.IdentityManager.Core.Assets.Templates.index.html");
}
}

Then later in EmbeddedHtmlResult:

public static HttpResponseMessage GetResponseMessage(HttpRequestMessage request, string name)
{
var root = request.GetRequestContext().VirtualPathRoot;
var html = AssetManager.LoadResourceString(name);
return new HttpResponseMessage()
{
Content = new StringContent(html, Encoding.UTF8, "text/html")
};
}

Then later, all the CSS and JS are handled by the ".UseFileServer()" extension from Microsoft.Owin.StaticFiles, and then Microsoft.Owin.FileSystems handles the mapping the whole of the /assets URI space over all the resources

app.UseFileServer(new FileServerOptions
{
RequestPath = new PathString("/assets"),
FileSystem = new EmbeddedResourceFileSystem(typeof(AppBuilderExtensions).Assembly, "Thinktecture.IdentityManager.Core.Assets")
});
app.UseFileServer(new FileServerOptions
{
RequestPath = new PathString("/assets/libs/fonts"),
FileSystem = new EmbeddedResourceFileSystem(typeof(AppBuilderExtensions).Assembly, "Thinktecture.IdentityManager.Core.Assets.Content.fonts")
});

It's nice and clean, and a cool reminder about what you can do with a nicely factored system and a decent middleware pipeline.

A bright future

If you've got a ASP.NET system and are looking for a flexible and simple web-based administration tool for your Identity system, you should totally check out Thinktecture.IdentityManager. It looks like the team is gearing up for the possible release of this project as NuGet, so may have that to look forward to as well!

Remember that when people create cool projects like this, they are often doing this as volunteers out of the kindness of their hearts. They are often looking for feedback and comments, sure, but also validation of their idea as well as help. Open source help can come in the form of Pull Requests, Bugs and Issues, Documentation, Build Servers, and more. Head over and "star" the GitHub Thinktecture.IdentityManager project, and check it out!

Related Links


Sponsor: A big thank you to my friends at Octopus Deploy. They are sponsoring the blog feed this week. Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

UPDATED 2014: How to setup CrashPlan Cloud Backup on a Synology NAS running DSM 5.0

June 12, 2014 Comment on this post [57] Posted in Tools
Sponsored By

My backup planI still have a Synology 1511+ NAS and I still think it's lovely. I recommend Synology NAS's but I recommend ones with an Intel processor as I feel the ARM versions are underpowered. I run Plex on my Synology and while I've had a few small issues, I love it also.

Back in 2012 I wrote a post on How to set up CrashPlan Cloud Backup headless on a Synology NAS - Backup Strategies. If you are running a 4.x version of the Synology DSM software, read that post.

Since then however, Synology has upgraded it's main OS to "DSM 5.0" or greater and Java 7 can run on Synology. I've had some hassle getting my newly upgraded Synology running CrashPlan so here's a new writeup for DSM 5.0+ for 2014.

Remember, any good backup strategy follows the Backup Rule of Three.

  • 3 copies of anything you care about - Two isn't enough if it's important.
  • 2 different formats - Example: Dropbox+DVDs or Hard Drive+Memory Stick or CD+Crash Plan, or more
  • 1 off-site backup - If the house burns down, how will you get your memories back?

Step by Step: How to run CrashPlan on your Synology NAS with DSM 5.0

This gentleman at PCLoadLetter has prepared excellent packages that make it MUCH easier than before to get CrashPlan running on your Synology. However, his instructions assume a some technical ability and also require reading a LOT and visiting several pages within his site. It took me about an hour to really understand what was being said. Here's my simplified version of How To get CrashPlan on your Synology.

 

1. TURN ON THE "USER HOMES SERVICE" ON YOUR SYNOLOGY

Log in to your Synology from a web browser. Mine is http://server. Go to the Control Panel, then User, then User Home and click "Enable User Home Service." This will give the future "crashplan" user a "place to live."

Enable user home service

2. ADD HTTP://PACKAGES.PCLOADLETTER.CO.UK AS A NEW REPOSITORY IN THE SYNOLOGY PACKAGE MANAGER

On your Synology, from the web browser, go to the Package Center, then Settings, then Package Sources. Add http://packages.pcloadletter.co.uk as a new repository. I named it "PC Load Letter" but it doesn't matter.

image

3. ADD THE JAVA MANAGER

In the Package Manager, type Java, and install the Java Manager.

image

On your main computer (not the Synology) head over to www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and download a "tar.gz" of Java. Get the right one for your system. I have an Intel x86 so I got the "i586" package.

Today (June 11th, 2014) I downloaded jdk-7u60-linux-i586.tar.gz but yours may have a newer number like "7u61." Now put that Java archive in a folder. Don't lose it.

Back on the Synology, go to the Java Manager and Install Java. From this dialog select the file you've just downloaded. It actually tells you all this on the dialog, too.

image

When you're done, Java Manager will look something like this.

image

4. INSTALL THE CRASHPLAN PACKAGE ON YOUR SYNOLOGY. STOP IT AND RESTART IT.

Staying in the Package Manager, go to Community, and search for Crash. Community is where "Other Sources" feeds into.

image

Once it's installed, wait a minute to two for it to calm down, then stop it, and start it again. It should look like this.

image

Click on View Log to confirm it's running.

image

Your log will have less stuff in it if you haven't configured CrashPlan from a client yet.

Remember this installation is *headless* so you'll need to connect to the Synology from a CrashPlan "client."

5. INSTALL THE CRASHPLAN CLIENT ON ONE OF YOUR MAIN COMPUTERS.

Go download and install the right CrashPlan client for you. After you've installed it, you'll need to POINT the client to your Synology.

You need to edit the "C:\Program Files\CrashPlan\conf\ui.properties" text file and put in the IP address of your Synology. My Synology is called "SERVER" so I opened a command prompt and typed "ping server" and was told its address is 192.168.1.18. I needed to run my notepad as administrator to edit this file.

    • NOTE: This is a Linefeeds only Linux text file so you'll want to use Notepad2 or something OTHER than Notepad so you don't corrupt this file. Make a copy.

Pointing ServiceHost to the right place

6. HOW DO YOU KNOW IT IS WORKING?

Run CrashPlan on your main computer to ensure it's successfully talking to your Synology.

  • You should see your Synology's name on the Settings Dialog
  • You should see CrashPlan Central in your Destinations if you have a CrashPlan subscription
  • You can select your files that exist on the Synology from the CrashPlan application on your main computer. Remember this CrashPlan client talks to the headless service running on your Synology.
  • You will likely have to sign into the CrashPlan client. When I did, even though I'd uninstalled and re-installed CrashPlan, it recognized I'd backed up before and it re-sync'ed over an hour. I didn't have to back everything up again!

The initial backup will likely take a LONG time so be patient - like for days or weeks. I am choosing not to backup super-large files like DVD backups, 60 gig VMs and other things. My #1 concern is family photos and personal files.

image

You can get CrashPlan+ and do one computer, or get CrashPlan+ Family and do up to 10 computers.

If I've made any mistakes here, do let me know in the comments and I'll update the post!

UPDATE July 2015: If you are having any issues with upgrades and CrashPlan 4.3, there may be some manual work you'll need to do. http://chrisnelson.ca/2015/07/02/fixing-crashplan-4-3-0-on-synology/ 

Related Links


Sponsor: A big welcome to my friends at Octopus Deploy. They are sponsoring the blog feed this week. Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.