Thursday, 5 October 2017

Use of Private Constructor in OOPS

If we set access specifier of a constructor to private, then that constructor can only be accessed inside the class. A private constructor is mainly used when you want to prevent the class instance from being created outside the class. 

This is mainly in the case of singleton class. Singleton classes are employed extensively in concepts like Networking and Database Connectivity. Using private constructor we can ensure that no more than one object can be created at a time. 

Example of Private Constructor in a Singleton Class

public class SingletonClass
{
    public static SingletonClass singletonClass;

    private SingletonClass() 
    {
    }

    public static SingletonClass getInstance() 
    {
        if(singletonClass == null) 
        {
            singletonClass = new SingletonClass();
        }
        return singletonClass;
    }
}

A class with private constructor cannot be inherited.

If we don’t want a class to be inherited, then we make the class constructor private. So, if we try to derive another class from this class then compiler will flash an error. Why compiler will flash an error? 

We know the order of execution of constructor in inheritance that when we create an object of a derived class then first constructor of the base call will be called and then constructor of derived class. Since base class constructor is private, hence, derived class will fail to access base class constructor.

We can also use sealed class to stop a class to be inherited. Sealed class provide more flexible and readable way to stop inheritance.

Diamond Problem in Multiple Inheritance in OOPS

The diamond problem occurs when two super classes of a class have a common base class. 

Suppose there are four classes A, B, C and D. Class B and C inherit class A. Now class B and C contains one copy of all the functions and data members of class A. Class D is derived from class B and C. Now class D contains two copies of all the functions and data members of class A. One copy comes from class B and another copy comes from class C.

Let’s say class A has a function with name display(). So class D have two display() functions as I have explained above. If we call display() function using class D object then ambiguity occurs because compiler gets confused that whether it should call display() that came from class B or from class C. If you will compile above program then it will show error.

This kind of problem is called diamond problem as a diamond structure is formed (see the image).

That is why major programming languages like C#, Java and Delphi don't have multiple inheritance because it can lead to diamond problem and rather than providing some complex way to solve it, there are better ways through which we can achieve the same result as multiple inheritance. We can use interfaces to resolve this problem.

C++ supports multiple inheritance.

Notice that the above problem with multiple class inheritance can also come with only three classes where all of them has at least one common method.

Because of this problem we can not extend two classes for implementing multiple inheritance and to resolve this problem of multiple inheritance in object oriented programming we use interfaces for implementing the functionality of multiple inheritance. 

As we know we do not define a function but only declare that function in an interface. So if we use interfaces we can extend one class and one or more interfaces or we can implement more than one interfaces at a time to use the functionality of multiple inheritance and we can escape from diamond problem.

Thursday, 28 September 2017

How to declare Static/Class variables, properties, functions and procedures in Delphi?

In Delphi, we do have static variables, properties, functions and procedures, but instead of the word "static" we refer the word "class". In this tutorial, I have shown the syntax of declaring the static variables, properties, functions and procedures in Delphi. We don't have to use "static" keyword while declaring the static variables and properties, just use "class" keyword. While declaring static functions and procedures, we have to use both "class" and "static" keyword.

Declare a static/class variable in Delphi

type
  TStaticDemoClass = class(TObject)
  public
    class var StaticVar: integer;
  end;
Declare a static/class property in Delphi

type
  TStaticDemoClass = class(TObject)
  private
    class var FStaticVar: integer;
  public
    class property StaticVar: integer read FStaticVar write FStaticVar;
  end;

Now we can use above StaticVar variable/property anywhere in the unit like this:
procedure TForm1.Button1Click(Sender: TObject);
var a:integer;
begin
  TStaticDemoClass.StaticVar := 1;
end;

We can also use static/class functions and procedures in Delphi. Below example, I have copied from documentation:

type
  TMyClass = class
    strict private
      class var FX: Integer;
    strict protected  
      //Note: accessors for class properties must be declared class static.
      class function GetX: Integer; static;
      class procedure SetX(val: Integer); static;
    public
      class property X: Integer read GetX write SetX;
      class procedure StatProc(s: String); static;
  end;

TMyClass.X := 17;
TMyClass.StatProc('Hello');

You need to use "static" keyword after function / procedure declaration. Classes can have static class methods -- i.e. methods that can be called from a class type. Class static methods can be accessed without an object reference. Unlike ordinary class methods, class static methods have no Self parameter at all. They also cannot access any instance members. They still have access to class fields, class properties, and class methods. Also unlike class methods, class static methods cannot be declared virtual.

Tuesday, 26 September 2017

VCL Hierarchy in Delphi: Types of Controls in Delphi: TWinControls and TGraphicControls

In VCL (Visual Component Library) hierarchy, you will find TObject at the top, then TPersistent, then TComponent and then TControl.

TObject >> TPersistent >> TComponent >>TControl

VCL Hierarchy in Delphi
TObject is the base class from which all classes descend.

TPersistent class descends directly from TObject. The special characteristic of TPersistent is that it is an abstract class that defines the methods that allow it to be streamed.

TComponent is the base class from which all components descend. Non-visual components are descendants of TComponent. For example: TTimer

TControl is the base class from which all the visual components descend. For example: TEdit, TListBox, TComboBox etc.

Again, there are two types of controls (TControl): Window Controls (TWinControl) and Graphic Controls (TGraphicControl)

Following is the difference between TWinControl and TGraphicControl in Delphi:

TWinControls

TWinControls can receive input focus and they can be parents to other controls.

Example: TEdit, TListBox and TComboBox

TGraphicControl

TGraphicControls differ from TWinControls in that they cannot receive input focus. Also, they cannot be parents to other controls.

Example: TLabel

TGraphicControls are used when you want to display something on the form.

Two key advantages of TGraphicControls over TWinControls:

1. TGraphicControls don't use up system resources since they don't require a window handle.

2. They are a bit faster at drawing than their TWinControl counterparts since their painting is not subject to the windows message dispatching system. Instead, they piggyback on their parent's paint process.

For more details, please refer to documentation.

What is the difference between Singleton Class and Static Class? Which one to use and when?

Almost both singleton class and static class serve the same purpose which creates confusion among developers and architects about which one to use. When to use singleton class and when to use static class. In this article I have tried to differentiate between the two. Following is the list of differences between a singleton class and a static class:

1. Singleton classes are more inclined to the object-oriented concepts as compared to the static classes. With Singleton classes, you can use inheritance and polymorphism to extend a base class, implement an interface and capable of providing different implementations. While a static class cannot inherit their instance members. So, Singleton classes are more flexible than static classes.

2. Singleton classes can be passed as an object to other methods while a static class allows only static methods and you cannot pass static class as parameter.

3. If your requirement is to maintain the state, then singleton class is the better choice than static class, because maintaining the state with static classes is very cumbersome and leads to subtle bugs.

4. Singleton classes can be lazy loaded if it’s a heavy object, but static class doesn't have such advantages and always eagerly loaded. Static class is generally initialized when it is first loaded and it will lead to potential class loader issues.

5. Static classes are hard to mock and consequently hard to test than singletons, which are easy to mock and thus easy to test. It’s easier to write unit tests for singleton than static classes, because you can pass mock object whenever singleton is expected, e.g. into constructor or as method arguments.

6. Singleton classes provide more flexibility. Consider the possibility that your application has a global shared object and tomorrow you decide that you must make more than one instance of the class. If you use a singleton class then all you should do is make the constructor public. This is not so simple with static classes.

7. Many Dependency Injection framework manages singleton quite well e.g. Spring, which makes using them very easy.

8. Singleton objects are stored in Heap, but static objects are stored in Stack.

9. Static class provides better performance than singleton class, because static methods are bonded on compile time.

10. Singleton classes maintain single object across the application life cycle, so the scope is at application level. The static does not have any object pointer, so the scope is at App Domain level. Moreover, both should be implemented to be thread-safe.

Thursday, 14 September 2017

Security and Privacy issues with IoT (Internet of Things) - Top barriers to IoT success

IoT is one of the biggest breakthroughs in the history of the tech industry. It will soon be an inherent part of every aspect of our lives. Security and Privacy are the most significant challenge for the IoT. Security and Privacy issues are acting as top barriers to IoT success. So, addressing underlying security and privacy concerns is very crucial. 

As more and mored devices are being added to the IoT everyday, privacy and security concerns are becoming vital. 

Security issue with IoT devices

Security is one of the main concerns of the IoT ("Internet of Things"). With billions of devices connected to the internet, it is needless to say that to protect your connected devices from malware penetrations is a real challenge. Security risks of IoT devices cannot be ignored whether it is from hackers or corporations. Increasing the number of connected devices increases the opportunity to exploit security vulnerabilities.

When IoT devices are connected to the cloud or data centers via internet, they get under the risk of being accessible to the outside world. Poorly designed devices can easily expose user data to theft. 

There are many reasons behind the state of insecurity in IoT. 

Companies do not update their devices enough or at all. This means that an IoT device which was safe when you first bought it can become unsafe as hackers discover new vulnerabilities.

The fundamental security weakness of the Internet of Things is that it increases the number of devices on the internet. Earlier, most of us had to only worry about protecting our computers, then, we had to worry about protecting our smartphones as well, and now after IoT, we have to worry about protecting our car, our home appliances, our wearables, and many other IoT devices.

Because there are so many devices that can be hacked, that means that hackers can accomplish more. You may have heard about how hackers could potentially remotely control cars and remotely accelerate or decelerate the car. But hackers could use even seemingly unimportant devices like baby monitors or your thermostat to uncover private information or just ruin your day. The point is that we have to think about what a hacker could do with a device if he can break through its security. 

In this way, our normal day to day life and health can become the target of IoT hack attacks. Urban infrastructure can also become a target for hackers.

Privacy issue with IoT devices

Corporations which create and distribute interconnected devices could also use these devices to obtain personal data, particularly dangerous when used for money transfers. Manufacturers can steal the information about your habits and misuse it. 

For example, consider how some companies are distributing Fitbits to their employees so that they can track their health and thus get lower health insurance premiums. Even if we ignore the worrying idea of workers’ health being monitored by corporations around the clock, there is the question of what corporations can do with the data they have gathered. Companies can attempt to send or even sell gathered data to other companies, which raises issues regarding our individual privacy rights.

Vision features and voice recognition are now being integrated into smart TVs. These features can listen continuously to conversations or look for activity and transmit data selectively to cloud services for processing. These cloud services may sometimes even include third parties. The collection of all this information faces a number of regulatory and legal challenges.

The collection of private information exposes legal and regulatory challenges facing data protection and privacy law. There are a wide range of regulatory and legal questions surrounding the IoT, which need thoughtful consideration. Legal issues with IoT devices include crossborder data flow, conflict between law enforcement surveillance and civil rights, data retention and destruction policies, and legal liability for unintended uses, security breaches or privacy lapses. 

In short, Security and Privacy issues are the biggest issues which consumers, businesses and governments need to consider before using IoT connected devices.

Tuesday, 12 September 2017

Real World Examples of IoT (Internet of Things) - How will IoT change our lives?

IoT (Internet of Things) is going to change our lives to a large extent. In the coming years, we will realize the real potential of IoT. Below are some real world examples of IoT.

Lets consider IoT enabled Alarm Clock or say Smart Alarm.

Imagine you wake up at 7am every day to go to work. Your alarm clock does the job of waking you just fine. That is, until something goes wrong. Your train is cancelled and you have to drive to work instead. The only problem is that it takes longer to drive, and you would have needed to get up at 6.45am to avoid being late. Oh, and it’s pouring with rain, so you’ll need to drive slower than usual. 

A connected or IoT-enabled alarm clock would reset itself based on all these factors, to ensure you got to work on time. It could recognize that your usual train is cancelled, calculate the driving distance and travel time for your alternative route to work, check the weather and factor in slower travelling speed because of heavy rain, and calculate when it needs to wake you up so you’re not late. 

If it’s super-smart, if might even sync with your IoT-enabled coffee maker, to ensure your morning caffeine’s ready to go when you get up.

Now consider IoT enabled car or say connected cars.

Having been woken by your smart alarm, you’re now driving to work. On comes the engine light. You’d rather not head straight to the garage, but what if it’s something urgent? In a connected car, the sensor that triggered the check engine light would communicate with others in the car. A component called the diagnostic bus collects data from these sensors and passes it to a gateway in the car, which sends the most relevant information to the manufacturer’s platform. The manufacturer can use data from the car to offer you an appointment to get the part fixed, send you directions to the nearest dealer, and make sure the correct replacement part is ordered so it’s ready for you when you show up.

You are on your way to a meeting; your car could have access to your calendar and already know the best route to take. If the traffic is heavy your car might send a text to the other party notifying them that you will be late. 

Now consider IoT enabled homes or say smart homes.

Take an instance where you need to monitor your home or child when you are away. A simple solution would be to fix an IP camera and monitor its feed using a web or mobile application. You can even hire a babysitter. The former option can give you the complete monitoring data, while the latter cannot. If you fix sensors or devices, which can be reached from anywhere, you have the flexibility to monitor as well as control those devices to the best of their ability; this can make your home or baby 99.99% secure. 

Your home security system, which already enables you to remotely control your locks and thermostats, can cool down your home and open your windows, based on your preferences.

British Gas's Hive Active Heating enables consumers to control their home heating from their smartphone, laptop or tablet. It even has the ability to turn off when no one is home by detecting whether your smartphone is in the house or not.

IoT can help in reducing accidents and save valuable human life.

Let’s look at one example. In 2007, a bridge collapsed in Minnesota, killing many people, because of steel plates that were inadequate to handle the bridge’s load. 

When we rebuild bridges, we can use smart cement: cement equipped with sensors to monitor stresses, cracks, and war-pages. This is cement that alerts us to fix problems before they cause a catastrophe. And these technologies aren’t limited to the bridge’s structure.

If there’s ice on the bridge, the same sensors in the concrete will detect it and communicate the information via the wireless internet to your car. Once your car knows there’s a hazard ahead, it will instruct the driver to slow down, and if the driver doesn’t, then the car will slow down for him.

And thus bridges become smart bridges, and cars smart cars. And soon, we have smart cities, and….

Airplane manufacturers are building air-frames with networked sensors that send continuous data on product wear and tear to their computers, allowing for proactive maintenance and reducing unplanned downtime. 

Now consider some more examples of Real World IoT:

Some insurance companies, for example, are offering to install location sensors in customers’ cars. That allows these companies to base the price of policies on how a car is driven as well as where it travels. Pricing can be customized to the actual risks of operating a vehicle rather than based on proxies such as a driver’s age, gender, or place of residence.

Sensors in even the domestic animals. In the world of IoT, even the domestic animals will be connected and monitored with the help of embedded sensors. This allows farmers to monitor their animal's health and track their movements, ensuring a healthier, more plentiful supply of milk and meat for people to consume. 

Some more...

What if your office equipment knew when it was running low on supplies and automatically re-ordered more? 

What if your refrigerators can warn you when you’re out of milk. 

What if smart dustbins can signal when they need to be emptied.

What if smart tea maker that knows just when you’re in need of a cup of tea.

Truly speaking, you can think of infinite examples of IoT in the real world. It cannot be summarized in an article. There is no limit. Just keep thinking...

Other articles on IoT:

Internet of Things (IoT) - Next Stage of Information Revolution

Internet of Things (IoT) - Next Stage of Information Revolution

The term "Internet of Things" was first coined by Kevin Ashton, cofounder and executive director of the Auto-ID Center at MIT in 1999.

The "Internet of Things (IoT)" is the next stage of the Information Revolution. 

What is IoT (Internet of Things)?

IoT refers to the connection of devices (other than computers, smartphones and tablets) to the Internet via embedded sensors. It allows devices to talk to us and talk to each other. So, IoT can also be defined as a network of internet-connected devices able to collect and exchange data using embedded sensors. 

A thing, in the "Internet of Things", can be a person with a heart monitor implant, a farm animal with a bio-chip transponder, an automobile that has built-in sensors to alert the driver when tire pressure is low or any other natural or man-made object (almost anything else you can think of) that can be assigned an IP address and provided with the ability to transfer data over a network with the help of embedded sensors. 

Earlier the data was created by people on the internet, but now the data will be created by the things (living or non-living) without any human intervention.

IoT Devices

Any stand-alone internet-connected device that can be monitored and/or controlled from anywhere. It should have embedded sensors and on/off switch. It should have the ability to represent itself digitally means it can be assigned an IP address and have the ability to collect and transfer data over a network without manual assistance or intervention. 

Due to the limited address space of IPv4 (which allows for 4.3 billion unique addresses), IoT devices will have to use the next generation of the Internet protocol (IPv6) to scale to the extremely large address space required.

Examples of IoT Devices: Smartwatch, TV,  Refrigerators, Washing Machines, Kitchen Appliances, Thermostats, Cars, Switches, Lights, Blood Pressure and Heart Rate Monitors, Smart grids, Virtual Power Plants, Intelligent Transportation and anything you can think of.

Basically, if your fridge or TV has an Internet connection, then it becomes an IoT device.

If your coffee maker connects to an app on your smartphone that allows you to begin brewing with a tap on your screen, that coffee maker becomes part of the Internet of Things.

As per IoT, Anything that can be connected, will be connected. Connect everything in this world. The Ultimate Goal of IOT is to Automate Human Life. In this way, IoT creates a relationship among people-people, people-things, and things-things.

Applications of IoT

Wearables (like Smartwatches to track health and exercise progress, sleep patterns, send text messages and calls).

Smart Home (hundreds of products in the market that users can control even with their voices).

Smart Cities (solves traffic congestion issues, smart parking, reduces noise, crime, and pollution).

Connected Cars (to assist drivers and reduce accidents).

Internet of Things Devices & Examples

Amazon Echo - Smart Home: The Amazon Echo works through its voice assistant, Alexa, which users can talk to in order to perform a variety of functions. Users can tell Alexa to play music, provide a weather report, get sports scores, order an Uber, and more.

Fitbit One - Wearables: The Fitbit One tracks your steps, floors climbed, calories burned, and sleep quality. The device also wirelessly syncs with computers and smartphones in order to transmit your fitness data in understandable charts to monitor your progress.

Barcelona - Smart Cities: The Spanish city is one of the foremost smart cities in the world after it implemented several IoT initiatives that have helped enhance smart parking and the environment.

AT&T - Connected Car: AT&T added 1.3 million cars to its network in the second quarter of 2016, bringing the total number of cars it connects to 9.5 million. Drivers don't have to subscribe or pay a monthly fee for data in order for AT&T to count them as subscribers.

Other articles on IoT:

Real World Examples of IoT (Internet of Things) - How will IoT change our lives?

Monday, 10 July 2017

Computer Science Internationalization - Unicode Encoding & Decoding

Several years ago I devised this visual and fun way to teach and practise encoding and decoding Unicode. I used this method in my International Computing class. This method involves use of pencil and eraser.

The codepoints and the UTF-8 are all written in hexadecimal(hex). The binary bits are an intermediate form for the purposes of encoding and decoding.

We start with the following form which is designed for encoding Unicode codepoints to UTF-8 and decoding UTF-8 to Unicode codepoints.
Encoding: We will start with encoding Unicode codepoints to UTF-8.

The first thing we can do is fill in the fixed bits. They are the fixed bits defined by the encoding scheme. I have entered the fixed bits in red to make them distinct from variable bits.
Now we will write one or more Unicode codepoints on the form. These will be the codepoints we will encode into UTF-8. The codepoints should be written in hexadecimal. I will use the codepoints U+0444 and U+597D.

So, how do we determine where the codepoints go on the form. We need to look at the free bits to determine the range of values that can be accommodated.

  • 1 byte row - 7 free variable bits giving a range of 0 ➔ 7F
  • 2 byte row - 11 free variable bits giving a range of 80 ➔ 7FF
  • 3 byte row - 16 free variable bits giving a range of 800 ➔ FFFF
  • 4 byte row - 21 free variable bits giving a range of 10000 ➔ 1FFFFF (the actual maximum value of a codepoint is 10FFFF)
Now we know the ranges we can put U+0444 and U+597D in the correct places of the form.

We have empty boxes into which we write the binary values of the codepoints.
Finally, we take the complete bytes and write them as hexadecimal values to form the UTF-8 encoded forms. U+0444 encoded is D184, U+597D encoded is E5A5BD.
Decoding: Now onto decoding from UTF-8 to Unicode codepoints. We will decode the UTF-8 F0AA9FB7 which I have entered onto the form. I have used spaces on the form to make the byte boundaries more obvious.
Complete the bytes by writing the binary variable values.
Extract the variable binary values to form the hex Unicode codepoint U+2A7F7.
Whilst I was at it, I completed a single byte entry. The single byte characters are ASCII characters. ASCII is a subset of Unicode.

It is a Unicode convention, when writing codepoints, to use a minimum of four hex digits. So for codepoints <1000, one should left pad with zeroes. Hence my entries U+0444 and U+0057 rather than U+444 and U+57.

Sunday, 2 July 2017

Computer Science Internationalization - Text Search

So, you have just written some Cool Code which will search for and find occurrences of specified text strings. You have access to Big Data text eg all the text in all public webpages. You will,of course, want to test your Cool Code. Letʼs perform some, seemingly, very simple tests.

Letʼs search for the word 'Scorpion'. Your code works just fine and hence finds all occurrences of the word 'Scorpion'.

Now test with the following two words.

  • Scorpion
  • Scorpion

Your Cool Code works fine as all I have done is applied some CSS styling, thus giving each of the two words differing appearance.

Now test you Cool Code with the following two words.

  • 𝑆𝑐𝑜𝑟𝑝𝑖𝑜𝑛
  • 𝐒𝐜𝐨𝐫𝐩𝐢𝐨𝐧

If you have only programmed for ASCII text then your now not so Cool Code will fail. These two words have differing appearance because they are not made up of the ASCII characters you are familiar with. These words use characters from the Unicode Math Alphanumeric Symbols block, U+1D400-1D4FF.

Should the Math Alphanumeric Symbols Scorpion be treated the same as the ASCII Scorpion wrt the search results of your code? In this context I think "Yes", most definitely. A person reading this blog, for example, will just perceive the word Scorpion whatever characters are used to write the word. The reader may well also visualise the insect with a "sting in the tail"😱

What of current working practice?

With twitter, a user has no means of changing text style within a tweet. It has thus become common to use Unicode Math Alphanumeric Symbols to change appearance. I could, for example, use Unicode Math Alphanumeric Symbols to emphasise a word (eg Scorpion) or phrase within a tweet. The meaning of the tweet remains the same.

Google returns the same number of search results whichever of the above forms of Scorpion I use. At time of writing this is "About 144,000,000 results". I deduce Google is treating ASCII Scorpion and Unicode Math Alphanumeric Symbols 𝑆𝑐𝑜𝑟𝑝𝑖𝑜𝑛 & 𝐒𝐜𝐨𝐫𝐩𝐢𝐨𝐧 as equivalent.

Sogou 搜狗 is a Chinese search engine. Using Sogou: ASCII Scorpion returns 93,341 results, Math Alphanumeric Symbols 𝑆𝑐𝑜𝑟𝑝𝑖𝑜𝑛 returns 4,738, Math Alphanumeric Symbols 𝐒𝐜𝐨𝐫𝐩𝐢𝐨𝐧 returns 61. I think it evident that Sogou does not treat my three forms of Scorpion as equivalent.

I side with Google on this.

Here is a taster of what is happening in the behind the scenes technicalities of Unicode. Letʼs take just one of the Unicode Math Alphanumeric Symbols I have used, 𝐒 MATHEMATICAL BOLD CAPITAL S U+1D412. If you visit codepoints.net/U+1D412 you will see a wealth of information about this character. Of relevance to this blog is the Decomposition Mapping which is to the, oh so familiar, ASCII uppercase capital S. This Unicode information can be used to compute string equivalents which can then be used for search thus providing all relevant results.

The moral of this "Sting in the Tale" is: If you do not already know it, you must learn Unicode, it is essential.

Friday, 28 April 2017

Computer Science Internationalization - Hieroglyphs in Domain Names

I have been aware for a long time that domains such as .com support many human language scripts. Verisign's .com includes support for Hiragana, Gurmukhi, Han, Tibetan, Sinhala, Devanagari, Hangul and many more.

But what of Verisign's .com equivalents .コム (Japanese) and .닷컴 (Korean)? Both of these support a multitude of human language scripts. The supported scripts for many, but not all, Domains are listed in the IANA Repository of IDN Practices iana.org/domains/idn-tables.

Whilst browsing this repository, I discovered there are sixteen domains, all belonging to Verisign, which support Egyptian Hieroglyphs which I think is totally cool! Verisign's .com, .コム and .닷컴 all support Egyptian Hieroglyphs. This means one can register domain names such as:-

  1. 𓇋𓈖𓏏𓂝𓂋𓈖𓄿𓏏𓇋𓍯𓈖𓄿𓃭.com
  2. 𓇋𓈖𓏏𓂝𓂋𓈖𓄿𓏏𓇋𓍯𓈖𓄿𓃭.コム
  3. 𓇋𓈖𓏏𓂝𓂋𓈖𓄿𓏏𓇋𓍯𓈖𓄿𓃭.닷컴

It is possible you do not have an Egyptian Hieroglyph font on your device so here are the domain names in image format.

Google provide a free Egyptian Hieroglyph font which you can download from google.com/get/noto/

Does the Egyptian Hieroglyph string I have used above mean anything? It is actually a transliteration of the English word international. I used ngm.nationalgeographic.com/ngm/egypt/translator.html for the transliteration. The hieroglyphs translator presents the Egyptian Hieroglyphs as images. So, no simple copy and paste of Egyptian Hieroglyph text. I had to match with the appropriate Unicode characters by visual inspection. I cannot guarantee I made all the correct matches but I think I have them correct.

Here are some registered and live Egyptian Hieroglyph Domain Names egyptianhieroglyphic.com/egypt/egyptian-hieroglyphics/

Friday, 31 March 2017

Computer Science Internationalization - Adaptive URL

A URL can consist of a Domain Name and a pathname. In the examples below x.y.z represents the Domain Name, the remainder being the pathname. My experience of the internet is that the pathname is usually written in English or more accurately ASCII. The below ASCII pathname represents a multi-page website in the form of a journey from home to a hotel in Korea.

x.y.z/home/bus/airplane/korea/taxi/hotel

Websites, such as Google, adapt the language of their text content according to the browser preferred display language (BL). This browser preferred language can be set by the user. Letʼs go one step further than Google and adapt the language of the URL pathname according to the BL. Here is the ASCII pathname rewritten into Chinese, Japanese and Korean.

x.y.z/家/公共汽车/飞机/韩国/出租车/饭店

x.y.z/ホーム/バス/飛行機/韓国/タクシー/ホテル

x.y.z/홈/버스/비행기/한국/택시/호텔

So, how do we implement these language adaptive URL parthnames? Firstly, we need to programmatically determine the BL. One way of achieving this is to examine the Accept-Language http header sent from the browser to the server. This will contain one or more language tags. If there is more than one language tag they are presented in priority order. Language tags can take many forms. They include: zh, zh-CN and cmn for Mandarin Chinese; ja for Japanese and ko for Korean. Now that we can determine the BL we can select the appropriate URL pathname, thus internationalizing our website with a language adaptive URL pathname.

On a Linux machine, each component of the pathname will be a directory. In my schema I am assuming an index.html or index.php, per directory. A requirement of this schema is that we do not want a directory hierarchy for each language, nor do we want an index.html or index.php for each language.

My native language is English so I will make my master pathname directory names English ie home, bus, airplane, korea, taxi and hotel. I will make the Chinese, Japanese and Korean directory names as aliases to the English named master directories. This can be easily achieved on Linux with the ln -s command, where ln means link and the -s option means create symbolic link, as opposed to a hard link.

ln -s home 家
ln -s home ホーム
ln -s home 홈

ln -s hotel 饭店
ln -s hotel ホテル
ln -s hotel 호텔

What if your native language is not English? In that case, create the master pathname directory names in your native language. If your native language is Korean then the master directory names will be 집, 버스, 비행기, 한국, 택시 and 호텔 and your links will be:

ln -s 홈 home
ln -s 홈 家
ln -s 홈 ホーム

ln -s 호텔 hotel
ln -s 호텔 饭店
ln -s 호텔 ホテル

Emoji are hugely popular so letʼs construct a totally cool Emoji pathname.

x.y.z/🏡/🚌/✈️/🇰🇷/🚕/🏨

ln -s home 🏡
ln -s bus 🚌
ln -s airplane ✈️
ln -s korea 🇰🇷
ln -s taxi 🚕
ln -s hotel 🏨

I have never encountered an Emoji URL pathname on a website and so implementing such a pathname on your website would be both totally cool and unique. You could also use an Emoji pathname for those languages your website does not support. My schema only supports Chinese, English, Japanese and Korean. If the BL was an unsupported language, such as Arabic, then the Emoji pathname could be displayed in the browser address bar instead of, for example, defaulting to English.

I have used x.y.x to represent the Domain Name, the implication being it is ASCII. We can complete the language adaptive equation by having Domain Names in supported BL languages. Thus my completed equation schema would have Chinese, Japanese and Korean Domain Names in addition to an ASCII Domain Name.

Friday, 17 March 2017

Computer Science Internationalization - EAI

As I stated in schappo.blogspot.co.uk/2017/01/chinese-email-address.html both DataMail and Google mail support Email Address Internationalization (EAI). DataMail provides a complete EAI service which includes both support and creation of Internationalized email addresses. Google Mail provides a partial EAI service, in that, it supports EAI but does not yet provide for creation of internationlized email accounts with internationalized email addresses. Thus organisations using Google Mail have an advantage over those organisations having an ASCII addresses only email service and have a head start in provision of a complete EAI service.

Given the Domain name of an organisation, the Unix host command can be used to determine the mail service provider. Here are some of the organisations using Google Mail:


苹果电脑 ~: host spotify.com
spotify.com has address 194.132.198.198
spotify.com has address 194.132.197.198
spotify.com has address 194.132.198.149
spotify.com mail is handled by 10 ASPMX3.GOOGLEMAIL.com.
spotify.com mail is handled by 1 ASPMX.L.GOOGLE.com.
spotify.com mail is handled by 10 ASPMX2.GOOGLEMAIL.com.
spotify.com mail is handled by 5 ALT2.ASPMX.L.GOOGLE.com.
spotify.com mail is handled by 10 ASPMX5.GOOGLEMAIL.com.
spotify.com mail is handled by 5 ALT1.ASPMX.L.GOOGLE.com.
spotify.com mail is handled by 10 ASPMX4.GOOGLEMAIL.com.

苹果电脑 ~: host twitter.com
twitter.com has address 104.244.42.129
twitter.com has address 104.244.42.1
twitter.com mail is handled by 30 aspmx3.googlemail.com.
twitter.com mail is handled by 10 aspmx.l.google.com.
twitter.com mail is handled by 20 alt1.aspmx.l.google.com.
twitter.com mail is handled by 30 aspmx2.googlemail.com.
twitter.com mail is handled by 20 alt2.aspmx.l.google.com.

苹果电脑 ~: host mixi.jp # ミクシィ
mixi.jp has address 52.198.59.66
mixi.jp has address 54.92.71.226
mixi.jp has address 52.198.89.90
mixi.jp mail is handled by 30 aspmx2.googlemail.com.
mixi.jp mail is handled by 10 aspmx.l.google.com.
mixi.jp mail is handled by 20 alt2.aspmx.l.google.com.
mixi.jp mail is handled by 20 alt1.aspmx.l.google.com.
mixi.jp mail is handled by 30 aspmx3.googlemail.com.

苹果电脑 ~: host bristol.ac.uk # University of Bristol
bristol.ac.uk has address 137.222.0.38
bristol.ac.uk mail is handled by 5 ALT1.ASPMX.L.GOOGLE.COM.
bristol.ac.uk mail is handled by 10 ASPMX2.GOOGLEMAIL.COM.
bristol.ac.uk mail is handled by 1 ASPMX.L.GOOGLE.COM.
bristol.ac.uk mail is handled by 10 ASPMX3.GOOGLEMAIL.COM.
bristol.ac.uk mail is handled by 5 ALT2.ASPMX.L.GOOGLE.COM.

苹果电脑 ~: host bathspa.ac.uk # Bath Spa University
bathspa.ac.uk has address 194.83.160.0
bathspa.ac.uk has address 162.13.24.154
bathspa.ac.uk has address 72.47.217.0
bathspa.ac.uk mail is handled by 10 ALT4.ASPMX.L.GOOGLE.COM.
bathspa.ac.uk mail is handled by 5 ALT2.ASPMX.L.GOOGLE.COM.
bathspa.ac.uk mail is handled by 1 ASPMX.L.GOOGLE.COM.
bathspa.ac.uk mail is handled by 5 ALT1.ASPMX.L.GOOGLE.COM.
bathspa.ac.uk mail is handled by 10 ALT3.ASPMX.L.GOOGLE.COM.
Providing a full EAI service involves going beyond ASCII. It entails supporting Unicode email addresses. Unicode email addresses such as my Chinese email 小山@电邮.在线

Tuesday, 31 January 2017

Computer Science Internationalization - Unicode Terminal Session

Below is an OSX bash shell command line terminal session. It is a real, working terminal session using basic unix commands. It does, though, look significantly different from a standard terminal session. If you know basic unix commands such as ls and cd, you should/may be able to work out what is happening.


苹果电脑 ~: 妈 我的目录
苹果电脑 ~: 茶 我的目录
苹果电脑 我的目录: 丽
苹果电脑 我的目录: 头 文档一 文档二 文档三
苹果电脑 我的目录: 丽
文档一 文档三 文档二
苹果电脑 我的目录: 词 > 文档四






苹果电脑 我的目录: 词 文档四






苹果电脑 我的目录: 丽
文档一 文档三 文档二 文档四
苹果电脑 我的目录: ⇉ 文档四 文档五
苹果电脑 我的目录: 丽
文档一 文档三 文档二 文档五 文档四
苹果电脑 我的目录: → 文档一 文档六
苹果电脑 我的目录: 丽
文档三 文档二 文档五 文档六 文档四
苹果电脑 我的目录:

So, what is happening!?

Firstly I am using Unicode characters. If you search the internet you will find many examples of terminal sessions but they will invariably be using ASCII characters only. In my above terminal session I am using Unicode characters, mostly Chinese/Japanese and two arrow symbol characters.

Where are the commands such as ls and cd? I have mapped a set of commands to Unicode characters using the alias command eg alias 丽='ls'

I have changed the command line prompt.

If you understand basic bash commands, I believe I have now given you sufficient information in order for you to work out what is happening in the terminal session. Knowing Chinese or Japanese gives a slight advantage but it is not essential to understanding this terminal session. The Chinese/Japanese characters I chose for the command mappings are somewhat random so it will not help you to google translate them.

I actually devised these command mappings and the terminal session several years ago. Today, I decided it was time to put it onto my blog. My main purpose was and still is, to encourage students to think beyond ASCII. I believe it has impact because it is so unexpected when one first sees this terminal session.

There can be many different permutations on the session using different human language scripts and unicode symbols. It makes for an interesting and unusual exercise for students studying unix. Absolutely no reason why one should not, for example, use emoji for the command mappings.

Monday, 9 January 2017

Chinese Email Address

The latest and hottest news is that I now have a Chinese email address➜ 小山@电邮.在线 😄

  1. 小山 is my adopted Chinese name
  2. 电邮 means email
  3. 在线 means online

I acquired my free Chinese email address from DataMail which supports email addresses in twelve languages: العَرَبِيَّة‎‎ Arabic, বাংলা Bengali, 中文 Chinese, English, ગુજરાતી Gujarati, हिन्दी Hindi, मराठी Marathi, ਪੰਜਾਬੀ Punjabi, ру́сский Russian, தமிழ் Tamil, తెలుగు Telugu, اُردُو‎ Urdu.

Additionally, DataMail has an impressive family of IDNs (Internationalized Domain Names) with each language having itʼs own IDN.
  1. Arabic داده.امارات
  2. Bengali ডাটামেল্.ভারত
  3. Chinese 电邮.在线
  4. English datamail.in
  5. Gujarati ડાટામેલ.ભારત
  6. Hindi डाटामेल.भारत
  7. Marathi डेटामेल.भारत
  8. Punjabi ਡਾਟਾਮੇਲ.ਭਾਰਤ
  9. Russian почта.рус
  10. Tamil இந.இந்தியா
  11. Telugu డేటామెయిల్.భారత్
  12. Urdu ڈاٹامیل.بھارت

If you would like your own DataMail email address in one of the above languages then just click one of the above links. The website directs you to download an Android or iOS App. One uses the App to actually register a DataMail email address.

The main points in the registration process using the DataMail App are:

  1. The crucial part of this process is that firstly you need to select the language for the email address you are about to register. Subsequent instructions will be in the language you have selected. So, I chose Chinese in order to register 小山@电邮.在线.
  2. Validation of your phone number - the DataMail App will, with your approval, send an SMS text to DataMail in India to confirm your phone number. If the validation process fails, it could be that your phone contract does not cover the sending of international SMS text.
  3. Choosing the local-part which in my case is 小山. The Domain Name part is fixed and is provided by DataMail. There is a Domain Name per language, as above.

I have successfully exchanged emails between Gmail ASCII emails addresses and my DataMail Chinese email address. Gmail supports Internationalized Email Addresses (IEAs) but one cannot create IEAs in Gmail. DataMail, to my knowledge, is currently the only production email system that both supports and allows creation of IEAs. I used Gmail with a browser when testing exchange of IEAs. If you are accessing your Gmail using IMAP or POP then IEAs may or may not work. It all depends on whether or not your client software supports IEAs.

I have sent email from DataMail using my Chinese email address 小山@电邮.在线 to several Gmail users. My current experience is that for some of the Gmail users, my email goes to their spam folder instead of their primary inbox. If this is happening to you or your recipients, please mark the Gmail email as 'not spam' to help prevent reoccurrences of this problem.

In addition to the App, DataMail can be used with a web bowser ➜ 邮.电邮.在线

Currently, the few systems supporting internationalized email addresses are DataMail, Gmail and Outlook 2016. So, what to do when exchanging email with a system that only supports ASCII email addresses? DataMail have thought about this issue and offer email aliasing. One can create ASCII email aliases and use them to exchange email with systems that do not yet support international email addresses. My DataMail mailbox has the Chinese email address 小山@电邮.在线 and ASCII @datamail.in addresses thus allowing me to communicate with any email system.

DataMail is a good example of an AI (Adaptive Internationalized) website. It adapts to the language of the web address used for access. The most obvious adaptation is the text content is in the language of the web address. Secondly, the appropriate language button is highlighted. Finally, and perhaps less obviously, in the top right corner there is a DataMail support email address which is in the current web address language. In the case of 电邮.在线 the DataMail support email address is 支持@电邮.在线

Letʼs examine some of the technicalities of EAI (Email Address Internationalization). The structure of an email address is local-part@Domain Name where the Domain Name identifies a mail server and local-part identifies a mailbox on said mail server. The email addresses you will be most familiar with are ASCII local-part@ASCII Domain Name. IEAs, on the other hand, are of the form Unicode local-part@Unicode Domain Name. In order to make this form work we need to encode both parts with one encoding for the Unicode local-part and a different encoding for the Unicode Domain Name. The encoded email address is UTF-8@punycode. Users see the Unicode email address and Computers work with the encoded address.

For further technical reading, these are the primary EAI RFCs:

  1. tools.ietf.org/html/rfc6531
  2. tools.ietf.org/html/rfc6532
  3. tools.ietf.org/html/rfc6533
  4. tools.ietf.org/html/rfc6534