All posts by admin

Talking about your apartment

Some useful words:

  • Roof
  • Top floor
  • The upper floors (in relation to your floor or some cutoff line)
  • Your floor
  • The lower floors (in relation to yours)
  • Bottom floor (could be street level, ground level, or ground floor)
  • Basement

Examples:

  • I live on the second floor and he on the third floor. He lives on the floor above mine.
  • I live on the second floor and he on the first. He lives on the floor below mine.

Exemplification:

My building has 18 floors and I live on the ninth floor. Mr Smith lives on the 18th, the top floor. Mr Jones lives in the upper floors on the 15th. Mrs Jackson and her kids live in the lower floors on the third. The bottom floor at street level is where the building manager lives. The basement is where the water boilers and the washing machines are located.

Source: https://www.quora.com

Resolution vs. Pixel Density in Displays

Motivation:

Which display should you choose when buying a TV or laptop or mobile device, bigger size or bigger resolution?

Terminologies:

Size Display size is measured in inches. Here we only measure the diagonal size in inches and not the horizontal or vertical size of the screen.

Square the horizontal or vertical size of the screen in inches, and add the two numbers together. Find the root of that resulting number, and you have your display's diagonal in inches.

Pixel It is the smallest element that can be displayed on a screen. To be more simple, it is just a single dot on a display or a screen.

Resolution Resolution refers to size of the display in terms of pixels. E.g. Resolution of 800×600 pixels means that the there are 800 pixels horizontally and 600 pixels vertically. So therefore there are a total of 480000 pixel in the display.

Square the display's width and height in pixels, and add the two numbers together. Find the root of that resulting number, and you have your display's diagonal resolution in pixels.

Pixel Density Many of us are not aware of the importance of Pixel Density in displays. It is the thing which describes the sharpness and clarity.

Pixel Density is usually measured in PPI (Pixels Per Inch) which refers to number of pixels present per inch on the display. Higher the pixel density higher is the sharpness of the content.

Pixel Density is calculated based on the resolution and size of the display.

Pixel Density = Diagonal resolution in pixels/Diagonal in inches

Consider the above image. The alphabet “A” on the left is displayed on screen (32 inch display size) with lower resolution. The alphabet “A” on the right is displayed on the screen (32 inch display size) with higher resolution which delivers better sharpness.

What does this mean?

The thing with PPI is that with the same resolution, the larger the screen, the lower the PPI, the lower sharpness. This is because a larger screen means the individual pixels have to be larger to fill the space.

If you compare iPhone 6s Plus and Samsung Galaxy S7 Edge which both have the same size 5.5 inch but iPhone 6s Plus comes with 1920×1080 resolution at 401 PPI while Galaxy S7 Edge comes with  a 2560×1440-pixel resolution at 534 PPI. It means the text and images on the Galaxy S7 Edge’s display are sharper than on the iPhone 6s Plus’ display.

The interesting thing about devices that boast a higher PPI that 400 is that your eyes can’t see the high concentration of pixels at normal smartphone viewing distances. Your naked eye can only see densities of up to 399, so you won’t be able to tell the difference between a device with a PPI of 400 and 440 (the Samsung Galaxy S7 Edge, for example).

Some examples:

  • Dell XPS 13 (2016) has a pixel density of 276.
  • Dell Precision 5510 Workstation 15 (2016) has a pixel density of 282.
  • MacBook Pro 13-inch (2016) has a pixel density of 227.
  • MacBook Pro 15-inch (2016) has a pixel density of 220.

How to Use Let’s Encrypt

Motivation:

Why use an SSL/TLS certificate to secure your website?

– To protect your website users from man-in-the-middle attacks.

– To ensure the integrity of the data being sent to your website.

Why use Let’s Encrypt SSL/TLS certificate?

– Because it is FREE.

Tested environment:

  1. Windows Server 2016/IIS 10
  2. win-acme.v2.2.6.1571.x64.pluggable
  3. Ubuntu 18.04
  4. certbot 0.27.0

On Windows and IIS:

  1. If you are using a cloud provider then ensure that HTTP and HTTPS service are enabled on cloud firewall.
  2. Log in a Windows server.
  3. Download  win-acme.v2.2.6.1571.x64.pluggable.zip on https://github.com/win-acme/win-acme/releases.
  4. Unzip the files to C:\inetpub\win-acme.v2.2.6.1571.x64.pluggable.
  5. Open Command Prompt (Admin) and execute below commands.
    cd C:\inetpub\win-acme.v2.2.6.1571.x64.pluggable
  6. Type wacs.exe and press Enter
  7. Follow the instructions.
  8. Open Task Scheduler and ensure that a task with description “Check for renewal of ACME certificates.” has been created.
  9. Open Firewall port 443 if needed.
  10. Open the selected website using HTTPS protocol.
  11. Update emails to which notifications will be sent: Open wacs.exe, type O, then A, then y, and enter an email.
  12. Remove website from automatic renewal:
    wacs.exe --list // Copy the exact name between ": " and " - renewed" without quotes. // Example: [IISBinding] huybien.com 
    wacs.exe --cancel --friendlyname "[IISBinding] huybien.com"

Redirecting HTTP to HTTPS in IIS7:

  1. Install the Microsoft URL Rewrite Module if needed.
  2. Make sure Require SSL is NOT checked under SSL Settings for your website.
  3. Copy and paste the following code between the <rules> and </rules> tags in your web.config file in your website root directory.
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
    <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

4. Open your site using HTTP protocol and ensure that you are redirected to the HTTPS site.

Multiple SSL Certificates per IP Address

  1. You have to use Server 2012 IIS to support Server Name Indication (SNI) which allows you to bind multiple SSL certificates to a single IP Address.
  2. Please repeat the Procedure for each site, then go to the IIS site, Bindings and ensure that the check box Require Server Name Indication is selected and the corresponding SSL Certificate is selected.
  3. Please be noted that SNI does not work with Windows XP clients.

On Ubuntu and nginx

  1. Login as root via SSH to a Ubuntu server.
  2. Execute 3 commands below.
sudo apt install python-certbot-nginx
sudo certbot --nginx -d huybien.com -d www.huybien.com -d example.com -d www.example.com
sudo certbot renew --dry-run

3. Remove a certificate:

sudo certbot delete

4. Update emails to which notifications will be sent:

sudo certbot register --update-registration --email [email protected]

5. Review Let’s Encrypt’s log file:

sudo nano /var/log/letsencrypt/letsencrypt.log

Press Ctrl+W, then enter a string to be found.

Press Alt+W to find a next match.

 

 

Wait and Await

The verbs wait and await have similar meanings but they are used in different grammatical structures.

The verb await must have an expressed object.

  • I am awaiting your reply.
  • They are awaiting the birth of their first baby.

The object of await is usually a thing. It is not a person.

For example, we can’t say: I am awaiting you.

The verb wait can be used in several different structures.

Wait does not require an object.

  • We have been waiting for hours.

Wait can be followed by an infinitive.

  • I waited in line to board the bus.
  • I am waiting to hear from him.

When we use the verb ‘wait’, we usually also mention the length of the time we have been waiting.

  • I have been waiting since morning.

Before an object, wait takes the preposition for. Note that in this case, the noun/pronoun that follows for is the object of the preposition.

  • I am waiting for you. (NOT I am waiting you.)
  • We are waiting for his call. OR We are awaiting his call.

Await is more formal than wait for. It can be used in formal letters and documents.

Wait is more common and leaves less room for confusion.

Note that await does not take the preposition ‘for’.

  • We are awaiting his call. (NOT We are awaiting for his call.)

Complete the following sentences using wait or await.

1. Let’s ………………. until he arrives. (wait / await)

2. The manager is busy now, so you will have to ……………….. (wait / wait for / await)

3. I have been …………………. a bus for two hours. (waiting for / awaiting / waiting)

4. The bill is ………………….. parliamentary approval. (awaiting / waiting)

Answers

1. wait; 2. wait; 3. waiting for; awaiting

Source: www.englishgrammar.org

How to completely uninstall Android Studio in macOS?

Problem:

You have an issue with Android Studio and want to reinstall it. In order to reinstall a fresh instance you need to uninstall the current version first.

Solution:

Execute these commands from the terminal:

rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/.AndroidStudio*

if you would like to delete all projects:

rm -Rf ~/AndroidStudioProjects

to remove gradle related files (caches & wrapper)

rm -Rf ~/.gradle

use the below command to delete all Android Virtual Devices(AVDs) and *.keystore. note: this folder is used by others Android IDE as well, so if you still using other IDE you may not want to delete this folder)

rm -Rf ~/.android

to delete Android SDK tools

rm -Rf ~/Library/Android*

Source: http://stackoverflow.com

How do we make an image look darker using Photoshop?

How do we make an image look darker using Photoshop?

  • Use Ctrl+J to duplicate the image layer
  • Click on the top layer and change the blend mode to either Multiply or Overlay
  • Go to Image > Adjustments > Levels
  • Adjust the middle node (sliding right makes darker image, sliding left makes lighter image) till you get your desired outcome.

How do we change a layer’s opacity?

  • Right click a layer > Blending Options…
  • Change the Opacity value

How do we straighten a photo (transform perspective while cropping)?

  • Hold down the Crop tool and select the Perspective Crop tool
  • Draw a marquee around the distorted object. Match the edges of the marquee to the rectangular edges of the object.
  • Press Enter (Windows) or Return (Mac OS) to complete the perspective crop.

How do we crop a photo with 4×6 ratio?

  • Hold down the Crop tool and select the 2:3 (4:6) from the drop down box on the top panel.
  • Resize the grid to appropriate size.
  • Right click on the image and select Crop.

How do we horizontally straighten a photo?

  • Hold down the Ruler tool and draw a line as the new horizontal.
  • Click Straighten Layer on the top panel.

 

 

How to Transfer Files and Music to an Android Phone Using USB

So you’ve plugged your USB to microUSB cable into your computer and Android phone and are ready to start downloading files.

Staring intently at your screen, you wait for a drive, a window — something, anything — where you can drag-and-drop your files, but it just doesn’t come.

Well, chances are, you are missing one simple yet critical but step.

Here’s how to transfer files to your Android phone:

  1. Connect your Android phone to your computer using the microUSB to USB cable.
  2. If you are using a PC, you will see an installation bubble pop up in the bottom right of your screen. Wait for the computer to successfully complete installation.
  3. The critical step: On your Android phone, pull down the notification window (aka ‘window shade’) and tap USB connected.
  4. A notification window will appear. Tap Mount. Your phone will enter USB storage mode.
  5. Find the removable storage drive. On a PC, navigate to My Computer and look for a new removable storage drive. On a Mac, the drive will appear on your desktop.
  6. Drag-and-drop the desired file(s) to the drive.
  7. In your phone’s notification window, tap Turn off USB storage.
  8. Unplug your phone and you’re all set.

Source: https://www.wirefly.com/

Topic 16 – Advanced Software Design

Why do I need to learn about advanced software design?
I think that I already learned about software design in the Topic 13 – Introduction to Software Design.

Now your task is not just to build a house.  Your task is to build a city. Now you will create very complicated software. You are responsible for creating a software system containing about 10,000 classes or functions for 5,000 people to use in 15 years. The maximum system downtime must be less than 5 minutes per year.

Image that you have to create a system that serves millions of users simultaneously like Facebook or YouTube or Amazon or Office 365 or GMail. Are you comfortable with building one.

Image that you are tasked to create a web framework for developers to extend such as ASP.NET or Yii or React. Are you confident in creating one?

If you are not sure how to fulfill these tasks then probably, you should learn how other people crafted similar systems and adapt their experiences to your case. Advanced software design introduces knowledge and tools to you so that you can begin to build your own complicated software.

What can I do after finishing learning advanced software design?

You will know how to design a complex software system that satisfies not only functional requirements but also security, modifiability, scalability, reusability, extensibility and reliability requirements.

That sounds interesting! What should I do now?

Advanced software design requires a lot of reading. Please do review the software design knowledge introduced to you in the Topic 13 – Introduction to Software Design first.

Nowadays software can be applied to many fields. Each of them requires specific advanced software design knowledge. In this topic, we only focus on enterprise software due to its popularity.

Before you design a complicated system you must thoroughly  understand its sophisticated requirements. This is a critical step when building a large system.

Please read this David C. Hay (2002). Requirements Analysis: From Business Views to Architecture. Prentice Hall PTR book to learn how to elicit, analyze and document requirements for an enterprise system.

After that please read this Philip A. Bernstein and Eric Newcomer (2009). Principles of Transaction Processing. Second Edition. Morgan Kaufmann book to learn about transactional processing principles and techniques.

After that please read
– this Eric Evans (2003). Domain-Driven Design: Tackling Complexity in the Heart of Software. Addison Wesley book, and
– this Jimmy Nilsson (2006). Applying Domain-Driven Design and Patterns: With Examples in C# and .NET. Addison-Wesley Professional book, and
– this Dino Esposito and Andrea Saltarello (2014). Microsoft .NET: Architecting Applications for the Enterprise. Microsoft Press book, and
– this Vaughn Vernon (2013). Implementing Domain-Driven Design. Addison-Wesley Professional book to learn how to leverage domain-driven design approach to reduce system complexity.

After that please read
– this Mark Endrei et al. (2004). Patterns: Service-Oriented Architecture and Web Services. IBM Corp book, and
– this Sam Newman (2021). Building Microservices: Designing Fine-Grained Systems. O’Reilly book, and
– this Sam Newman (2019). Monolith to Microservices – Evolutionary Patterns to Transform Your Monolith. O’Reilly Media book, and
– this Cloves Carneiro and Tim Schmelmer (2016). Microservices From Day One. Apress book to learn how to design microservices.

After that please read  this Martin Kleppmann (2016). Making Sense of Stream Processing. O’Reilly Media book to learn how to leverage event sourcing and stream processing to design software.

After that please read this Ian Gorton (2022). Foundations of Scalable Systems – Designing Distributed Architectures. O’Reilly Media book to learn how to design scalable software systems.

Terminology Review:

  • Enterprise Applications
  • Enterprise Systems
  • Transaction Processing
  • Domain-Driven Design
  • Factory
  • Repository
  • Microservices
  • Command Query Responsibility Segregation (CRQS)
  • Event Sourcing
  • Stream Processing
  • Event-Driven Architecture
  • Serverless

After finishing learning this topic please click Topic 17 – Calculus to continue.

 

How to Install Windows XP from a USB Flash Drive?

Why install Windows XP?

Sometimes you do need Windows XP for some specific tasks. For example running and testing old programs, a specific program, using your old computer for a specific task.

This is a  short guide to install Windows XP from a USB flash drive.

Requirements:

1. Windows XP installation files (you can use any Windows XP disc or ISO file).

2. DOS.zip file (download)

3. A USB flash drive of at least 2 GB (The best size is 1GB or 2GB. Some old computers do not allow to boot from USB having size being larger than 1GB).

4. A Windows 7 OS or a previous version.

Procedure:

1. Attach the USB to your computer

2. Unzip DOS.zip and run HpUSBformat.exe (this program can only be run under Windows 7 or a previous version), select below option values

  • File system: FAT
  • Volume label: SYSTEM
  • Select “Create a DOS Start up disk”
  • Select radio button “Using DOS system files located at:”
  • Enter the path where you have extracted DOS.zip files (Give the path of DOS folder).

3. Copy all other files from DOS folder to your USB disk (you can overwrite the existing ones).

4. Copy all the Windows XP installation files (I386) to the USB drive.

5. Boot system from the USB disk (you may need to adjust your BIOS for this).

6. Type fdisk, hit Enter and follow the instructions to create a partition for a new XP installation.

7. Type format d:/s to format the partition in the 6th step. If the partition already exists then use command format d:/q/s.

8. Type cd I386 and hit Enter to go to the I386 folder.

9. Type winnt and hit Enter.

10. Follow the screen instructions.

Important note: Your hard drive size should be less than 128Gb.

In, At, On + Time or Date

In

Use ‘in’ with months, years and periods of time such as decades or centuries:

  • in January
  • in 1978
  • in the twenties

When does the school year begin in your country? – In mine it begins IN September.

Use ‘in’ a period of time in the future to express that an action will occur after that amount of time:

  • in a few weeks
  • in a couple of days

At

Use ‘at’ with an exact time:

  • at six o’clock
  • at 10.30
  • at two p.m.

When do you eat lunch? – I usually eat it AT noon.

On

Use ‘on’ with days of the week:

  • on Monday
  • on Fridays

Use ‘on’ with specific calendar days:

  • on Christmas day
  • on October 22nd

When is your birthday? – Mine is ON October 12.

Important notes

in the morning / afternoon / evening – at night

We say in the morning, afternoon or evening BUT we say ‘at night’.