The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,722 other followers

Archive for March 1st, 2017

JavaScript. Sigh. No real RegExp support. Sigh. Google Search results. Sigh.

Posted by jpluimers on 2017/03/01

Prologue

Every time I need to use JavaScript there’s this tiny voice in the back of my head “Please don’t”, for instance because of

JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=.

Verify a URI in JavaScript with a Regular Expression using Google Search examples

This time it did it again: I used JavaScript. My need was to verify a basic URI in JavaScript, so I wrote this function based on RFC 3986 [WayBack] which in Appendix B has a nice regular expression: ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

function isValidUri(uri){
    var uriRegExPattern = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?";
    var uriRegEx = new RegExp(uriRegExPattern); 

    return (uriRegEx.test(uri));
} 

It would crash. But JavaScript is JavaScript, so even a site like JSFiddle wouldn’t show an error (later I found out that enabling the console on http://jsbin.com/wamavacuco/edit?html,console,output does show the error in the console complete with stack trace).

Read the rest of this entry »

Posted in Development, JavaScript/ECMAScript, JSON, RegEx, Scripting, Software Development | Leave a Comment »

Finding your way in the maze of Atom settings – awarding and frustrating at the same time

Posted by jpluimers on 2017/03/01

The main Atom menu allows you to change both Config and Stylesheet

The main Atom menu allows you to change both Config and Stylesheet

I’ve been using Atom as a text editor on Mac OS X for quite a while now, but never delved into the detailed settings.

Somehow, that version wasn’t the type of program that auto-updates itself, nor notifies the user of new updates (it only did that for outdated packages). This seems to be fixed for Mac OS X, but not yet for Linux.

So I hadn’t noticed my version was really old version, which meant that showing “Invisible” characters like spaces and tabs had a high opacity.

Since Atom is highly hackable, it wasn’t hard to find a solution for the old version, which involved changing config files (also accessible from the menu, see the screenshot on the right):

What struck me is that searching for this kind of information got me directed to solutions for old Atom versions. Apparently my Google-fu isn’t good enough, or Google has trouble estimating relevancy of Atom information.

What helped was looking at this poart of the config.cson file:

  editor:
    invisibles: {}
    showInvisibles: true

Back when searching,

The latter lead me to these interesting pages:

Read the rest of this entry »

Posted in Development, Software Development | Leave a Comment »

 
%d bloggers like this: