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,862 other subscribers

Archive for the ‘Web Development’ Category

HTTP Prompt is an interactive command-line HTTP client featuring autocomplete…

Posted by jpluimers on 2017/07/26

HTTP Prompt is an interactive command-line HTTP client featuring autocomplete and syntax highlighting. Download url -> https://github.com/eliangcs/http-prompt – Joe C. Hecht – Google+

Source: HTTP Prompt is an interactive command-line HTTP client featuring autocomplete… [WayBack]

To me it looks remarkably similar to https://github.com/jkbrzt/httpie [WayBack] which too is a visual cURL replacement.

–jeroen

Posted in *nix, Communications Development, cURL, Development, HTTP, Internet protocol suite, Power User, Software Development, TCP, Web Development | Leave a Comment »

Fiddler2 direct download

Posted by jpluimers on 2017/06/06

For automated installs that cannot have UI interaction:

The install is “per user” as it is a user-local application; it installs in %LocalAppData%\Programs\Fiddler\Fiddler.exe.

Docs

Note that Fiddler acts as a HTTP proxy. When Fiddler starts, it hooks itself into the default WinINET proxy (which is used by any tool using the WinINET API, including Edge, Internet Explorer, Chrome, but not FireFox).

If you kill your Windows machine before stopping Fiddler, it cannot restore the WinINET proxy, so you have to do that by hand (otherwise you cannot browse web pages any more).

Manual restore:

  1. Run "C:\Windows\System32\rundll32.exe" shell32.dll,Control_RunDLL inetcpl.cpl,,4
  2. Press “LAN settings” (Dutch: “LAN-Instellingen”)
  3. Uncheck the proxy server checkbox “Use a proxy server for your LAN” (Dutch “Een proxy-server voor uw LAN gebruiken”)
  4. Confirm
  5. Close the control panel wizard

–jeroen

Read the rest of this entry »

Posted in Development, Fiddler, Software Development, Web 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


<!DOCTYPE html>
<!–
Resurrect
Based on 20160531-Google-Plus–403.-That’s-an-error.–Your-client-does-not-have-permission-to-get-URL–sorry–IndexRedirect–workaround.html
at https://gist.github.com/jpluimers/4f07a2f3f9b9890a3a44e184c1abadf2
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
url=http://www.barryodonovan.com/2012/06/29/migrating-svn-with-branches-and-tags-to-git
The Great Suspender Google Extension:
https://chrome.google.com/webstore/detail/the-great-suspender/klbibkeccnjlkjkiokjodocebajanakg
Test at http://jsbin.com/yukidaferu/1/edit?html,console,output
–>
<html>
<title>Decode URLs from The Great Suspender after a browser restart fails to reload them</title>
<body>
<h1>Decode URLs from The Great Suspender after a browser restart fails to reload them</h1>
<p>Please URL encoded by <a href="https://github.com/deanoemcke/thegreatsuspender&quot; target="_blank">The Great Suspender</a>:</p>
<input id="suspenderUrl" size="200">
<button type="button" onclick="decodeSuspenderUrlMethod()">Submit</button>
<div id="decodedUrlsCaptionDiv">
<p id="decodedUrlsCaption">Here you will see the decoded URLs so you can follow them:</p>
</div>
<ul id="decodedUrlsUl">
</ul>
<script>
// based on http://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_validate
function decodeSuspenderUrlMethod() {
var decodedUrl = "";
var errorText = "";
// Get the value of the input field with id="numb"
var suspenderUrl = document.getElementById("suspenderUrl").value;
var stripPrefix = "chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=";
var prefix = stripPrefix + "http";
// Am I a SO developer now? At least I'm quickly learning some JavaScript basics…
// http://stackoverflow.com/questions/1767246/check-if-string-begins-with-something/9430330#9430330
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/substring
if (suspenderUrl.indexOf(prefix) == 0) {
// now strip the bits we don't need, then decode what is left.
// I always wondered why they call it substring instead of subString
var googlePlusEncodedUrl = suspenderUrl.substring(stripPrefix.length);
// decoding got a new new a while ago: http://stackoverflow.com/questions/4292914/javascript-url-decode-function/4292961#4292961
decodedUrl = decodeURIComponent(googlePlusEncodedUrl);
} else {
errorText = "URL is missing this prefix: <<" + prefix + ">>";
};
// for now, just add the output; in the future, only add unique output.
// Based on http://stackoverflow.com/questions/5519747/how-to-add-anchor-tags-dynamically-to-a-div-in-javascript/5519795#5519795
var decodedUrlsUl = document.getElementById("decodedUrlsUl");
var decodedUrlLi = document.createElement('li');
if (errorText == ""){
var aTag = document.createElement('a');
aTag.setAttribute('href', decodedUrl);
aTag.innerHTML = decodedUrl;
decodedUrlLi.appendChild(aTag);
} else {
var aDiv = document.createElement('div');
aDiv.innerHTML = errorText + " " + suspenderUrl;
decodedUrlLi.appendChild(aDiv);
}
decodedUrlsUl.appendChild(decodedUrlLi);
}
</script>
</body>
</html>

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

Found as a byproduct of following +Jeroen Wiert Pluimers …

Posted by jpluimers on 2017/01/18

Found as a byproduct of following +Jeroen Wiert Pluimers …:

Found as a byproduct of following +Jeroen Wiert Pluimers
http://youmightnotneedjs.com/

Which is a cool site:

Examples of common UI elements and interactions with HTML and CSS alone.

Source: You Might Not Need JavaScript

–jeroen

Posted in CSS, Development, HTML, HTML5, JavaScript/ECMAScript, Scripting, Software Development, Web Development | Leave a Comment »

Contrast Rebellion – to hell with unreadable, low-contrast texts!

Posted by jpluimers on 2017/01/11

Contrast:

When making the contrast of the text lower and lower…designers need to think of

  • elderly
  • users with bad vision
  • low quality monitors
  • bad lighting and glare
  • reading on tiny screens

Source: Contrast Rebellion – to hell with unreadable, low-contrast texts!

–jeroen

Contrast Rebellion - to hell with unreadable, low-contrast texts!Low-contrast font color and unreadable texts? To hell with them!

Posted in CSS, Development, HTML, HTML5, Software Development, Web Development | Leave a Comment »

Fiddler for OS X Beta

Posted by jpluimers on 2016/11/03

–jeroen

Posted in Development, Fiddler, Software Development, Web Development | Leave a Comment »

A great way to interactively browse xml/xhtml/html on the console: xmllint –shell

Posted by jpluimers on 2016/10/12

A while ago, I heard about xmllint, a program that can parse and query xml from the command-line.

Later, I discovered it can also parse html, can recover from xml/html errors and has an interactive shell that has a lot of commands (see table below) to navigate through the loaded command.

The relevant command-line options:

--recover
--html
--shell

Note that --recover will output failing input to stderr. You can ignore that using 2> /dev/null

Some good examples of usage are here:

The table of shell commands:

Shell

xmllint offers an interactive shell mode invoked with the –shell command. Available commands in shell mode include:
Command Parameter Description
base display XML base of the node
bye leave shell
cat node Display node if given or current node.
cd path Change the current node to path (if given and unique) or root if no argument given.
dir path Dumps information about the node (namespace, attributes, content).
du path Show the structure of the subtree under path or the current node.
exit Leave the shell.
help Show this help.
free Display memory usage.
load name Load a new document with the given name.
ls path List contents of path (if given) or the current directory.
pwd Display the path to the current node.
quit Leave the shell.
save name Saves the current document to name if given or to the original name.
validate Check the document for error.
write name Write the current node to the given filename.

–jeroen

via xmllint.

Posted in Development, HTML, HTML5, Software Development, Web Development, XML, XML/XSD, XPath | Leave a Comment »

Convert HTML to Markup using CSS – Render HTML as unrendered Markdown – see http://jsbin.com/huwosomawo

Posted by jpluimers on 2016/03/02

Convert HTML to Markup using CSS:

–jeroen

Posted in CSS, Development, HTML, HTML5, Software Development, Web Development | Leave a Comment »

NTLM and Kerberos Authentication for a WebRequest and a WebProxy

Posted by jpluimers on 2016/02/16

This was very useful to get a WebClient with a WebProxy configured to use a proxy server that is based on NTLM authentication.

The note in the MSDN NTLM and Kerberos Authentication. documentation however was totally wrong.

String MyURI = "http://www.contoso.com/";
WebRequest WReq = WebRequest.Create MyURI;
WReq.Credentials = CredentialCache.DefaultCredentials;

Note NTLM authentication does not work through a proxy server.

This code works perfectly fine as the CredentialsCache.DefaultCredentials contains your NTLM or Kerberos credentials.
It even works when you have a local Fiddler http proxy as a facade in front of your NTLM proxy.

Read the rest of this entry »

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Fiddler, Software Development, Web Development | Leave a Comment »

Why Your Code Is So Hard to Understand – via CodeProject

Posted by jpluimers on 2015/09/29

Below are the captions, read the full article as it is very well written.

Why your code is hard to understand

  • Problem , Overly Complex Mental Models
  • Problem , Poor Translation of Semantic Models into Code
    • Class Structure and Names
    • Variable, Parameter and Method Names
    • Single Responsibility Principle (SRP)
    • Appropriate Comments
    • Problem , Not Enough Chunking
  • Problem , Obscured Usage
  • Problem , No Clear Path Between the Different Models
  • Problem , Inventing Algorithms

–jeroen

via: Why Your Code Is So Hard to Understand – CodeProject.

Posted in .NET, Delphi, Development, Software Development, Web Development | 5 Comments »