MeshCookie Blog


Setting up MLKIT Firebase on Android

  Google launched MLKIT in it Google I/O 2018, this is one big step for any of the tech giant to make the trained model available for developers. Google went one step ahead and made it available on a mobile device that run locally and most f the without an internet connection. Although Amazon Web Services ( AWS ) also provide similar services through it Machine Leaning, Rekognition and other service but all of them require an internet connection and setting it up to work in real-time is a big pain.   There are few important points that Google’s ML took care of: Offline Real-time Accurate Platform Independent ( Android / IOS ) The above points will give MLKIT  worldwide acceptance. For a developer its a nightmare to train model, collect data sample and then make those trained available for use. After Tensors flow, this is the next big step of the company toward contributing to the community.   So what all MLKIT offers: For starting there are few ready-made models available for beginners:   Text recognition Face detection Barcode scanning Image labeling Landmark recognition However, you can also use your own Tensor Flows Lite models for taking care of custom scenarios.   In this blog, we will set up a sample app and configure it to use MLKIT and setup Face tracking. The Facetracking Model can detect the following things: Happiness  ( Range 0 – 1 ) Left & Right Eye closing ( Range 0 – 1 ) So in order to start, clone the following Repo: , everything is working on it, you might have to setup google-services.json file.   Now open the project in Android studio, and connect your mobile and install the APK . The first screen will have a start button, press the start button and it will open an activity with camera preview. if you put a human face in front of camera you will be able to see MLKIT in action., it will show a bounding box around the face and values of Happiness, left & right eye open status. How to download google-services.json file. Go to Firebase console, create a project and select Android Project on the next page, next page will ask for package name and other optional detail. fill those detail and in next step, it will ask to download the google-services.json file. Put the file in “app” directory and sync it.        

Document Viewer 2

Embed Google Doc Viewer in your website

  Many a time you feel a need to show user-uploaded content on your website, but un-luckily browsers only support few document types, viz pdf & images. What if your user uploads documents ( doc, docx, xls, xlsx, ppt, pptx , psd, ai  and many more ). It will very good user experience if your website shows user content right on the user’s page without moving them away to any third party. Google Doc Viewer to rescue Google offer a free tool, that let you embed a pretty looking doc viewer that can serve all the file types mentioned above. You just need to add a single iframe and you are done. <iframe src=”” style=”width:1024px; height:700px;” frameborder=”0″></iframe> Note:, is the file being viewed. Just place this iframe on your website and the docx file will be viewable right on the page.   Few take aways CORS if you add iframe to your website and the URL of the iframe is a domain which is not part parent domain, then the browser will generate an error and you won’t be able to view file. In order to sort this issue make sure you add the param  <pre>embedded=true</pre>, so if you are embedding the viewer in your website then make sure you add this param. <iframe src=”” style=”width:1024px; height:700px;” frameborder=”0″></iframe> URL Encoding   if the file that you want to show requires some added param for some version or maybe passing auth params, it is required to use URL encoding. var url = “”; var accessibleUrl = encodeURIComponent(url);   People Using it There are a lot of people using it for there benefit, few include: Trello Eazespot

Continuous Integration Pipeline 0

Continuous Integration – Small Story

When a startup starts growing up and have software background, one day or the another there will be a need to build infra for your developers. We at Tagbin are now good in numbers and working on single codebase has become critical.So today I setup a very small continuous integration pipeline.   [If you are interested in more advanced pipeline including Docker & Jenkins that I am currently working on, check this link: ] To start with continuous integration is basically a automated develop-test-build-deploy pipeline.Many tech giants use a complex version of it, but this blog will explain how to get up and running very fast with a small pipeline and trust me this is all you will need to start off. First thing Version Control, there are three alternatives: 1) Git on Github 2) Git on Bitbucket 3) Git on your own server (Try Gitlab, its really amazing with almost all the features of GitHub, I will be shifting to it very soon) I choose Bitbucket, the reason being, free unlimited private repository. Second thing is Test Suite: This depends on whatever technology or platform you are working on, you can either run it on your local machine or make it part of deployment pipeline. Finally Deployment: I used Bitbucket’s Web Hook for it. Pipeline Flow: When you done writing code, push it to remote git account(bitbucket in our case),before pushing it to master a test suite will run to check if you are breaking any body’s code and the a final push is made which in turn will fire a WebHook added earlier. This Webhook is basically a script that receives request from bit bucket regarding different events, if the event is a push to master the script will automatically pull the content from the master and put it on development/stagging server based on your configuration.   The Script There is whole big file I wrote that does lot of housekeeping, but the below lines will be enough: <?php exec(‘git config –global credential.helper “cache –timeout=3600” 2>&1’, $output); echo(‘Setting up Password in cache… ‘.implode(‘ ‘, $output)); exec(‘git reset –hard HEAD 2>&1’, $output); echo(‘Reseting repository… ‘.implode(‘ ‘, $output)); //The URL will changes based on where your code is hosted exec(‘git pull 2>&1’,$output); echo(‘Pulling content… ‘.implode(‘ ‘, $output)); ?>   Put this php script under any http server, that is accesible publically and is on same machine on which you… Read More

Using openCV in c# 0

Using OpenCV in C#

I am writing this blog post to explain how opencv can be used in C# WPF/Windows Form application. Emgucv ( is a wrapper over opencv than can be used in C# application, the steps are: STEP 1: Create x86/x64 directory in Debug/Release folder and copy all the DLLS present in your emgucv installation directory.   STEP 2: After copying these DLLS in   “bin/Debug/x86” or “bin/Debug/x64”  same for Release add these lines in you code: using Emgu.CV; using Emgu.CV.Util; using Emgu.CV.CvEnum; using Emgu.CV.Structure;   Note: Don’t forgot to add reference, by right clicking on project in solution explorer->add refrence. and pointing to those DLLS. You can use Emgu provided toolbox element, by right clicking in toolbox section->choose items and then inside .NET framework tab, browse to emgu installation directory and select EMGU.CV.UI.dll and press OPEN, then you will see IMAGEBOX inside you toolbox components, and you can use it by dragging and dropping in to the UI(only for Windows Form Application). To know more shoot me at


Linux Custom Command

This is very short tutorial to get you started on creating custom command in linux. Lets say you are working on some project, and every time you start, you need to navigate to the directory and manually start the script and extra house keeping task. So how about you just write a command from your terminal “do-this” and every thing is all set-up to get started with, here is what you can do: You are actually setting up aliases. STEP 1: Open your terminal and type following command sudo nano ~/.bashrc STEP 2: What ever your commands are, just add under alias like this alias do-this = ‘python  /var/www/’ and save it. STEP 3: Log in back, and just type do-this and you are done. Now you can use your custom command “do-this” every time you want to get started, also you can chain lot of command by using semicolon  “;”

Setting up XMPP server (ejabberd) on Ubuntu 1

Setting up XMPP server (ejabberd) on Ubuntu

Today i was setting up XMPP server (ejabberd), so i thought i should write what i learnt. First of all you need to decide which XMPP server you want to deploy, in my case “ejabberd”. Here is the process to deploy on Ubuntu: 1) First of all install ejabberd using the command. sudo apt-get install ejabberd This command will set up all the necessary thing for ejabbered in /etc/ejabberd 2) Now you need to register user for your Server, the command is: ejabberdctl register admin localhost password Your password in place of  “password”  in command above. 3) Now you need to change few thing in the configuration file. sudo nano /etc/ejabberd/ejabberd.cfg   and change following thing in the file, here admin is the username and localhost is the server, you should add your own {hosts, [“localhost”,””]}.  %% Admin user {acl, admin, {user, “admin”, “localhost”}}. %% Hostname {hosts, [“localhost”]}. 4) Restart ejabber sudo service ejabberd restart Bravo, the server is all set now you can access its Web panel form: Then you need to enter your credentials user: pass: password  (you changed in STEP 2) Now from this panel you can add/delete/check users, IMPORTANT: if you are setting it up on AMAZON you need to open following ports 5280, 5222   Now you can use XMPP client to chect ex: pigdin   Shoot me at   Regards Ankit Sinha

Jquery Logo 0

Extending Jquery

This post explains how you can use your own javascript code along with Jquery by extending it So you have a function, lets say function blast(){ pullTrigger.init(); } Now your init function needs some jquery related function, so are you gonna write those from scratch… No lets take advantage of people who already wrote Jquery. OOPS  is your friend. Now all you need to do is this: jQuery.fn.extend({ blast: function() { return this.each(function() { this.checked = true; }); } }); // Use the newly created .blast() method $(“#bomb”).blast(); Note:Leave your comments below, or shoot me at Ankit Sinha

Install FTP on EC2 Intance 0

Install FTP on EC2 Intance

Step #1: Install VSFTPD sudo apt-get install vsftpd Step #2: Open up the FTP ports on your EC2 instance Log in to AWS management Console, go to EC2 Instance, select Security Group from Dashboard and add a port range 20-21. If FTP is not present just make it a custom rule. Add & Save. Step #3: Make updates to the vsftpd.conf file Edit your vsftpd conf file by typing: > sudo vi /etc/vsftpd/vsftpd.conf or >sudo nano /etc/vsftpd.conf (USE THIS) Disable anonymous FTP by changing this line: anonymous_enable=YES to anonymous_enable=NO Then add the following lines to the bottom of the vsftpd.conf file: pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=<Public IP of your instance> Your vsftpd.conf file should look something like the following – except make sure to replace the pasv_address with your public facing IP address: Step #4: Restart vsftpd Restart vsftpd by typing: > sudo /etc/init.d/vsftpd restart or >sudo service vsftpd restart You should see a message that looks like: Step #5: Create an FTP user If you take a peek at /etc/vsftpd/user_list, you’ll see the following: # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody This is basically saying, “Don’t allow these users FTP access.” vsftpd will allow FTP access to any user not on this list. So, in order to create a new FTP account, you may need to create a new user on your server. (Or, if you already have a user account that’s not listed in /etc/vsftpd/user_list, you can skip to the next step.) Creating a new user on an EC2 instance is pretty simple. For example, to create the user ‘bret’, type: > sudo adduser bret > sudo passwd bret Here’s what it will look like: