DIY Guides for AWS

These how-to guides that will help you start an create a simple and cheap server solution that will cost around $20/month. These guides includes:

  • Introduction
  • Domain Name
    • Purchase
    • Configuration (DNS)
    • Transfer from GoDaddy
  • Create and configurure your personal virtual server
    • Remote desktop access
  • Hosting web sites / apps on a virtual machine (Windows Server / IIS)
  • Configure your first small business or personal web site
    • WordPress
      • PHP
      • MySQL
  • Host ASP.NET Web Application
    • IIS
    • SQL Server
  • Send-Receive Emails
    • Outgoing (local smtp / IIS), using:
      • Integrated Windows SMTP Relay Service IIS
      • or hmailserver (preferred)
        • Configuring DKIM for hmailserver
      • or AWS SES (Simple Email Service)
    • Outgoing alternative
    • Incoming (MX, txt, spf, pop, accounts, catch-all, …)
  • SVN Server
  • FTP Server
  • Network and Security
    • Firewall
    • private and public IP
  • Monitoring
  • Troubleshooting
  • etc

You can get all that running, for about $20/month, on a EC2 T2.Micro Virtual Machine.

Let’s begin with…

Getting Started with Amazon AWS.

how-to fix “usb read error” on toyota mp3 player

I have a 2012 Toyota Yaris, that can play mp3 / aac audio files from an USB key.

So, I bought a 128G usb key, load it with my audio files on it, and it works fine for months.

Then, I decided to update the usb key with new songs. Before copying my files to it, I format it using Windows format utility. Then, I copy all my new mp3 files on it.

And now, what? I can’t read them! My car player always displays the “USB READ ERROR” message. I thought I put too much files on the USB key, so I tried with only 1 album, with the same result.

After lot of research, I found that, using the windows format tool, I changed the original “FAT32” partition, to a exFAT partition type. And, most car player can’t read that partition type.

So, I tried to format it using the command prompt: “format f: /fs:FAT32”. It took almost 1 hour, before completing with the error: “The volume is too big for FAT32”. I tried the “/q” method before, with the same result. That’s why I retry without the /q, but don’t lost your time, it doesn’t work.

I searched again… then I found that, only third party apps can format a large USB key with the real FAT32 format. There were lot of tools that can do that, but I choosed the one that looks the more simple, as I don’t always trust apps from unknown sources…

The app I used is this one: FAT32 guiFormat from Ridgecrop Consultants.

It was just simple, nothing to setup, and does the job perfectly.

I was able to copy all my mp3-aac, and now my can read read them!

Now, I strongly suggest you to make them a donation on their web site if you like this tool.

How to revert “low blue light” mode on Benq monitor

I just got 2 new Benq monitors. One 24 inch GW2470 set as landscape, and a GW2765 set as portrait mode. They are wonderful on my desktop! And that portrait mode will help me develop web apps with the “developer mode” visible in the bottom of the screen.

I really like the low blue light feature, specially in low light environment like a small room, when there’s no other lights over or behind me.

There a “quick action” button that allow to choose between 4 type of “low blue light” preset.

The level of blue light is not the same on both, so I set the first one at 30%, but I did not set it on the second one, as the white level is not as strong as it is on the first screen.

But now, how can I reset that blue light mode ?!?!? As you see in the previous picture, we can choose between 4 modes, but there’s 1 missing: “DISABLE”! Once you set it, it looks like you have to keep it forever!
I searched the web and found some people having the same issue, and their solution was to “reset all settings” in the menu.

But, there’s a better method, for those who can read the manual!

Go in the menu, then select “Picture Advanced”, and “Picture Mode”. There, you will see that “blue light” is one settings between others. You can then move to “standard”, “movie”, … So, the 4 blue light settings are sub-items of the “blue light” picture mode!

That’s it! enjoy your new Benq monitors.

How to use jQuery “$” in WordPress

If you add javascript into WordPress, you will certain try execute some jQuery functions sooner or later.

And, you will get an error telling that $ is undefined.

I think that jQuery embedded into wordpress do not declare the “$” variable, as it may confuse some users with all the $ server-side variables from PHP.

All jQuery functions can be run using “jQuery” variable instead of “$”.

But, if you want to use “$” as you did before, be warned that just typing:
$ = jQuery;
can interfere with some existing functions that may use the $ variables for other purposes.

So, what I propose is to encapsulate all your functions inside a self-called function like this:


You put all your code inside that function, the “$” is available, and it doesn’t interfere with all other code.

Best MySQLdump options

I recently had to configure an automated backup procedure for MySQL databases, related to wordpress sites.

I am a long-time user of MS SQL Server, so I was surprised to find that there is no “binary” option of MySQL backup, only text script version.

Then, I quickly found that MySQLDump is what I need.   So, I start using it as-is, without any doc reading.  

mysqldump --all-databases > backup.sql

Finally, to make sure it works fine, I tried to restore it.

My first surprise was to find lot of invalid data in my backup!  What?

Then, I learned that mysqldump, by default, is NOT set to backup everything the correct way.

Because I use some wordpress plugins that store their data into “blobs”, I need to add this very important option: 


In fact, I don’t understand why it’s not included in the default --opt option, as it MUST be used to get blob correctly backed up.

Also, I read at some places that I should use the --opt settings, because it enables all of these: --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset

But, you don’t need to, as –opt is a “default” option automatically applied when you run mysqldump.exe.

Now, is there others options I need to enable to make sure I backup everything?  Yes, I found 3. And, mysqldump give us warning to enable them if we need to get a full backup!  So, once again, why aren’t they enable it by default?

These options are: –routines, –events and –triggers.

In some versions of mysqldump, using “–all-databases” automatically enabled the --routines and --events, but not if you backup 1 single database.  And, in the version 8+, these options are NOT set by default.

So, don’t take chances, add them.

One last thing: If you want to avoid problems with file encoding, I suggest to use --result-file=filename.sql, instead of > filename.sql, to prevent different encoding between systems.

Finally, the backup options I use are: 

mysqldump.exe --defaults-extra-file=config.txt --all-databases --hex-blob --routines --events --triggers --result-file=backup.sql

The “–trigger” option is ambiguous.  The documentation (5.7 / 8.0) say it is enabled by default, but if you don’t add it, the warning message suggests to add it.  So, don’t take chances, just add it.

The --defaults-extra-file= is used to set my host / uid / pwd in an external file.

How to make your server-side javascript code private in IIS

You learned that you can use Server-Side Javascript mixed in our ASP Classic VBScript application.

Next, you want to create tons of javascript files, and mix them with your old ASP. You can name them “.asp”, or “.inc”, like you did with your old VBScript files.  But, what about using intellisense in a standard editor from these extensions?

The best way to use intellisense in your favorite editor, like Visual Studio Code or anything else, is to name these files with the .js extension.

But, there’s a security issue.  If you name these files like that, they should be returned to your client in plain text if called from a web browser.  You don’t want your server-side code to be exposed through IIS.

What you need to do, is just put all these files in a specific folder, in which you will disable all IIS handlers, by using the following steps.

  1. In your application root, create a folder called private.
  2. In that folder, create a web.config file, and add this content:
    <clear />

You can now add all your server-side JS in that folder, and they will private to your ASP code.

If you call that js file in the browser, you will get a 404:

From your ASP page in the root, include them like this:

<script runat="server" language="javascript" src="private/code.js"></script>

That’s all! Happy Coding.

How to use Try Catch in ASP Classic

The worst part of Classic ASP in VBScript is Error Handling.

You need to type “on error resume next”, then, check, on every line, check if the previous one generates an error using [If Err.Number <> 0 then …]. That’s a real pain.

When you need solid error handling inside an ASP – VBScript sub or function, there’s a very simple method you can apply.

Just turn your existing error-handling-needed function into JavaScript, and use Try-Catch!
What? Javascript in ASP Classic?
Yes you can! It’s called JScript, it’s ECMAScript 3 compatible, and it just works.

Also, it’s totally compatible with your existing VBScript application, that will be able to call that JS method without any issue.  Even all your application VBScript variables will be shared between VB and JS.

100% VBScript file:

function fct1
	fct1 = true
	on error resume next
	' do something that can crash
	dim i : i = 1
	i = i / 0
	if err.number <> 0 then
		fct1 = false
		response.write err.number & "<br>"
		response.write err.description & "<br>"
	end if
	on error goto 0
end function

sub sub1
	dim value : value = fct1()
	response.write "result: " & value
end sub

call sub1()

Now, the same, using mixed VBScript/ Javascript

<script runat="server" language="javascript"> 
function fct1(){
		// do something that can crash 
		var i = 1;
		i = parseINT(i); // <- typo
		return true;
		return false;
sub sub1
	dim value : value = fct1()
	response.write value
end sub

call sub1()

Now, go and start converting your Classic ASP functions in JavaScript!
Just, watch out as JScript is case sensitive, VBScript is not.
vb: response.write "txt"
js: Response.Write("txt");


How to mix Classic ASP and Server-Side Javascript

Sometimes I need to fix some old Classic ASP applications or add small new features to them.

Because I do Javascript or C# every day for new apps, it hurts to get back to VBScript for these old apps!

That’s why I try to do these using Server-Side Javascript instead.  But wait, how can I mix NodeJS and VBScript?  The answer is, you can’t.  But, there was Server-Side JS before NodeJS exists!

Now, look at this.

You have a ASP Classic site like this:

<% dim product : product = "apple"
response.write product %>

And you need to create a new function to get the product name.

But, you don’t want to do it in VBScript, because you prefer JavaScript.

All you need to do is to create an “include” file, in pure javascript, like this:

function getProduct(){
	var product = "apple";
	return product;

And, add it to your existing ASP file:

<script runat="server" language="javascript" src="" ></script>

Finally, you can fix your existing code like this:

<% dim product : product = "apple"
response.write getProduct %>

Yes, the VB code can call JS function directly.
Also, your JS code can also use already existing VBScript functions and variables.

IIS can run Server-Side Javascript since 1997

When I read articles about NodeJS, they almost all consider NodeJS like if Ryan Dahl invented Server-Side Javascript.

But, did you know that, in IIS 3.0 on Windows NT 4.0, it was possible to run server-side javascript?

On May 15, 1997, Microsoft released the Service Pack 3 of Windows NT4, introducing Active Server Page technology (ASP).

Classic ASP was built to run Active Script.  VBScript AND JScript are the first Active Script languages developped, and were included in all versions of Windows since 95.  And, that “Jscript”, can be used to run server-side javascript.

Wait, JScript is not JavaScript?  Yes it is. Just another name.  FireFox 1.0 run something named JavaScript 1.5, and IE6 run JScript 5.0  And, both were, in fact, ECMAScript 3.0. (more info)

That said, it means that if you still need to work with Classic ASP application, to maintain old software that can’t be rewritten, you can write some JavaScript to do that.  And, it is totally compatible with existing VBScript app!

Now, look at this sample of a 100% server-side javascript in an classic ASP file.

I’ll show you, in another article, how you can add some javascript in your existing Classic ASP / VBscript application.

How to change the default Log Files location for Filezilla Server

When you enable Logging in FileZilla Server, there’s no option in the configuration to change the location of these files.

By default, you get them in this folder:
C:\Program Files (x86)\FileZilla Server\Logs

As they say in their documentation, “This location cannot be changed.”

In my case, I like to get all my logs at the same place, e.g. d:\logs, where have all my iis, smtp, hmailserver, … log files.

So, why can’t I get filezilla logs too?

There’s a solution, just follow these steps.

  1. Stop Filezilla Service
  2. Open a command prompt, as admin.
  3. Go to C:\Program Files (x86)\FileZilla Server\ folder.
  4. Rename “Logs” to “Logs2”, (or just delete it)
  5. Type: “mklink Logs m:\logs\filezilla /d”
    1. (replace m:\logs\filezilla with any folder you want)
  6. Restart FileZilla Service

That’s it, Filezilla Server thinks that the local folder exists, but it is located elsewhere!

Useful url rewrite rules for IIS

These are some rules I use in IIS to make all my web sites works as expected.

What I need to automate in all site:

  • Remove prefix “www.”
  • Redirect “http” to “https”, as http will soon disappear, thanks to LetsEncrypt.

Also, for very simple static sites, I want to make all pages respond to the same fixed static page, and get no 404.

You can do that without any code, when using the IIS Rewrite extension.  You first need to install the extension to your existing IIS configuration. (link)

This is an example of my IIS configuration:

  • Site 1: “”
  • Site 2: “”
  • Site 3: default (ip binding)

Bindings strategy

The first strategy can be to add these rules to all your sites, one by one.
Exemple for site 1, these are the 4 bindings configuration:


If you set your IIS bindings like that, you need to add the rewrite rules to all your sites, one by one.

But there’s another simple strategy that I prefer, by using a “default” site on IIS.
On the first and second sites, I only set the “final” binding, e.g. and, both on port 443 without www.

On the “default” site, I configure the bindings to respond to all other requests on my public IP address.

That way, I only need to add the redirect rules on the default site, as the redirection will be handled by the redirected site after.

IIS Rewrite Rules

First rule: Remove www prefix.

<rule name="Remove www" stopProcessing="true">
 <match url="(.*)" ignoreCase="true" />
 <conditions logicalGrouping="MatchAll">
  <add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
 <action type="Redirect" url="https://{C:1}/{R:0}" redirectType="Permanent" />

Second rule: redirect http to https

<rule name="Redirect to https" stopProcessing="true">
 <match url="(.*)" />
  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
 <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" redirectType="Permanent" />

The third rule can be set to all sites, and is used to get a fixed page always responding, without 404.

<rule name="Default page" stopProcessing="true">
 <match url=".*" />
  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 <action type="Rewrite" url="index.html" />

Finally, you can add the “canonical” meta on that page to make robots index only 1 page, not all possible url.

<link rel="canonical" href="" />