Monday, September 26, 2016

How to use Scala along with Spark for a Java Developer

Below are tips and tricks I have learnt about Spark with Scala

  1. How to create dataset of custom objects
    import spark.implicits._ class MyObj(val i: Int) // ... val d = spark.createDataset(Seq(new MyObj(1),new MyObj(2),new MyObj(3)))
    Will give you error, so instead use kyro encoder
    import spark.implicits._ class MyObj(val i: Int) implicit val myObjEncoder = org.apache.spark.sql.Encoders.kryo[MyObj]
    // ...
    val d = spark.createDataset(Seq(new MyObj(1),new MyObj(2),new MyObj(3)))


Monday, September 5, 2016

Health Benefits of Kefir I have seen personally!

Disclaimer: This is not any medical advice or prescription, please consult doctor for any health issues. These are authors personal observations.


  1. Kefir drink is rich in B vitamins, enzymes which are essential for healthy individual.
  2. Kefir drink is very beneficial for dental health  as the root cause of dental decay or any other dental problems are bad bacteria. Regular intake of water Kefir fermented with lemon or ginger improves the dental health a lot and also removes the bad breath from mouth.
  3. Candida infections are cleared. Kefir is instrumental in removing candida infections by drinking regular water Kefir. It removes candida infections in mouth, private parts.
  4. Tendency towards Alcohol is gone. Sugar craving is reduced and improved the responsible living attitude, I mean taking care of personal health.
  5. Brightens the skin by regular application on skin.
  6. Anti depressant, it inhibits the feel good feeling by boosting the serotonin production.
  7. Solves several gut issues ranging from indigestion, acidity, constipation etc.
  8. Diabetic patients need to be careful while using water kefir, as it may contain more sugars if not reduced by doing second fermentation. In my case regular drinking of second fermented drink has brought down my sugar levels to normal range. 

Thursday, August 25, 2016

How to increase the growth of Kefir Grains?

If you want to increase the growth of Kefir grains you can do by adding mineral sources such as Baking Soda (only pinch of it, i.e. 1/16th of spoon) to the fermentation bottle. You can alternate it with organic Jaggery. Both are good sources of minerals; Jaggery contains molasses which is rich in minerals. Also do give just regular white sugar on few days.

While using jaggery make sure it is dissolved in the water otherwise Kefir cannot feed on it. Merchandises are selling the powdered jaggery also.

Kefir Grains need regular minerals as our water sources are mostly filtered and/or RO, so prolonged use of just RO water will deplete the Kefir health and content.

While using above mineral sources if Kefir grains and fermented liquid is turning slimy then it is clear indication that excess minerals are being fed. So you need to give them simple sugar liquid for few days until they become more crystalline. Also reduce the amounts of mineral sources. In case of jagerry you can use 50% jagerry and 50% plain sugar.

Monday, August 22, 2016

Everything you want to know about your Moto G4 Plus

Below are the various tips, tricks and how to's to use Moto G4 Plus efficiently and fully


  1. How to take screenshot on Moto G4 Plus?
    • For taking screenshot, follow the steps given below.
      • Go to the screen on which you want to capture screenshot.
      • Press and hold volume down and power button simultaneously.
      • The screenshot will be taken and saved in the Gallery folder. You can access it from “File Manager” or from the “Photos” app from Google which are preinstalled on your Moto G4 Plus.
  2. You can quick-load the camera with a double-tap of the power button, or a double-twist of your wrist.





References

  1. http://www.tech2touch.com/moto-g4-plus-tips-tricks-faq/
  2. http://www.digitaltrends.com/mobile/moto-g4-tips-and-tricks/
  3. https://recombu.com/mobile/article/moto-g4-plus-camera-review-and-comparison-vs-moto-g4-camera#
  4. http://www.trustedreviews.com/opinions/motorola-moto-g-tips-and-tricks

Tuesday, August 16, 2016

Kefir Articles

Below are list of various articles on water kefir which can help you to know more about water kefir and using it. If you have any questions about kefir or articles please feel free to ask here using comments section. 

 

How to prepare Water Kefir

FAQ on Water Kefir 

How to make Coconut Water Kefir

How to reduce sugar from water kefir (second fermentation!)

How did I made my wonderful Kefir Ginger Lemon drink

 

 

 

 

 


How to reduce sugar from water kefir (second fermentation!)

Water kefir is a wonderful probiotic drink, I have myself saw improvements in digestion and regular bowel moments. I have seen uplift in my confidence levels and seeing depression being faded away in just one week of regular drinking (3 spoons) of kefir once in bed time.

If you are diabetic or concerned about higher sugar content in the Kefir drink, I have seen second fermentation as best solution. My best choice is Ginger based second fermentation.

Procedure

  1. Take a piece of Ginger, peel its skin and cut into 4 equal cubes. 
  2. Drain the first fermentation liquid into glass jar and preserve the kefir grains into another fresh sugar water jar.
  3. Add the prepared ginger cubes to this drained water kefir and close the jar lid tightly
  4. Let it ferment for 24 hours and after that store it in fridge and use it for up to a week.
  5. You can have around 30 ml of this drink along with glassful of water in the early morning and before bed in the night. 

More on Kefir here

Monday, August 8, 2016

How did I made my wonderful Kefir Ginger Lemon drink

What do you need
  1. A cup of fermented water kefir
  2. Take a 15 grams of ginger and peal the outer layer and cut into slices
  3. Take one lemon


How to prepare

  1. In glass bottle with kefir water mix ginger slices and squeeze cut lemon juice.
  2. Tightly close the bottle and keep it in dark place, for every 6 to 10 hours burp the bottle by carefully opening the lid so that carbonation can be removed and then tightly close the lid.
  3. This is called second fermentation of water kefir, keep this until you see enough bubbles in the bottle and not more than 24 hours to 36 hours.
  4. Once ready you can mix sugar and some cold water and enjoy the drink. If you are first time drinker just start with one or two spoons drink and gradually increase it.
  5. The drink should not have any strong odor or color.

More on Kefir here

Friday, August 5, 2016

How to make Coconut Water Kefir

Image result for coconut waterBefore using the Kefir grains for making coconut water Kefir make sure to prepare few batches of sugar water kefir so that Kefir grains are well hydrated and nourished. 

Preparation is as same as making Water Kefir drink.
1. Take 1 tender coconut water and 1 spoon of Kefir grains.
2. Use coconut water instead of sugar water and add the Kefir grains in to the bottle.
3. Depending on the temperature let it ferment for 10 to 12 hours.
4. Drain the fermented coconut water into a bottle and separate the grains, put the grains in to sugar water for next batch.
5. This bottled water you can refrigerate and drink for 1 day.

Rotate grains with sugar water and coconut water on alternate days as grains can't absorb sugars well from coconut water.

More on Kefir here

Tuesday, July 19, 2016

How to prepare Water Kefir


Kefir is a very good probiotic and is rich in enzymes, Vitamin B. Unlike yougurt its benefits last for more than one day.

Prerequisites

  1. A glass bottle (size of fruit jam bottle) preferable with plastic lid.
  2. Filter similar to tea filter, but of plastic.
  3. Plastic or wooden spoon. Never bring Kefir grains or Kefir liquid in direct contact with metal utinsils.
  4. Good quality white sugar (preferably with no preservatives)
  5. Either good quality brown sugar, Jaggery, organic molasses
  6. Baking Soda. It is not baking powder. It is also called Eating Soda in India.
  7. A lemon

Preparation

Once you obtain the grains, place them in a glass jar with two tablespoons
of sugar. Add water until it is about 2-3 inches above the grains and store in
the fridge overnight. There is a lot of flexibility with how you prepare water
kefir, but the basic steps are as follows.

Step 1

Fill a glass jar with water, leaving a couple inches of headspace at the top.
For every 2-3 cups of water add a tablespoon of grains and a tablespoon or
two of sugar. You can use white sugar, brown sugar, molasses, etc.

Step 2

Stir with a wooden spoon until sugar is dissolved. If you want to add fruit at
this point, go ahead. You can also squeeze some lemon juice in.

Step 3

Cover the jar with a paper towel, or light cloth, so the mixture can breathe,
and store in a cool, dark place, like a cupboard for 7-12 hours depending on
room temperature and how strong you want it. On a hot summer day it
may be ready in as little as 7-8 hours.


How to consume it

After fermenting the Kefir grains with suagr and water solution for about 7-12 hours you can filter the liquid from grains. This liquid you can directly drink or can make non hot beverages such as lemonade by mixing lemon juice or some other fruit juice. You can store this liquid in fridge for 24 hours or a bit more.

When you are taking this drink for first time, start with less quantity like 1 or 2 spoons and then gradually increase in take.

While preparing for first time using starter culture, do not consume the finished liquid for first 3 to 4 days. Simply throw it and start next fermentation cycle by adding fresh sugar and water to the grains.


Precautions and Troubleshooting

  1. Never expose Kefir grains or fermented solutions to heat, it will kill the Kefir.
  2. During fermentation never keep the bottle directly exposed to sun light. 
  3. During or after fermentation if Kefir liquid or grains color changes to blue or green then there could have been contamination during preparation so you need to discard whole batch i.e. liquid along with grains.
  4. If you see any molds in the bottle then you have to discard whole batch.


Tips

  1. Even after 10-12 hours of fermentation if your water kefir still tastes sugary then you can let it ferment for few more hours based on your local temperature. Kefir ferments slowly in cool temperature; moreover it should not be exposed to very hot temperatures also like summers, may be in such cases you can keep it in AC room.

FAQ

Second Fermentation & Flavoring

Tuesday, July 12, 2016

FAQ on Water Kefir

1. What is the temperature to ferment the water kefir?

Answer: 25 Centigrade

2. With how many spoons of Kefir grains to start the first fermentation?
3. How many cups of water to be mixed with first Kefir fermentation batch?
4. How many spoons of sugar has to be added to first Kefir fermentation batch?

Answer: Two table spoons of Kefir grains to be mixed with 2 cups of water and 2 to 3 spoons of sugar. Need to dissolve entire sugar in to water using wooden spoon as metal kills the Kefir grains. 

5. How long to ferment
Answer: 10-12 hours
While starting with starter kit, for first 3-4 days give them fresh water and sugar for every 10-12 hours, so for every 10-12 hours drain the old liquid and add fresh water and sugar.

6. How long I can use the fermented Kefir drink?
Answer: 
Once the drink is ready, if you leave it for too long, it will become too pungent;
as soon as you find the taste to be palatable, consume it within 24 hours or less.

7. Once fermented Kefir liquid is ready, what to do with fresh grains after draining the Kefir liquid.

Answer: 
You can either freeze the extra grains without water and sugar
or
You can keep them in fridge in sugar, water solution and keep changing it every 5 to 6 days.

8. What type of water has to be used

Answer: Non chlorinated water has to be used

9. Should I have to ferment Kefir right after receiving the starter kit grains?

Answer: Yes, so that Kefir grains will adjust to the new environment.

10. Can I take few weeks break?
Answer
Yes, simply put the Kefir grains in white sugar and water solution and close the bottle lid tightly and keep it in fridge. You can leave it for up to 3 weeks.

11. How to restart after break?

12. When I can have the Kefir drink?
Answer: Any time of the day 

More on Kefir here

13. How to ferment Kefir in summer season
Answer: Refer this article 

Friday, June 17, 2016

Software trends - what to expect in near future!

Twenty years back there was nothing like blogging, online News, online Search; at the most there were few computer games, few programs useful to common people such as word processor, spreadsheet etc.

As predictive analytics is strengthening in its accuracy and efficiency, mostly people should be consuming curated content based on their likes, preferences and demands. And this kind of services will become common.

Let us take generic search application, you want list of govt jobs whose prerequisite is experienced individuals even from private industry. This kind of search is currently not easily available. You have to look for web sites providing this data from the lot many of search results you got based on keyword search.

Similarly News or article suggestion engine which gets you feed based on your interests and preferences. There are few websites which already does this but there is no one stop solution which does all of this. Similarly food, restaurent, travel etc recommendations. 

It's basically like your assistant, that gets you done things you would be liking, it may be called avatar-bot which automates several steps to make it one step for you. At present this kind of technology is not there and above mentioned requirements fulfillment may involve several steps but once this kind of innovation is brought in then it will be like Jini sitting in a click!

Friday, May 6, 2016

Notes on Docker

In a Docker installation on Linux, your machine is both the localhost and the Docker host. In networking, localhost means your computer. The Docker host is the machine on which the containers run.

Container runs the selected OS image.


Quick Start:


  1. Download and Install Docker toolbox
  2. Make sure Virtual box is installed, it is included in Docker Toolbox
  3. For troubleshooting: http://stackoverflow.com/questions/33725779/failed-to-open-create-the-internal-network-vagrant-on-windows10
  4. Follow below steps to Create a new Docker VM


set PATH=%PATH%;"C:\Program Files\Git\bin"


docker-machine create --driver virtualbox my-default


Setting Proxy on Windows

Method-1

In Docker Toolbox install folder identify start.sh file and include following lines

#export HTTP_PROXY=http://example.com:80

#export HTTPS_PROXY=https://example.com:80
Close and open Docker Quickstart Terminal.

Method-2

  1. Connect to Docker machine
  2. Connect 
    • docker-machine ssh default
  3. sudo vi /var/lib/boot2docker/profile
    • HTTP_PROXY=http://example.com:80
    • HTTPS_PROXY=https://example.com:80
  4. Restart the docker-machine

Starting Kitematic using proxy


for /f %%i in ('docker-machine.exe ip default') do set DOCKER_HOST=%%i

SET NO_PROXY=%DOCKER_HOST%

set DOCKER_HOST=tcp://%DOCKER_HOST%:2376
cd Kitematic
Kitematic.exe

Saving and Loading images to and from file system

Saving sample:
docker export - saves a container's running or paused instance to a file

docker save - saves a non-running container image to a file
docker save -o <save image tar file> <image name>

Loading sample:
docker load -i <path to image tar file>

Docker Commit (Save Changes Locally):
sudo docker commit container_id image_name : commit changes made to a local docker container to save any changes made locally.

Thursday, May 5, 2016

Smart Accelerator

This idea is about automobiles with wrong accelerator press detection and collision prevention technology.

This leverages radar sensor's on the vehicle which provides the distance between your vehicle and vehicle's in front of you. Based on your current speed if you mistakenly pressed accelerator instead of break then based on above described acquired details it is trivial for the system to identify whether it is a wrong accelerator press. If it is a wrong press then it will be curtailed from being applied really on the vehicle and prevents a dangerous accident. 

Sky Eye - Eye in the Sky

Source: www.freedesignfile.com
Here I am talking about new technology idea which helps police and other security personal in chasing and pursuing the suspects who are trying to escape in fast moving vehicles.

Let us take a scenario where in a police officer is trying to chase and catch fast moving car which jumped the traffic checkpoint without going through the check. Let us assume there is lot of traffic on the road and police car is unable to overtake the offender car and is gradually losing it.

Now this police officer can switch on the sky eye and mark the fast moving car, from here on the sky eye also starts tracking the offender with much more speed than the offenders speed and relay the movements, coordinates and video to the pursuing police officer. 

Sky eye is an expert system running on police force's servers, it heavily leverages advanced GPS capabilities to track the vehicle direction, speed and vehicle identification marks such as color, make, model, registration number etc. It uses machine learning techniques to remember the pursuing vehicle and differentiate it from other surrounding vehicles and identify it. GPS would be feeding the video of the circular area for the given coordinates & radius provided by and to the Sky Eye. Sky Eye would estimate the next possible circular area where the vehicle would be present in the next time period based on the last scanned speed of vehicle, this coordinates are given to GPS to get the video and vehicle is identified from the video and this process continues until vehicle stops. All these identified vehicle trace coordinates and video's are relayed to ground force in real time for pursue.

This automated system could be used in unmanned check posts to track the offending vehicle and report to the nearest police station with all the trace details.

Thursday, February 11, 2016

Database 101 FAQ


  1. To get Oracle DB size in GB's:

    select sum(bytes/1024/1024/1024) from dba_data_files;
  2. Pagination in Oracle

    select * from ( select rownum rnum, a.* from (YOUR_QUERY) a where rownum <= :M ) where rnum >= :N;
  3. continued

Wednesday, February 10, 2016

Daily Life Hacks - 1

Scenario: If you are a trainer and had to be given training on a subject which is new to you or you don't have much experience. But you don't want to expose your proficiency on the subject to your audience.

Problem: In the subject there are few areas which you are not sure of or there are not clear to you.

Solution: If you are very confident on other areas of the subject and confidently accepting the unknown topics is good thing to do. But if you think this list is increasing :) then you can try below explained technique.

Order your lecture in a structured way so that you would be dealing with a single topic at time. In a particular topic when you come across with not so sure or confident areas then you can say that we will come back to this later when we deal with this. This way you escape the revelation and avoid those areas/concepts.

Thursday, January 7, 2016

Object Oriented Java Script

Below is the best sample for declaring makeCounter class and creating two objects counter1 and counter2 of the same.

Here this class returns three closure functions increment, decrement and value which share a common environment consisting of one private variable privateCounter and private method changeBy.

var makeCounter = function() {
  var privateCounter = 0;
  function changeBy(val) {
    privateCounter += val;
  }
  return {
    increment: function() {
      changeBy(1);
    },
    decrement: function() {
      changeBy(-1);
    },
    value: function() {
      return privateCounter;
    }
  }  
};

var counter1 = makeCounter();
var counter2 = makeCounter();
alert(counter1.value()); /* Alerts 0 */
counter1.increment();
counter1.increment();
alert(counter1.value()); /* Alerts 2 */
counter1.decrement();
alert(counter1.value()); /* Alerts 1 */

alert(counter2.value()); /* Alerts 0 */


Closure

It is an inner function that has access to the variables/ of outer function.

Closures can be used to allow public functions to access private methods and variables.

* Took notes from http://developer.mozilla.org