Website building checklist 2023

Long gone are the days where you published a simple page and search engines sent you traffic, in this day and age, even that page, no matter how important the content in it is, needs to be on a website that meets certain criteria

  • Privacy Policy: A privacy policy is essential, I will enumerate all the things that you will lose for not having a privacy policy right after this list
  • Cookie banner: or any notification in general, asking the user for consent to use cookies
  • Mobile and small screen compatibility: the most common form of that is a responsive design, no design at all can often be responsive as well, but that is a different topic altogether, this compatibility also includes the spacing of clickable content as well as showing elegantly on the small screens
  • Speed: Search engines seem to like faster websites more, it improves their visitor’s experience
  • Create distinctive favicons of various sizes, they help people identify your website in search results and other places, so whether they are looking for something they have seen on your website before, or want to find the tab in their browser, you make it easy for them

Why does my SSD slow down on copying large files

So you have a budget SSD, something like the Kingston A400, and half way through a multi gigabyte file it slows down !

Coming to think about it, this SSD does not have a DRAM cache, and should be slower but more consistent, right ? after all, you can’t run out of cache when there is no cache !

The answer is NO, just because it does not have RAM cache or even actual SLC flash, does not mean it is writing casually to its MLC flash, the controller uses trickery to speed up writing and sometimes reading

Most drives with no RAM cache (Examples below) use a method called Single Level Cell mode cache, but even this name is misleading, your cheap hard drive does not have “Single Level Cell flash memory” inside of it, Instead, it utilizes it’s own MLC by writing single entries to it (One bit of a multi level cell), then re-copying it the normal way

When you are copying a large file to the disk, all the blank space at that level has been consumed, and the disk is now writing directly to the 3 dimensional MLC flash, which is, in most cases, slower than a mechanical hard drive for sequential write !

The most common of such a controller is the Phison PS3111-S11-13, it is a relatively good controller if your purpose does not require super fast SSDs, the controller has some cool features including Bad Block management (Spare flash that automatically replaces bad cells), besides standard features like S.M.A.R.T., It also supports native command queuing (NCQ), EEC error correction, so all in all, this post is not advice to stay away, this post is just hee to explain that it will be slow

Examples of such disks:

Kingston A400
– 240GB = Phison PS3111-S11-13
Silicon Power A55
– 1TB = Phison PS3111-S11-13
HIJVISION C100
– 120GB = MAS0902. (Read features below), and while the controller seems okay, at least on paper, I can not seem to be able to figure out the 64GB x 2 chips that read (TZA512G221 060422JC JWT5220364RB)

The Maxio MAS0902 SATA DRAMless controller. comparable to the (Phison PS3111) but has some interesting tech upgrades, 1- AgileECC 2 (2nd gen ECC) 2- WriteBooster 2 (2nd gen SLC write buffer), DEVSLP (low-power mode), power and thermal throttling, and end-to-end data protection. The controller also supports both TCG-Opal 2.0 and Microsoft’s eDrive (IEEE1667) full disk data encryption.

How to pick a domain name registrar

Factors to consider

First of all, the choice depends on 3 things, or 4 but to me, the fourth is not very important

  • PRICE for a given TLD (TLD = .com, .net, etc…) and it’s persistence
    This is probably the most important factor, there is no such thing as “Performance” as your registrar does not run the TLD’s registry, something to take into account is also the renewal price next year.
  • whether or not you plan to use their “Usually free” nameservers (Most people will use their web host’s nameservers and not the registrar’s)
  • The business stability of the registrar, when a registrar goes down, you might find your domains with a registrar who picked up all the domains the sunken registrar had, and if you were using the old registrar’s add on services, you will end up needing to redo them, and probably find a different registrar that you like to move those domains to.
  • And last but not least, the interface and speed of the registrar’s website and tools, I don’t think this is very important as most registrars have a usable interface and you will only need to use it infrequently

Which one do i recommend ?

I personally use more than one registrar, for some TLDs, I use nameCheap, and for the more standard domain TLDs (Like .COM etc…) I used godaddy for a long time, then i switched to a godaddy reseller (PoloDomains), it has the same exact products (and phone support) as godaddy and in my experience this reseller has very persistent prices that are lower than those of godaddy themselves, not to mention that godaddy keeps surprising me with different pricing when the time comes to renew. Again, godaddy is a good registrar that checks all the boxes, but the reseller is more or less just cheaper. other good well known registrars include namesilo.com, google domains (Not recommended as google is selling it to another company), Name.com, domain.com and many others that you can research online…

Get it for free when it makes sense

Some web hosts offer free domain names for as long as you are paying for your hosting, this is not exactly a catch, but it might be, so what I do is decide on a web host through reviews and what have you, and if that web host offers free or cheap domains with their web hosting, then that is where I will get my domain, But mind you, when i make the choice, i subtract 1/12 of the normal domain price (that you would get if you used a separate registrar) from the monthly hosting fee, and then compare the web-hosts with the new discounted price tag, the last thing i want is to get stuck with a bad web host because they offer a free domain, that would be a very bad decision.

When is the registrar relevant to performance ?

The main function of a registrar is to sell you domains and register them with a registry, after registering them, the registrar also informs the registry of what nameservers to use with the domain name. after that, the registrar in it’s strict form has no technical function, up until you either want to renew that domain, or change the nameservers attached to that domain, a web request (from a website visitor for example) does not pass through your registrar.

The above remains true, unless you opt to use one of those free DNS services that are provided by many registrars, in this scenario you are using the registrar’s DNS servers instead of your host’s or a third party, which is not a bad idea depending on the quality of your registrar, godaddy (and it’s resellers) provides a free DNS service that uses anycast ! anycast is a cool internet technology where the user will be using the closest DNS server to them without knowing, effectively cutting down the latency of the DNS request.

NGINX – Common tweaks

if you are processing data with nginx and PHP-FPM, you might want to increase the following

“504 Gateway Timeout” is when nginx is waiting for a response from php-fpm for too long, you can fix that with

Increase PHP maximum execution time in /etc/php.ini: max_execution_time = 300
Increase PHP-FPM request terminate timeout in the pool configuration (/etc/php/8.2/fpm/pool.d/www.conf): request_terminate_timeout = 300

To disable all timeouts… you can add the following into any context, for serverwide, add anywhere in the http context (in /etc/nginx/nginx.conf)

keepalive_timeout 1d;
send_timeout 1d;
client_body_timeout 1d;
client_header_timeout 1d;
proxy_connect_timeout 1d;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
fastcgi_connect_timeout 1d;
fastcgi_read_timeout 1d;
fastcgi_send_timeout 1d;
#memcached_connect_timeout 1d;
#memcached_read_timeout 1d;
#memcached_send_timeout 1d;

Increasing php fpm values

Before you change values in php.ini, you need to tweak nginx a bit, so you need to start by editing the nginx config file at /etc/nginx/nginx.conf, and at the bottom of the http block, you may want to do the following

client_max_body_size 150m;
client_body_timeout 120;

Now, the above should be higher than the php max upload and max post sizes, if you like, you can disable the nginx restriction by setting them to zero !

Now, go for your php file that you can find in a place such as (/etc/php/8.2/fpm) and edit the values, for example

upload_max_filesize = 150M
post_max_size = 150M

Once done, dont forget to restart both

systemctl restart php8.2-fpm
systemctl restart nginx

Updating the firmware on my 2TB Seagate Barracuda

Why update the firmware !

My answer here is a bit unconventional, and certainly not a fact.. I even think I am wrong, but it can’t hurt, so here it goes

Seagate recommends you update the disk’s firmware to improve performance and longevity of the hard drive, I on the other hand have an extra mission…

The firmware on a hard drive is stored partially on a chip on the PCB, and partially on the disk itself ! I know that disk platters have a data retention life of 10 years, the area where the firmware is written is never refreshed since it is read only when the disk boots up, So i am hoping (even though doubtful) that the firmware update might re-write this area of the disk and breath new life into it.

A disk certain application claims to refresh the data on that area of the disk, After testing that application I will come here and add my findings accordingly

Getting the firmware

Let us start by downloading the firmware ! To download firmware from seagate’s website, you will need to know your hard drive serial number, to do just that, open the command prompt elevated, and run the following command

wmic diskdrive get model,serialnumber

The result of me running that command is as follows

The results of executing the command above show that I have a hard drive of the model (ST2000DM001-1CH164) as you can see with a serial number that I now have (Masking serial numbers just in case seagate has a problem with me publishing them as it allows you to download the firmware using the serial number)…..

Now that I have the serial number, I can go to seagate’s firmware download page here and grab the firmware… once done, I unzip it, and the following folders appear

Creating a bootable USB flash disk

Now, inside the Bootable tools, there is a file (SeaChest_RC_2.7.4_10-18-2018.usbBootMaker.exe) that will create a bootable flash stick for you, insert a flash stick of any size that is to be deleted by this application, run the application, and now you have a bootable drive, but without the firmware, so copy the firmware folder you see above into the flash stick, and now you are ready to boot from it, for instructions how to boot from a flash stick, you will need to check with your motherboard’s manufacturer documentation, it is usually a simple thing such as hitting F11 at boot time.

Updating the firmware

Once booted, you should be presented with a linux command prompt, where we can run commands to update the firmware

To see what disks are on your system, run the following command

SeaChest_Firmware --scan

The scan should give you the handle for the drive, if you have never used linux before, the handle started with /dev/ (Short for device), and sata disks usually start with sdX (Where X starts with A and ends with a letter corresponding to the last disk you have in your system) old PATA disks usually start with hdX… but that is usually not something you need as PATA disks are virtually non existent at this stage

Now, execute the firmware update command like so

SeaChest_Firmware -d /dev/sg3 --downloadFW /firmware/filename.LOD

Now, if you want to know whether the update was successful or not, just run the scan command again, and note the firmware on it !

My Problem !

As you can see from the image below, I have 3 firmware files, named 1TB, 2TB, and 3TB, when i ran the command above, The system claimed that the update was successful, but didn’t really update the firmware, I was still stuck with 26 rather than 29 !

So i decided to use Seagates own configuration file to do the update with the command

SeaChest_Firmware -d /dev/sg3 --fwdlConfig GPCC2949.CFS

Surprise was that I got the following error

model matched but the current firmware version does not match the available updates

So, I went back in time and remembered that for this particular disk, I had changed the PCB before (Trying to get a 3TB disk to work by moving a certain chip from one board to the other, diagnosis turned out the problem is not the PCB)… So instead of flashing the 2TB firmware file, I flashed the 3TB, and what do you know, It worked.

Anyway, I will come back with screenshots of the whole thing… and more data for those who are having trouble updating their firmware, until then, hang in there

URL Rewrite in nginx (coming from Apache)

If you are like me, you already know how to use MOD-REWRITE in apache2, but need guidance to implement things in nginx !

There are three directives in nginx concerning rewriting, namely return, rewrite, and try_files Directives, what i will be starting with is rewrite, since most websites on Apache use “rewrite_rule” which can be easily translated into rewrite

I will also provide the most common examples for software such as WordPress, laravel, and other software so that you can get up and running in the shortest possible time

1- Translating my RewriteRule from Apache into nginx

The good news is, it is very easy, I will provide a few simple guidelines, then provide examples.

  • The counterpart to RewriteRule in apache2 in nginx is rewrite, so start by changing the text RewriteRule into rewrite
  • Replace [L] or [QSA,L] with the string “last;”, Notice that configuration entries in nginx end in a semicolon
  • Wherever there is an occurrence of ^ follow it with a /, Making it ^/
  • In nginx, curly braces are used for two purposes, block control and regular expressions, so if your existing apache2 rules contain those curly braces for regular expressions, you can tell nginx that this is a regular expression not block control by surrounding the regular expression with quotes (double or single).

So let me create an example, explain what it does, and show you how it is translated into nginx rewrite

What it doesIn ApacheIn nginx
This rewrites
everything onto
the index.php file,
except for the
contents of one
folder named
norewrite
* RewriteEngine on
* RewriteRule ^norewrite(.) – [L]
* RewriteRule ^(.)$ index.php?q=$1 [L,QSA]
Create a separate section
for the folder norewrite,
and then use the following
* rewrite ^(.*)$ /index.php?q=$1 last;

Changing the default port 80 on nginx

First of all, check what ports nginx is currently listening on, you can do that with any of the following commands

netstat -tlpn| grep nginx
ss -tlpn| grep nginx

So, you probably found nginx listening to port 443 for SSL connections, and on port 80 for plain http….

On many occasions, you may want other application (Such as varnish or apache) to be listening on port 80, So nginx needs to move to another port, in this example, I am moving it to port 8080

Step 1: Go to sites available, there is the default site, and there are any other sites you added to nginX, open those config files that you will find in /etc/nginx/sites-available, search for 80, and replace it wherever it may occure with 8080 or any port of your choice, restrictions are the following, port numbers under 1024 will requier root privilages (So keep it above 1024), and the maximum port number is 65535, Also port 0 can not be used for http (Relevant to UDP though)

Will changing my transmission fluid break it

So i have a 2008 Mercedes-Benz E 200 Kompressor 5G-Tronic (W211). being aware of the theory that changing transmission fluid after having 135K Kms on the car will break my transmission/gearbox and finding it hard to believe, I decided to try it myself.

Why I am doubting this theory

My theory is about the origins of “transmissions breaks when fluid is changed”, and why it is likely WRONG.

The origin of that theory is probably the number of people who have problems soon after changing transmission fluid, and basically there is nothing wrong with the theory in this regard but bear with me.

my counter theory is, when people change their transmission fluid at such high mileage, they are not exactly servicing the car on proper intervals, the reminder to change the fluid for them was probably that the transmission acting up, so the transmission is on it’s last leg, you change the fluid, but the fluid can’t save the transmission, it is too late, the dirt in the dirty transmission fluid was creating a bit of friction (and accelerating the wear in the process), the situation is bad enough that you went to change the fluid to see if that helps, the transmission keeps on deteriorating because it is already going in that direction, so what do you do, you blame the oil change ! “It was working at least before I changed the oil !”

So my car comes with the 1.8L M271 , My transmission is probably the 722.695.

I have already drained 3Liters of fluid (All that was in the pan), and filled the transmission with 3 liters of Mercedes-Benz 236.14 transmission fluid, I have also replaced the oil filter and the pan gasket. there is a magnet stuck to the pan from the inside, be sure to clean that too !

Later on, I drained another liter and a half, and added a liter and a half, and kept half a liter to top it up once i find my relevant dipstick (Does not come with the car)

There are alternatives to the somewhat expensive MB fluid, but since i couldn’t find an MB certified one, or at least a fluid that claims to be the same, I decided to bite the bullet and go with the original.

UPDATE: After one year (today is April 19 2024), the transmission is working exactly the same as it was before changing the fluid, things seem to be going just fine.

Repairing the Prius HV traction battery

Attention: the stuff/information you need is at the beginning, Most of the stuff that follow the practical section you will not need (The some theory section), whatever more you see is for my reference, for the curious, and for those who are wondering why i do it this way.

The lowdown: I have successfully repaired my 2014 (3rd gen) Prius battery, despite the fact that most information on rebuilding your Prius battery online is Bull, almost as if it were engineered so that you kill the remaining good cells after a month or two.

this is going to be one long article, and probably a video will follow.

Here are the tools you need

  • An android phone (You can use Apple/iPhone with torque pro, but the instructions here are for android)
  • The Torque Pro app on the phone
  • Prius PIDs for torque pro (Download here)
  • A compatible OBD2 adapter, I use a WiFi adapter, you can use a Bluetooth or any other that works with torque pro
  • A laptop with software like excel or LibreOffice calc, A paper and pen should also work
  • A charger capable of charging a battery of 6 NIMH cells (Battery means in series), I use the SKYRC imax B6 mini
  • Car headlight lamps (To drain the batteries)

Like everyone else, it all started with CHECK HYBRID SYSTEM STOP THE VEHICLE IN A SAFE PLACE getting displayed on my center “multi information display / instrument panel” or MID for short.

Connecting the OBD2 adapter resulted in fault code (P0a80) other relevant codes might display with P0a80 such as p3011, p3012, p3013 etc. which should point you to the failing module pairs that are causing the failure. in my case, I only had the P0a80.

Prius battery terminology (As per Toyota)

Hybrid battery: the whole Prius traction battery pack of 28 modules
Module Pair: the car reads voltages of modules in pairs, So voltages of the 28 modules in a Prius battery are reported to the car as 14 values, meaning every 2 modules are read together as the sum of the voltage of those 2 modules.
Battery Module: in a Prius battery, every 6 cells are enclosed in a sealed container called a module, this is why you don’t directly see the cells, a module’s nominal voltage is 7.2, which is the nominal voltage of 1 cell multiplied by 6.
Battery Cell: A 1.2V NIMH cell that you will not see because it is hidden inside a module.

So, without further ado, let us get started

Diagnosis, which modules are bad

Before we take the battery out, we can save a hell lot of time by looking at what the car has to say about it’s battery pack.

I have broken this down to steps you see below

  • Install torque pro to your phone (android in my case)
  • Download the Prius 3rd Gen PIDs file by clicking here
  • extract the file you have just downloaded to the (/.torque/extendedpids) directory in your phone
  • Open torque pro, and go to the Menu -> Settings -> Manage extra PIDs/Sensors -> Menu -> Add predefined set.
  • Create an Realtime Information page in torque pro to display battery voltages in real time such as the one below, you start with an empty page, then add (tiny) displays corresponding to voltages of individual modules, I personally like to add the Min and Max voltage entries to make it easier to know when you have found what you are looking for while driving without having to scan through the batteries
  • Clear the error code, switch the car off then on again, the car should now appear to be working fine as if the battery is okay, this is obviously just for the test as the car will soon find out the problem again and inform you of your problem
  • Now, once connected and information is displayed, find a nice uphill climb that is not too steep, with no traffic, at the bottom of that climb, floor the break and gas pedal at the same time, this will charge the battery, then on EV, start climbing wile recording your phone screen, the battery should drain really fast and you will either hear the engine running, or the “Check hybrid system” message should appear again, either way, you now have a reading of which batteries drained very fast…
  • Inspect the recorded screen recording, and figure out which modules are the ones causing the problem, please note that there may be other modules in bad shape, but for now, the worst ones are clear

Taking the battery out of the car

To be able to pull the battery out of the car, you will need to take the following steps

Some theory

The 20% to 80%

Q: Why does the car consider the battery fully charged at 80%, and depleted at 20% of the batteries actual capacity ?

A- Why the 80% cap ?

Let us start with why it caps at 80% ! (At 80 percent, 100% will display on your instrument cluster)

The most common theory (that i don’t find convincing) is that the car wants to leave headroom for regenerative breaking, if it were so, why does it start using the gas engine’s breaking at 80% ? burning fuel, and defeating the purpose of regenerative breaking ?

My own theory is that there are multiple reasons, of which the headroom theory above is not one… here are the reasons i expect the car was designed this way

1- NIMH batteries heat up once you are charging above 80%, which is wasted energy, so the car is expected to try an use up the battery back down to the happy 6/8 area.
2- Heat is bad for the module’s health, and the health of the modules around it (See 1)
3- When modules in module pairs become mismatched health wise, this 20% headroom spares the weaker cell the overcharge and the damage associated with it., illustration will be added soon.

B- And the 20% depletion mark ?
NIMH cells can be depleted to ZERO, in fact, the company that makes the enelope batteries for Panasonic calls depleting the battery to zero and then charging it again a refresh function.

The area between 0.9V and zero volts has very little energy, as most energy is delivered between 1.3 and 1 volt, but still, this area is much less than 20% ! so why 20%

1- Unlike gas cars, hybrid vehicles do not have a 12V starter motor, the gas engine in a hybrid car is started by the electric motor itself, the same one used to propel the car is used to start the engine, if the battery falls below 20%, especially as batteries start to age, there will not be enough power to start the engine, more to that, the batteries have internal resistance, so the car needs to be sure that when it is parked for a few days (or months), it will have enough traction battery power to start the gas engine.