The Wiert Corner – irregular stream of stuff

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

  • My work

  • My badges

  • Twitter Updates

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • 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,811 other followers

Archive for the ‘JavaScript/ECMAScript’ Category

Sending various HTTP request kinds using curl

Posted by jpluimers on 2017/07/25

I’ve been using cURL but always had a feeling not to its potential basically because the cURL man page [WayBack] is both massive and lacks concrete useful practical examples.

For instance, I knew about the --header and --verbose options (I always use verbose names even though shorter -H and -v exist) to pass a specific header and get verbose output, but the man page basic examples like this by Tader:

curl --header --verbose "X-MyHeader: 123" http://www.google.com

source: How to send a header using a HTTP request through a curl call? – Stack Overflow [WayBack]

There are some more examples at bropages.org/curl but they’re hardly organised or documented.

So I was really glad I found the below answer [WayBack] by Amith Koujalgi to web services – HTTP POST and GET using cURL in Linux – Stack Overflow.

But first note that recent versions (around 7.22 or higher) of cURL now need to combine the --silent and --show-error (or in short -sS) parameters to suppress progress but show errors: linux – How do I get cURL to not show the progress bar? – Stack Overflow [WayBack]

Back to the examples

Read the rest of this entry »

Posted in *nix, Communications Development, cURL, Delphi, Development, HTTP, https, Internet protocol suite, JavaScript/ECMAScript, JSON, Power User, REST, Scripting, Security, Software Development, TCP, TLS, XML, XML/XSD | 1 Comment »

Bash that JSON (with jq) — Librato Blog

Posted by jpluimers on 2017/04/18

 Glueing together APIs requires working with JSON: parsing it, extracting it, transforming it. JQ is a fast, lightweight, flexible, CLI JSON processor, that does the job well. Learn how to use it by getting your hands dirty with a JSON blob that represents the open issues in the public Docker GitHub repository.

Source: Bash that JSON (with jq) — Librato Blog [WayBackhttp://blog.librato.com/posts/jq-json

via: http://blog.librato.com/posts/jq-json – Joe C. Hecht – Google+

–jeroen

Source: http://blog.librato.com/posts/jq-json

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

Heroku Node.js in the cloud (free hosting!) – via: Smart Mobile Studio

Posted by jpluimers on 2017/03/28

Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.

Source: Cloud Application Platform | Heroku

via:

As mentioned in the first part, node.js was initially developed for the cloud. While there are enough paid hosting providers available, much nicer is of course to get it running for free! :). We will try to get our node.js server of part 2 up and running in the cloud…

Source: Server-side Node.js (part 3): Node.js in the cloud (free hosting!) – Smart Mobile Studio [WayBack]

Heroku is ideal for experimenting as their free plan allows for sleeping dyno instances that only get activated when there is a need for it (they sleep after 30 minutes of inactivity) and rain from the pool of 1000 free dyno hours per month.

See these links for more information

–jeroen

Posted in Development, Heroku, JavaScript/ECMAScript, Node.js, Scripting, Software Development | Leave a Comment »

Decode URLs from The Great Suspender after a browser restart fails to reload them

Posted by jpluimers on 2017/03/16

Hosted at: Decode URLs from The Great Suspender after a browser restart fails to reload them

Converts URLs like these:
chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=http%3A%2F%2Fwww.barryodonovan.com%2F2012%2F06%2F29%2Fmigrating-svn-with-branches-and-tags-to-git
back into
http://www.barryodonovan.com/2012/06/29/migrating-svn-with-branches-and-tags-to-git

Source below.

It decodes a URL encoded by The Great Suspender which is a cool Google Chrome plugin that suspends pages after some idle time.

The uncool thing is that when Google Crome restarts after a crash (it’s software, it does that, especially as it consumes truckloads of memory and is full of memory leaks) it often fails to restore some (but not many) of the suspended pages into a usable state: it shows only the encoded URLs.

–jeroen

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

node.js – a nightmare to get started. Did I try the wrong technology for my problem?

Posted by jpluimers on 2017/03/08

Most of my web-stuff is on Apache. Which works fine, has TLS/SSL enabled, etc.

But I wanted to do server-side JavaScript. Which somehow is a forrest without trees, or a nightmare to get started, especially on OpenSuSE.

First of all, virtually all examples explain how to run node as a script. But none explain where to save it, how to run it as a service (and restart when it crashes: it will crash) or how to run multiple sites under it. And the scripts seems to listen to a TCP port by themselves so they operate as a full server by themselves. Nice for a fully fledged portal, but not for some one-offs.

Some links below hopefully will get me re-started later on, but for now, I’ve given up: the out-of-the-box experience is totally non-intuitive.

Maybe what I really want is something else: I want JavaScript stuff that normally renders a page in the browser through the dom to run server side so I can run XMLHttpRequest to various places without bumping into CORS stuff but still render a page DOM.

If you know a better way to do what I want (serving small mostly single-page scripts written in an easy to debug/trace language) let me know.

So basically work around this:

XMLHttpRequest cannot load http://myApiUrl/login. No
'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'null' is therefore not allowed access.

Read the rest of this entry »

Posted in *nix, Apache2, Development, JavaScript/ECMAScript, Linux, openSuSE, Power User, Scripting, Software Development, SuSE Linux | 1 Comment »

 
%d bloggers like this: