Tuesday, May 24, 2022

Programming job opportunities by country

In my last blog post, I showed programming jobs by city, using LinkedIn. This got me thinking about job opportunities by country, normalized by population. Here is a sample for Python jobs:

We see that per capita, there are 124 times more Python jobs in the USA than in Egypt. Netherlands is close to the USA. Comparing Germany and Turkey, Germany has 79 / 3 = 26 times more jobs. These figures provide a rough estimation of opportunity differences in the tech industry. And since talent needs opportunity to flourish, it correlates with the direction and speed of brain drain (human capital flight).

Programming language selection

When selecting a programming language to specialize in, it makes sense to check industry demand. I used LinkedIn's job search and got the following job post numbers:


As you can see, the first four (Python, Java, JavaScript and C++) are close to each other and C# is a distant fifth.

Friday, May 20, 2022

Summer time

Doing extra-curricular projects will be a differentiating factor throughout your professional career because it will demonstrate your interest in the field, desire to learn and motivation. These are highly sought after qualities which separate the top engineers from the average. Below is a question from an online application which shows the importance of having a mobile and a web app project:


Summer is a good time to go the extra mile because there is no exam pressure. Of course there are internships to do, fun places to go, books to read and re-charging for the up coming semester.

If you think you can spare some time during the summer, I can help you with the following in a low-pressure setting:

  • Coding projects to enrich your GitHub portfolio
    • Ideas
    • Design guidance
    • Management (sprint planning with Trello)
    • Implementation (code review, debugging)
    • Documentation
    • Testing
  • Meetings
    • Tech discussions, e.g. self driving cars, cryptocurrency, internet of things, games, medicine/bioinformatics. Sectors: Automotive, aerospace, medicine, bioinformatics, games, finance (incl. crypto), cyber security etc.
    • Team building: You are not just my mentees but potential founders / colleagues for me and for each other. Think of all these activities as parts of an extended interview.
    • Start-up idea brainstorming.
If your summer is not 100% occupied and you want to stand out, send me a message so that we can make plans.

Tuesday, May 17, 2022

Testimonials

Recent comments from my mentees:

"Working with you was an insanely beneficial learning experience. Your approach to tackling problems is much more efficient than what I used to do." Amer

"I usually get confused by the details, you showed me how not to loose sight of the overall picture." Nansy

Monday, May 16, 2022

Programming the PIC microcontroller

Recently I helped my students with a PIC18F8722 microcontroller project. Hardware setup:

  1. UNI-DS6 Development System + microboard with PIC18F8722 and seven segment display
  2. PICkit 3 In-Circuit Debugger
  3. Windows 10 PC + MPLAB X IDE + XC8 compiler
Notes:
  • Pay attention on how the cable is connected to PICKit 3.
  • Difference between PORT and LAT: The latch is the output latch onto which values are written. The port is the voltage at the actual pin… So in most situations, you will write to the latch and read from the portWhen you're reading from LATx, you're reading what is in the Data Register, when you read from PORTx, you're reading the actual I/O pin value. PIC uses read-modify-write to write operations and this can be a problem, so they use this shadow register to avoid it.
  • Setting timer and interrupt bits:
//Clear interrupts
INTCONbits.GIE = 0; //Global interrupt enable
INTCONbits.TMR0IE = 0; //Timer0 interrupt enable.
TMR0L = 0;    
TMR1 = 0;

//TIMER 0 (PIC18F8722)
INTCONbits.GIE = 1; //Global interrupt enable
INTCONbits.TMR0IE = 1; //Timer0 interrupt enable.
INTCONbits.TMR0IF = 0;
T0CONbits.T08BIT = 1;
T0CONbits.T0CS = 0; //internal clock selected
T0CONbits.PSA = 1; //prescaler is NOT assigned
T0CONbits.T0PS0 = 0;
T0CONbits.T0PS1 = 0;
T0CONbits.T0PS2 = 0;
T0CONbits.TMR0ON = 1;

//TIMER 1
T1CONbits.RD16 = 1;
T1CONbits.T1CKPS0 = 0;
T1CONbits.T1CKPS1 = 0;
T1CONbits.T1OSCEN = 0;
T1CONbits.TMR1CS = 0;
T1CONbits.TMR1ON = 1;
T1CONbits.T1RUN = 1;
  • Using two timers with interrupt:
void __interrupt() isr(void) {
    if(TMR0IF) { //Timer 0 overflow
        TMR0IF = 0; //Clear Timer 0 interrupt flag
        TMR0 = 0; //Timer 0 counter
    }
    if(TMR1IF) { //Timer 1 overflow
        TMR1IF = 0; //Clear Timer 1 interrupt flag
        TMR1 = 30000; //Set counter so that overflow takes less time
    }
}
  • Calculating timer overflow period:
    • For 40MHz oscillator, use #pragma config OSC = HSPLL
    • Frequency of instruction cyles = 40Mhz/4 = 10MHz → 1 instruction cyle = 0.1us
    • 8 bit timer overflows every 2^8 instruction cycles = 256 * 0.1 = 25.6us
    • 16 bit timer overflows every 2^16 instruction cycles = 6553.6us = 6.5536ms
  • XC8 problem: Cannot use const int nTimer0_500ms = 19531; int maxTimer0 = nTimer0_500ms; XC8 displays message “error: (712) can't generate code for this expression” at the int maxTimer0 = nTimer0_500ms line. I had to use #define nTimer0_500ms (19531).
  • cTimer0 > 2 * 19531 → we expected 1s delay but the board LEDs behaved strangely. When we used a prescaler of 1:2 (000), it worked as expected.
  • Make Timer 1 faster by setting TMR1 to e.g. 30000 so that it start counting from TMR1 and number of counts until overflow would be 2^16 - TMR1.
  • Finding a binary number corresponding to row: nb += 1 << iRow
  • PORTA = 0b0011: Turn on first two LEDs in column A of board
  • Turn on 4th bit of a number: nb |= 1<<4
  • Turn off 4th bit of a number: nb &= ~(1<<4)
  • You have to check button presses multiple times to give user time and to do debouncing.