Drupalathon’ 17; Happy ending

It was a dream for me to conduct an event in my campus before I graduate (I guess all want something like that in their college life). It all began in late December 2016 where a group of  5 of us(Abhishek, Akash, Chiranjeeb, Prashant and myself) started thinking of a Drupal hackathon- Drupalathon’ 17 in our campus in connection with FOSS@Amrita, to help students get an overview of this powerful Content Management System(CMS) used by many exciting projects including The white house, Harward university, Grammy awards and so on.

We started contacting Drupal communities in and around India for sponsorships. The initial responses weren’t that great. At the same time, we got replies from Jet Brains and GitHub. We assumed it to be sponsorships as funding for the conduct of the event. But, they could only provide the stickers which we could distribute among the participants. Thanks to both these communities.

Months passed, we kept on contacting the local communities, not many responses and in March we could find an exciting update from the Drupal association itself who were ready to share our funding in the form of Community Cultivation Grant(CCG).

At the same time, we were also in talks with the local Drupalers in Bangalore and Trivandrum to find potential speakers who could lead the event. We finally ended up in Rakesh James from Valuebound whom I have met during DrupalCon Asia 2016 in Mumbai. The dates were initially set to March 25 but later on got shifted to April 22nd due to some permission delays.

But, at the last moment, Rakesh had to go to Baltimore to attend the Drupalcon which again brought new issues for us. We were feeling really down that we will lose all of our efforts if we couldn’t implement the plans effectively. To our good luck, Rakesh sorted out the issue by helping us get in touch with Nishant Kumar from his company. That was a huge relaxation for all of us from all the sudden happenings. He also got Chirag Shah, his colleague to help him for the event.

Again when it was nearing the event, April 22nd was declared as a working day,  making us more difficult for the event to occur due to the unavailability of the computer labs, duty leave permissions. We discussed with the speakers and they were kind enough to shift the event to the next day, Sunday, April 23rd.

We had 40 attendees for the event. It got started by 9:3 with Nishant Kumar introducing the participants to an overview of the Drupal ecosystem, its usability, how it stands apart from the current existing technologies. It was a totally interactive one with students raising their questions and clearing their doubts on the various aspects of this technology.

DSC_0339

Then Chirag joined Nishant with the installation of Drupal in the local systems. Most of them could install successfully by the lunch time. All were really enjoying the environment learning new things which could come into their real use may be once they start applying it.

IMG_20170423_135233The afternoon session mainly dealt with customizing the website and exploring the various cutting-edge features of this enormous CMS. Students also tried to work out some of them to enjoy the real beauty.

DSC_0298And it was really a happy ending for all of us. We got positive feedbacks from the participants and the speakers. We feel really proud to have conducted the event, breaking all the barriers and ending up a day, sharing the Drupal knowledge with the students of my campus. Thanks to FOSS@Amrita for all the support and encourage throughout entire planning and implementation phase of the hackathon.

Hope we could come up with more events in the future.

Advertisements

Back to writing

The blog post has always been a powerful tool express the views. I have been out of posts due to some reasons. Yes, and finally I think let me scribble down something to restart my writing habits. Another GSoC proposal period has come to an end with an enormous amount of participation from FOSS@Amrita club. I feel really proud to know that around 25 first years have applied for GSoC this year. In our times, we were not even aware how to contribute to an organization at this entry period (even though I used to hear talk like I contribute to so and so organization from my seniors and mentors out here). I am not coming up with a topic to debate here. Yes, at the same time, I could learn a lot about my various technologies which helped me to be a part of last year’s GSoC.

I am really happy to see the performance of the students in the form of their proposals. They have taken serious efforts to come up with attractive proposals. I see really high-quality proposals from our students which are definitely due to the extreme support from our senior members. I am sure the last 1 month was really a memorable time for my juniors. They could interact with developers all around and most importantly craft software project proposals of open source organizations.

This is a totally different experience and I would say all the Computer science Engineering students should give an attempt here at least once. The selection of the proposal is an entirely different story. There are no words to express the satisfaction we get on submitting the proposal in the GSoC website after all the efforts. We build new partnerships with developers worldwide and this is definitely going to help us throughout our lifetime.

Good luck to all the GSoC aspirants. You have already amazed us 🙂

It’s all happening!

I just remember a simple conversation I had with one of my faculty placement coordinator which happened around 12 months back. It goes like this:

Me:  Hi. I feel really excited seeing the current placement statistics.

Coordinator: Yes, this year we had a good number of core placements. Most of your seniors are placed and that too with very high packages. The performance of the batch has been improving year by year.

Me: oh, nice. That ‘s really a cool. Our batch is also going to face the interview process very soon.

Coordinator: Yes, and which is your dream company?

Me: (a bit surprised, not yet having some clear goals and just for the sake of an answer gave a random reply): SAP labs!.

I was placed in Bosch software solutions in July 2016. But, I wanted a core company. I won’t say Bosch isn’t a perfect place. But, when it comes to Computer science, Bosch remains a question mark. Then, I attempted one more interview for Symantec. I went without much preparation and the result was disastrous (knocked out in the very first interview!).

SAP labs arrived in Amrita for placements last week and I was in the second round of interviews after clearing the online rounds which were held at the respective campuses. I could clear all the rounds successfully.

Yes, and finally on January 25, 2017 (a day before the Indian republic day), I am placed in this well known German campus in Bengaluru, the silicon valley of India.

PS: Please don’t consider this is as a drama as a result of the selection process. The characters of this conversation are still alive 🙂

GSoC’ 16: Port Search Configuration module; coding week #9

I am part of the Search Configuration module porting process to Drupal 8 as part of the Google Summer of Code’ 16. I have been mentored by Karthik Kumar, Naveen Valecha and Neetu Morwani. If you would like to have a quick look at my works so far, please go through these posts.

The past week I worked on fixing some of the issues in the port process. Moreover, I could learn some important concepts in the process. I ported the helper functions of the search configuration settings to the form API.

Basically, settings were stored as helper functions in the Drupal 7 module. I ported the helper functions of the search configuration settings to the form API. Generally, forms are created and worked on using four important functions, namely, getFormId, buildForm, validateForm and submitForm. These definitions are stored in classes.

The basic format will be of the form:


use Drupal\Core\Form\FormBase;
 
use Drupal\Core\Form\FormStateInterface;
 
class searchForm extends FormBase {

 public function getFormId() {
    return 'search_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    //create the form here.
    return $form;
  }

  public function validateForm(array &$form, FormStateInterface $form_state) {
    // Validate submitted form data.
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Handle submitted form data.
  }
}

The getFormId() returns the unique id of the form. We need to write the features of the form in the buildForm(). It includes the structure of the form, various fields included and its corresponding types accepted. The validate form is for validating the contents entered into the form which is definitely an important part of any form. Finally, the submitForm() handles the works to be carried out once the user enters the data in the form fields.  This mode of arrangement of the form functionality makes it more standard and properly arranged.

Also, the deprecated functions were removed from the .admin.inc of the module. There were some underscore functions in the Drupal 7 module which supported the configuration and the form settings. These are to be added to the helper file of the module.

These were some of the basic functionalities I could work on and explore. Stay tuned for the future updates on this port process.

GSoC’ 16: Port Search Configuration module; coding week #8

I have been porting Search Configuration module from Drupal 7 to 8 as part of this year’ s Google Summer of Code (GSoC). This summer program is an opportunity for university students to work on projects connected with open source organisation. I have been really lucky to be a part of this initiative. I could explore deep of more technologies, version control systems as part of my project in Drupal. This gives young students a platform where they are assigned mentors who are experts and experienced in various software.

Last week, I could learn some of the Drupal concepts as part of this module port. So, let me begin with the Drupal 7 property. The t function translates a string to the current language or to a given language. This makes the strings used in Drupal translatable. This generally takes up the format:

t($string, array $args = array(), array $options = array());

Here, $string is the string containing the English text to get translated.

$args: An associative array of replacements to make after translation.

$options: An optional associative array of additional options, with the following elements: lang code and context.

This t function has got some alteration in the Drupal 8. It has been replaced by the $this->t() by making use of \Drupal\Core\StringTranslation\StringTranslationTrait. 

 The translatable markup returns a string as a result of this process.

Another important aspect which I dealt was the roles. This is an important feature  for any module as it  deals with the security constraints of the module. Roles are often manipulated to grant certain permissions. What we have to do is that, initially, load the particular role to be manipulated and then provide the permission which is to be granted.

$role = Role::load('access page.');
$role->grantPermission('access comments');
$role->save();

These role functions help us to load the roles and manipulate the permissions assigned to it quite easily. Thus, turns out to be really helpful in dealing with permissions.

I have been also dealing with writing the simple test for my module. In one of my previous blog posts, I have introduced the PHP unit testing.  The simple test tests the web oriented functionality of the module. It needs a good understanding of the behaviour of the module to write an effective test. Tests are often really important to identify the flaws of a functionality and to correct it accordingly. I will be writing the simple tests for my module in the coming days. I will be sharing you the concept of this mode of testing in my next blog post.

Stay tuned for further developments on this blog post.

 

 

 

GSoC’ 16: Port Search Configuration module; coding week #6

Google Summer of Code (GSoC) is into the next phase of coding after the mid-Term evaluations which got over by June 27th. This also reminds students to speed up the coding activities to complete the projects within the schedules provided in the proposal.

I am porting Search Configuration module to Drupal 8 as part of this year’s summer of code. GSoC is definitely turning out to be a venue for the young students from universities around the world to work on real-world projects under the experience of well-known developers, learning new technologies, making use of version control systems, with regular meetings and finally building up a software which is going to help a large section of the society.

I blog regularly, sharing my project progress. If you would like to have a glimpse of my past activities on this port, please visit this link.

Drupal 8 has introduced the concept of Html twigs in place of the PHP templates. So, the PHP template files have to be now ported to the Html environment. The .tpl.php template file is replaced by the .html.twig file for the module templates.  Templates are simply text files which can give outputs in Html, Latex, CSV or XML formats.

To print some data, we usually take the service of echo statements in PHP.  The print statements are replaced by {{ }} in Html twigs.

<?php echo t(‘Let’s start the process.’); ?>

is replaced by:

{{ ‘Le’s start the process’|t }}

The variable names have to be converted to simple names. For instance,

$page[‘title’]

becomes

{{  title }}

The PHP logics have to be replaced by {% %} syntax. This is applicable to all the logical statements.

<?php if ($page[‘title]): ?>

…..

<?php endif; ?>

is transformed as:

{% if form %}

……

{% endif %}

Also, the variables are replaced by simple names.

<?php if ($logo): ?>

is transformed as:

{% if logo %}

These were some of the basic transformations to get started into created the HTML twigs.The use of the Html twigs has made the templates look very simple and easily understandable. It is really easy to get the templates converted to the Html twigs. This is always one of the crucial requirements of porting modules from Drupal 7 to Drupal 8.

Stay tuned for further updates on this port process.

GSoC’ 16: Port Search Configuration Module to Drupal 8 : Mid Terms

I feel really excited to have cleared the mid-Term requirement for my project in Google Summer of Code (GSoC). The results of the mid-Term evaluations were announced June 28, 00:30 IST. This was the evaluation for the first phase of GSoC. In this evaluation process, set up by GSoC organisers, students and mentors have to share their feedback about the current progress of the project. Mentors need to give a pass/ fail grade. Students can continue coding once they clear the evaluations successfully.

I have been working on Porting Search Configuration module to Drupal 8. Please go through my previous posts if you would like to have a look into the past activities in this port process.

Last week I worked on testing some of the units of this module using the Php unit tests framework. Testing is an important process when it comes to any software development process. It plays a crucial role for any software. It helps us to understand the improve our software to the required level by making use of various test cases. We input various values and check whether the tests are passed according to the requirement. If any condition fails to our expectations, we need to make the required changes to suit the application needs.

Php unit tests are generally used to test some units of an application. To check whether the functions implemented gives the expected output, behaviour of the functions in various test cases, giving different types of arguments as inputs to check the errors or flaws for improving the application.

We need to install the Php unit for this process. You could follow this documentation for this process. Furthermore, they give a detailed analysis of the Php Unit Tests.

Once the installation is completed, we can start writing the unit tests for the functionalities we have implemented. The tests are generally stored in the tests/src/Unit directory of the module. The name of the unit test file will be of the format xyzTest.php. All tests are suffixed by ‘Test’. ‘xyz’ can be replaced by the functionality you are going to test.

The following is a simple test to check the sum of two numbers: sumTest.php

<?php
class SampleTest extends PHPUnit_Framework_TestCase
{
  public function testSum()
  {
    $this->assertEquals(2+2, 4);
  }
}
?>

As mentioned in this above code snippet, we need to create a class, with class name suffixed by ‘Test’ which is an extension of PHPUnit_Framework_TestCase. Now, we need to write the tests inside as member functions. The functions starting with the name test are executed. Here we are checking the sum of the two numbers. This is a very simple demonstration.

The tests are run by using the command PHPUnit. i.e,

$ phpunit tests/src/Unit/sumTest.php

The output generated on running the above test is:

PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: 252 ms, Memory: 13.25MB

OK (1 test, 1 assertion)

Stay tuned for future updates on this module port.