The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 1,854 other subscribers

Archive for the ‘Scripting’ Category

Chrome does not pick up on time zone changes until the browser is restarted. (via: pellepim / jsTimezoneDetect / issues / #57 – Wrong time zone using Chrome on Mac — Bitbucket)

Posted by jpluimers on 2014/02/11

Just got bitten by Wrong time zone using Chrome on Mac:

Chrome does not pick up on time zone changes until a new tab is opened or the browser restarted.

Actually, it requires a browser restart, as below is the difference between a new Chrome tab and running on jsc on the console: Read the rest of this entry »

Posted in Chrome, Development, Google, JavaScript/ECMAScript, Power User, Scripting, Software Development | Leave a Comment »

Mac OS X: How do you run JavaScript script through the Terminal? (via: Stack Overflow)

Posted by jpluimers on 2014/02/11

Now I have these aliases in my ~/.bash_profile:

alias jsc='/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc'
alias JavaScript='/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc'

Now I can use the WebKit jsc from the console.

Thanks User microspino – Stack Overflow for this answer: Read the rest of this entry »

Posted in Apple, Development, JavaScript/ECMAScript, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | 1 Comment »

Ready to cast: Chromecast now open to developers with the Google Cast SDK #interesting #fun (via: Chromium Blog)

Posted by jpluimers on 2014/02/03

With a more decent internet connection during our trip, it is time to catch up on some recent news.

The first that caught my eye was that the Chromecast API now is open to all developers.

Developer information is available through Casting Your Content to the Big Screen – Google Cast — Google Developers.

You need to pay a one-time USD 5 fee per development account (how’s that Apple?) for the Google Cast SDK Developer Console.

After that, you will have to register your Chromecast device(s) and custom or styled media receiver apps.

Interesting. Fun.

I hope this can be combined with the new Smart Mobile Studio 2.0 release or the Delphi for Android support.

Will get back on that as soon as I’m back home.

Resources:

More links:

–jeroen

via: Chromium Blog: Ready to cast: Chromecast now open to developers with the Google Cast SDK.

Posted in Chrome, Chromecast, Delphi, Delphi XE5, Development, Google, JavaScript/ECMAScript, Pascal, Power User, Scripting, Smart Mobile Studio, Software Development | 1 Comment »

idank/explainshell: explainshell.com – match command-line arguments to their help text

Posted by jpluimers on 2014/02/03

This is brilliant for learning *nix shell programming:

explainshell.com – match command-line arguments to their help text

explainshell is a tool (with a web interface) capable of parsing man pages, extracting options and explain a given command-line by matching each argument to the relevant help text in the man page.

It has open source code at gitub too: idank/explainshell.

–jeroen

Posted in *nix, Development, Linux, Power User, Scripting, Sh Shell, Software Development, SuSE Linux | Leave a Comment »

Downloading https urls from the commandline through cURL for Windows

Posted by jpluimers on 2014/01/27

Lately I moved more and more away from wget, mainly because out of the box, wget (and also aria2, which I like for the bittorrent support) handle https downloads so badly: you need to manually setup your CA store on each and every installed system.

Not so with cURL, especially not on Windows any more, as “recently” (that is: since the last time I examined it, which is over a year ago now), there is a new kid in town: cURL for Windows: a Windows Installer for the Web Transfer Tool.

You don’t even need to download the installer. Grabbing the stuff from the bin directory in the zip download is enough: it contains a prepackaged CA certificate set that works splendid.

So now downloading https://dl.google.com/update2/installers/ChromeStandaloneSetup.exe to the current directory is as simple as Read the rest of this entry »

Posted in *nix, Batch-Files, Development, Power User, Scripting, Software Development, wget, Windows | Tagged: , | Leave a Comment »

Read-Eval-Print-Loop with a twist: repl.it

Posted by jpluimers on 2013/12/26

Just found out about the repl.it site that allows you to do a Read-Eval-Print-Loop with 15 different languages running from within your browser.

Really: from within your browser. Your browser becomes a console “IDE” by first translating the language to JavaScript then executing it on the browser.

They have all their code in a Git repository, with at the root implementations of those languages.

There are only a few pages on the site to complement the “IDE”:

According to their @replit twitter feed they have been around since about September 2011, but there are still regular updates.

–jeroen

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

Different ways of sleeping/waiting in batch files

Posted by jpluimers on 2013/12/13

About a year and a half ago, I wrote about a Batch file to “Keep Alive” a CMAK generated VPN connection in Windows 7.

It uses ping to wait a certain amount of time, but it has the drawbacks of

  • requiring TCP/IP to be installed (which some headless systems don’t).
  • using N+1 as the number of seconds

Since then, I learned that since Windows Vista and up has timeout command that just waits:

timeout /t 600 /nobreak

Two parameters are used:

  • /nobreak
    does not stop waiting when you press a key
  • /t #
    waits # seconds

(the example is 10 minutes, I use it to regularly run FlushFileCache.exe or FlushMem.exe to empty the Windows file chache and release memory – often more than a gigabyte – back to Windows)

There is also sleep.exe, but that requires the Windows Resource Kit or Windows Server 2000/2003.

–jeroen

via:

Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows | Tagged: | Leave a Comment »

Windows batch files: How to set a variable with the result of a command (via: Stack Overflow)

Posted by jpluimers on 2013/12/11

One of the easy things in *nix is to set the value of an environment with the output of a command.

Something like this is possible in Windows too, but you have to instruct Windows to keep an empty set of delimiters to capture the full first line.

There is also a small but important difference between Windows and *nix upon command failure: *nix will always return an empty value, but in Windows you must make sure to empty the value first.

Thanks Jesse Dearing for this summary: Read the rest of this entry »

Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows | Leave a Comment »

Cyber-Dojo: practice unit-tested programming in pairs/groups using Katas

Posted by jpluimers on 2013/11/07

Wow, I’ve been living under a stone (:

Just discovered the online Cyber-Dojo by Jon Jagger. It is an online manifestation of a Coding Dojo. Both have been there for years, and I think both are brilliant.

They take the concept of a Dojo as being a place to practice sports like martial arts in a pair or group setting with a series of Katas or practices.

Katas in a Dojo are a means for performing deliberate practice in order to learn new things. For instance, acquire new movement techniques, learn about your balance, gain strength, all in both a physical and mental way.

The aim of both is do more deliberate practice.

When performing Coding and Cyber Dojo, you should use Test Driven Development using pair programming and BabySteps. Those help you to slow down, as one of the Dojo Principles is for Katas to slow down. It reminds me of the “if you are in a hurry, sit down” mantra and is a key part of the Coding/Cyber Dojo Principles too.

The aim is to learn, and part of that is to first un-learn and open you to new thoughts. That’s why it is so cool that the Cyber-Dojo provides you with:

  • a bunch of pre configured programming languages*,
  • preformulated practices** (including a few cyber-dojo refactorings),
  • a small boilter plate to get started.

You’d think they speed you up, but that is not their aim. Like a regular Dojo it gives you an pre-set environment and gives you piece of mind to get started.

The Cyber Dojo does without a Sensei, whose purpose in a Coding Dojo is to ask questions in order to guide the participants.

That’s why it is good to use the Cyber Dojo as part of a Coding Dojo: basically the Cyber Dojo provides a standardizes set of tools to quickly setup a Coding Dojo.

Cyber Dojo languages

(a prime number, so the table is a bit distorted)

C Go PHP
C# Haskell Perl
C++ Java-Approval Python
Clojure Java-Cucumber Ruby
CoffeeScript Java-JUnit Ruby-Rspec
Erlang Javascript

Cyber Dojo practices

Many of the practices come from rosettacode.org.

100 doors Harry Potter Print Diamond
Anagrams LCD Digits Recently Used List
Bowling Game Leap Years Reversi
Calc Stats Mine Field Roman Numerals
Count Coins Monty Hall Tennis
Diversion Number Names Unsplice
Fizz Buzz Phone Numbers Verbal
Game of Life Poker Hands Yahtzee
Gray Code Prime Factors Zeckendorf Number

–jeroen

via:

Posted in .NET, Agile, C, C#, C++, Development, Java, JavaScript/ECMAScript, Perl, PHP, Scripting, Software Development, Unit Testing | 3 Comments »

Interesting SO question: What are the experiences with using unicode in identifiers?

Posted by jpluimers on 2013/10/29

Toon Krijthe posted an interesting question to SO.

Though 5 years old, I think it stilll is very valid one:

At my work, we have decided to stay with the ANSI characters for identifiers. Is there anybody out there using unicode identifiers and what are the experiences?

For all projects I work on (in various Languages like  English, German, Dutch or other), I stick to ASCII characters (not even ANSI) for:

  • file names
  • identifiers

I also try to abstract the non-ASCII strings into places where I am sure that the encoding is preserved (for text files, I prefer UTF-8), or where these characters are properly escaped.

What is your take on this?

–jeroen

via: uniqueidentifier – What are the experiences with using unicode in identifiers – Stack Overflow.

Posted in .NET, Agile, AS/400 / iSeries / System i, C, C#, C++, COBOL, Continuous Integration, Delphi, Development, F#, Prism, Scripting, Software Development, VB.NET, Visual Studio and tools | 4 Comments »