Posts

2017 in my life

Image
The Year 2017 gave me many surprises, painful surprises. I got a lot, but at cost of losing some. I will never ever forgot this year. It is a unique time span of my life which made my life upside down. I learn a lot about life. I got me new friends and made my relation more strong with old friends. 

Finished undergraduate course in computer engineer from Gujarat technological university (GTU) and got the degree of bachelor of the engineering in computer engineering. There was the pleasure of getting the degree with good score but, the pain of leaving the friends and amiable faculties.

A beautiful moment with friends

In June, I got new the jobat tuzzin infotech pvtltd (Ahmedabad) as a software engineer. Got new friends saurbh and keval jadwani who are also my colleagues at tuzzin, and the chance to work with Dipen Bhikadya and Jemin Shingala.  
My job made me left my parents  and my hometown. It made merealize how much I love my family and especially my father who had loved and cared about…

word count tool

Image
I have to write a post for Alibaba cloud platform. I come to know that the post has to be 1300-1500 word long. So I write a post and that searched for a word counter tool. 
In the search result, i found two site
wordcounter.networdcounter.io
wordcounter.networdcounter.net is the best site I found. It gives more details than just count of the word. 
It gives the information of 
characterswordssentence paragraphs word density
have been written. 
In additions, it also provides information like,
Reading levelReading timespeaking time

datastore remove index

Image
Cloud Datastore imposes limits on the number and overall size of index entries that can be associated with a single entity. These limits are large, and most applications are not affected. However, there are circumstances in which you might encounter the limits. Types of Datastore index Built-in indexes By default, Cloud Datastore automatically predefines an index for each property of each entity kind. These single property indexes are suitable for simple types of queries. Composite indexes Composite indexes index multiple property values per indexed entity. Composite indexes support complex queries and are defined in an index configuration file (index.yaml). Cost Counting for Datastore write In the current pricing model, inserting a new entity costs 2 write operations for the entity + 2 write operations per index. here index may be the composite index or built-in index ( single property index). You can remove composite index using either gcloud tool or appcfg


Remove composite Datastore indexTo r…

Host secured laravel 5.x appliaction on ubuntu 16.04 vps with apache

Image
Aim

The aim of this tutorial is to show how to migrate the local laravel 5.x project to the Ubuntu 16.04 vps. We will see how to setup the vps for hosting from scratch. We also see the ways you can copy your laravel project to the vps and at last we will see how to secure your project with ssl using the lets encrypt. we will also add a cron job to auto update the ssl certificate. PrerequisitesTo follow this guide along you will require this  Ubuntu vps with 16.04 laravel project you want to hostssh clientFor windows you can use puttyFor Mac you can use terminalsftp clientFor windows you can use winscpFor Mac you can use cyberduckGitRemote Git repository ( optional )Steps Now after gathering the required elements you can follow these steps to host your laravel 5.x project. Prepare the vps for the web hostingInstall PhpInstall Mysql Install ApacheInstall GitCopy and setup the local laravel project on vpsCopying the projectUsing sftpUsing gitInstall the dependenciesSetup the project and run m…

use hilite me for code sharing on your site

Image
I have seen many sites which are sharing the code snippets having a good look. Like having the sublime like format. One example is laravel-news.com. In my early posts, I was used to putting the code as it as without any formatting other than making the code in italic.


After certain posts, I started to use GitHub gist for sharing. But the gist was not the actually for what I was looking. Though it was quite good for code sharing thing is that it was not giving the look I was wanting.



After searching for certain days I find hilite.me which is actually I was looking for. A site/service that takes programming language code as input makes the syntax highlight and puts in the box of CSS we have defined.

It actually provides HTML-CSS code which can paste on the blog to share the code with specific highlight and format.
Here is my favorite CSS for the box



( Code for the box below you are seeing is also generated with hilite.me )


background:#111111;overflow:auto;width:auto;color:#eee;font-size:19px;…

Use Cli based Utilties and application with golang

Image
Actually, this post is about " use cli based utilities and application with golang", but I will explain it using the example of the 7zip.

The best way I found for zip extraction is using the 7zip cli. This is just sample how you can use any cli based application with your golang project. I will explain it using the example of 7zip cli.


( I am assuming that you have basic knowledge of golang )

What we are going to do is we will make cli command calls from our golang app using the os/exec package
For details of os/exec package please visit this official doc.

Let's see the code of unzipping of the archive using cli and golang

cmd:=exec.Command("7z","e","path-to-file")err:=cmd.Run()iferr!=nil{fmt.Println("error during extraction:",err.Error())continue}


In this code first, we are getting the command struct for our cli based process.

Here Command takes the name of cli utility as the first argument like 7z or echo.

For the simplest example,
if you …

golang oauth2 facebook example

Image
Todays most sites are integrated with social platforms like twitter, facebook, google plus for one or other purpose. I am writing this post to show how you can integrate Facebook with your golang app using facebook oauth2.

Just Some Word About OAuth2

OAuth 2 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service, such as Facebook, GitHub, and DigitalOcean.
For More information read this article ReadMore
Create App For FacebookTo integrate Facebook with your golang app, first of all, you have to need a facebook app_id and app_secret. Those are app identifiers for facebook. 

To create an app on facebook you should have an account on Facebook ( and ( think you might have already ). Using your Facebook account login on developer.facebook.com



 After login click on MyApps dropdown and click on Add a New App Button




Create New AppId by providing the Display name and contact email address.
After creation of your new app, you will see the da…