Online Tools Collection

March 23, 2017

Encoding / Decoding

Base64 Decode and Encode – Encode text to base64, decode base64 to text

utf8-decoder – Decode bytes and characters to Unicode character names

HTML entity encoder/decoder – Translate text into HTML entities

Punycoder – Punycode (IDN) converter

Unicode code converter – Convert Unicode text to code point values (hex, UTF-8, etc.)

Images

Favicon Generator – Create favicons from image

ICO Convert – Convert image to .ico format

Palettes and Gradients

Ultimate CSS Gradient Generator – Gradient with 2 or more colors, generates CSS including support for older browsers

CSSmatic – Gradient generator

Paletton Color Scheme Designer – generate palette with up to 4 colors from base color

Parsing

.Net Regex Tester

Online Collaboration

EtherCalc – spreadsheet

Advertisements

Adding SSL Wildcard Certificates to IIS Webs

March 21, 2017

As web browsers start to issue warnings on plain http websites if you are asked to input username/password, it’s time to add SSL certificates even on dev/test servers. We can expect more aggressive warnings in the future 😉

Apparently there is a way to create a self-signed certificate built into IIS (screenshot from Windows Server 2008)

iis create certificate

but this seems to create cerficates only for the host name, not for any domain hosted on the machine.

Back to square one, start up a current Linux machine, and make sure your openssl is newer than version 1.0.1f. (Remember Heartbeed?).

The instructions I found to create self-signed certificates are nearly identical (source, source, source)

openssl genrsa 2048 > my-host.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key my-host.key > my-host.cert
# make sure Common Name starts with "*.", e.g. *.my-host.com
openssl x509 -noout -fingerprint -text < my-host.cert > my-host.info
cat my-host.cert my-host.key > my-host.pem

For use in IIS, you need to create a .pfx from these certificate files:

openssl pkcs12 -inkey my-host.pem -in my-host.cert -export -out my-host.pfx

Copy the .pfx to your IIS machine.

In IIS Manager, select “Server Certificates” on the server node, click “Import…” to import the .pfx certificate.

Start up mmc, “File”, “Add/Remove Snap-in”, select “Certificates”, “Add”, “Computer account”, “Finish”, “OK”, (this click orgy shows you how important certificates were in 2008, as compared to Start/Administrative Tools/Data Sources (ODBC) 😉 ) and find the imported certificate(s) under

Console Root\Certificates\Personal\Certificates

Right-click each of them, select Properties, and make sure that the Friendly Name starts with “*.” for wild-card certificates. Otherwise, you cannot assign a host name for https web sites.

Back in IIS Manager, select each site you want to add https support, click Bindings, Add, select Type: https and select the wild-card SSL certificate. Only if the friendly name starts with *, you can/must set the site’s Host name. Click OK and you are done.

If you want your sites to redirect http to https automatically, make sure the Require SSL box is not checked in the site’s SSL Settings.

The minimal web.config to perform these redirects looks like this (source, source)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect-HTTP-HTTPS-IIS">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" 
            redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Be aware that while these steps enable https for your IIS sites, self-signed certificates still require the users to explicitly accept the certificates in their browsers, which will raise an “Unknown issuer” warning at their first visit.

Update: There also seems to be a Powershell way to do it 😉


Detecting Screen Orientation Change

May 2, 2016

Browsers provide different means to detect screen orientation:

Documentation in the Mozilla Developer Network (linked above) states the first to be deprecated but currently still in the WhatWG Living Standard, whereas its documentation on the latter differs from the W3C documentation.

According to documentation, detection of screen orientation change can be achieved by implementing handlers for the events

  • window.orientationchange
  • screen.orientation.change
  • window.matchMedia() listener
  • window.resize

but specific browsers may not support all of these events, with window.resize being the catch-all solution if everything else fails.

So based on SO answers and this blog and this blog I came up with a solution that currently seems to work, and a couple of findings:

  • window.orientation gives the angle on mobile browsers only – desktop browsers always contain 0 (zero).
  • Similarly, window.onorientationchange is only supported by mobile browsers.
  • screen.orientation (and its browser-spezific siblings mozOrientation and msOrientation) contains the angle in its angle property. IE11 does support support screen.orientation on Win7. Mobile Chrome (35) and the Android 4.4.2 Browser do not seem to support it either.
  • Of the browsers I tested, none seem to implement the event screen.orientation.onchange.
  • Orientation change can be detected using the window.matchMedia() listener on both mobile and desktop browsers which support mediaqueries and its orientation selector.
  • In desktop browsers, orientation can only be derived from $(window).width() and $(window).height(), or from the .matches property of a matchMedia listener.

Note that all this need not apply for older browsers, not even the values of window.orientation! (See SO, SO, SO, Giff’s note)

So here now is my JavaScript code for screen orientation change detection:

function doOnOrientationChange(src)
{
  if (window.console && console.log) 
    console.log("width " + $(window).width() + " height " + $(window).height());

  var orientation = { 
    angle: window.orientation,
    type: ("onorientationchange" in window) ? "mobile" : "desktop"  
  };

  if (window.screen) {
    var o = window.screen.orientation || window.screen.mozOrientation 
      || window.screen.msOrientation || orientation;
    orientation = { angle: o.angle, type: o.type };
  } else if ((window.orientation === 0) || window.orientation) {
    orientation = { angle: window.orientation, type: "" + window.orientation + " degrees" };
  }
 
  if (!("onorientationchange" in window)) {
    var w = $(window).width(), h =$(window).height();
    var a = (w > h) ? 90 : 0;
    orientation.angle = a;
    if (window.console && console.log) 
      console.log("angle := " + a + " " + orientation.angle);
  }
 
  var jsonOrientation = JSON.stringify(
    { angle: orientation.angle, type: orientation.type });

  switch(orientation.angle) 
  { 
    case -90:
    case 90:
      // we are in landscape mode
      $().toastmessage('showNoticeToast', src + ' landscape ' + " " + jsonOrientation);
      if (window.console && window.console.log) console.log(src + ' landscape ' + " " + jsonOrientation);
      $("#orientation").text(src + ' landscape ' + " " + jsonOrientation);
      break; 
    case 0:
    case 180:
      // we are in portrait mode
      $().toastmessage('showNoticeToast', src + ' portrait ' + " " + jsonOrientation);
      if (window.console && window.console.log) console.log(src + ' portrait ' + " " + jsonOrientation);
      $("#orientation").text(src + ' portrait ' + " " + jsonOrientation);
      break; 
    default:
      // we have no idea
      $().toastmessage('showNoticeToast', src + ' unknown ' + " " + jsonOrientation);
      if (window.console && window.console.log) console.log(src + ' unknown ' + " " + jsonOrientation);
      $("#orientation").text(src + ' unknown ' + " " + jsonOrientation);
      break; 
  }
}

$(function () {

  if ("onorientationchange" in window) 
    window.addEventListener('orientationchange', 
      function() { doOnOrientationChange("window.orientationchange"); });
  //window.addEventListener('resize', 
  //    function() { doOnOrientationChange("window.resize") });
  if (window.screen && window.screen.orientation && window.screen.orientation.addEventListener)
    window.screen.orientation.addEventListener('change', 
      function() { doOnOrientationChange("screen.orientation.change"); });

  if (window.matchMedia) {
    var mql = window.matchMedia("(orientation: portrait)");
    mql.addListener(function(m) {
      if (m.matches) {
        doOnOrientationChange("mql-portrait");
      } else {
        doOnOrientationChange("mql-landscape");
      }
    });
  }

  doOnOrientationChange("init");
});

(I put the window.resize handler into comments because it generates too may events on desktop browsers.)

In this sample code, detection change only causes output of angle and orientation type to

  • $().toastmessage() – a jQuery extension
  • console.log
  • $(“#orientation”).text() – a jQuery call

Of course, your handlers may perform some useful actions…


Compiled Spam

March 12, 2015

We encountered the unprocessed spam template nearly 2 years ago.

And now there’s the compiled processed spam comment, which seems to include every spam comment ever posted in just 1 comment. Hooray!

I’m excited to uncover this great site. I want to to thank you
for your time due to this wonderful read!! I definitely appreciated every little bit of it and i also have you saved as a favorite to look at
new stuff in your site.

May I simply say what a comfort to find somebody that genuinely
knows what they’re discussing on the web.
You certainly know how to bring a problem to light and make it important.
More and more people really need to check this out and understand this side of the story.
I was surprised that you’re not more popular since
you most certainly possess the gift.

Excellent post. I absolutely appreciate this site.
Continue the good work!

It’s hard to find knowledgeable people on this topic, however, you seem like you know what you’re talking
about! Thanks

You should take part in a contest for one of the best sites on the internet.
I will highly recommend this blog!

An intriguing discussion is worth comment. There’s no doubt that that you should write more
about this issue, it might not be a taboo matter but generally people do
not discuss these subjects. To the next! Cheers!!

Hello there! I just want to offer you a huge thumbs up for your excellent
information you’ve got here on this post. I will be coming back to your web site for more soon.

After I initially left a comment I seem to have
clicked on the -Notify me when new comments are added- checkbox and now
whenever a comment is added I get four emails with the exact same
comment. Is there an easy method you are able
to remove me from that service? Cheers!

Next time I read a blog, Hopefully it does not disappoint me as much as
this one. After all, Yes, it was my choice to read, nonetheless I genuinely thought you’d have
something helpful to say. All I hear is a bunch of moaning about something you could fix if you weren’t too busy seeking
attention.

Spot on with this write-up, I absolutely believe this
website needs a lot more attention. I’ll probably be back again to see more, thanks for the
information!

You’re so awesome! I do not think I’ve read through
something like that before. So good to discover somebody with some
unique thoughts on this subject. Seriously.. thanks for starting this up.
This website is one thing that is needed on the internet, someone with a little originality!

I love reading through an article that can make men and women think.

Also, many thanks for permitting me to comment!

This is the perfect blog for everyone who wishes to
understand this topic. You realize so much its almost tough to argue with you (not that I actually would want to…HaHa).

You certainly put a new spin on a subject that’s been discussed for ages.
Wonderful stuff, just great!

Aw, this was an exceptionally good post. Taking a few minutes and actual effort to create a great article… but what can I say… I put things off a whole
lot and never seem to get nearly anything done.

I’m impressed, I must say. Seldom do I encounter a blog
that’s both educative and entertaining, and without a
doubt, you’ve hit the nail on the head. The problem is something that too few folks are
speaking intelligently about. Now i’m very happy I came across this in my
search for something regarding this.

Oh my goodness! Amazing article dude! Thanks, However I am experiencing issues with your RSS.

I don’t understand why I cannot join it. Is there anyone else
having similar RSS problems? Anyone that knows the answer can you
kindly respond? Thanx!!

An outstanding share! I’ve just forwarded this onto a friend who was conducting
a little research on this. And he actually ordered me lunch
simply because I discovered it for him… lol. So let me reword this….

Thank YOU for the meal!! But yeah, thanx for spending time to talk about this matter here on your website.

After looking into a handful of the articles on your web site,
I honestly like your technique of blogging. I saved
as a favorite it to my bookmark website list and will be checking back in the
near future. Take a look at my web site too and tell me what you think.

This site truly has all of the info I wanted concerning this subject and didn’t know who to ask.

There’s certainly a lot to know about this subject.

I really like all of the points you made.

You have made some good points there. I looked on the web for additional information about the issue and found most people
will go along with your views on this website.

Nice post. I learn something totally new and challenging on blogs I stumbleupon on a daily basis.
It will always be helpful to read through articles from other writers and practice something from other websites.

I blog often and I genuinely appreciate your content. This article has really peaked my interest.
I’m going to book mark your blog and keep checking for new details about once a week.
I opted in for your Feed as well.

Pretty! This has been an incredibly wonderful post.
Thanks for supplying these details.

Greetings! Very useful advice in this particular post!

It’s the little changes which will make the biggest changes.
Many thanks for sharing!

Howdy! This blog post could not be written any better!

Looking through this article reminds me of my previous roommate!
He always kept talking about this. I will send this information to him.

Fairly certain he will have a great read. Thanks for sharing!

Howdy, I think your site could be having web
browser compatibility issues. Whenever I look at your web site in Safari,
it looks fine however, when opening in Internet Explorer, it has some overlapping issues.
I merely wanted to give you a quick heads up! Apart from that, wonderful website!

Having read this I thought it was really informative.
I appreciate you taking the time and effort to put this content together.
I once again find myself personally spending a significant amount of time both reading and commenting.

But so what, it was still worth it!

Hi there! I could have sworn I’ve visited this site before but after browsing through many of the posts I realized it’s new to me.
Anyhow, I’m definitely happy I stumbled upon it and I’ll be bookmarking it and checking
back regularly!

I want to to thank you for this very good read!! I certainly
loved every little bit of it. I’ve got you book-marked to look at
new stuff you post…

Hi, I do believe this is an excellent site. I stumbledupon it 😉 I am going to return yet again since i have book-marked it.
Money and freedom is the greatest way to change, may you be rich and continue to help others.

Your style is unique compared to other people I’ve read stuff from.
Many thanks for posting when you’ve got the opportunity,
Guess I will just book mark this web site.

I used to be able to find good advice from your blog posts.

Very good post! We will be linking to this great post on our website.

Keep up the good writing.

That is a very good tip particularly to those fresh to the blogosphere.
Simple but very accurate info… Many thanks for sharing
this one. A must read article!

I could not refrain from commenting. Perfectly written!

bookmarked!!, I really like your website!

Very good article. I am experiencing a few of these issues as well..

Way cool! Some very valid points! I appreciate you writing this write-up plus
the rest of the website is very good.

Great web site you have got here.. It’s hard to find
good quality writing like yours these days. I really appreciate people
like you! Take care!!

This is a topic that’s near to my heart…
Cheers! Exactly where are your contact details though?

I truly love your website.. Pleasant colors & theme.
Did you create this site yourself? Please reply back as I’m
attempting to create my own personal site and want to know where you
got this from or just what the theme is named.

Appreciate it!

I really like it when people get together and share thoughts.
Great website, stick with it!

Very good info. Lucky me I recently found your blog by chance (stumbleupon).
I’ve book-marked it for later!

This blog was… how do you say it? Relevant!!
Finally I’ve found something that helped me. Appreciate it!

Everything is very open with a clear clarification of the
challenges. It was really informative. Your site is
very useful. Many thanks for sharing!

I would like to thank you for the efforts you’ve put in penning this blog.
I am hoping to see the same high-grade content from you in the
future as well. In fact, your creative writing abilities has
motivated me to get my own, personal site now


Spam Bot Crawlers?

February 7, 2014

Spam alert again!

1) The famous unprocessed spam template finally reached my spam queue. At last!

2) some sort of blog crawler seems to crawl this blog and collect the URLs, such that some Russian film lovers get the opportunity to advertise

Лучшие фильмы!

Смотрите популярные фильмы

from various IP ranges.

Getting tired…


Googlebot POSTS – using jQuery

January 22, 2014

After I came up with the idea to log web application hits using jQuery, to my great surprise I found that Googlebot actually performs POSTs implemented as jQuery $.ajax() calls:

2014-01-15 09:46:04 POST /Log - - 66.249.64.45 
  Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) - 200 0 0 255

Wow!

Searching the Interwebs I found other people who observed this behavior, too:

Most importantly, the links in Wikipedia’s Googlebot article analyze the bot’s behavior in more detail:

The articles are about 2 years old, so the bot may now be even more capable than then.

Of course, the simplest solution to prevent bots from POSTing is to add the logger’s URL to robots.txt:

User-agent: *
Disallow: /Log

 


Follower Spam?

August 2, 2013

The internet gets stranger and stranger. After referrer spam, which I understand would only target blog admins, the latest trend is follower spam. Really?

celestineptixf@hotmail.com is now following devioblog

learzrzerv@hotmail.com is now following devioblog

kassandravrmxe@hotmail.com is now following devioblog

merilynvawwt@hotmail.com is now following devioblog

amparobbhae@hotmail.com is now following devioblog

annabellulxqy@hotmail.com is now following devioblog

caridljyq@hotmail.com is now following devioblog

vaniapuuqc@hotmail.com is now following devioblog

paigekllln@hotmail.com is now following devioblog

nevadaoisbg@hotmail.com is now following devioblog

valraoij@hotmail.com is now following devioblog

fletamzrlv@hotmail.com is now following devioblog

bobbiemcgfq@hotmail.com is now following devioblog

jamikazkzpi@hotmail.com is now following devioblog

jadaialfl@hotmail.com is now following devioblog

renegltwwcf@hotmail.com is now following devioblog

dedetdait@hotmail.com is now following devioblog

delorasmmdcj@hotmail.com is now following devioblog

celestineptixf@hotmail.com is now following devioblog

Wow, I really became popular only within a couple of hours! 😉