Power of Eloquence

Purposeful web scraping - where did it all begin and why we should handle it (with care)?

| Comments

Not long ago, I always wanted to write myself a useful tool on Github. And that is to do with finding how do we web-scrape data from any websites or web pages.

And sure enough as soon as I opened up the Github page, and go search for web scrap you get the following:

There are about 8800+ search results about this topic. And it sounds like it’s an expansive topic to know for such a simple software that goes out and extract all the data across any sites you encountered.

So I ask myself this question is - how and where did all this web scraping begin?

Well.

As it turns out, I went ahead to dig up the little history behind it.

Understanding ES6 Iterators and Generators - and their use cases

| Comments

In my previous post last year, I mentioned briefly about using ES6 generator/iterators feature as one of the major ways to write asynchronous code in your Javascript/NodeJS applications.

But what are they greatly capable of really, other than just doing that?

I never get my head around with this ES6 feature fully since its inception. So I couldn’t find a lot of other common usages besides its apparent usefulness for handling continuous streams of data that runs asynchronously.

Thus I decided to go and explore a bit out about them, and understand what is their true purpose.

Working with states in ReactJS - understanding why and how we should start caring about them

| Comments

Ever since Facebook officially made ReactJS library open-source for the global dev community back in 2013, there has been no slow-down with its meteoric rise as the next ‘best’ Javascript library that jQuery could never be (or never able to catch on).

It’s a pretty big bold statement for me to say this after reading this article online, explaining the design process of implementing ReactJS when building front-end applications, and comparing its main contrast to jQuery’s application-building approach. The author went on, highlighting the importance of maintaining the separation of concerns between states information and the actual DOM elements that rely on them; and making points on how jQuery may not handle this aspect of good software development practices very well and its other drawbacks.

After working within the front end(FE) space for some time, where the majority of my time was spent on hacking jQuery, the article casts some reflections on how using jQuery was (and still) a great multi-purpose utility tool for web developers for building web user interactivity for a very long time.

NodeJS Logging with Chalk

| Comments

As you’re working with NodeJS more and more, you’ll soon find yourself in a position to put in more logging messages than ever before. Especially, when your server encounters a number of, say, error handling exceptions, such that you want to divide your continuous stream of logger messages into the following:

  • Critical messages
  • Info messages
  • Warning errors
  • Debugging errors, etc

And our best logging friend is console.log usually comes to the rescue for the all the above-mentioned things. But sometimes, you just wish there’s a better way to preformat and categorise them differently when they get spat out in the terminal screen, as you go.

That’s where Chalk comes in.

Made URL shortener tool using Python/Redis

| Comments

There are a lot of URL shortener web services online that marketers and advertisers use to promote their URL content such as Google URL shortener, Bitly and TinyURL etc. They all do one thing in common, ie they take long URLs; have them shortened in length; and when visitors click on the modified links, they will be redirected to actual link content.

Given how good the other URL shortener web service implementations are done, I got myself involved in wanting to find out how I could achieve the same thing by implementing my own simple version of URL shortener service.

For a typical URL shortener service to be useful for people wanting to publish shareable content, it must simply fulfil the following:

Major tech trends happening in 2018 (and beyond) that developers should be aware of

| Comments

With just a little over a week in the new year of 2018, things are about to heat up down under 🔥🔥🔥🔥🔥 (like literally as we’re right in the middle of hottest summer at the time of this writing).

2017 has brought vast changes and major disruptions in the tech ecosystem that we, developers, should no longer afford to ignore what the preceding events have in store for us. It’s gonna be one helluva year for engineers and developers of all ages.

After doing some bits of googling and researching online, several industry watchdogs are keeping their watchful eyes and keen ears on the next upcoming ‘tech appetite’ people could expect to taste in the new year.

Working with Datetime fields in Rails as presentation layer

| Comments

When developing a Rails application that deals with a lot of form inputs, you’ve probably come across seeing this often.

Your typical Rails form setup
# Profile form submit <%= form_tag(@contact) do %> <%= label_tag (:name, "Name") %> <%= text_field_tag (:name) %> <br/> <%= label_tag (:email, "Email") %> <%= email_field (:email) %> <br/> <%= label_tag (:address, "Address") %> <%= text_area_tag (:address) %> <br/> ......... <%= submit_tag("Submit") %> <% end %>

As per ruby/rails guides, this is the most basic and most common setup for capturing user input data into our system.

We need to find a way to create one-to-one object mapping between the form fields and their respective ActiveRecord model’s members and properties.

And, we couldn’t have done much better without the help of Rails HTML form helpers to create these data-binding mechanisms within our form input fields against our model objects.

Typescript vs Javascript - what's the catch?

| Comments

There’s been a lot of attention going about amongst developers working within the front-end ecosystem on how to go about making Javascript-based applications impervious to bugs on data-type checking.

If you’ve worked with Javascript for some time, you will discover a number of pain points this de-facto language comes with - not that many developers would care to admit.

For eg,

// here, num is a number
var num = 1;

// now num is string
num = '1';

If you can clearly see what’s wrong with this, then you are in the same boat with countless of developers who simply couldn’t help themselves, pulling their hair out far and wide when you’re completely stuck figuring out where did all the right (and intended) data types disappeared to. As Javascript is a dynamically weak type programming language, you’d be sure to know that landing in this awkward scenario will drive you up several walls when searching high and low for buggy behaviour in several places.

Know your algorithms and data structures - in any language - part 2

| Comments

From my previous post, I discussed the importance of knowing simple algorithms every software developer/engineer must grasp as part of their engineering repertoire. In this post, I will be covering topics on common data structures that we normally (or always, should I say) use when implementing our algorithms.

The common ones are the following:

  1. Arrays
  2. Linked Lists
  3. Stacks
  4. Queues
  5. Hash Tables

##Data Structures

###a) Arrays

If you’ve ever been doing some programming for a while, you may have run into this term a lot by now if you ever worked with or seen lots of loop iterations in many codebases. If you haven’t, then I’d suggest now it’s time to take a refresher course on the for loop constructs. After all, that’s what (and why) arrays are built for :).

Arrays are the most prominent and well-known piece of data structure programmers of different programming disciplines have come across with. They are very simple data structures, and you can place any kinds of data types in them from strings to booleans. And they usually have a finite size of holding items. And the most common type of data operations we’ve seen on arrays are manipulating and traversing data hold of items by referencing its indices.