Showing all posts tagged: 'JavaScript'

A 20-post collection

TypeScript 2.0 RC with Visual Studio Code

You know how much I love new, shiny things? For some odd reason, I'm compelled to try the latest and 'greatest' as soon as I know it's available. This, oftentimes, has inadvertent side effects such as breaking my machine and causing me undue stress. I also choose to do these upgrades/updates close to upcoming talking engagements. In summary, I'm a gluten for self-inflicted punishment. On the other side, I suffer so you don't have to :) Today, I decide to test the latest version of TypeScript 2.0 RC which was released only 2 days ago. I also chose to …[read more]

Render PDFs on the browser using JavaScript

Most browsers these days support PDF rendering. In some cases, you may also need a PDF plugin to be installed. But what happens if you need to render PDFs on a closed system with no access to 3rd party plugins? How do you ensure that your solution can work consistently cross-browser? I recently worked on a project where we had to integrate a PDF viewer on a “closed” web application and this presented a new challenge. And who doesn’t love a good challenge? The requirements for the PDF viewer were as follows: Should work cross-browser Should support modern(ish) …[read more]

Finding out Angular.js Form validation errors the easy way

Today I was having an issue with one of my forms misbehaving (or so I thought) while validating errors. The Submit button is disabled by default if there are any vaidation errors. But where are these errors coming from? Then I asked help from a friend (thanks Jon MacInnes) who showed me a very clever code snippet for figuring out what validation is doing on my form. If you, like me, have similar issues, just inject the following piece of code in your form and debug away Make sure you change the form name and the position to fit your …[read more]

Get URL parameters using JavaScript

This one will be quick and easy. I'm currently working on an Angular.js/MVC application and I need to grab the URL parameters from the current page. Simple right? Well not so much. Firstly, I'm not using ngRoute and, secondly, I don't want to use any other external library/utility. Just plain, old, vanilla JavaScript. How did I do it then? Parsing URLs with JavaScript I've created a simple method to manage this. The method is pretty straightforward. It takes a URL, parses the parameters with a bit of RegEx 'magic' and then returns an object with our parameters. …[read more]

SignalR cross domain with CORS

I've recently had to create a demo for a SignalR project I'm working on. SignalR is awesome when it comes to enabling real-time communications for your application. The amazing thing about SignalR, apart from how easy it is to use, is that it works across many different application types and platforms. You can use it on website, desktop apps and even mobile apps (both native and Xamarin). If you want to know more, have a look at the official website However, as with everything else, sometimes things don't work as you would expect them. SignalR is incredibly easy to setup …[read more]

Create Electron applications with Visual Studio Code

Visual Studio Code (VSCode) is by far my favourite editor. I've got nothing against Sublime or Atom, but the first one is not free and the second one tends to get a bit slow. I use all 3, in case you think of accusing me of favouritism, but my Go-To editor is VSCode. One of its biggest strengths is obviously the debugging experience. This week I decided to start rewriting my password application (PasswordDefence) with Electron. This will mean that once finalized, I will have a mobile and desktop presence and it also gives me a good opportunity to play …[read more]