Author: championshuttler (Shivam Singhal )

MozCoffee V11: Time to wakeup Community

There is a long time from Mozilla Delhi went on a hibernate so its time to wake up the community. To rejuvenate the community some members took initiative. Thus Pushpita and Bhuvnesh  planned to organize Mozcoffee V11 on July 15 at Qutub Spring House, Delhi.

I had two events on same day , one is Hackathon Random Hacks of India in Gurgaon at 9 AM where my team members wait for me and  another was MozCoffee at 11 AM, i preferred first to go to MozCoffee as it was necessary to wake up the Community.The main agenda of this MozCoffee was to discuss about the current projects of Activate Mozilla Campaign.

So I reached by 10.30 AM at the venue. Pushpita and me reached at the same time 😀 . Bhuvnesh Sir was already at the venue. More attendees began to join us from 10.45 onwards. I was so happy to some newbies join us as they were interested in Open Source Contribution. So I and Sanyam Bhaiya introduce them to open Source and tell them about how to contribute to Mozilla Projects and Mozilla Campus Club. This was first time I introduce some one to Open Source though it was not official talk 😛 .

After that Sanyam Bhaiya told about various Mozilla Projects after that Pushpita explained about the Activate Mozilla Campaign. She also highlighted other projects for non- tech peoples.

IMG_0359.jpg

Finally, it was time to bid goodbye to all the Mozactivities 🙂 .

IMG_0705.jpg

Thanks for reading. Sorry for such bad english. Be Mozillian :).

 

Advertisements

Tabs v/s Spaces: Analysis on why tabs better

Tabs vs Spaces : Silicon Valley

Tabs v/s Spaces. I am sure you have encountered this dilemma in your coding career time and again. I prefer tabs. There are some people who prefer spaces instead. Today I would like to discuss why tabs are better than spaces. I am only going to use rational points here. Please spend 5 minutes on this article and then make a decision.

First, I would like to point out the major argument why people prefer Spaces over Tabs.

They say, spaces make indentation look more consistent across different setups. This is not totally correct. Tabs can be configured to consume any number of columns in the editor. So if you hate high indentation, you can set tab width as 2. But, spaces do have a real advantage and it comes when you are trying to do non-uniform indentation like of function parameters in a function declaration.

int mainFunction(int a, char b, bool c, short d, long e){
               return 0; } 
int mainFunction(int a, char b, bool c, short d, long e){
               return 0; }

The first function in this code uses spaces whereas the next one uses tabs. If you try to see the difference here, you will notice that double f is slightly misaligned in the second function. For me, this is not bothersome and I would gladly accept this over the benefits of tabs. Let’s look into these in detail.

1. Tabs are meant for Indentation

Why were ‘Tabs’ created when we already had spaces? For indentation right, what other could be the reason. Now tabs were introduced for indentation because indenting using space required lots of keystrokes (though it’s not the case with modern editors now). So you might still argue “I would use spaces because my editor automatically takes care of indentations for me”. Well have a look at the next points then.

2. Tab-based indentation is uniform, like spaces

As I already told at the start of this article, tab width can easily be changed in the editor to make indentation look consistent across different setups. As a bonus, tab width can be changed unlike spaces and this allows a developer who hates, say wide indentation to visualize a narrower indentation while coding.

This is the main point why people thought spaces are better. In my opinion, it’s just the opposite. Indentation using tabs is flexible in its own way.


I hope at this point of the article, I have cleared the air around tabs and why people feel that spaces are superior to tabs. At this point, we can say that spaces are pretty much equal to tabs if you don’t consider that indentation example earlier. Now let’s see, why tabs are better than spaces.

PS – It may feel like I am being picky here but hey, tabs = spaces has been established so every pro for Tabs matters.

3. Tabs work better with Notepad

You might be saying, who uses “Notepad”? Well, Notepad here symbolizes the most basic of the text editors. These editors don’t convert a tab press to 4 spaces. Now, there might be a need where you have to quickly edit a code file. If the code has been indented by spaces and you are trying to add a few lines in the code, you will have to use 4 times spaces for each level of indentation.

If the code had been indented through tabs, well .. things could have been much faster and less frustrating.

I know this happens in a very rare case but let’s face it, we all have faced these situations many times in our career.

4. Code size with tabs indentation is lesser

Suppose you are using a 4-space indentation, then the total size of the file added by your indent chars will be 4 times more than using tab indents. Now, in a complex program indents can easily go up to 5 levels. Suppose average indent in a program is 3 levels and average code length (without indents) in a line is 50 chars and total lines is 100, then the file size we have with space indentation is 100 * (50 + 3*4) = 6200. With tab indentation, total file size is 100 * (50 + 3) = 5300. This is a saving of 17%.

Yes, obviously the real numbers for the industry would be different than this. But how much less can it be, 15%, 12%, 10%? Even if we are getting a saving on 10% in the code size, don’t you think it’s beneficial. And this comes at absolutely no cost.

5. Spaces Indentation takes more time to fix

Again, this is a very rare situation but because tabs = spaces has been established after point 2, this adds weight to the tabs category.

Let’s take a situation where you accidentally deleted some spaces (n s.t. n % 4 != 0) in the indentation. To fix this, you will have to add some tab spaces for the indentation blocks (n / 4) + (n % 4) spaces for the extra. This won’t be the case with tabs as you will only have to add the tabs that were deleted.

6. Spaces promote super-ugly & inefficient code style

class MyClass: 
    def myDescriptiveNameMethod(param_a # description for param_a 
                                param_b, # description for param_b
                                param_c): # description for param_c 
        pass

Yes, I have seen code examples like this in the wild. I know that you want to give comments to parameters and that’s why you are putting one parameter at a line but why this high degree of indentation. A better example using tabs would be –

class MyClass:
	def myDescriptiveNameMethod(
		param_a, # description for param_a
		param_b, # description for param_b
		param_c  # description for param_c
	):
		pass

Yes, keeping param_a in a separate line could have been done using spaces as well but the point here is that because people use spaces for indentation, they are following a horrific code style like the first example.


So these are my pro-Tabs reasons. You might think some of them as BS but they are rational and you can’t disagree with that. The only pro-Space argument I see is the very first code example in this article. But for me, that doesn’t win against the stronger reasons we have for using tabs.

I hope this article will get programmers aware of why they should use tabs or spaces, whatever they feel like. I have tried to put together all points I have on tabs v/s spacesand I came to the decision that tabs are clearly better. This might not be the case with everyone. If this article triggered a change in your coding habit, do let me know in the comments. Also if you have a feedback about the article or would like to add to it, just throw in a comment.

That’s all for now. Thanks for taking time reading this blabbering 😀

 

Mozilla Launches “Firefox Focus” For Android, It’ll Protect Your Privacy And Save Data

Ad-blocking is one of the important aspects of privacy protection in people’s lives. Mozilla knew it last year when they launched Firefox Focus for iOS, a mobile web-browser with inbuilt ad-blocker which is enabled by default. Now, Firefox Focus has been released for the Android operating system.

The web browser builds on top of the iOS version and has extra features including Ad Tracker counter (shows the number of ads blocked, Notification reminder (reminds Firefox is still running) and disable tracker blocker (an option to disable ad-blocker).

According to Firefox’s product manager, Barbara Bermes, the new Firefox Focus is faster, and it consumes lesser data while browsing.

Firefox Focus is the still simplest web browser I have ever seen. Deleting the history and cookies as simple as tapping the dustbin present on the screen. And it does what it promises.

Firefox Focus

This is another major announcement from the house of Mozilla after the recent release of Firefox 54 which improves Firefox’s multiprocess abilities up to four content processes. However, E10S-multi is yet to reach all the users. Here is how you can enable it manually.

 

 

I think Mozilla is now definitely ahead of Google who is also baking ad-blocking capabilities into Chrome. However, it would be at far bigger scale than Firefox as it would be rollout across all platforms where Chrome exists.

You can download Firefox Focus from Google Play.

Thanks for reading. Wrote after a long time due to some projects works. Cheers 🙂

Be Mozillian 😀

Mozilla NIEC Activate

The event took place in Auditorium of my own college Northern India Engineering College on 28th January 2017. As I was the organizer of the event so there were lot of work i had to done like taking permission for the event,  publicity of the event in the college and in other colleges too and to set whole setup in Auditorium and some other stuffs too. So on final D-Day i reached the college at 10AM to make arrangement. Attendee start coming from earlier of 12 noon.

From 12.15 pm around we started event.

pb

Sanyam(CuriousLearner)  bhaiya start from introducing people to the FOSS and open source and about the open source contribution benefit. After that he introduced all to Git and  taught peoples how to use Git. This is the session where all the peoples got their hand dirty on their laptops with Terminals. Peoples with Windows OS faced some issues then i helped them with download the Git Bash for Windows.It  was also a great session for me also as i did not know that too much about Git.

start

After that session we took a break of around 20 minutes for some lunch but in that time also Sanyam Bhaiya did not stop also, in that time also Bhaiya told us about his own journey of Mozilla and his projects.That willingness of Bhaiya to share his knowledge inspired me too much for working hard and also for contributing to Mozilla Organization.

After that break we started with A Frame and Web VR.This session was also a practical session in which peoples had to write codes in <A assets> which is same like as of HTML.With the help of A Frame any page can be designed easily in a very good manner.

After that session we gave swags(stickers) of Mozilla to all attendees and took a feedback too from all of them.

swag

So overall for me it was a great event as i learned a lot of things from this event as i was organizer i got to learn that organizing of a event is not such too easy as it seems. And i can not explain in words about Sanyam Bhaiya how such a great human being he is. This was the 3rd meet with him but i got to know more about him from this event.

It is my first blog. Sorry for my bad English.

Thanks for reading. 🙂 Cheers.