Posts

Java 8 Streams and Collectors - Magical GroupBy features like SQL

Hi All, Sorry, I was away for a long period of time. But, I learned something yesterday and couldn't resist myself from sharing it here. You may already be aware about it, but I am lagging behind and still using Java 7 on my projects.... In past, I have always ended up using SQL to perform any GroupBy or other complex transformations because - firstly, they are easy to write and secondly, they are efficient. But, I learnt this new java feature which is introduced in Java 8 and I was so amazed. My task was to group by 2 fields(country and credit_rating) in a collection and then calculate the average of third field (amount). If country is unavailable for any record, then I had to use city field instead. [Note: There were other conditions, but let's keep this example simple here] companyList .stream().collect(  Collectors. groupingBy (  p  -> ( p .getCountry() ==  null )?  p .getCity() :  p .getCountry(),  Collectors. groupingBy ( p  -...

Workplace Friendship: Exercise Caution

There is no doubt – if you have good friends at workplace, you’re most likely to enjoy the time spent at work. There is someone to sit with at lunch, someone to discuss the gossips ;-) someone to accompany while going for break and someone to empathize over challenges you faced. For last 6 -7 months, this debatable subject was going through back of my mind as I had seen both good and adverse effects – I was thinking about its pros and cons and whether it’s advisable or not etc. A person may act according to one’s own traits – for example, I am a person who makes very limited friends not only at work but in personal life as well. But, Do I need to improve and make more friends? What is actually required at workplace? Now that I am going to be part of management (officially), what does management in industry feel about the subject being discussed? I discussed with some of my close colleagues working in different companies about their opinions. What I found was – it is really comp...

Hey! Please don't call me Sir

Image
It has been a long time, since I posted my last blog. Nevertheless, it’s better to be late than never Today, I am picking a simple but debatable question – “ Is using the terms “Sir” and “Ma’am” appropriate, outdated or condescending?” Remembering my Sainik School days, we used these terms (also referred as salutation) for my teachers and seniors (even if they are just one class senior to me). Even now, I use it while communicating with them. For sure, the purpose of using such salutations is to show respect for others and we are taught to use them since our childhood. This is inherent in our Indian culture. Having said that, there is another aspect to it as well. Nowadays, in most of MNCs (I am talking about corporate culture) in and outside India, it is always preferred to call any junior or senior colleague by first name. The terms like Sir and Ma’am are not encouraged. It symbolizes that “everyone is equal” – if you look from this perspective, isn’t it a great though...

Traps in Decision Making

Decision making is an important activity, not only for executives but for everyone in the world. In our day to day life, we make lot of decisions. Starting from choosing between chocolate and strawberry to life and death, we make tons of quick decisions unconsciously. Some of these decisions may not be so important but some can be really vital and may result in disaster. We choose actions from opinions via mental processes which are influenced by biases, reason, emotions and memories.  While pursuing AMDA Silver certification, I came across a white paper on Decision Making which explained lot of interesting hidden traps that a decision maker may ignore while decision making. In this blog, I would like to share some of those common traps which we should avoid while making a decision. Anchoring Trap : When considering a decision, mind gives disproportionate weight to the first information it receives. You can try it!! If I ask you two questions: a)  ...

Search Engines - Making our web page visible at top

Hi Everyone!!   Yesterday, I was having a discussion with one of my colleague on how to empower your web page to make it visible on the first page when searched from a search engine like Google. Just putting across my understanding on the same based on learning from several sources–   Search engine has always fascinated me in the way it searches across millions of pages, filter them and gives us the pages which we want. There is definitely a smart algorithm that does the background work.   Crawler-based search engines – This type of search engines use a process called Web crawling / spidering.   Such search engines (e.g. Google) create their listings automatically. They crawl (in literal terms) the web and then people search through what they have found. If we change our web pages, such search engines eventually detect the changes and that can affect how the web pages are listed. Details on web crawling could be found at http://en.wikipedia.org/wiki/Web_cr...

What is a LEADER?

  I believe all of us have a “leader” within ourselves. It’s just a matter of knowing and improving on those leadership traits. If you know how to lead yourself, you can lead others as well. During last session with my team, I raised the topic about leader and leadership qualities. We had a good discussion on that. However, I couldn’t go into more details around it, due to lack of time. So, thought to share my views here.   Since my childhood, I have been learning and studying a lot on this topic. I grew up seeing the red flag with a tiger in the centre – the flag of Forward Bloc party founded by Netaji Subhash Chandra Bose. He inspires me a lot. My close friends think that there is a rebel within me too. But, let’s not discuss that now J . Fortunately, I did my schooling from Sainik School, which also provided me an environment where one has to come across this subject everyday.   Well, talking about the leaders, everyone has someone as their favourite leader. If we clos...

Attractive Reports from SQLPLUS

Image
Hi Everyone, On last Friday, I finished working on automating the generation and mailing of a report. Got to learn few interesting way of generating reports directly from SQLPLUS without any extra effort and would like to share that with you. SPOOL ON/OFF is a common functionality in SQLPLUS to write the output of query into a file. Following lines will send the output to C:\test.txt file. SQL> SPOOL C:\test.txt SQL> select * from employee; ---- assuming that employee is an existing table. SQL> SPOOL OFF Now, we might be interested in creating output report in excel format. Simplest way will be: SQL> SET COLSEP ‘,’ SQL> SPOOL C:\test.csv    --- filename with “.csv” as extension SQL> select * from employee; ---- assuming that employee is an existing table. SQL> SPOOL OFF Open test.csv in excel and you are there. But, what if we need output in HTML format????? ………………Well, there is a way to do this as well in SQLPLUS. See below: SQL > SET MARKUP HT...