New NodeJS 12 feature look more enterprise java now

New NodeJS 12 support thread and it is more stable

Threads are almost stable!

With the last LTS we’ve got access to threads. Of course, it was an experimental feature and required a special flag called –experimental-worker for it to work.

With the upcoming LTS (Node 12) it’s still experimental, but won’t require a flag anymore. We are getting closer to a stable version!

V8 Gets an Upgrade: V8 update to V8 7.4

Hello TLS 1.3

Properly configure default heap limits

Switch default http parser to llhttp

Making Native Modules Easier — progress continues

Worker Threads

Diagnostic Reports

Heap Dumps

Startup Improvements

ES6 Module Support

New compiler and platform minimums

The creation of Telegram MyWeatherTodayBot

What is Telegram?

Telegram is a messaging app with a focus on speed and security, it’s super-fast, simple and free. You can use Telegram on all your devices at the same time — your messages sync seamlessly across any number of your phones, tablets or computers.

With Telegram, you can send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create groups for up to 200,000 people or channels for broadcasting to unlimited audiences. You can write to your phone contacts and find people by their usernames. As a result, Telegram is like SMS and email combined — and can take care of all your personal or business messaging needs.

What is Telegram Bot?

Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests.

What is MyWeatherTodayBot?

MyWeatherTodayBot is a Telegram Bot that’s able to send your location and get real time weather forecast.

How MyWeatherTodayBot made?

MyWeatherTodayBot is made by PHP and a web service to get weather forecast. First it receives user input as location (latitude and longitude), and the bot will send a REST POST to an external web service to get weather forecast.

To make your own MyWeatherTodayBot, you need Telegram Apps, and Invited @BotFather (a Telegram own bot that you can create your bot) to your accounts, that you can get started to create bot.

Step by Step to create MyWeatherTodayBot

  1. Chat with @BotFather
  2. Click and send /newbot
  3. Name your bot
  4. Copy the API token and it looks like this: 898795721:AAGkiU2Taw83m6CDpVSpH4PaVbEaFkIByHo
  5. Write a PHP file and hosts on a web server, assume the location of the file is at https://<your web server>/bot/telegrambot.php
  6. With following code
[code] $endpoint = ''; $action = !empty($_GET['action']) ? $_GET['action']:''; function reply($chat_id, $text, $opts = array()) { global $endpoint; $url = $endpoint . ‘/sendMessage?text=’.urlencode($text) . ‘&chat_id=’.$chat_id; if(!empty($opts[‘reply_markup’])) { $url .= ‘&reply_markup=’ . json_encode($opts[‘reply_markup’]); } if(!empty($opts[‘parse_mode’])) { $url .= ‘&parse_mode=’ . urlencode($opts[‘parse_mode’]); } file_get_contents($url); } if($action == ‘setWebhook’) { $url = ‘https://<your web server>/bot/telegrambot.php?action=incoming’; echo file_get_contents($endpoint.’/setWebhook?url=’.urlencode($url)); } else if($action == ‘info’) { echo file_get_contents($endpoint.’/getMe’); } else if($action == ‘incoming’) { $entityBody = file_get_contents(‘php://input’); $incoming = json_decode($entityBody, true); $username = $incoming[‘message’][‘from’][‘username’]; $chatid = $incoming[‘message’][‘from’][‘id’]; $input = $incoming[‘message’][‘text’]; $location = $incoming[‘message’][‘location’]; if(!empty($location)) { $latitude = $location[‘latitude’]; $longitude = $location[‘longitude’]; $userData[‘weather’][‘latitude’] = $latitude; $userData[‘weather’][‘longitude’] = $longitude; $url = “,lat=$latitude,lng=$longitude,display=label,stat=telegrambot”; $label = file_get_contents($url); reply($chatid, $label); } else { reply($chatid, ‘Enter your location to get weather now’, array( ‘reply_markup’ => array( ‘one_time_keyboard’ => true, ‘keyboard’ => array( array( array(‘text’ => ‘My Location’,’request_location’ => true) ) ) ) )); } } [/code]


7. Now, in your Internet browser, access https:///bot/telegrambot.php?action=setWebhook, which will register a webhook to your bot.

8. And now, you can start testing with your telegram bot now.

The safety features remind you when exceed speed – Pokemon Go

The safety features remind you when exceed speed – Pokemon Go

Pokemon go released a new version today with new updated feature. One of the features attracted me is that they will remind players when travelling exceed certain speeds. This could be a safety features after many car accidents surfaced on news because of playing Pokemon Go.

Phantomjs fails to load HTTPS issue as switching to tlsv1

I had an apps to use phantomjs to generate a report by using Google Charts.

The apps will spawn a child process to execute phantomjs command, to load a web page that contains the charts, and then take a screenshots saving into JPG, which later convert into PDF for archive.

In the code, it needs to load the following JS URL from Google:, which is HTTPS based.

Suddenly it is stopped working since last month.

By checking the log and found that PhantomJS encountered JavaScript error: “ReferenceError, can’t find Google”. Hey, I tried to open the web page in my local Chrome browser, and it still working. I tried to CuRL from my server, still can download the page. So I suspected might be SSL issues on PhantomJS.

Tried googling and found a solution. As Google had already deprecated the old version of SSL (SSLv3) and use TLSv1.

In the command line, we need to add one more option: –ssl-protocol=tlsv1, to bypass the HTTPS error, and it turns out it is working now.

phantomjs --ssl-protocol=tlsv1 your-code.js