W3C Server Timing Header and API

I used custom headers in the past to send some metrics over to the client–mostly for debugging purposes to quickly differentiate between client and server issues on slow web request and/or web application performance.While that was working out pretty well I like standards and even if I did not tell anybody I always wanted such a thing built into HTTP.A W3C standard is on the way: Server TimingIt consists of a spec how the HTTP Header is constructed: And a client side API for JavaScript: Of course not all browsers support it yetBut Chrome 65–at the time of writing in the beta channel–does so:Even without any extra JavaScript you can inspect the numbers sent with the header in the Network tab of the DevTools:

JavaScript, Date and ISO 8601 part3

As there seems some confusion and issues with JavaScript dates (here and here) I wanted to have a look at google Chrome and its ES6 capabilities. So I opened the javascript-harmony setting, enabled it and restarted chrome. I opened up the developer tools and hacked some ES6: Running it on Chrome 55.0.2883.87 m: Meh! The web is broken and nobody cares… So far, so good, so what?

JavaScript, Date and ISO 8601 part2

I had a JavaScript date issue some time ago. Today I looked at the sources of ChakraCore and dug to the point of interest. // Compute the time value timeValue = TvFromDate(year, month, day, timePortionMilliseconds - utcOffsetMilliseconds); if (isLocalTime) { // Compatibility note: // In ES5, it was unspecified how to handle date strings without the trailing time zone offset "Z|(+|-)HH:mm". // In ES5.1, an absent time zone offset defaulted to "Z", which contradicted ISO8601:2004(E). // This was corrected in an ES5.1 errata note. Moreover, the ES6 draft now follows ISO8601. timeValue = GetTvUtc(timeValue, scriptContext); } DateImplementation.cpp line 990   Let's have a look at the ISO8601:2004. B.1.3 Date and time of dayCombinations of calendar date and local time Basic format Extended format Explanation 19850412T101530 1985-04-12T10:15:30 Complete Let's have a look at the EcmaScript 2015 spec at Date Time String Format ( If the time zone offset is absent, the date-time is interpreted as a local time. So as long as I'm running ES5.X Internet Explorer and Edge are wrong according to the EcmaScript spec. Which can be considered wrong according to the ISO spec and is corrected for ES6. <sarcasm>What a wonderful place the web is</sarcasm> I can understand somehow that Microsoft is not fixing this as it is for the old spec. So the next task is to see how the other browsers behave when forced to run ES6

If time is an issue, the lack of reading might be the root cause

Look at the following code:var x = new Date('2016-01-29T14:00:00'); console.log(x.getTime()); Running it in different browsers is surprising1454076000000 // Chrome | FF | Opera 1454072400000 // IE | Edge MDN says: The getTime() method returns the numeric value corresponding to the time for the specified date according to universal time. I repeat according to universal time! ECMA Script Spec says: Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC Pretty accurate. Let's change the code slightly by appending a Z at the end of the string being parsed as date: var x = new Date('2016-01-29T14:00:00Z'); console.log(x.getTime()); Here are the results:1454076000000 // Chrome | FF | Opera 1454076000000 // IE | Edge So it's definitely NOT the getTime() part that lacks. ECMA Script Spec says: The String may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the String. The function first attempts to parse the format of the String according to the rules called out in Date Time String Format ( If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Where the Date Time String Format ( says The value of an absent time zone offset is “Z”. I repeat Z, which is universal time! If only the IE/Edge team was able to read and understand the specs... HTH, Daniel

Why Microsoft's Browser Developer Tools suck

Ok, this is kind of a rant post. I acknowledge that Microsoft is really really doing a good job at certain (developer) spots (ASP.NET, Visual Studio, IIS, SQL Server, …). But NOT at the browser developer tools – I’m listing my issues here, hoping the IE-Team will listen and make the world better for everybody. Dev Tools Pinning Location Why can’t I pin the developer toolbar on the right side as in every other browser. Screens with 4:3 have gone. Widescreen is the standard. Pinning at the bottom makes no sense to me (in most cases). Edge IE11 Firefox Chrome Opera Open Developer Tools At Start Tab In Edge the ability to open developer tools is disabled … for whatever reason:   In internet explorer with about:blank this was possible… Q: So how can i network trace an initial request? A: Go somewhere else, Hit F12, then do what you originally wanted to do #this-is-not-intuitive Opera, Chrome, Firefox Explicit enablement of network trace (<Win10) Thank you for fixing that on Windows 10 – in IE11 on Win 8.1 it’s still disabled by default. Please offer an update for IE/<Win10. Initiator of network request (<Win10) Thank you for fixing that on Windows 10 – in IE11 on Win 8.1 it’s still shows <script> and not the specific script with line and char. Please offer an update for IE/<Win10. IE11.0.9600.18161/Win8.1 IE11.63.10586.0/Win10 Dockability of Tools Window Thank you for fixing that on Edge – In IE 11 the tools window cannot be docked with [Win] + [left|right]. Dark Theme FF developer edition does it. Chrome can do it. IE and Edge lack a dark theme, seriously. Call to action So c’mon Edge Devs. Make the web developers life easier. surprise us. you can do better!

Basta 2015

It felt great to be and speak at Basta! again. Thanks to the organization and the audience.Here are my slides and samples:Defensive programming, resilience patterns & antifragilityhttp://www.slideshare.net/lennybacon/2015-basta-2015-de-defensive-programming-resilience-patterns-antifragilityhttps://github.com/lennybacon/resilience-patterns-jshttps://github.com/lennybacon/resilience-patterns-tsJavaScript & Buildhttp://www.slideshare.net/lennybacon/2015-basta-2015-de-javascript-und-build

Code Snippets in IntelliJ

Code snippets can be helpful. Otherwise the can lead to code duplicates – so use them with wisely.In JetBrains IntelliJ the code snipptes are called Live Templates. They are stored in files saved in C:\Users\{UserName}\.IntelliJIdea{Version}\config\templates on Windows and ~/.IntelliJIdea{Version}/config/templates on Linux. To create a live template open IntelliJ and open the Settings from the File menu:In the Settings dialog you can use the search text box to quickly access the Live Templates section:Now just select the Language and use the green plus button on the upper right to add a new one (like the iife that I just added here).There is a special placeholders that can be used aside from variables:$SELECTION$The Edit variables button switches to enabled state as soon as you user a variable name in the code.

Batch processing Visual Studio ProjectItems with the Nuget Package Management Powershell Console

Today I helped a customer to minify and bundle a bunch of JavaScript files. We used WebGrease triggered from MsBuild to do the job. The next thing to do is changing the BuildAction property on all non-bundled-and-minified JavaScript files so that only minified and bundled files are published. Here is my script: Hope that helps