Which one is better to live in, Calgary or Edmonton? Why?

Calgary and Edmonton are the 2 biggest cities in Alberta, Canada. The question is which one is better to live in, Calgary or Edmonton? Why?

What are the pros and cons of Calgary vs Edmonton.




As someone who has lived in both cities for more than 3 years and is still living in Calgary:

  1. Weather: you have more sunshine and less harsh winter in Calgary with occasional positive temperature in the middle of the winter because of the Chinook winds: Calgary wins
  2. Cost of life: Edmonton rent, home ownership, food, clothing is slightly cheaper than same items in Calgary: Edmonton wins
  3. Job Opportunities: more blue collar jobs in Edmonton, more white collar jobs in Calgary: tie
  4. Education: Edmonton has one of the top university in Canada called University of Alberta. University of Calgary has a first class business school called Hayskane school of business. Edmonton wins.
  5. City’s architecture: Calgary seems newer, nicely architected and just more beautiful to me by far: Calgary wins
  6. People: just the same to me, no difference: tie
  7. Size and population: Calgary (1.3 million people, 825 km2) is larger and have more people than Edmonton (1 million people, 684 km2): I won’t call this a win
  8. Mountains and lakes : Banff National Park, Lake Louise, Jasper National Park, Waterton Lakes National Park, are all closer to Calgary than Edmonton: Calgary Wins
  9. Summer festivities: Both cities have great and similar festivals, but Calgary hosts the greatest western festival on earth in July called the Stampede. Calgary wins.
  10. Sunshine: Calgary has way more sunshine that Edmonton. In fact, Calgary is amongst the top city with sunshine exposure in the entire country. Sunshine is happiness. Calgary wins.
  11. Politics: Both cities are economically conservative. Edmonton is a little bit more socially liberal than Calgary. Who cares? Tie.
  12. Sports: Flames(NHL)and Stampeders(CFL)in Calgary, Oiler(NHL) and Eskimos(CFL) in Edmonton. Several amateur leagues, indoor and outdoor facilities for soccer, hockey, basketball, football and baseball in both cities; ShowUpAndPlay in Calgary, ShowUpAndPlay in Edmonton : Tie
  13. Bars and Pubs: Cowboys in Calgary, Black dog free house in Edmonton are the most populars. Cowboy culture in both cities but not violent, no guns. Tie ( The 10 Best Nightclubs in Calgary , The Best Nightlife in Edmonton – TripAdvisor )
  14. Downton: See Calgary Downtown inRealTimeNow.com. See Edmonton inRealTimeNow.com They are both vibrant and Nice: Tie
  15. Cleanliness: Calgary is one of the cleanness cities in the world. I am in awe myself whenever I walk downtown and in my neighbourhood of Walden. Calgary wins by far.

 

With all that in mind, I’ll choose Calgary any day.

Resources:




Learn more about Calgary here.
Learn more about Edmonton here.

Are you planning to visit or move to Calgary or Edmonton?

Things to do to build more diverse technical teams?

What are specific Things to do to build more diverse technical teams?

  • 1. Start at the junior high school level in poor neighborhood by helping schools to teach minority kids how to code.
  • 2. Help set up computer labs in junior high school in poor neighborhoods so that kids who cannot afford the equipment can use the lab.
  • 3. Start coding challenges with prizes in those high school neighborhood and make the kids feel confident about their abilities.
  • 4. Get successful minorities entrepreneurs to host the kids and give them tours of their companies and offices and projects to inspire them.
  • 5. Give internships to minorities kids starting in high school.
  • 6. For the kids in senior high school who missed early adoption to coding, speed them up with after hours coding classes to prepare them for college.
  • 7. In college, make the minority kids feel welcome. Try to make them part of all activities ( computer related or not).
  • 8. For the kids in senior high school who missed early adoption to coding, speed them up with after hours coding classes to prepare them for college.
  • 9. In college, make the minority kids feel welcome. Try to make them part of all activities ( computer related or not). Help find internships from top IT firms (Google, Apple, IBM, etc.) for minorities.
  • 10. When minorities start working after college, welcome them in the team and trust them. Don’t just invite certain kids to dinner and golf. It makes minorities feel unappreciated and unwanted.
  • 11. Give minorities the same opportunity of advancement at work with other employees.
  • 12. Inclusion, inclusion, inclusion in every aspect of the company is the key.
  • Assess the progress of your efforts and adjust. Make sure that team leads or managers are open minded people and make it a priority for them to build diverse teams, because in the long run, it will be a win win for the company

Read more here on Quora.

How to stay healthy as a software engineer?

Tricks and Tips: How to stay healthy as a software engineer or IT professional?

I am a software engineer like you and by my second year I started feeling the unhealthy behavior of sitting down and coding for long hours.

How to stay healthy as a software engineer
How to stay healthy as a software engineer

Below are the steps that I took:

  1. Avoid sitting down for more than 1 hour without getting up for a walk.
  2. Stand up for 15 minutes every hour to code.
  3. Take multiple short walks outdoor during working hours.
  4. Avoid elevators unless you have no choice, use the stairs to go up and down if your office floor is lower than the 5th floor.
  5. Avoid drinking sweet drinks or too much coffee during work hours.
  6. Avoid eating chips or almost anything while working.
  7. Instead of spending long hours reading manuals and documents on your computer, print them out, then take a walk and read them somewhere quiet while standing.
  8. Stretch often while working (extend your legs, arms, rotate your neck).
  9. Take short breaks of 2 to 5 minutes every 2 hours to read something different from your main topic. It can be news, sports, entertainment, or anything else you like. I read or write on Quora during my breaks.
  10. Change your position frequently and don’t hesitate to stand up at your desk from time to time while working.
  11. Make sure that your chair is always comfortable. Don’t hesitate to upgrade or get a better chair if necessary.

Here are the steps that I took to stay active and healthy:

  1. I am committed, no matter what, to playing at least 2 competitive games of soccer or basketball a week, either in an amateur team league or at drop-in sports leagues. Check out one of my drop in league chapter in your city at ShowUpAndPlaySports chapters – Djamga – ShowUpAndPlaySports
  2. I volunteer to organize soccer and basketball games every week via Home – Djamga – ShowUpAndPlaySports
  3. I walk regularly at lunch time, and try to get as much sunshine as possible.
  4. I visit a chiropractor once a month to adjust my back and neck.
  5. I visit a certified massage therapist regularly to work on my neck, back, hamstrings, and feet.
  6. I visit a pedicure clinic once a month for a good pedicure and foot massage.
  7. I eat a healthy diet of mostly vegetables and fish (mostly salmon).
  8. I drastically reduced the carbs in my diet. Every morning, I take one cup of coffee or tea with no sugar or milk and a small cake. Then, I am covered until dinner time. In the evening, I have a large meal of vegetables and fish, usually salmon.
  9. I drink plenty of water.
  10. I don’t drink alcohol or smoke.
  11. It is very important to sleep well; sleep at least 6 hours per day.
    You spend about 25% of your life in your bed, there you need to invest on your mattresses, pillows, bed furnitures and upgrade them regularly.

After adopting these habits, my efficiency came back. I was able to work as hard as when I was a student . I even lost weight!

Now, I can go toe-to-toe with young players and students in their twenties on the soccer field. I easily work more than 60 hours per week and still have enough time to play with my kids and enjoy a fulfilling life with my family.

I highly recommend these life-changing habits to all IT professionals and engineers so they can remain healthy and effective as they get older and busier.

reverse a string on Linux and Windows

How to reverse a string on Linux and Windows

Via shell script on Linux

reverse a string on Linux and Windows

sh-3.2# vi reverse.sh
#### Start Script #####
#!/bin/bash
input_string=”$1″
reverse_string=””

input_string_length=${#input_string}
for (( i=$input_string_length-1; i>=0; i– ))
do
reverse_string=”$reverse_string${input_string:$i:1}”
done

echo “$reverse_string”
##### End Script #####

Let’s run it:

sh-3.2# chmod 775 reverse.sh
sh-3.2# ./reverse.sh Etienne
enneitE

Via powershell script on Windows

#Let’s use the script reverse.ps1 below.
######
$string=”Etienne”
$string_array=$string -split “”
[array]::Reverse($string_array)
$string_array -join ”

#####Output#####
PS C:\Users\etienne_noumen\Documents\Etienne\Scripting> .\reverse.ps1

E t i e n n e

enneitE

Via powershell script on Windows in one line

([regex]::Matches($String,’.’,’RightToLeft’) | ForEach {$_.value}) -join ”

Via batch script on Windows

::Note: ReverseStr also calls StrLen
::and string length is not greater than 80 chars
:: but can be changed.

@echo off
SetLocal EnableDelayedExpansion
cls
set Str=Etienne
call :StrLen %Str%
echo Length=%Len%
call :ReverseStr %Str%
echo String=%Str%
echo Reverse Str=%Reverse%
exit /b

::—————-
:: Calc Var Length
::—————-
:: %*=Str to Check
:: Returns %Len%
:: —————
:StrLen %*
set Data=%*
for /L %%a in (0,1,80) do (
set Char=!Data:~%%a,1!
if not “!Char!”==”” (
set /a Len=%%a+1
) else (exit /b)
)
exit /b

::—————
:: Reverse String
::—————
:: %* Str to Reverse
:: Returns %Reverse%
::——————
:ReverseStr %*
set Data=%*
call :StrLen %Data%
for /L %%a in (!Len!,-1,0) do (
set Char=!Data:~%%a,1!
set Reverse=!Reverse!!Char!
)
exit /b

Via perl script on Windows or Linux

Via python script on Windows or Linux

Source:

  1. http://www.computing.net/answers/programming/reverse-a-string-in-dos/26004.html

jQuery What is it?


Who hasn’t gotten this question yet: jQuery What is it?

Source: http://www.w3schools.com/jquery/jquery_intro.asp

Definition:
jQuery is a lightweight, “write less, do more”, JavaScript library.
jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.

Purpose
The purpose of jQuery is to make it much easier to use JavaScript on your website.
jQuery’s syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications
jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.

What is in it
The jQuery library contains the following features:

  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and animations
  • AJAX
  • Utilities

Advantages:
The modular approach to the jQuery library allows the creation of powerful dynamic web pages and web applications.
jQuery has plugins for almost any task out there.

jQuery Syntax:
The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s).

Basic syntax is: $(selector).action()

  • A $ sign to define/access jQuery
  • A (selector) to “query (or find)” HTML elements
  • A jQuery action() to be performed on the element(s)

Examples:

$(this).hide() – hides the current element.

$(“p”).hide() – hides all

elements.

$(“.test”).hide() – hides all elements with class=”test”.

$(“#test”).hide() – hides the element with id=”test”.

Example of html page including jQuery code:
jQuery_Code_Example
Test it below:






If you click on me, I will disappear.

Click me away!

Click me too!




More on jQuery:
[jQuery Guide and Resources]

JSON : JavaScript Object Notation

What is JSON : JavaScript Object Notation?

Source: https://www.json.com/

What is JSON?

JSON is a lightweight text-based open standard designed for human-readable data. It is the most widely used format for exchanging data on the web. It originates from the JavaScript language and is represented with two primary data structures: ordered lists (recognized as ‘arrays’) and name/value pairs (recognized as ‘objects’).

Why JSON?

The JSON standard is language-independent and its data structures, arrays and objects, are universally recognized. These structures are supported in some way by nearly all modern programming languages and are familiar to nearly all programmers. These qualities make it an ideal format for data interchange on the web.

JSON vs XML

The XML specification does not match the data model for most programming languages which makes it slow and tedious for programmers to parse. Compared to JSON, XML has a low data-to-markup ratio which results in it being more difficult for humans to read and write.

JSON Data Types

  • Number{ “myNum”: 123.456 }
    A series of numbers; decimals ok; double-precision floating-point format.
  • String{ “myString”: “abcdef” }
    A series of characters (letters, numbers, or symbols); double-quoted UTF-8 with backslash escaping.
  • Boolean{ “myBool”: true }
    True or false.
  • Array{ “myArray”: [ “a”, “b”, “c”, “d” ] }
    Sequence of comma-separated values (any data type); enclosed in square brackets.
  • Object{ “myObject”: { “id”: 7 } };
    Unordered collection of comma-separated key/value pairs; enclosed in curly braces; properties (keys) are distinct strings.
  • Null{ “myNull”: null }
    Variable with null (empty) value.

Unsupported Data Types

  • Undefinedvar myUndefined;
    Variable with no value assigned.
  • Datevar myDate = new Date();
    Object used to work with dates and times.
  • Errorvar myError = new Error();
    Object containing information about errors.
  • Regular Expressionvar myRegEx = /json/i;
    Variable containing a sequence of characters that form a search pattern.
  • Functionvar myFunction = function(){};
    Variable containing a block of code designed to perform a particular task.

JSON cheat sheet

Example1: Mixed Data Types

var myObject = {
“myNumber”: 123.456,
“myString”: “abcdef”,
“myBool”: true,
“myArray”: [ “a”, “b”, “c”, “d” ],
“myObject”: { “id”: 7 },
“myNull”: null
};

Example2: Send HTTP POST request with JSON to a http://url with the following string fields: ‘first_name’, ‘last_name’, ’email’, ‘phone’,’urls’

curl -X POST -d ‘{“first_name”: “John”, “last_name”: “Doe”, “email”: “johndoe@email.com”, “phone”: “000-000-0000″,”urls”: [“https://djamga.com”,”http://enoumen.com”,”http://twitter.com/enoumen”]}’ http:/url -H ‘Content-Type: application/json’

Remove all empty lines in a file

How to Remove all empty lines in a file on Linux and Windows?

Remove empty lines from file.txt via Linux command line

  • Option 1: sed -i ‘/^$/d’ file.txt
  • Option 2: awk ‘NF > 0’ file.txt > output.txt
  • Option 3: perl -i.backup -n -e “print if /\S/” file.txt
  • Option 4: grep . file.txt > output.txt

Remove empty lines from file.txt using Powershell script on Windows

  • (gc file.txt) | ? {$_.trim() -ne “” } | set-content file.txt
  • Windows Boot process

    What is involved in Windows Boot Process:

    Windows_Booting_Procedure

    • Power is turned on.
    • The first process starting when you turn on your computer is BIOS i.e, Basic Input Output System. BIOS has two functions, to conduct POST and read MBR.
      1. POST – POST stands for Power On Self Test. POST checks all the hardware devices connected to a computer like RAM, hard disk etc and make sure that the system can run smoothly with those hardware devices. If the POST is a failure the system halts with a beep sound.
      2. Now BIOS checks the boot priority. We can set the boot priority as CD drive, hard disk or floppy drive
      3. MBR – The next duty of BIOS is to read the MBR. MBR stands for Master Boot Record and its the first sector on a hard disk. MBR
        contains the partition table and boot loader.
    • Functions of Boot loader
      Now BIOS has passed the control to boot loader and boot loader is a small program which loads kernel to computers memory. Actually there are two stages of boot loaders, stage 1 boot loader and stage 2 boot loader. MBR contains the stage 1 boot loader and stage 1 boot loader is a link to the stage 2 boot loader. The stage 2 boot loader resides in the boot partition and it loads the kernel to memory.
    • Boot files and functions
      There are three boot files in a Windows operating system and they are NTLDR, NTDETECT.COM and Boot.ini. The boot files are found in the active partition of hard disk and its normally C drive in a Windows machine.

      1. NTLDR – NTLDR stands for NT Loader and its the second stage bootloader. The path of NTLDR is C:\Windows\i386\NTLDR.
      2. Boot.ini – Boot.ini contains the configuration files of NTLDR. When the operating system is loaded we cannot pass any arguments to kernel, so those arguments are passed through boot.ini. You can edit boot.ini by opening through notepad. The path of Boot.ini is C:\boot.ini.

      3. NTDETECT.COM – This file detect hardware’s and passes information to NTLDR. Using the collected information the NTLDR creates a hardware key and this key is used to detect hardware’s. A new hardware key is generated after each reboot of the operating system and that’s why system asks to reboot after installation of a new hardware. The hardware keys created by NTLDR can be found in Windows registry at
        HKEY_LOCAL_MACHINE -> HARDWARES.

    • Kernel and its functions
      After executing the functions of boot files the control is passed to Kernel. ntoskrnal.exe is the kernel file in a Windows machine and its path is C:\Windows\system 32\ntoskrnal.exe. Kernel acts as a layer between software and hardware. The library file hal.dll (C;\Windows\system32\hal.dll) helps Kernel to interact with hardware’s. HAL stands for Hardware Abstraction Layer and this hal.dll file is
      machine specific. Now the drivers for hardware’s are loaded from the file C:\Windows\system32\config\system and the Kernel is loaded to primary memory.
    • Services and log in procedure
      When kernel is loaded in the primary memory services for each process is started and the registry entry for those services can be found at HKEY_LOCAL_MACHINE – System – Current control set – Services.
      Winlogon.exe (C:\Windows\system32\winlogon.exe) is the last service started during this process.
      Winlogon.exe starts the log in procedures of windows machine. It first calls the library file msgina.dll (C:\Windows\system32\msgina.dll). MSGINA stands for Microsoft Graphics Identification and Authentication and it provides the log in window. Now msginal.dll passes the control to LSA (Local Security Authority), it verifies the username and password from the SAM file. SAM (Security Accounts Manager) contains the information about all users created in a Windows operating system.
      Now the booting procedure is over and we have reached the desktop of Windows operating system.

    Source:

    1. https://kb.acronis.com/sites/default/files/content/2006/01/1934/windows_booting_procedure.pdf
    2. http://www.slideshare.net/dominiquec/understanding-the-boot-process

    Mac OS X Boot Process

    What is Mac OS X Boot Process:

    Boot ROM Firmware. Part of Hardware system
    BootROM firmware is activated
    POST Power-On Self Test
    initializes some hardware interfaces and verifies that sufficient memory is available and in a good state.
    EFI Extensible Firmware Interface
    EFI does basic hardware initialization and selects which operating system to use.
    BOOTX boot.efi boot loader
    load the kernel environment
    Rooting/Kernel The init routine of the kernel is executed
    boot loader starts the kernel’s initialization procedure
    Various Mach/BSD data structures are initialized by the kernel.
    The I/O Kit is initialized.
    The kernel starts /sbin/mach_init
    Run Level mach_init starts /sbin/init
    init determines the runlevel, and runs /etc/rc.boot, which sets up the machine enough to run single-user.
    rc.boot figures out the type of boot (Multi-User, Safe, CD-ROM, Network etc.)
    • Power is turned on.
    • Open Firmware code is executed.
    • Hardware information is collected and hardware is initialized.
    • Something (usually the OS, but also things like the Apple Hardware Test, etc.) is selected to boot. The user may be prompted to select what to boot.
    • Control passes to /System/Library/CoreServices/BootX, the boot loader. BootX loads the kernel and also draws the OS badges, if any.
    • BootX tries to load a previously cached list of device drivers (created/updated by /usr/sbin/kextcache). Such a cache is of the type mkext and contains the info dictionaries and binary files for multiple kernel extensions. Note that if the mkext cache is corrupt or missing, BootX would look in /System/Library/Extensions for extensions that are needed in the current scenario (as determined by the value of the OSBundleRequired property in the Info.plist file of the extension’s bundle.
    • The init routine of the kernel is executed. The root device of the booting system is determined. At this point, Open Firmware is not accessible any more.
    • Various Mach/BSD data structures are initialized by the kernel.
    • The I/O Kit is initialized.
    • The kernel starts /sbin/mach_init, the Mach service naming (bootstrap) daemon. mach_init maintains mappings between service names and the Mach ports that provide access to those services.
    • From here on, the startup becomes user-level:

    • mach_init starts /sbin/init, the traditional BSD init process. init determines the runlevel, and runs /etc/rc.boot, which sets up the machine enough to run single-user.
    • rc.boot figures out the type of boot (Multi-User, Safe, CD-ROM, Network etc.). In case of a network boot (the sysctl variable kern.netboot will be set to 1 in which case), it runs /etc/rc.netboot with a start argument.

    Source: http://osxbook.com/book/bonus/ancient/whatismacosx/arch_startup.html

    Linux Boot process

    Let’s describe Linux Boot Process:

    BIOS Basic INPUT/OUTPUT System.
    Executes MBR
    MBR Master Boot Record
    Executes GRUB
    GRUB Grand Unified Bootloader
    Executes kernel
    KERNEL Kernel
    Executes /sbin/init
    INIT Init
    Executes Run level programs
    Run Level Run Level Programs are executed from /etc/rc.d/rc*.d/
    • As power comes up the BIOS is given control
    • BIOS runs self tests, usually including cursory memory tests.
    • The BIOS then loads the first sector of the disk to be used for booting and transfers control to it.
    • The MBR code varies. One version will chain to the code in the first sector of the boot partition (Windows), another will load a bootloader. Windows boot proceeds from code and information in the boot partition.
    • The bootloader chooses kernel location and version
    • The bootloader prepares kernel and initrd image in memory, transfers control to kernel
    • Loading kernel modules
    • Discovering hardware and load additional kernel modules to support it
    • Looking for disks
    • R/O mount of / partition so that it can potentially be checked and repaired
    • init process spawn
    • /etc/inittab read and executing
    • Mounting all FSes from /etc/fstab
    • runlevels running (based on default runlevel in /etc/inittab) or another init method such as systemd or upstart
    • rc.local
    • login prompt

    Source:

    1. http://unix.stackexchange.com/questions/27034/discribe-in-details-tha-boot-process-of-any-linux-system
    2. http://www.thegeekstuff.com/2011/02/linux-boot-process/
    3. Watch video here
    4. http://www.slideshare.net/dominiquec/understanding-the-boot-process