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!
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
Chat with @BotFather
Click and send /newbot
Name your bot
Copy the API token and it looks like this: 898795721:AAGkiU2Taw83m6CDpVSpH4PaVbEaFkIByHo
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
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: https://www.google.com/jsapi, 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.
ReSnap – A Smart Automated Photo Book Creation Platform
ReSnap, a company that automatically creates a book of photographs from a range of sources, has announced an update for its beta platform, with a revamped platform that allows you to upload photos from local storage – it will then automatically pick the best images from the selection without you having to do anything.
I just setup a HomeKit apps on my home, using Apple Siri to control my television.
First, need a smart home device, for example Sony Bravia TV which connected to a home WIFI. Second, requires a HomeKit Server talking HomeKit Protocol. This server will interact with other smart home device registered as accessories. Third, requires a HomeKit client installed on mobile, which talking to HomeKit Server, adding any accessories available from HomeKit server. In usual setup, HomeKit server can installed on Raspberry PI, but I don’t have, use my Mac to host it.
The following procedures will help to setup.
1) Get a Mac with Node JS installed. Get a Apple licensed developer program.
5) Follow instruction on how to control Bravia TV by using the library. And then, you may build a HTTP based interface around the Bravia library. And then, you may program HomeKit server apps, add a new accessories, and then send the command requests to Bravia Server via HTTP (Turn on/off TV). The last part is much more tricky, to setup HomeKit client talks to HomeKit server.
6) Important note, once you had HomeKit client installed, navigate to one of accessories, look for the service name, this is the name Siri will look and map into. Name it as “television”, or some fancy name, which you will tell Siri to look for and do the action.
7) After that, if everything goes well, you can turn on your Siri, and say “Siri, turn on television”. Then your television magically turned on. Enjoy.
1) to download prebuilt opencv2.framework, the fine working version is 2.4.9.
2) to create new XCode Project, target iOS8.0 if you are under XCode 6.0.1 as this version not yet support iOS8.1
3) link opencv2.framework to XCode Project. Go to project build phase, and link following frameworks:
opencv2.framework
AssetsLibrary.framework
AVFoundation.framework
CoreGraphics.framework
CoreImage.framework
CoreMedia.framework
CoreVideo.framework
Foundation.framework
UIKit.framework
Accelerate.framework
4) Create <NameOfProject>-Prefix.pch, with following snippets of code add between ifdef / endif block.
5) in ViewController.h, add the following to header
#import <opencv2/highgui/cap_ios.h>
#include <opencv2/opencv.hpp>
Note, the most important line is #include <opencv2/opencv.hpp>, this is important to make the stuffs works. I spent few hours and found this solve my problems, which unable to recognize cvtColor function, OK, will introduce in next steps.
6) To do some testing, by adding a video camera, reading 30 frames per second, process the images by inverting the color…
7) Rename ViewController.m to ViewController.mm as we are going to put C PlusPlus Code. Extension mm allows coexist of Objective C and C PlusPlus.
8) In ViewController.h, add following line
@property (nonatomic, retain) CvVideoCamera* videoCamera;
9) In ViewController.mm, we initialize videoCamera and starts it.
10) In ViewController.h, add CvVideoCameraDelegate
Like this
@interface ViewController : UIViewController
11) In ViewController.mm, add following snippets of code before @end.
#pragma mark – Protocol CvVideoCameraDelegate
#ifdef __cplusplus
– (void)processImage:(Mat&)image;
{
// Do some OpenCV stuff with the image
Mat image_copy;
cvtColor(image, image_copy, CV_BGRA2BGR);
bitwise_not(image_copy, image_copy);
cvtColor(image_copy, image, CV_BGR2BGRA);
}
#endif
CMake, the cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice.
To install CMake on Mac, you can download the precompiled binaries here. Under platforms Mac OSX 10.6 or later, I chose cmake-3.1.0-Darwin64.dmg at the time of writing.
Once downloaded, run open cmake-3.1.0-Darvin64.dmg on terminal.
A finder view shown. Drag cmake-3.1.0-Darvin64.dmg to Applications shortcut, it will copy the binary to Applications folder.
Open the applications by sudo.
Do sudo /Applications/CMake.app/Contents/MacOS/CMake
Click on menu Tools, Install for Command line use.