Monthly Archives: July 2015

Social Share Counts Python Implementation

I wrote this little script that grabs the count of shares on popular social networks, using their APIs. I have listed the documentation on the project page on Github. I will copy the relevant pieces of readme here.

Social Network APIs

Facebook

Request:
https://graph.facebook.com/?id=https://www.github.com

Response:

{
   "id": "https://www.github.com",
   "shares": 31684
}

Twitter

Request:
https://cdn.api.twitter.com/1/urls/count.json?url=https://github.com

Response:

{"count":14,"url":"http://github.com/"}

Google Plus

Request:
https://plusone.google.com/_/+1/fastbutton?url=https://github.com

This returns the +1 button. I extracted the counts using regex window.__SSR = {c: ([d]+)

LinkedIn

Request:
https://www.linkedin.com/countserv/count/share?url=https://github.com&format=json

Response:

{"count":0,"fCnt":"0","fCntPlusOne":"1","url":"https://github.com"}

StumbleUpon

Request:
https://www.stumbleupon.com/services/1.01/badge.getinfo?url=https://github.com

Response too large.

Pinterest

Request:
https://api.pinterest.com/v1/urls/count.json?url=https://github.com

Response:

receiveCount({"url":"https://github.com","count":0}) 

Reddit

Request:
https://www.reddit.com/api/info.json?url=https://github.com

This returns a lot of data, which can be easily used to extracted counts.
Note that the Reddit guys don’t really like automated requests and may cause the call to return HTTP 429.

Vkontakte

Request:
https://vk.com/share.php?act=count&index=1&url=https://github.com

Response:

VK.Share.count(1, 419

This marks the end of the documentation. I hope that serves some purpose. The reason I wrote this was that I wanted social sharing buttons on this blog. I could not afford any of the mainstream buttons like Addthis and Sharethis. They kill the load time, and I’m already struggling with Disqus and Adsense overload. More on that soon. I hope to create a ‘dynamic looking’ static set of buttons for this blog, and I’ll update you if I get time to complete it.

First Anniversary Of My Blog

Last month, I was reminded by Bigrock.in about the pending renewal of nagekar.com. It was through an email. I had completely forgotten the date of registering the site and it came in as a handy reminder. 6th of June it was, in 2014.

I had an affinity towards blogs and blogging right from when I was 15. That was when I had seen the first blogs and shortly after that, it was when I created my first blog. It was in the morning, of 5th March, 2011. I knew I was up to something awesome. 7 in the morning, I was home alone. I remember mom and dad had to go out early, to receive some guests. I spent an effort filled three hours and finally got the site up at around 10 am. The domain was geekystuffforall.webs.com (It reads, Geeky Stuff For All, if you had trouble). It felt good, to have an identity. I wrote a paragraph for the homepage, which was the first post for me, ever.

Hi everyone, if you are searching for someone who thinks spending 8 hours in front of a PC is normal, you are at the right place 😉
You will not find any amazing new hacks or such stuff here.Then why this site ? It is because I am not a computer expert but computer enthusiast just like you. I will try to share whatever new I come to know. I would be extremely pleased to hear from you.
By the way I am Abhishek Nagekar. You can meet me on Facebook(If you like to !!)

March 5, 2011

And that was also the last thing I wrote on that blog. It was not that I got bored or anything, but I was quick to realize more amazing platforms are available that gave more control to bloggers. I created something called cyber-outlaws.blogspot.com to post all the tricks and hacks I then knew. I worked pretty well. I had around 800 views in the first month, which is good number compared to even this blog. Then came many more blogs on numberous subdomains on almost every popular free hosting out there. My ‘niche’ had changed from hacks and tricks to mobiles and gadgets, news and reviews alike. I though about moving on from something.somehost.com to something.com, mostly because of the fact that I could have a [email protected] like email address. I registered my first top level domain, lulztec.com on Godaddy. It costed about INR 99, or USD 2, under a promo scheme. It was back in May or June, 2013. I was just out of junior college, and it was time to make some money. I blogged and blogged, but did not get the traffic I was expecting. After 2 or 3 failed attempts to signup for Google Adsense, I finally settled for Chitika and Infolinks. I didn’t make anything for the next 6 months I kept them on my site (I did actually make $2.80, but I will call it nothing because the cashout was $100, so I never actually got anything in hand).

I thought there was more to blogging than just posting new stuff everyday. I moved everything to a paid hosting company called Visiba. They were charging around $2/month back then. I was really impressed by their service and kept my blog there for another three months. Later, not seeing any improvements, I had to think what next to do, that would work. I purchased a small VPS from DigitalOcean, where I moved the blog and started writing Linux tutorials. I was paying $5/month to DigitalOcean, which is considered low for a VPS. Still, there was no sign of revenue and I was spending a great deal of time on blogging. I knew I had to change things. I registered a new domain called tutshub.net, where I decided to post technical tutorials. It worked only a little better with this one. Meanwhile, I was accompanied by my school friend, who used to be a blogger too. Together, we managed to get our blog under alexa 400k which was cool, I thought. Also, we tried our hands in the web development world, and registered nakshtra.org, which failed miserably. Tutshub.net was going good and it was mostly because of my partner Harshal, who worked harder than me. Here’s a snapshot I found at archive.org

But we decided to stop that blog. The last post was made in February 2014, and then we orphaned it. Blogging helped me to realize there is much more I can do, than just write about other people’s achievements. I got to be better than that, I thought. I still don’t know if it was a good decision but it definitely helped me concentrate on myself. It was a few months later, in June, that I got this blog. It was not aimed to be a traffic scoring blog, because I know for sure now, I cannot blog for traffic. One year passed, 30 articles written, tried many new languages and frameworks, got accepted by Adsense, did average in academics, made some great friends in college and many great things happened in just this year. I am glad I decided to start this blog which, as I have always said, is a diary to me.

As it happened, many people have appreciated the things I write, and there have been a lot of feedbacks, positive and constructive alike. I share this one year with you’ll, who took the time to read my thoughts. The past is history, quite a beautiful one. You, me, we grew wiser each day, and we’ve no intention of changing that. Finally, happy birthday! to my blog. Here’s to more good content in future.

Blog Moved To Github

Take a look around. Everything’s changed. Yet again. I am sure you’re probably sick of me changing the total appearance of this blog every 3 months or so, and you’re right in being so. Let’s go back into a little history. Around a year from now, I stumbled across Ghost blogging platform. It was clean, neat and beautiful. I knew I always wanted something like that to write. I didn’t have this (nagekar.com) domain at that time. I went ahead and started their trial, which gave me a subdomain at ghost.io to blog on. It was beautiful, visually and the overall experience. After having dealth with most of the popular opensource PHP content management systems like WordPress, Joomla and Drupal, this was something new altogether.

I registered this domain, about a week later and started using their minimal plan of $5 per month, which included 10k pageviews. It took me not long to realize that I couldn’t afford those $5 because, 1) it was a personal blog from which I wasn’t making any revenue, and 2) because being a student, I have to save money to utilize in other areas like books and all. I got off there, with the half dozen articles I published while I was there for a month and a half. I, with those articles in my backpack started wondering like a hunter, looking for a new shelter, cheap and simple. Svbtle was another platform that I liked, unfortunately I didn’t have an invite at that time, and even when I got the invite, the custom domain feature, which I needed, was only available to paid customers. Of course not everything can be free, and I have no complaints, rather I am grateful to them for such a wonderful platform. I had to settle for Blogger, as the forced ads in WordPress were something that made me hate WordPress.com. Initially, with a custom theme, a little complicated, but later reverted to simple one. Then I went to code my own, which turned out to be successful, as far as my goal was concerned. It was perfect. No foreign code and nothing that increased the load time.

There is a problem with near perfect things. They are boring. And so, I thought, was my blog. No new problems to troubleshoot and no commandline to work with. Blogger is everything what a writer sometimes needs, but we computer people are a different breed. We need problems, then be it in our own personal blogs. While randomly surfing, I came across Jekyll, a blog-like platform created to be used with Github, to publish static pages. I knew not much about how Ruby applications are, or how to set one, but thanks to their excellent documentation, I was able to set it up in less than a day. There is no database, simple text files which become posts and pages. Github automatically parses markup or markdown in the post, and you have a nice little blog which is free, easy to manage and test locally, everyone can see the source, plus new stuff can be published with a mere git push.

I liked the way the blog looks and feels. It is important for me to like it since I mostly blog for selfish reasons, haha, but I hope it is comfortable for others to navigate too. I would like to hear anything regarding the new look of my blog down in the comments, and constructive suggestions are welcome. Keep visiting.

Love For Graphical User Interface

I considered myself a ‘programmer’. One who can make stuff happen, put it on paper, my thoughts and use it as a framework to create working stuff in the digital world. As any programmer, I learnt to write command line programs first. What are command line programs, you’d ask. Well, a Command Line Interface (CLI) is an interface which reacts to not visual, but textual inputs from the keyboard. You never need a mouse to work with a command line, of course, if you’re skilled with that particular type.

Command lines were the only way people worked with computers in the past. It was a time when the other name for people who worked with computers was programmers and hackers. No one else had the time or skill to learn and master the complicated systems. But like everything, it changed. Back in 1973, we had the first computer system that ran a GUI, or Graphical User Interface. As it sounds, yes everything was now controlled by pointing device, better known to us as a mouse. This was the onset of computers for the non programmers. Now, everyone could learn how to make computers do stuff with few ‘clicks’. We never actually looked back since.

But same was not true for people who program the computer. Programmers still and will always prefer the command line interface for most simple tasks. There are actually some tough reasons for this statement. Mainly, although the task to master CLI tools is not easy, once you do it, it feels much more comfortable than to use the every changing GUI. Not to mention the low resources that are required to run these utilities, and consistency over different platforms or operating systems. As an example, I can write a CLI tool in Python and C++ to run on Windows and Linux, and you won’t be able to spot the difference between the four instances. Can I do the same with GUIs? No, at least not right now.

For the above few reasons, I never gave a thought to learning GUI programming, in any language. You don’t want to do something that is of no use to you, right? Maybe.

After been coding for sometime now, I gave a thought to why some people who are not very good programmers, succeed more than people who are great programmers. It was a thing that deserved a thought. After reading several success and failure stories on Medium and Quora, I was convinced that there is no lack of skill in any field on this planet. Take anything for example, like I thought about C++. The language I am getting better at everyday, people have been learning it from the past 30 years. Who am I challenging? It struck me that mastering some form of art (yes, programming is as much an art for me as astronomy) and creating something that people use, are not necessarily same sets. Though there is a large area of intersection, you can’t be sure that just being good at something will make you successful, whatever that word means here. It was good time for me to stop thinking about how good of a shot I am at programming, and start focusing on what the world actually needs that I can provide or produce, if at all I can.

That was the time I realized, CLIs are great, but if you want everyone to use your thing, you need to give them something they will love. You need to help them in a way that they are able to use the help. How did I expect everyone to love the CLI just because I think it is cool and looks all black and white (well, that’s what I think is cool).

Not everyone is a nerd. Not everyone has to be one. The world is so diverse. It is really satisfying to see an artist painting, a drummer performing and an athlete giving his best. It is this diversity, in us, the animals and the plants as well that makes our home, the Earth. We, geeks and nerds are no different. We love making stuff that work to our command. But we, like every other human present, also has the morale duty to help others with the stuff that excites us. Just as a painter sells his paintings, not only because he wants to earn from it, but also because he wants his art to spread, so that somewhere in a living room of some house, the hosts always get asked, ‘where did you get this masterpiece from?’.

There is a very different joy in seeing your creation being used. It is something different than doing what you love. Yes, it really is different. It brings the best out of you, a kind of motivation. I wanted to make something like that. I wanted to write GUIs. I took up learning it about a month ago, and I am kind of comfortable with Qt.

There are a lot of frameworks for writing GUIs, as anybody using a computer today can imagine. Plus, many high level languages provide APIs to write graphical applications within the language libraries, Java for instance. Still, having done some programming in C++, I had two basic options open in front of me, GTK+ and Qt. I choose Qt after reading some articles on Stackoverflow from users with similar dilemma. Qt is cool, lots of possibilities and support. Code is quite portable, and an important thing, I am enjoying it, which matters a lot, right?

If you wonder where am I right now with it, I am writing a GUI wrapper for the GNU’s dd utility which should make it simple for someone who’s just started using GNU/Linux to burn ISOs to disks, without the hassle of setting up a more than required complex tool or destroying the data trying to use dd from the command line by messing up the ‘if’ and ‘of’, for example.

Neat, huh? Haha. I will put it up once I finish it, but the important thing is, I could do it. The best part about being a programmer is, adapting is too easy. At least when beginning. And that is mandatory, given the ever changing world of Information Technology.

I’ll conclude this long post here. If you made it till here, then a big thank you. I feel it is hard to read what I write, because I tend to write my feeling, and mostly they don’t look the same on paper. Nevertheless, do tell me what you think about this article. Liked it, hated it, anything.