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 🙂

Advertisements

Fedora-Hubs: Google Summer of Code 2016

Fedora-Hubs: Google Summer of Code 2016

 

A warm hello to the Summer Coding World.

Devyani is a CS Undergraduate who will be working on Fedora-Hubs as her Google Summer of Code 2016 Project.

The Google Summer of Code 2016 results were declared on 22nd April 2016. The Community Bonding Period has been amazing: meeting like-minded people, making new friends and being a part of this awesome community !

Initially in May, I started to hack around the Feed-Widget of the Project, Fedora-Hubs.
The project is available on Pagure.

I had to go through the documentation, and hubs/widgets code more in detail thus, that week was pretty much a reading week rather than coding week. Hubs is implemented using Flask, which uses Flask-SQLAlchemy. Flask-SQLAlchemy wasn’t exactly my strength, especially the models and the relationships that exist. Hubs are related to widgets by many-to-many relationship. I went thoroughly through the Flask-SQLAlchemy documentation and googled more about establishing relationships amongst the fields. I tried to write down the code to establish relation between the databases to understand the connections between the various fields: Hubs, Users, Widgets 😛
This helped me a lot to understand the basic structure of Hubs.

I also had to go through the Feed-Widget to work on getting similar threads of the mailing-list posts together based on Mizmo‘s mockups. That’s still a work in progress, though.
Largely the summer goals will be to integrate hubs successfully, with all the widgets working efficiently. By the summer, we plan to provide the user with an individual hubs-page featuring the widgets; a cool bookmarks bar for the user to switch tabs at his will; provide info regarding the unread notifications that he/she follows or is subscribed to.
We also plan to work on the badges-widget before Flock 2016 that displays a cool path of the badges that can be achieved. For the more interested folks, I have my project proposal updated on the wiki 🙂

For more updates on Hubs, follow me @devyanikota. I go by the nick devyani7 on freenode, you can find me lurking on #dgplug, #fedora-apps, #fedora-hubs. My Github profile and Pagure profile.

Until next time, Happy hacking !

GSoC Battle 2016

GSoC Battle 2016

Hello reader,
The third attempt and yeah made it, this time. 😀
No more regrets in life ! soon a GSoCer !

I started contributing to Fedora infrastructure projects after I returned from PyCon India 2014 prior which was contributing to gnome-shell, one can say that after this event, meeting people and the environment as a whole motivated and inspired a lot, and since then I never backed down !
yeah, the trick was to not lose hope and keep working harder, guess that worked 🙂
After the Outreachy debacle, (which the lowest phase I guess) am blessed to have such motivating people around me who kept pushing me.
Huge thanks to Kushal da, Sayan, Subho, and Elita of course for helping me through it.

The cliche result night, for two seconds my mind said, “That’s alright, maybe not this time either. Am anyway not losing hope, will move on !” But, then there was my name. “phew!!”, “yay ! I finally made it”. Am so happy, I will be working on Fedora-hubs this summer.
I should thank my mentor RalphBean for helping me with my naive doubts, and for guiding me fix bugs all this time. Huge thanks to Pierre, MizmoJustin, Sayan, for reviewing my proposal and getting it done on time 😛
Am glad I will be working with them this summer, hacking on Hubs !

A little throwback: am really glad I finished the #dgplug summer training successfully that moulded me be what I am !

For those interested, can take a look at the proposal on fedora-wiki.
See ya all !

Happy Coding 🙂

 

 

Modelling Models !

Modelling Models !

Hey there reader !
Its been quite some time since I updated about brainstormings going on for the new widgets for the hubs pages.
So, I was working on an issue for the Subscriber/Subscribe widget, where I had to list the number of subscribers that were subscribed to this user(his/her hub page), and also the number of users he/she was subscribed to, basically the subscription stats.
pretty simple, eh? That’s what I thought too 😛
Well PR #111 fixes it !

I learned a lot while trying to figure out ways to solve this issue, jotting them down :

  • how easily one can access the attributes if we know the relation between two objects/tables.
  • using dir() function to see beyond an alphanumeric object !
  • write test-cases.

Structure of HUBS :
User : A user table with attributes like openid, fullname, and created_on.
Hub:   This is the individual user’s hub page(in simple terms-profile page) with attributes                like name, created_on, widgets, etc
So, we wanted to implement a many-to-many relationship between users and hubs, ‘coz many users can subscribe themselves to many hubs.
So, I spent quite some time with the flask-sqlalchemy tutorial to learn the pythonic implementation of the many-to-many relationship. 😛 my bad !!
Its really amazing to read code written by awesome developers. Ralph‘s code already had the ‘Association’ table to connect the users and hubs.

>>> for assoc in widget.hub.associations:
........sub_list = [u.name for u in assoc.user.subscriptions]
>>> subscribers = [u.username for u in widget.hub.subscribers]

‘widget.hub.associations’ returned a list of associated user objects.
This is where dir() function came to my rescue 😛
So I tried to print the attributes of the user objects that were being returned by simply printing the output of the same.

>>> print dir(widget.hub.associations)

Thus, displaying a list of the attributes of the object.Screenshot from 2016-03-15 02-38-05
Hub names were extracted, which helped extract the subscriptions of the respective hub_user’s page.
Rest, was a simple edit in the jinja template, that made the Subscribe/Unsubscribe button do its magic 😉

But, that was not the end !
I had tests failing ! 😦
I didn’t have any experience with writing tests.

Why were tests failing ?
‘coz the default values of the subscribers was still assigned ‘0’, when I had changed it into a list. Changing its default value to ‘[]’ and voila !
It works !

I came across an awesome quote when bugs overpower you 😛

Your Goals don’t care if its the weekend !

 

Fedora Hubs !

Fedora Hubs !

What have I been hacking on recently ?
Well, for the past um, a month and a half, was hacking on Fedora-Hubs !!

So, it was after I returned from PyCon India 2015 that I thought of applying for Outreachy Internship this winter, and that is when I came across this – Fedora-outreachy-wiki link.
Next, I mailed Ralph, who was listed as the mentor for the project, pinged him on IRC eventually 😉 and got an immediate response to go ahead with the ReadMe and get it up on my system.

What is Fedora-Hubs ?
It will be an ‘intranet’ page for the Fedora Project. A single place to get information on all the different projects on Fedora, as a contributor. It’s a social network for Fedora contributors. One place to go to keep up with everything across the project in ways that aren’t currently possible.

Possible tasks to hack on :

I started hacking on hubs beginning with a very small bug that Ralph had assigned, bug#46 that needed work in the “Community Rules” widget. I worked on the jinja2 template : PR#48, to link the users’ usernames to their hub-pages.
Next, I was assigned bug#49, where the ‘updates ready for stable’ widget needed work, where I needed to extract the name, version and release of the packages that were ready for the release from the bodhi url. Well, PR#51 fixes it ! pythonic ! 🙂
Screenshot from 2015-12-08 19-23-41
Bug#53 was a tricky one because it had an untamed list to deal with 😉 hehe
Learnt about Base Conglomerator, that was some cool thing ! The list_to_series() function would naturally process the list consisting of hubs that the user is subscribed to and returns a string – Subscribed to : <A>, <B>, and 5 others. The task to link them to their respective hub pages before being processed into a string, kinda needed a bit of tweaking to do ! Nevertheless, PR#54 fixes it. 🙂

Incase, you have plans to hack on it, the latest Source-Code is not on Github but on pagure.
HACKING : Like I said, the README is pretty clear.
Happy Hacking 🙂
There is a Prototype ready too.
The designs are really amazing, found these links on the fedora-outreachy wiki page itself :
mockup, design and for more 😉

The Outreachy results were supposed to be announced on the 17th of November 7pm UTC, a very cliche result night 😉
12.30am IST, these nights can get really intense,
Felt really awesome to see “You were accepted for the program” !
Fedora-Outreachy

But, yet again … !! :/
Catch up the rest of the story in my next Blog-Post !! 🙂

 

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 :