Sortable !

Sortable !

I wanted to finish working on this feature by the end of the previous week but university exams were keeping me busy. As they say, Better late than never ! eh? πŸ™‚

Quick Recap : I was working on the bookmark-modal window which would feature the hub pages bookmarked by the user, that the bookmarks-bar cannot hold (overflowing bookmarks)

Week 1:
I hacked on the master.html file to get the edit_bookmarks modal window to pop-up on hitting the *edit* button. Added few hacks on style.css as well to bring it closer to Mizmo’s mockup.
Screenshot from 2016-06-19 11-52-28.png

Screenshot from 2016-06-08 23-08-49.png

Week 2:
Making the bookmarks toggle !
During the Hub’s meeting, Sayan suggested that the mockup required extra styling that wasn’t preferred. We wanted to use fedora-bootstrap alone, so that the modal window looked bootstrappy,Β thus dropping the idea to add styling.
The user is to be able to re-order the bookmarks at his will, so Pierre suggested to use something like jquery sortable() but using bootstrap. I tried experimenting using jqueryui and after several attempts, it finally worked ! πŸ™‚ Though there is still more experiments to be done…

Screenshot from 2016-06-19 12-06-00.png

Screenshot from 2016-06-18 23-59-41.png

Preview : This week I plan to work on providing suggestions to the user to re-order hub-bookmarks depending on the frequency of the hub pages he/she visits often.

Till next week ! Good day to you πŸ™‚

Advertisements

Scroll ! Think ! Bookmark !

Scroll ! Think ! Bookmark !

Hi there,
so we are in the second half of the year and its been quite exciting so far πŸ˜›
Looking forward to amazing times !

It’s been a week since the coding period began, the first feature that we plan to work on is the bookmark feature. Soon there will be quite some hub-pages for Users and also for groups, such as Infrastructure, Design, Marketing, Commops, etc.
So it might get difficult to keep track of the pages a user wishes to follow closely.
Currently, the hub pages are just added to the bookmarks bar.
We plan to provide the user with a *EDIT* bookmarks option, which would list down the hub pages that were bookmarked by the user initially, followed by the pages that are most frequently opened by the user, that exist in the overflowed list and not in the main bookmarks bar.
Aye ! that’s confusing πŸ˜›

Screenshot from 2016-05-31 16-59-55

So, we see here that the bookmarks were just added to the main bar.
Instead, an ‘Edit bookmarks’ option will be listing the hub pages that exist in the overflowed list, with those that user bookmarked in the top of the list.

9f55e46911d9e3589045fd0fe17e879e0a48573e878a8ff6448a7c50958367ed-edit-hubs-list

Thanks to Mizmo, Sayan, Pingou for providing a few pointers on the same in yesterday’s Hubs-meeting ! Discussed ideas were that the bookmarks shouldn’t change dynamically, rather we’ll be providing the user a suggestion to move the frequently opened bookmarks further up in the bookmarks list.
This is what I plan to accomplish this week. *fingers crossed* πŸ™‚

A small info : We have our weekly Hubs meeting in #fedora-hubs at 14:00 UTC on Tuesdays. Anyone interested can attend or if you have any suggestions; they are most welcome !

That’s all folks ! See you next week πŸ™‚

What did I do this Summer – Part 2(Summer-Internship)

What did I do this Summer – Part 2(Summer-Internship)

Its been about a month since I finished my summer-internship, glad am finally blogging it πŸ™‚

Hey there ! This blog post is the second blog post on my summer ! After FUDCon, I left for Bangalore where I interned in a startup- Eventifier which was recently acquired by BookMyShow. I was excited to work with awesome people and wanted to get the best out of it.

I was not really very sure of things when I reached ! But then… πŸ˜› Someone said “Things will always move on !” -@harisibrahimkv

So, I met Haris, Praseetha, Sharat, Unni, Saud, Nazim, Nawaz, and Jazeel in the order as listed. πŸ˜› They are really a fun bunch of people to hang out with, who do skateboarding (oh yes, they do :P) Β and discuss on topics, debate and laugh over the same πŸ™‚

Ah! they are cool coders too ! On my first day, Saud who is the co-founder told me that I will be working on the Analytics of the product, and would hack on the Backend part that used Django. I went through the code-base which was clean, and beautifully written. Sharat helped me get it all set on my system, and I was good to go ! πŸ™‚

So, what did I work on ??

Task 1: I worked on getting Social-Insights of a brand/company based on their respective twitter info.

upload

I used Python-Requests to extract info with the Twitter API, and the Twitter-Counter API. Thanks to my mentor @harisibrahimkv who has helped me throughout to explain stuff with patience.(He would be like, “You really can’t see the bug !” and then he goes ahead and explains). It used to be really fun coding with him, haven’t seen someone as humble as him. Later, I also got to work on another task under the mentorship of Nazim, CTO of Eventifier.

So reader, hi again ! Try and imagine a situation, where you host a site and a celebrity or well known personality tweets about the same. Wouldn’t you want to showcase it? Wouldn’t you want to extract more info of that interested customer who also happens to be a celeb ? Now imagine how many followers would also be interested in the product !! And why wouldn’t they! πŸ˜‰ Now these are just a few features that team Eventifier hacks on. This was my first task to get the tweets of the celebrities who tweet about certain products.

So, here I am, Β writing this blog to explain how Python-Requests made life easier for me.

Requests is an Apache2 Licensed HTTP library, written in Python. Python’s standard urllib2 module provides most of the HTTP capabilities one needs, but the API is thoroughly broken. Previously, one would, put off doing HTTP requests in Python because the API was such a pain. One would end up running wget at the command line and copy paste html into files and load the files in python because open() was an easier API. But, then !! πŸ™‚

Requests to the rescue !!

  • Requests have a way better API design.
  • To get information all one needs to do is use .get() as a method.
  • Auth is an optional parameter in Requests, and
  • status is a field not a method.

It is written to make HTTP requests way easier. Such an improvement ! πŸ™‚

Screenshot from 2015-10-09 02:51:12
urllib.py
Screenshot from 2015-10-09 02:51:54
urllib.py

Fig : This is sad and shouldn’t be this way !

Requests is the perfect example how beautiful an API can be with the right level of abstraction.

Python HTTP: When in doubt, or when not in doubt, use Requests. Beautiful, simple, Pythonic.

For example, to get a webpage :

>>> r = requests.get('http://www.python-requests.org/en/latest/')

This is how one can simply make a get request; then again what about other HTTP request types: PUT, DELETE. Well, they are all just similar.
>>> r = requests.put("http://httpbin.org/put")
>>> r = requests.delete("http://httpbin.org/delete")

Now, how did requests be my saviour !? Like I mentioned previously, for my task I would have to hit the Twitter-Counter API at regular intervals to extract twitter info of the customers, thus all I had to do was to ask the requests API to hit the tweet-url and extract the required information of the user, and showcase it for the product.

During this, I learned to use tools like tmux, and other python hacks that helped me get only the required data within a tolerable time limit.

2nd task : In my next task, I got to work with Nazim who wanted me to get the twitter-followers information of a user and display it in the form of graphs with respect to time. Here again, I had to use the requests API to hit the tweet-url using the Twitter-Counter API to extract the followers info.

From the graph, one can conclude the growth in the followers count, information of the followers, their interests and more.

During this, I learned about the importance of a cache DB for a Django product, for immediate retrieval of data to display.

Before my internship got over I also hacked on a Django app for the Djangothon that was conducted by Hackerearth, where I participated with Praseetha and Sharat. That will be in my next post, so stay tuned !! πŸ™‚ Goodbye reader !

For detailed info on Python-Requests, one can refer the documentation :