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 generate a strong password using Google Chrome

There’s a good password generator embedded into Google Chrome. It appear when you create a login in the “input type password” fields.

But, if you need to generate a password for something else, e.g. mysql database user, there’s no way I found to use it from the menu or somewhere else.

That’s why I create that “fake” signup form, just to use the “generate password” chrome feature.

uid:
pwd:

Save it in in your bookmarks and enjoy!

Split string SQL Server

Being able to do a simple split on a string in SQL server have always been a real pain.

With SQL Server 2016, Microsoft introduces the new “STRING_SPLIT” function.

Easy to call, but very limited.

select * from string_split('s,p,l,i,t', ',')

returns a 5 row, 1 for each letter. Just values, no position.

That’s why I added some features to that function, with the addition of the “position” in the resultset.

CREATE OR ALTER FUNCTION string_split_position
(
	@input nvarchar(MAX),
	@separator nvarchar(1)
)  
RETURNS @RtnValue table 
(
	[value] nvarchar(max),
	position int identity
) 
AS  
BEGIN 	
	INSERT INTO @RtnValue ([value])
	SELECT [value] FROM string_split(@input, @separator)
	Return
END;
GO
SELECT * FROM string_split_position('s,p,l,i,t', ',')
valueposition
s1
p2
l3
i4
t5

Finally, I also create an “inline” function, used to get 1-based nth character directly from a string.

CREATE OR ALTER FUNCTION string_split_inline
(
	@input nvarchar(MAX),
	@separator nvarchar(1),
	@position int
)
RETURNS nvarchar(max)
AS
BEGIN
	DECLARE @value nvarchar(max)
	select @value = ssp.[value]
	from string_split_position(@input, @separator) ssp
	where ssp.position = @position
	RETURN @value
END
GO
SELECT dbo.string_split_inline('s,p,l,i,t', ',', 3) AS third
returns 'l'

If you have ideas to make these functions more powerful, do not hesitate to share them with us in the comments.

How-to allow AWS IAM users access to Billing Dashboard

You found that page because you tried to create an IAM user, and allow Billing dashboard access.

You set it all the required permissions, like “AdministratorAccess” or “Billing”, and it didn’t work.

Then, you also tried to add an “inline policy”, by selecting “Billing” service, + “All Billing Actions” (aws-portal:*), and it’s still not working.

When using that IAM user to access billing dashboard, you always see that message:
“You Need Permissions – You don’t have permission to access billing information for this account. Contact your AWS administrator if you need help. If you are an AWS administrator, you can provide permissions for your users or groups by making sure that (1) this account allows IAM and federated users to access billing information and (2) you have the required IAM permissions.”

You follow provided help link, and it doesn’t help, they only tell you again and again that you should enable billing access to iam users. But, like most of AWS documentation, they never tell you HOW to do that easily!

I will tell you, because I lost hours to find it, and I want to help someone who have the same issue.

Login with your “root” account. Then, go to “my account” menu on top right, or follow that link: “My Account“.

On that page, search for “IAM User and Role Access to Billing Information“.

There’s a warning in that section: “IAM user/role access to billing information is deactivated“.

Finally, all you need is to click “Edit”, check the box, hit Update, and you’re done!

Calibre is slow, not your Kindle.

I recently decided to move from Kobo to Kindle. Because I have a Prime subscription, that give free books, from their “Prime Reading” offer. Also because there was a good deal on Boxing Day, we could get it for only $60.

They call it the “All-New Kindle”, something like a new version of the previous Paper White I think, without water resistance…

To manage Kobo files, I always used the Adobe Digital Editions software, who works great, fast and easy to use. It is compatible with all e-readers in the world, except Kindle.

Then, I thought Amazon did an app like that. They did an app called Send To Kindle, works really find with pdf and some other formats, but not Epub files.

So, after a few research, you found that Calibre app, that can help you copy these files to your Kindle.

I tried it. Added my Epub to the library, and hit the “send to device” button. What? That is terribly slow, and it crashed a lot of times. I thought, like others on the internet, that the kindle device or its USB port is so so slow and that’s the reason calibre is slow.

But, the problem is not the kindle. It’s calibre!

The good way to send your Epub to kindle, using the Calibre app, is to do a 2-step process.

First, select your files, click “Convert”, and choose “Mobi” format on the top right dropdown.

Then, wait. And wait again. That process is very long.

When it’s complete, select all your files again, and now hit Send to Device button. Now, it will be very fast without crashing.

I think Calibre have lots of trouble handing conversion + usb transfert at the same time.

You can see the running jobs by clicking the “Jobs” label on the lower right corner of Calibre app.

Now, restart your Kindle device, you will see all your uploaded content appear one by one for about a minute.

That said, Calibre is an easy to use, free well done app, that help us get control over Kindle devices. That’s why all Calibre users should hit the “Support Calibre” link and donate something, to encourage that developer to continue supporting that app for a long time.

How to list all Route53 DNS zones entries

I recently had to list all my DNS entries, just to do some cleanup of them. I was surprised that there is no “official” way to export them all from the AWS console!
I found the cli53 tool, but it doesn’t do exactly what I need.

So, I decided to write my own powershell script. I share it with you, I hope it may help!

Feel free to send me your suggestions to make it better!

$zones = Get-R53HostedZoneList | select name,id,ResourceRecordSetCount | sort -Property name

foreach ($zone in $zones) {
    [string]::Format(“[{0}] [{1}] ({2})”,$zone.Name, $zone.Id, $zone.ResourceRecordSetCount)
    $recordsets = Get-R53ResourceRecordSet -HostedZoneId $zone.id
    $recordsets = $recordsets.ResourceRecordSets | sort -Property type
    foreach ($rs in $recordsets){        
        [string]::Format(“`n[{0}] [{1}] ({2})”,$rs.type, $rs.name, $rs.ResourceRecords.Count)
        foreach ($record in $rs.ResourceRecords){
            [string]::Format("   {0}", $record.Value)
        }
    }
    "`n-----------------------------`n"
}

(ASP.NET) How create master UserControl

There are cases when you want your ASP.NET usercontrols all look the same. For example, to add a header and footer to all your popup, and these header-footer needs always looks the same.

You know you can do it by creating a header.ascx footer.ascx, then add them in all your UC. But, you will still need to maintain all the containers for these, and keep them in sync.

You want it to be as easy as using masterPages + web form.

I had to do that recently, I searched for solutions. I only found complicated solution involving inheritance and lot of code behind script.

But now, I have working solution, that uses real contentplaceholders, and absolutely no code behind.

The only prerequisites is that you need to load these userControl from Ajax. You can’t add directly on another page, as you did with a normal usercontrol.

My solution is to just use the standard master page / asp.net webform!

When you create a masterPage, it is filled with all page content: html, head, body, form, … and all the stuff required for viewState to work. But, you can delete all that content.

Create your masterUserControl, let’s call it popup.master. In Visual Studio, just create a normal MasterPage.

By default, it is filled with that content:

<%@ Master Language="VB" CodeFile="popup.master.vb" Inherits="ucTest_popup" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

But, you don’t create a page, you create a master for your userControls.  So. remove all page-related content, and only add your common usercontrol html.  It will look like this:

<%@ Master Language="VB" CodeFile="popup.master.vb" Inherits="ucTest_popup" %>
<div>
   <header>My common header</header>
      <article>
         <asp:contentplaceholder id="cph1" runat="server">
         </asp:contentplaceholder>
      </article>
   <footer>My Common Footer</footer>
</div>

The designer indicates an error on the asp:contentplaceholder item, but just ignore it.

Then, create some popup, as asp.net webpages, and select that popup.master.

Add specific code in the contentPlaceHolder:

<asp:Content ID="Content1" ContentPlaceHolderID="cph1" Runat="Server">
   Popup1 Content
</asp:Content>

You can now test that page directly in your browser, and look at its source: It contains only the html of the master embedded with your specific content.

<div>
   <header>My common header</header>
   <article>
      Popup1 Content
   </article>
   <footer>My Common Footer</footer>
</div>

Finally, to use it in your app, you will need to load it from ajax, because you can’t add it directly like a normal usercontrol.

A simple jquery call can do the job:

$('#myDiv').load("/popup/popup1.aspx")

The “myDiv” div now contains the userControl + master html! Just use your favorite popup manager to show it now, e.g.

$('#myDiv').kendoWindow({}).center().show()

Happy coding with these “master usercontrol”!

How to fix PowerSeeker 127eq tripod

As many of you, I was amazed by the very low price of the Celestron PowerSeeker 127EQ. And, I really liked it for a few weeks.

But after a while, it starts to be very hard to adjust it using slow motion wheels.

I balanced it horizontally, vertically, I thought the weight was not correctly centered.

But, everything was fine, and it was still very hard to turn it using the wheel that should be help to follow a moving star or planet easily

Then, I found the magic solution! What you need to add in your amateur astronomer kit is a ratchet with a 11/16 inch box.

And, when it starts to be very hard to adjust your telescope using slow motion wheel, just use your ratchet in the hole behind the larger wheel, turn it a little bit, and wow, you can now use that tripod again!

I have to do that very time I use it, as it seems to loose itself very often.

Apple TV vs Raspberry PI (Steam link)

tl;dr: Use SteamLink on a Raspberry Pi.  It just don’t work on an Apple TV (4th gen).

I have a PS4 and I prefer play in the living room on the couch with a remote.  I recently decided to finally use Steam a little more, because they have good deals on their store that are sometimes very cheaper than those on the Playstation Store.   But I prefer play on the couch in front of the TV instead of near the Desktop PC, where I usually work, not play.

To do that, I can use the Steam Link service, to stream my desktop PC  to the living room TV.

SteamLink app is available for both Apple TV and Raspberry Pi, and I have both.

Because I already set my Raspberry to play games, with RetroPie, I tried it first.  I bought a Logitech F310 controller and plug it to the PI.

The app is easy to install on Raspbian, just search it in the “add or remove programs” section.

To play, you need to start the Steam app on your PC first.  Then start the app on the Pi.  I would like to be able to start the app using the controller, but I can’t.

So I need to use my Logitech K400+ wireless keyboard+touchpad to start the app.

Everything works fine, I can play for hours at Assassins Creed Unity.

But, because I also have an Apple TV 4th gen (model A1625, 2015), and I want make it easier to start the Steam Link for the family, I tried to do the same using the new Steam Link app for TVOS.

My network and host configuration is exactly the same for both client… wired network, a pc with an Intel i3 + GTX1060 gpu.

I can’t use any of the remote I have at home with the Apple TV, because, they only support MFI (Made For I(pod-pad-phone)) controllers. So, I bought the SteelSeries Nimbus from Amazon.

TVOS 13: you will be able to use ps4 and xbox controller on the Apple TV Soon…

The Nimbus is easy to sync from the bluetooth config, and automatically sync very quickly after when turning it on. Also, it’s easier to start the steam link app from the Apple TV menu, because I can do all from the Nimbus controller without using the Apple TV remote.

While connecting to my PC, the steamlink app show a warning about 4 buttons that are not available on the Nimbus: Select, Start, L3, R3.  The default config for them is Menu+A,B,X,Y.  I accept the default settings.

Then, I start to play.  The same game, with all settings set to default, as I did with the Raspberry Pi.  

Suddenly, the game starts to freeze.  It locks for 0.5-1 second, every 10 seconds.  And the sound start to cut.  The resolution automatically lower, and it’s still the same.

I started the real-time monitoring of informations, and the fps were moving between 30 and 60, and suddenly switch to 1-2 when I get the freeze. And the status bar on the right show a huge peak.

I restarted all devices, and I went to the settings options, telling the steam link app to use “fastest” config, and I set the maximum resolution to 720p.  Still same result, it’s unplayable.

My conclusion is simple: the Apple TV 4th gen CAN’T be used with Steam Link.  I don’t know about the 5th gen “4k” Apple TV.

The SteelSeries Nimbus is a good device, looks solid, and works very well with all native ios games. The issue is only when using the Steam Link app, nothing else. And it’s not related to the controller.

Because I bought the SteelSeries Nimbus ONLY to play Steam Link, and I can’t, I returned the controller to Amazon. But, again, it’s a good controller for all native TVOS games.

My suggestion is to buy a cheap Raspberry Pi 3 (or the new 4), and use any compatible controller you want, but I strongly suggest the Logitech F310, or a genuine Xbox controller (wired).

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.