Daily notes

Thursday, April 5, 2018 - 12:07

Very nice town. Very sunny and clean here.

Basingstoke station , Basingstoke
Tuesday, April 3, 2018 - 22:40

This morning I was going to Reading when I thought of exposing the shell script that I wrote yesterday to read the CSV file where I am storing my GPS location and sending it to my website. I though of this idea where I can simply query my database of flat files. I thought of creating a bash script where I can pass the date and time argument and it will return my GPS coordinates of that day by looking in the CSV files. I also thought of exposing this script using API.

So when I was searching on the net for some libraries I am actually found one called goexpose that might do the job but I was interested in doing something very simple and quick. I also found one link where I found this code.

  1. // This tool exposes any binary (shell command/script) as an HTTP service.
  2. // A remote client can trigger the execution of the command by sending
  3. // a simple HTTP request. The output of the command execution is sent
  4. // back to the client in plain text format.
  5. package main
  6.  
  7. import (
  8.  "flag"
  9.  "fmt"
  10.  "io/ioutil"
  11.  "log"
  12.  "net/http"
  13.  "os"
  14.  "os/exec"
  15.  "strings"
  16. )
  17.  
  18. func main() {
  19.  binary := flag.String("b", "", "Path to the executable binary")
  20.  port := flag.Int("p", 8080, "HTTP port to listen on")
  21.  flag.Parse()
  22.  
  23.  if *binary == "" {
  24.   fmt.Println("Path to binary not specified.")
  25.   return
  26.  }
  27.  
  28.  l := log.New(os.Stdout, "", log.Ldate|log.Ltime)
  29.  http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
  30.   var argString string
  31.   if r.Body != nil {
  32.    data, err := ioutil.ReadAll(r.Body)
  33.    if err != nil {
  34.     l.Print(err)
  35.     http.Error(w, err.Error(), http.StatusInternalServerError)
  36.     return
  37.    }
  38.    argString = string(data)
  39.   }
  40.  
  41.   fields := strings.Fields(*binary)
  42.   args := append(fields[1:], strings.Fields(argString)...)
  43.   l.Printf("Command: [%s %s]", fields[0], strings.Join(args, " "))
  44.  
  45.   output, err := exec.Command(fields[0], args...).Output()
  46.   if err != nil {
  47.    http.Error(w, err.Error(), http.StatusInternalServerError)
  48.    return
  49.   }
  50.   w.Header().Set("Content-Type", "text/plain")
  51.   w.Write(output)
  52.  })
  53.  
  54.  l.Printf("Listening on port %d...", *port)
  55.  l.Printf("Exposed binary: %s", *binary)
  56.  http.ListenAndServe(fmt.Sprintf("127.0.0.1:%d", *port), nil)
  57. }

The code above actually works perfectly. To expose the "date" command as a web API. You can simply run the tool as follows:

./bash2http -b date

Check the link for more details.

However I was not entirely convinced with the approach of this code. There is no security and that is why I will spend more time on goexpose code on github to understand how secure it is. It supports SSL which is assuring. Let us see if I can spend some more time this week. I really want to find a solution. Most likely I will try to make the above code slightly secure and reusable. I just don't understand Go that well yet. I wish if we can simply feed our brain with knowledge while we are sleeping.

I also came to know that the approach of exposing shell using API method so that it can be invoked over the internet is exactly what CGI used to do. It reminded me of the days when we used to work on C++ during our college days. Internet was still quite new in late 1990s and create a web page using C++ was so much fun. All the memories of floppy disk filled with hundreds of CPP files that we used to compile with Alt+F9 and then run with Ctrl+F9 by smashing the keys on TVS gold keyboard. So many amazing memories of college.

I made couple of projects with Chinar in college using graphics in C++ and mouse programming and working with interrupts. I wish if I get find the code again. It is a shame there was no Github back then. I am sure I must have the code somewhere in floppy disks but how will I read them?

Pic 1:Me in my college.

Pic 2: This is my class (Check the bag I still have the same bag here with my in London and I take it to work everyday).

Going to work after ages tomorrow. I am actually missing "Mind the gap" voice. Excited!

Ravi in college , Ravi in college
Monday, April 2, 2018 - 14:10
Sunday, April 1, 2018 - 13:51
Sunday, April 1, 2018 - 10:29

Recently I made a Hugo website for one of my domain. The idea was to learn Go Language but at the same time make a project as well. Good thing about Hugo is that it takes very less time to setup. I also deployed the website from my Github repository to Netlify.

Instructions to setup Hugo with Netlify: http://go.ravi.pro/c3meq

Here is the video.

Setup Hugo website and deploy it in less than 30 minutes
Saturday, March 31, 2018 - 19:13

I am obsessed with location tracking. I started using Foursquare more than 10 years ago on my Blackberry phone. I loved that app. It is still one of my favourite application. It was very popular for couple of years but then after the smart phone revolution (post Blackberry phase) I guess Foursquare lost its shine but they came back with their new service Swarm. I have not really restarted using Foursquare to the fullest yet however since the last few months I have been hooked to the IndieWeb principles.

I am trying very hard to post everything on my website and syndicating it elsewhere - POSSE. It is a good way to own your data and I don't see any reason why people should not follow IndieWeb principles.

Coming to the point of my obsession with GPS tracking. I do track lot of my actual physical location with either Garmin or an app on my Blackberry that continuously uploads a GPX file to my server but I still need to make it more usable. I used to use Google Latitude but we all know what happened to that and these days I am working on storing my GPS location on a regular interval in the background, without me pressing any button and I really want to also retrieve that location. For instance if I want to know "Where was I 3 years ago on this day at 4:00 PM?", On IndieWeb website I did find some great insights shared by Aaron Parecki and I am yet to fully implement and achieve what he is doing. He has open sourced his work and I can set it up as well but still I am not sure about the approach that I will take.

Anyways, so today what I did I implemented Geocoder and Geofield modules in Drupal. Install and enable both the modules and follow the instructions below.

Step 1

Create Geofield Field type called "Location" and add it in the Content Type of your choice. I added it in notes

Step 2

The "Geocode method" should be set to "No geocoding".

Step 3

Go to "Manage for display" of your Content Type and set the Widget of Location field to "Geofield Map".
Google Maps API Key: XXXXXXXXXXXXXXXX (Create your key and set it here)
Google Places Autocomplete Service: enabled
Map Library: Google Maps
Map Type: roadmap
Map Type Selector: enabled
Map Dimensions - Width: 100%; Height: 450px;
Zoom Levels - Start: 12; Focus: 16; Min: 1; Max: 22;
HTML5 Geolocation button: enabled
Click to find marker: enabled
Click to place marker: disabled
Geoaddress Field: - any -

I have enable Google Places Autocomplete Service because when I create a new node apart from choosing the location on the map I would also like to manually enter the venue name. It sometimes makes it simple sometimes. Also HTML5 Geolocation button is enabled so that it can pick the coordinates when I create a node from my Blackberry (Yeah!) browser.

Step 4

Go to "Manage display" of your Content Type and set the Format of Location field to "Geofield Google Map". You can modify various setting for the map as per your liking. I just changed the Start Zoom to 16.

And you are literally done but wait there is more. Yes few more sexy configurations to make this checkin thing little more fancy.

Step 5

Create one Address Field Type called "Address (field_address)" and set the "Geocode method" to "Reverse Geocode from a Geofield type existing field" and then under the "Reverse Geocode from an existing field" drop down select the "Location (field_location) [geofield]"

On the same page under the "Geocoder plugin(s)" select "GoogleMaps".

Using this Address field is optional but I also wanted to store the Venue's Company, Street address, Post town and Postal code because these fields are managed by just one "Address (field_address)" field. These fields are automatically populated based on the coordinates that you are setting in the "Location (field_location) [geofield]". Pretty neat. Though I had some issues sometimes when this Address field was not fully updated but the node was anyways saved with the location and that is what I needed.

Step 6

Create a view to display all the checkins with the map of course. I created a /checkins page view on this site. Since I am using my Notes Content Type so I just used the following "Filter Criteria".

Content: Location (not empty)

In the "Fields" section I added the "Content: Location" with "Formatter" set to "Geofield Google Map". Add more fields if you want.

This post is actually a note but I have written so much here, well that is the idea. I wanted to share this concept because if you want to also use similar technique of owning your checkins then this method can be very useful. To be honest I am not absolutely 100% sure how far I will take this but so far based on my 2 days of work I think I am satisfied. The next step would be to post checkins to my Foursquare whenever I add a node with location, vice versa can also be useful. This is what I did on my known site which I launched just few days back.

Amazing stuff, really happy with my holidays, doing what I love. I am so glad I starting spending more and more time with my first love again ;)

Drupal Blackberry Checkin
Saturday, March 31, 2018 - 18:45

Finally I figured out a way to manage checkins on my site. Phew. Was scratching my head since yesterday.

Friday, March 30, 2018 - 10:59

Amazing, it rains every weekend. Rain Rain wow

Rain in Burnham , DevOps
Thursday, March 29, 2018 - 13:28

I installed Known CMS last night quickly. It took me 10 mins flat to install it on my webfaction hosting. So far I like it.

Just couple of days back I setup Hugo which is a static site generator written in Go Language. I really like it.

Although this blog is my primary site which I will continue to use as it is a Drupal based site.

This is my post on my Known site: http://www.sagar.ravi.pro/2018/checked-into-dental-appointment

Let me check if webmentions work or not :)

Friday, March 23, 2018 - 18:54

There was a phase in my life when I used to do some side projects quite regularly. It really gave me satisfaction to build something. When I was kid I used to learn how to solder and make small electrical projects. When I bought my first computer those electrical projects turned into digital projects and I still miss playing with resistors, transistors and capacitors but you can't do everything at the same time in life. May be I will go back to electronics later in my life but till then I have to expand my knowledge in digital space.

This week I have 2 projects in mind. Little ambitious but possible certainly. I want to try Known CMS which follows IndieWeb principles and hopefully inline with my POSSE plan. Most likely I will setup a subdomain on ravisagar.in or ravi.pro but not sure where. Let us see.

The other thing which I want to try this weekend is the Circleci. Earlier this week I went to the DevOps summit and I attended one wonderful talk "Don't build your platform on sand" by "Aubrey Stearn, Interim Head of DevOps, Arcadia Group". It was really inspiring and Circleci was mentioned in the talk so I am really interested in evaluating it. I will try to understand how it is different from Bamboo and Jenkins.

Looking forward to the weekend.

Circleci , KnownCMS
Wednesday, March 21, 2018 - 21:36

I am doing a webinar where I will be showcasing how to use Atlassian tools for ALM lifecyle and implementing DevOps pipeline. There are still spots left to sign up but it is filling up soon. If you are always wondered how the full ALM works with Atlassian tools but always wondered how, this is the opportunity to learn.

Please click on the link below to sign up for this free webinar.

Register here

Earlier today I went to the #DevOps Summit and it had some amazing talks. I did a live tweeting from the event. If you missed it please check the details of the event here.

Ravi Sagar DevOps Webinar
Wednesday, March 21, 2018 - 14:22

I am currently at the DevOps summit.

I created a moment on twitter. Please take a look at it here.

I am still here till evening. Come and say hi!

DevOps Summit London
Tuesday, March 20, 2018 - 07:23

I will be going to the DevOps Summit happening on 21st March in London.

Register here: http://events.computing.co.uk/devops/

Take a look at the list of speakers: http://events.computing.co.uk/devops/speakers

I am quite excited to go there. If you are coming too then give me a shout.

DevOps Summit 2018
Sunday, March 18, 2018 - 17:04

In this video I want to talk about the most common mistakes made by new Jira Administrators and the strategy that you should adopt to get around them. Please take a look at this video if you want to start your Jira learning journey.

If you like this video then do leave a comment.

http://www.sagar.ravi.pro/2018/not-working-today-relaxing-at-home-nice

Top 3 mistakes by Jira Administrators
Sunday, March 18, 2018 - 17:01

In this video I want to talk about how to get started with Jira and how to evaluate it. This is one of the most asked questions from people who want to know and compare Jira with other tools that they want to evaluate in their company.

Do you want to evaluate Jira?
Saturday, March 17, 2018 - 21:06

Do you want to move to DevOps and wondering what languages you should learn? Is Shell scripting the most important language or Python?

Video

Slides

Thanks Check out Known CMS

5 Important languages for DevOps
Saturday, March 17, 2018 - 10:16

Weather is strange. It snowed a lot in the first week of March in fact more than the snow in Dec. Yesterday temperature was 12 degree, sunny and warm. Today the temperature dropped to -2 degrees here in Burnham and it is also snowing, not that much though.

I am not doing very good heath wise, have this cold since last week and it is annoying me.

Long weekend is coming next week and I need to plan something for that.

Snow in Burnham , Snow in Burnham
Tuesday, March 13, 2018 - 18:23

I recently came to know about Flutter.io which is an open source mobile development SDK from building mobile apps. Interesting thing to note here is that as per the Flutter.io page they say it can let you create native apps for both Android and iOS which is really interesting.

Few years ago I personally learned building mobile apps natively on Android and iOS. I created apps using Java and Swift and it was amazing experience. I felt really good when I also published those apps on both play store and app store.

I wanted to create more apps but honestly I never got a chance to do that again (or no one actually paid me ;)). I do have some ideas to develop more apps, not really to make a product out of it but mostly to solve some of my problems and make my life easier. I am trying to follow #IndieWeb concepts these days and as per their principles you should manage your location without sharing that information to third parties. I wanted to create the app that will track my location and store it on my server.

Anyways after I came to know about flutter I thought I should learn it and give it a try. It will probably take me 1 or 2 days to setup the SDK and create a simple application. However should I bother about learning it.

I was wondering since there are very less developers right now using flutter, it might be a very good idea to learn it and become early adopter. Honestly I sometimes do feel that I did not get into mobile app development from very early. Although it is never late but in technology sector early adopter do get some advantage. So I am actually considering learning flutter, I will probably spend a few days on it not more and share my findings.

Do begin your flutter learning first start from their website: https://flutter.io/ and then take a look at some youtube videos. I will share some of the videos below so you can also take some hints.

and

and one more

Flutter.io

Subscribe

* indicates required

Please confirm that you would like to from Sparxsys:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices.

Want to contact me?