Tuesday, November 24, 2015

Java 8 Streams



It was the time when Java 8™ released by Oracle® with many cool new features, and among them the one was Streams.

Well, time went well and I learnt new technology by means of exploring source code, Java docs and some books and blogs. That was a fantastic learning experience.

Learnt! Now what?

This is now time to present it to some people by making some slides. And what could be the best place than your own company!

Well I presented the session. It went well, many people seemed excited to learn it and the response was overwhelming!

I'm sharing here the response I got from 14 of those 50 people. It could have been better if more people provided their input, but its okay.


  1. How would you rate the content quality of the session?
    • Content was below average. 0
    • Content was pretty average. 3
    • Content was good and did justice to the topic. 8
    • Content was simply superb. I can refer to it anytime. 3
  2. How would you rate the session based on the value addition to your knowledge?
    • The session was rather confusing than enhancing knowledge. 0
    • There was nothing new to learn. 0
    • There were few new things that I learnt from this session. 7
    • I feel I learnt a lot of new things during the session. 7
  3. Do you feel motivated enough to revisit the topic again on your own?
    • No, I am rather confused to look at this again. 0
    • May be some time, when I feel I can't do without this. 3
    • Yes, I would like to explore it. 8
    • Of course, I feel an itch to explore it at the earliest. 3
  4. Given the time that the presenter had, was he able to give enough time to all the topics that were covered?
    • Did not justify the time given. 0
    • Could have been better. 5
    • It was well planned. 5
    • It was intricately well planned, managed and executed. 4
  5. Was the presenter able to interact well and involve the audience in the session?
    • He/She was more interested in presenting the things rather than involving the audience. 0
    • Presenter tried to involve the audience but it was not just good enough. 1
    • The presenter was able to interact with only some people. 4
    • The presenter was able to interact with almost everyone and kept the interest alive. 9
  6. How do you feel after attending this session?
    • I think I've wasted my time and deeply regret coming to this session. 0
    • I felt like it was just another day. 1
    • The session was good and I'm happy that I attended it. 8
    • The session was amazing and I feel I would have missed something exciting if I had not attended it. 5
     

Well, it was not even that bad, but the designated session length was 45 minutes and I took 1:30 minutes. May be I was over excited myself. That was seriously long enough. That's why I got following feedback also:

Keep up the good work. Though it went little longer than expected. Please plan session for max 45 mins. Some of the slides could have been skipped and taken care verbally.
Session was good.

Hmmm. I guess it was good, but let the people decide. :-)


You can find the slides at: http://www.slideshare.net/manvendrask/java-8-streams-43360981

Books I followed are as follows:
  1. Apress Beginning Java 8 Language Features found at http://www.apress.com/9781430266587
  2. O'Reilly Java 8 Lambdas found at http://shop.oreilly.com/product/0636920030713.do

Hope you find the prsentation and books useful.

Oh, forgot one detail. Currently I'm working at http://www.tothenew.com.

Take care, till next time. :-)

Thursday, March 6, 2014

Syntax Highlighting In Linux Terminal

Hi friends,

Today I am going to show how you can highlight your source code file while you are outputting it inside the Linux terminal. As all of us know what the cat command does. It simply concatenates two or more files, and moreover if just provided one file than it simply renders file's content in terminal.

But wait, what if we can use it to show file's contents as syntax highlighted, much like Vim does. But unfortunately it doesn't.

But there is always a way.

I will tell about a python program called Pygments and how to use it. To install you must have python installed on your machine along with Pip. Pip is a program to download, configure and install python programs on your computer.

To install Pip you can use following command if you are on Fedora:
sudo yum install python-pip
And if you are on Debian like systems you can use:
sudo apt-get install python-pip 
Now having Pip installed let us install Pygments program:
sudo pip install Pygments
This command will install new program in your /usr/bin/ directory called pygmentize.

One of the options pygmentize command has in its sleeves is -g. This option tells command to use appropriate lexer for syntax highlighting by checking files content. For example, if you had provided it a C source file by executing following command:
pygmentize -g pointers_arithmetic.c 
 The program will output file's content using C lexer for syntax highlighting.

That is all we had to do to get syntax highlighting right inside the Linux terminal.

Moreover, we can make a alias in our .bashrc file like this so that we don't have to remember whole command:
alias ccat="pygmentize -g"
Now we can render file's content like this:
ccat pointers_arithmetic.c


That's it all about syntax highlighting inside the Linux terminal.

Cheers.