Happy New Year!

What’s the best way to start a new year for a geek other than coding at night? Tonight I practised coding in Python by tackling a problems that I got from Project Euler’s archives. You can view the first 2 problems I solved in my Github.

Since it’s already a new year, so what’s my wishes this year?

Well, I have some wishes such as:

  1. I wish to build and have my own simple SaaS running
  2. Make Makna.online and Kokotiam self-sustaining
  3. Take care of my body and my mind better
  4. Create a Programming Course. I haven’t decided which language yet though (PHP? Laravel? Vue? React? Or Python? Swift? Java? Or something else?)

Anyway, let us all wish for a better future ahead! 😀

Happy New Year all!

Kotlin and Java, side by side in the same app?

Yep. It is possible for Kotlin and Java to live side by side inside the same app. That’s what I did with rider’s app for Karhoo Courier. For the purpose of learning, I only use it in one of the activity. As I said before, the best way to learn is by using what you want to learn with what you have to do.

If you can combine them,  you can learn while achieving your objective of the day (for me, it is to let the riders view the consignment note details).

How to Migrate from Homestead to Valet

I am going to show step by step on how to install Valet on your Mac. I tested this on MacOS Mojave.

Before this I encounter these errors:

  1. Could not symlink, /usr/local/bin is not writable
  2. In Brew.php line 187: Unable to determine linked PHP
  3. compact() not defined

It turns out that Laravel does not support PHP 7.3 yet. (At least that’s in my case). 

Here’s the step you need to do first. You have to make sure you use the right PHP which is version 7.2.

# Will show you any php packages you've got. make not of that!
brew list | grep php
# Will uninstall any php packages you may have
brew list | grep php | while read x; do brew uninstall --force $x; done
# You may need to run this too
rm -rf /usr/local/Cellar/php
# Clean up Launch Agents
rm ~/Library/LaunchAgents/homebrew.mxcl.php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php*
brew untap homebrew/php
brew cleanup
brew update
brew doctor # just to make sure you're all clean
ps ax | grep php
# if some PHP daemons are still runing, reboot.

Now, you can install PHP 7.2 by running this command:

brew install php@7.2

after that, you have to do this:

ln -s /usr/local/Cellar/php@7.2/7.2.13 /usr/local/bin/php

After that, you have to do these:

composer global require laravel/valet

After that, you can use the instructions found on Laravel website.

How to Install PIP and CodeIntel on Mac OS Mojave

Mojave has its own  Python installed already. Just run this inside your Terminal :

python --version 

and you will see that there is a version installed.

So all you had to do to install PIP if you already have installed Python is by typing this:

sudo easy_install pip

and you will have installed PIP after that. I use PIP to Install CodeIntel.

To Install CodeIntel, remember to put Sudo in front of the command.

sudo pip install -U CodeIntel

What’s The Best Way to Learn New Framework?

By doing.

As simple as that.

For example, I don’t know the difference between Bootstrap 3 and 4.

So I created a project based on Bootstrap 4.

A simple dictionary website for people to find meaning of a word.

Super simple, right?

Basically it’s a place for people to search for meaning of a word in Malay.

To make it better, I also use Google Translate API to grab meaning in English and insert it into the DB. So it doesn’t have to query Google Translate all the time. It only query it one time and then I insert it into the DB.

The second time people visit the same page, the page won’t call Google Translate API again. Just have to query the database. I use MySQL for this project.

I originally use Vue with Axios for this website. Vue is after all the hottest thing right now. I first used it in one of the take-home coding interview and it seems quite interesting to use.

But the moment I saw the website in Google Index, it seems that Google doesn’t really crawl all the links inside.

So I turned back to using vanilla HTML website again.

I need to figure out a way how to make a Google-friendly Javascript-based website before I use Vue again.

At the website I also implemented a simple search suggestion using Bootstrap Typeahead so people can know what’s in the database before they click Cari.

As you can see, there are a lot of things that I am doing on the website under the hood. It’s pretty simple website, sure. But it means that I can learn how to use Bootstrap 4, Vue and Axios.

That’s how we can learn how to use a new programming framework — by using it. Every framework is a little bit different and the best way to learn about it is to implement it yourself.

So have a look at Makna Perkataan and tell me what you think!

My Silliest Mistake So Far (Maybe?)

My boss asked me to create a survey form for people to fill in and we can know how students feel and what kind of improvements that can be done in the university.

So I literally did that.

I created a form, a database, the script and all… just to create a survey form.

A waste of time.

There are a lot of system out there that are better than what I attempted to do. They already went through trials and errors and have improvised based on suggestions by their users.

I should have surveyed the market first through and through.

When there are so many survey tools out there. And there’s even an open source tool to do survey.

I can use Google Forms, or Survey Monkey and I achieve the same thing.

This is what I’ve created.

I use Metronic Admin Template to create this. And for the code, I use PHP.

Always survey and see what the market has. Or else you probably will miss what others have made that can make your life easier.

Thinking About Microservices Architecture

In the past 2 weeks I was so busy with many things. Had an interview with a well known media company. It was the longest interview process that I ever had.  and I was busy finishing a system I’m developing and collecting data for the green system here.

Right now, at AiU, I have to think a lot about how to implement IoT solution. How the overall of the architecture looks like.

And I chose microservice architecture.

From microservices.io:

Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.

Why do I choose microservices architecture?

At AIU, I won’t be connecting just one type of device (the switch), but I’ll be connecting with the door and the solar, the battery and the grid.

I don’t like a single point of failure even though using just one system may make the system easier to make.

Another challenge that I have is that all these devices “speak” different languages. One is Java, another is C++ and another… Microsoft Access.

Since I have to connect to multiple types of devices with multiple languages at the same time, I doubt that a monolithic architecture is a good way to integrate all these devices.

From Wikipedia, monolithic applications are:

In software engineering, a monolithic application describes a single-tiered software application in which the user interface and data access code are combined into a single program from a single platform.

Drawbacks of Microservices Architecture

  1. To debug is quite hard. You have to write all the loggings for all the different services and it may have different languages
  2. Consumes more time to develop than a monolithic one. Each type of devices has its own so-called “controllers”. Instead of one big one that manages everything.

Pros of Microservices Architecture

  1. Easier to add new functions. If I wanted to add new function to the smart switch like scheduling, I just whip open the smart switch controller’s project, I can add that function.
  2. Know exactly what’s going on – instead of guessing, I know which device caused problem. Can’t get the data from solar panel, OK it’s autoswitch controller’s problem. I can debug from there.

Microservices is not a silver bullet to me. It’s just that I felt that using this architecture is the best for this situation of mine.