Code … Debug … Test …

Outreachy weeks 5 and 6

With this blog I have reached the mid point of my internship and have successfully finished 6 weeks !!

The past 2 weeks were filled with lots of Java script coding and debugging. Periods of thinking of a logic , frustration while debugging,  followed by excitement that my code finally works basically summarizes  the past few days 😉

Well, Java script debugging can be a tedious task at times. I have spent hours trying to debug a small piece of code. Sometimes I start out with one error on my console and end up with 5 by the end of the day  😛  It is rightfully said that –

“It is a jackpot when you get to know Java script can be debugged.”

Having said that nothing beats the joy and satisfaction when you actually get your code working as desired !! And for that reason Java script is definitely one of my favorite languages to code it 🙂 It can turn web browsers into application platforms and is amazing for both front end and back end development !

Goals of my project

Since I am half way through the internship , this is the best time to look back and reflect on my progress so far. The goals of my project can be briefly classified into 3 parts :-

1) UI revamp

2) Standardization and refactor

3) Testing

I worked on the first part for about 3-4 weeks of my internship. The UI revamp for the LEL library mainly revolved around creating a more user friendly collapsible menu. This menu categorizes and displays the layers on click. One can use this menu to toggle between number of active layers, overlay layers and base layers. It is more like building the dashboard of the map to navigate between the different features !!

In these first few weeks I also worked on some existing bugs in the repo and fixed issues related to layer loading problems and problems related to zoom and bounding boxes of the map. The next step was to standardize layer code !!

I started standardization of layer code in the 4th week 🙂 The first step was to refactor the main code base. I separated and refactored code in the main html css and js files. Broke huge files into 2 where needed and also opened a few interesting new comer issues for the same to encourage community growth and participation!!

Standardization of Layer code

LEL when initially developed , had different java script files for each layer when you could logically merge some of them to use the same or similar functions. Hereby there was lots of redundant code in the library. Let me give you guys an example –

So there were 3 indigenous land layers ie the language, territories and treaties layer. These used practically the same functions and code base  other that the API url that fetched that layer’s specific data. But there were 3 different JS files in the repo for these layers !! So as my first task in the standardization process I wrote one JS file to combine the functions of these 3 layers and reduce code redundancy 🙂

This seems pretty easy at first ! I thought I can just parameterize the function and pass the API urls ….

CORS error with API url’s

But nope ! That did not work :/ This method give you a CORS error. Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. There was a lot of debugging me and 2 of my mentors did here !! We worked on this PR for days yet unsure of how we can resolve this error.

By now I started trying different methods to achieve this standardization. I passed the layer name and wrote a ternary condition statement or an if-else block to assign the url’s real time. This method finally worked 🙂 But there was a catch here !!

In this method I was facing variable scope problems and the function was not able to access the latest value of the variable. After a lot of thinking and debugging I have now standardized the layer code for these 3 layers !! Would never have been possible without my mentors help 🙂

In the big picture, I now know the procedure for standardizing layers and it will be easy to standardize the rest hopefully 🙂

Future goals

With 6 weeks of my internship done, I am now presently working on writing tests for the layers. We recently installed and set up jasmine testing framework for the LEL repo and I am now writing tests parallely as I standardize layer code.

The process I plan to follow is standardize particular layers and then write tests for them so that they don’t break anything and are rendered properly !!

The UI revamp phase of my project was definitely the easiest and smoothest while the standardization of layer code took a while. There were times when I was clueless on how to proceed since nothing I had tried worked so far. But there is always a way to everything you just need to be patient , reach out to your mentors for help and keep working !! There are usually these 2 phases in a programmers life –

1) Don’t know whats happening – this is usually while we are stuck and are trying to fix something

2) Top of the world feeling – this is when at last you get your code working as desired and the PR gets merged  !!

So keep the hard work going guys !! Code debug and test It will always work in the end !!

 

 

 

Advertisements

LEL – Whats my internship about ?

Outreachy Week 3 and 4

Hi everyone, I am an outreachy Intern with Public Labs and with this blog post I would like to explain my project to a new comer in this community ! Assuming you are totally new to Public labs and my project Lets get started with this blog 🙂

So Public Labs is a DIY environmental friendly open source organization started in 2010. We support communities facing environmental justice issues in a do it yourself approach to environmental monitoring and advocacy. Leaflet Environmental Layers is one such project of Public Labs started an year ago as a part of the google summer of code program (or GSoC) by Sagarpreet Chadha.

 

What exactly is LEL ?

LEL or Leaflet Environmental Layers is a collection of different environmental map layers in an easy to use Leaflet library. This library is a user friendly map project. We can choose a combinations of layers to display on the map . Each layer gives some environment – related information on the map in the form of small markers or polygons . Each marker on clicking shows a pop-up with more detailed information on that exact location.

The map consists of a main menu which is collapsible in nature and helps a user toggle between layers. Key features regarding the layers are a set of base layers like grey-scale, standard, street and satellite followed by the set of overlay map layers that get displayed on the base layers chosen.

We have layers that show climate across the globe like the weather, rain, precipitation layers. We also have layers to show land usage and languages in an area. We have justice map layers that helps to visualize race and income data for your community to name a few.

LEL – issues for newcomers !!

So I guess by now you understand the basic goal of the LEL library and its use right ? Do you want to contribute to LEL ?! We at Public labs have separate new comer friendly issues for people like you 🙂

At LEL too there are a lot of interesting new comer issues open and in due course of time I shall be opening more !! https://github.com/publiclab/leaflet-environmental-layers/issues

Right now I have completed the UI revamp of LEL and am working toward standardization of layer code and refactoring the code base.

LEL does not have any tests set up yet , so I shall be writing tests too for the layers in the popular testing framework for JS libraries Jasmine !!

 

My passion 🙂

Working on the LEL project with my mentors for the past month has made be not just a better coder but also allowed me step out of my comfort zone and learn to work and coordinate better with a group.

I am inspired by the motive of Public Labs to provide a better and cleaner world to live in. From childhood I had strongly felt the need for environmental conservation. I also love science and the very idea of DIY experiments to learn stuff excites me.

Improving workflow and display of maps would encourage better participation and promote a wonderful community to unite and discuss problems and make a change to this world. Users can use and benefit from these maps. If i can be a small part of this change it would definitely mean something 🙂

 

 

 

 

” Nobody said it would be easy, so never give up when it gets hard”

Outreachy week 1 and 2

I was selected as an outreachy Intern for Public Labs this summer. My journey started in February during the initial application period. I recently finished 2 weeks of the Internship program and with this blog I would like to give you a few technical details regarding my application and project 🙂

The first step was to understand and install Public labs code base. The projects used either Java script or Ruby primarily. I was new to Ruby so understanding the project took me a while. I had to start from scratch to understand their code base. I learnt Ruby from tutorials online and after hours of looking through the communities code I felt I can finally contribute to it.

The first issue i solved on the public lab community was a small One line change that changed the UI of their website.

This was just the beginning, after this I went ahead and solved various issues related to form validation, statistics and graphs visualization, map related issues and documentation.

While solving many issues at one go, I faced problems with different branches on github and rebasing. I had never worked on so many issues at a time and in such a big community. It seemed intimidating seeing huge files and lines of code at first but slowly with the help of my mentors I got a hang of Git workflow in Public Lab.

A really nice learning from the application phase was creating new issues for new comers in the organization. I had a lot of fun opening easily documented new comer issues called “First timer issues” and guiding new contributers to the community.

The next step was reviewing Pull requests. This taught me how to look at and understand other people’s code. While working in a large community collaboration is the key to successfully getting work done.

While opening new issue and reviewing PR’s I felt very responsible and my mentor also kept encouraging me to take on the leadership role as well apart from just contributing to an org.

Internship Officially Begins

I officially started the internship recently.

I am working on the project titled

“Extend Leaflet Environmental Layers with new layer menu and layer addition workflow”

Leaflet Environmental Layers – LEL – is a collection of different environmental map layers in an easy to use JavaScript Leaflet (https://leafletjs.com). This library is rapidly growing and has many new layers being added, but there is no structure or workflow to it. When displayed the layers are not segregated conceptually and is hard for the user to understand the current process. My Project aims to add additional structure to make the display/management of leaflet environmental layers smoother and maintainable and to allow better data flow/handling.

I was about to start my Internship work, so I pulled the latest changes to my local installation and for some reason the repo suddenly failed to build.

After 2 days of trying everything possible regarding node and npm installation and trying to build the repo, with my mentors help I figured that it was a PR merged about a month ago that was causing the build to fail. Accidentally redundant code had been merged and there were issues in the ordering of scripts that caused the build to fail.

So this lead to the first challenge of my internship – to fix this !

After a few technical challenges I faced, I was finally able to fix the code and now It feels great to know the repo builds again when new users pull it.

The past few weeks I worked on layer organization and display related issues. Felt great seeing my PR’s merged and my code being reflected. I am going to start working on standardization of Layer code from next week. This is going to be challenging but I’m really excited to get it working !!

Never be scared to ask questions. I strongly believe and can assure you that is the best way to move forward when you are stuck. I used to be (well still am :p ) a timid person by nature and afraid to ask questions publicly on an open community. But once you start collaborating and asking questions  things do not seem as scary as you think and you will realize you were worried and hesitant for no reason 🙂

Learning from mistakes and challenges is the best part of any learning process. Its ok to fail !! Nobody is perfect 🙂 I found this really interesting paragraph in a blog that inspired me – “Fail faster, as a strategy and technique to take the pressure off yourself to be perfect. Failure is good. Good judgment comes from experience which comes from bad judgment, or making mistakes.”

So dont let the fear of failure affect what you can achieve and as I always strongly believe and say – Always believe in yourself coz you are no less 🙂 !!

 

Outreachy 2019 – My journey to getting selected !

Hi everyone !!

I am Ananya Arun , an undergraduate from International Institute of Information Technology, Hyderabad (IIIT-H) . Here I am pursuing a degree in Computer science and have recently finished my second year of study.

So this is my very first blog post and I am brimming with excitement as I write this. On May 6th at 9:30pm, just a few days back, I got to know that I was accepted as an outreachy intern. I was thrilled beyond explanation and so thankful when I saw my name on their website.

How it all started …

I first found out about outreachy after coming to college from a few of my seniors who were outreachy interns themselves. From the time I got to know about open source and different projects of different organizations, I was always fascinated by it and wanted to start contributing to it.

I started my journey with open source last summer when i solved small bugs and documentation related issues in orgs like sugar labs, coala and systers. The joy on seeing my very first PR get merged was so very encouraging and with that it all started 🙂

Picking an organization

I decided to apply for outreachy 2019 since I really enjoyed contributing to open source in the smallest ways possible and working with like minded people in a community. Picking an organization was one of the hardest task for me.

I think for many people this is the hardest thing to do, that is get started. Things are usually overwhelming at the beginning but once you get started there is more clarity to the work you are doing. After a lot of time looking at the organizations and projects listed, I finally decided to contribute to Public Labs.

Contributing to Public Labs

Looking back, I am so glad I chose this !!

From the very first issue I solved on Public lab to mentoring new comers in the organization, creating issues for others to solve and finally drafting my proposal the people of public labs especially my mentors have been so encouraging and supportive !!

I got to learn so much in this application period. I had never really contributed to such a large project before and each time my PR was merged, It felt great to see my bit of the code being reflected on the website used by so many people.

I learnt communicating and working in a huge team and I also got to improve my coding skills. Honestly This experience was and would be worth it even if I had not been selected.

 

Finally, I would really like to thank all my mentors at Public Labs and outreachy for this great opportunity. I cant wait to get started and am really looking forward to this summer !! 🙂 I strongly encourage all budding aspirants to never be scared to get started or ask questions no matter how trivial they are. Open source organizations are very new comer friendly and this is the right place to start if you love and want to contribute to open source.

Always believe in yourself coz you are no less 🙂

Thank You