Category: Uncategorised

Living the Moment (with Gaming and Consoles)

I remember seeing an Atari 2600 clone, an NES clone and a PlayStation in the late 90s and was mind blown by those consoles. I mostly saw them at my friend’s place, and although I got to play very little of it, I became a gamer in my mind just watching others play. Pac-Man, Super Mario and a whole collection of games.

Many of the games for these consoles came as cartridges or compact discs, and the best way to buy them were to go to these discreet shops in Kolkata (New Market/AC Market). You would get these pirated games for cheaper than original, which were very hard to get in the Indian markets.

Games such as Brian Lara Cricket and football games like Winning Eleven were an immediate win, and among friends the controller would be passed around to compete against each other. There were also hits like Silent Hill, Tekken and Mortal Kombat.

There was always the alpha, the kid who probably also owned the console and was impossible to beat. That apart, I always dreamt of owning a console and playing games all day. Coming from a middle class Indian family, consoles were an impossibility – Mainly because they were costly and unaffordable. So I went to other kids house to sit and stare at others playing games.

When I got into a job and started earning in the mid 2000s, I finally could afford a console. I got myself a TV and a PlayStation 2. I bought several games like the God Of War, Need for Speed, Grand Theft Auto. Subsequently, over the years, I would go on to buy many of the consoles and handheld devices. I could afford more technology, the more I aged and moved up the corporate ladder.

The graphics of the newer consoles have increased beyond compare. The hardware now more capable, made way to incredible complexity and unique gameplay experiences. However, with all the latest jazz, what I could not get is the joy and experience I enjoyed when I was young. Even though I could get any new console or games, I was beyond the age of feeling it like how I was when I was a kid trying to play the Atari or PlayStation.

So what is the point? An experience is about living the moment. If you feel you want to do something but postpone it – perhaps to when you have money or more time, it would not be the same as when you actually wished to do it. We grow, become disinterested, or simply things change.

Productivity: Three Things I Changed During Covid.

Like many of us, I had lived a life of belligerence – opinionated, intoxicated, hustled and travelled. I never sat home for a minute. The only time I would find myself at home is to sleep at night. Just couple of weeks before covid hit the world, I was doing a road trip across the winter of Iceland braving snow storms and staying in beautiful scenic Airbnb’s in temperatures way below zero throughout my two week trip.

My sister, the partner in crime and the chief planner, had decided we will travel Europe unlike many would, one country at a time. First of which was Iceland. Next year, August 2020, would have been Italy.

We all know what went down and I guess each of us have a story to tell about the mental and physical assault we went through to get past 2020. Political, religious, international or simply things being shared and shouted on falsely. It still is, half way into 2021, a never ending rabbit hole and there is no choice of exit.

As things are I changed a few things compulsively in my behaviour to work better and make work from home fruitful. But I also found some peace in the process. These are certainly not guaranteed to work for everybody but some things are common sense and I realized it only this late.


Stop criticising everything or everybody. Stop being involved in somebody else life.

Being part of a humongous Indian society, every move you make is a criticism and a gossip. Everybody unrelated even, has a comment on you or the family. The most watched Indian shows capitalize on this culture and reward people for bad bitchy behaviour. This kind of a negative culture gets imbibed from a very young age by seeing parents and others doing it regularly with everybody. “Sharmaji” and the subsequent dialogs inundates the country with memes and jokes – famous of them being “Sharmaji Ka beta”.

This took away a lot of my brain processing. I sat to talk with family or office friends and it took away a lot of mental time – politics, neighbours, relatives and the subject becomes so personal that I was expected to take sides, if I didn’t, they stopped talking or it became awkward. Imagine losing friends and family over politics or religion, both of which won’t help you when you need help.

It not only brought in social anxiety but also the brain was 100% occupied and I gotta no time to think about innovation or code that I could have otherwise written.

What did I do to change this? This is the hardest and it took the longest, especially when it is unconsciously happening.

  1. Silence is golden. Sit and listen and not absorb. From a very young age I had this mental trick to tune out. What I mean by tune out is, I can think of something completely different while I am nodding my head at the discussion on the table. I have a go to trope – I would imagine playing for India in a cricket game. Based on the series going on at that time, I will imagine India to be really struggling to win when I step out to bat and save the game. It sounds ridiculous, but it is more elaborate. Similarly I imagine playing tennis and hitting some outrageous shots. It is narcissistic, yes, but only in my head and so the brain invests in the alternate thought and does not wander. It is similar to how we play video games – we never tell our friends how much we failed, but how well we succeeded in a game. Find the trope that interests you.
  2. If silence doesn’t work, walk away or change the subject. An inflamed brain is a dangerous tool. So choose to exit the conversation or simply make a polite excuse and go away from toxicity.
  3. If none of those work, confront. As an example – A lot of things were falsely being discussed on the subject of how internet and phones work during these times. Or how spams, false news and other tech things work. Having worked with computers and internet for the last twenty years, I may claim to be a subject matter expert on the technology of those subjects but I know only a very small fraction of a fraction. Others are experts in different fields and they are not fully expected to know how technology works. Educate them and remind them politely that you know on the subject and set the record straight. An informed polite confrontation more often than not ends a toxic discussion.
  4. Grow balls to discuss the criticism with the person I am criticising.

Time is irreversible.

If the choice is between taking more time or spending more money, choose to spend the money than taking more time. One can always make back the money, but I can’t with all the money in the world get back the time. Instead of taking a train, which takes a day, if it is affordable, take a flight and be there in three hours. Train may cost way lesser, but the time saved is way more precious, even if it is spent resting.

Of course this comes with several caveats most importantly – affordability. If it is not affordable it is not a choice then one can only spend time whether you choose it or not.

Another caveat might be that you want to spend time – a train journey with a loved one or a trek through scenic landscape than taking that taxi.


Take that risk.

A few of my friends spent a lot of their savings investing in shares, crypto and land. I chose to save for an emergency during Covid. What if I lost my job or lost the saving? What if there is a medical emergency in the family.

When the market rose, at the end of phase I, my friends had doubled or tripled their savings. Fear sometimes makes us irrational, choke up and be complacent. Here I am not just talking of money but everything unknown. Should I take that new job? Should I travel during the times?

An impulsive risk is often detrimental and is like playing Russian roulette. But an informed risk has more chances of success. If I change the job, does the compensation or position cover my risk? Have I researched enough about the new company and its outlook? If I travel, am I taking the precautions of wearing masks, washing my hands and following protocol even more so than normal?

From that lesson, I managed to travel, see movies in theatre, change a job and do a bit of investment during the first/second phase. All of which perhaps I didn’t do so much (except movies and travel) pre-covid times.

Finally, stand against flaming. Think and reason on your own.

end.

Learning Multiple Programming Languages Quickly

Recently I gave a presentation on learning multiple programming languages quickly. The idea of the presentation was to quickly start coding in multiple languages and learn the toughest or the unique parts as we go along practising.

The technique is just common sense though, and has mostly worked for me in my career where I have used it to learn multiple programming languages – Java, JavaScript, Python, Go and Rust to name a few. I intend this article for anybody with interest to learn new languages.

In the hands-on presentation, I presented ways to understand Go, Rust and the newer Nim quickly.

Before we start:

  • Basic knowledge of Programming – Differences between Object Oriented concepts, procedural programming and some previous experience in some programming language.
  • Go and Rust are systems programming languages, which require the knowledge of knowing the internals – particularly network, multiprocessing, memory and other things you wish to use it for. Other languages like JavaScript requires the knowledge of understanding the Web and how various parts of the web work. The more general-purpose the language is the more specific becomes the knowledge – Python can be used for many types of apps and libraries, hence it is important to know fully the consequence of what you want to achieve.
  • The most important aspect to a developer is maintaining the history of the changes made, hence on the way, knowing how git or any other source control tool works will be a great plus!
  • Interest and time is of prime importance. If you have an interest you will make time!

Usually, any programming language has a learning curve. The lower the language is, the harder it becomes. Ruby or Python, for example, might take a week compared to C or C++, which can take weeks. If it takes that long to learn any language, why not learn more than one?

It is essential to pick conceptually similar languages. For example, if you are learning Ruby, Python becomes easier. If you are learning JavaScript, then mixing it with learning TypeScript or Lua can speed the understanding. It also helps compare the features and remember better.

This blog is also no about mastery in learning multiple languages. Mastery takes years together. This is about learning just enough to start coding meaningful stuff quickly.

There are few things common to every language –

Eco System

Eco-System is about how to build and ship. Every language has a source build system, a way to ship for distribution and tools to help build everything.

  • Java has the javac compiler, jars for distribution and the JVM for the runtime.
  • Similarly, python has a runtime installation for running python scripts. IT also has tools like egg and wheel for distribution.
  • Go, and Rust produces system binaries that can run natively without a VM. Go binaries are usually bigger as it compiles a runtime into the binary. Rust has a bare minimum runtime – the coding style itself helps to manage the memory and other safety.
    • Rust has Cargo to create, manage and compile projects, while Go has “go tools” to do something similar.

Defining Functions

Every programming language has a way to declare code blocks, provide an entry to run the code. Keywords such as func, def, fn are used to declare blocks of code.

Additionally, special blocks named “main” exists in many languages, including Go, Rust, C/C++. While Python and Nim, the body of the file itself is the main function.

Decision Making & Looping

The most important part of any code is decision making and looping. Every programming language has tools to enable decision making and looping.

Go handles looping using the for keyword itself for looping over a range, dictionary or sequence. Rust has for loop and while loops similar to many other languages.

Memory Allocation

This is probably the most complex part of a programming language – How to declare a variable, how to destroy after the usage. Higher-level languages use different techniques such as garbage collection and other methods for automatic memory management. Lower-level languages like Rust use several language constructs to help with allocation and deallocation – particularly mutability, ownership and borrowing and lifetimes. Go has a garbage collector along with pointer constructs to offer for managing memory efficiently.

Source Structure and Modularisation

Modularisation and dividing similar functionality, albeit being not as important as others are of deep importance. Languages like Java enforce it by the way code is written into directories. This affects how reusable code is imported and shipped. Rust has modules and cargo for the same purpose while Go borrows a little bit from java. Go also has a specific $GOPATH which makes it a good practice to develop sources in a specific location.

Other Things

OOPS is different in each language. Java is considered a pure Object Oriented Language while JavaScript has a prototype-based inheritance. GO may or may not be called OOPS and Rust is only interface implementation based object-orientism.

Every time I have to learn a new language, I approach them not only with understanding these 5 concepts, but also by writing code and using aspects of those. Here are the example I used:

Factorial in Go
Factorial in Rust
Factorial in Nim

end.

Best Gifts for Young Kids and their Parents: Raspberry Pi

The Raspberry Pi

If you ever wondered about the gift you would give a young nurturing mind, look no further than the Raspberry Pi.

The Pi as it is commonly called what is a Single Board Computer. They are fully functional computers having the processor, I/O, memory in the same board. For all that, they have a very small form factor. They are powerful enough to automate stuff, create robots, build internet of things or like me build retro consoles or simply be used as desktops.

I usually have a raspberry pi attached to a TV to automate household things and to play games. One particular stuff I do with it is to monitor the house cameras, download the video files, compress them and upload it to to the cloud to have free access from anywhere. The video from the camera is already dumped based on object detection and movement. Perhaps it would be an overkill to add any ML algorithm to it. That is for a later discussion.

Another useful project I have worked on is building a dashcam. Using the Pi Camera, an official add-on. It has taught me great things about image stabilization and picture processing.

It is exlilarating to see a piece of hardware work by running a few lines of code.

Children’s from all age group can enjoy the Pi. However, the raspberry pi is a crude tool designed to be used in so many things. So it is imperative as a gifter, you design the solution, install the necessary software and provide a guide for the parents. The gift works two ways –

  • It helps the parents learn the board and perhaps they will discover something they like.
  • It helps kids with cognitive growth.

The basic Pi with the full Raspbian OS comes with great tools to make hardware work and also tools for children. Raspbian comes out of the box with Scratch which can be used to visually make games and tell stories.

Besides a little older children can start learning python as a first programming language. The ease of the language will be very useful to get them into programming. The Raspberry Pi comes with great python IDEs and tools in itself. For little more advanced usage, PyGame and PyDub can be great teaching tools for visual and audio programming. Minecraft is excellent for coding and gaming.

Requirements

Usually, when I build a Pi, I build it for both parents and kids. Here is a list of things you require:

  • Raspberry Pi 3 or a Raspberry Pi 4
    • Raspberry Pi 3B is a cheap and perfectly capable board. It has 1 GB of RAM and can run the Raspbian OS.
    • Raspberry Pi 4 comes in 2 variations. the 2 GB and the 4 GB versions. These are more powerful and costlier than the Raspberry Pi 3B. The 4GB version is costlier than the 2GB version.
  • A good and cheap controller. Preferably wireless.
  • An SD card preferably 32GB.
  • Power supply for the Raspberry Pi. Power supply for the Raspberry Pi 3 is straightforward – most modern Android Mirco USB will work. The Raspberry Pi 4 is a different ball game. I like to buy the original Raspberry Pi supply for the Pi4. Here is a benchmark comparison for the Raspberry Pis
  • HDMI cable, Keyboard and mouse for the installation. I do not normally include the keyboard and mouse in the gift 🙂
  • A monitor for the installation.
  • ROMs downloaded from the internet for the console of your choice. I have a few – NES, SNES, N64 and my first console – Atari.

Installation instructions:

To not repeat myself, I will link to articles that I followed:

  1. Install the OS image to the SD card. I use Balena Etcher successfully many times.
  2. While you are at it, look for ROMs.
  3. Boot up/Configure the Pi. Install Retropie manually. I prefer the manual method.
  4. Install the ROMs to RetroPie.
  5. Set RetroPie to Autoboot – The games should be autoloaded.
  6. Configure the controller and others.

I prefer the manual installation of RetroPie over Raspbian installation, instead of using the official Retropie images. Even though it is bigger and time-consuming, Retropie can be shut down and the Pi Desktop can be used for other software.

The last step is to market the kit to the parents so that they feel enthusiastic enough to spend the time learning and teaching their kids. The instructions here are only to get you started. This isn’t a complete guide by any chance.

end.