MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

Lessons learnt from camping in the midst of a flood

Posted by Venkatt Guhesan on August 8, 2016

This past weekend when Ellicott City was hit with the worst storm in over hundred years, we ended up camping out in Rocky Gap State Park. Last year when we were out camping it rained a little and I had no tarp below my tent. So as soon as I got home last season, I ordered a tarp and had it ready this time. But some lessons are learned the hard way.

Lesson Learned: Make sure your tarp’s edges are well within the tent’s boundary.

In my case, my tarp was oversized and I had an extra two to three feet all around my tent. And with the worst storm in a while, the border that sticks out collects all the water and the tent in the middle becomes a sponge. Soon enough, we had moisture build up in the tent that we can see a puddle building up inside the tent. I guess you live and learn these lessons.

Here are some of the pictures from the camp:

20160731_082523

20160730_092210

Click here for more Photos from camping at Rocky Gap State Park – 2016

Cheers

Posted in General, Outdoors & Nature | Tagged: , , , | Leave a Comment »

Horrific floods in Ellicott City – Maryland and walk-up walk-down basement drain problem

Posted by Venkatt Guhesan on August 7, 2016

This past week, Ellicott City, Maryland had one of the worst floods in a long time. You can see some of the devastation that it has caused in this link. Fortunately, only my basement had a little bit of flooding. But interestingly, this has been the second flooding in over a month. This made me question the drain at the bottom of the walk-down/walk-up basement.

Here is a picture of the drain at the bottom of the stairwell.

20160731_191444As you can see the drain hole not the best and it gets blocked with just a few leaves and dirt. I have been clearing the dirt and leaves regularly but when there is a storm, the water floods down from the adjacent wall bringing with it debris which end up clogging the drain hole.

As a first fix, I tried this from HomeDepot. It’s called a drain trap. (shown below)

trap1Again this was good but it did not solve the problem. So I decided to try something different. I needed a frame that was at least 1-in tall giving the dirt a place to settle around it and not flow into the cavity. I also need it to be sturdy where the weight of the frame keeps the mesh/trap down to the ground even in moderate to severe thunderstorms. I searched online for a solution and after spending quite a bit of time searching through blogs, I decided to build one myself.

So here is the finished product:

20160807_164830

Here are the materials I used to build this:

  • Chicken-coup mesh grill
  • four L-brackets
  • two tree stump posts cut to the size of the chicken-coup (to create a 1in thick frame)
  • Long plastic corner bead to keep the grill corners from cutting into me with rust over time
  • outdoor screen plastic to to add a second layer of filtering
  • Staple gun
  • Silicone used for household seals

20160731_190519

Here is the frame upside down. It’s basically the wood is framed in against the chicken coop metal grill.

20160731_190524Corners are bracketed in to keep the frame together.

Added the finer outdoor plastic screen-door screen on top and kept them together with the staple gun. And the last step is to create a seal between the pavement floor and the frame.

20160807_164836

And voila a gutter guard (that can hopefully withstand some rain). Keeping my fingers crossed.

20160807_164830

I will keep this blog post updated as I improvise on my custom made gutter guard. Hopefully others can follow this blueprint and build their own gutter-guards.

Cheers.

Posted in General, Great Ideas, Outdoors & Nature | Tagged: , , , , , | Leave a Comment »

Families Can Now Share All Their Google Play Purchases

Posted by Venkatt Guhesan on July 27, 2016

http://fortune.com/2016/07/27/google-play-family-library/

Posted in Uncategorized | Leave a Comment »

Two useful links comparing CentOS 6.X’s – SysV-Init vs CentOS 7.X – SystemD – init systems

Posted by Venkatt Guhesan on July 19, 2016

In CentOS 6.8, the init system that brings up all the services (link autoexec files in Windows) was called SysV- Init. This has been the foundation for ages as long I’ve been using CentOS. But in the latest release of CentOS (CentOS 7+) the init engine has been moved to a more favorable engine labeled SystemD. SystemD is the init engine behind Ubuntu, Fedora, Red Hat and CentOS. So the standardization is good for the Linux community but moving from CentOS 6.8 to CentOS 7 is not a trivial task (especially when it comes to RPMs that working on the SysV-Init paradigm).

Here are two links that outlines the differences:

Cheers!

 

 

Posted in CentOS 6.X, CentOS7, Linux | Tagged: , , , , , , | Leave a Comment »

Tiny storage device writes information atom-by-atom

Posted by Venkatt Guhesan on July 18, 2016

Memory that writes atom-by-atom. 

Approx. 500TB per square inch. 

Entire library of Congress archives can be stored in .1mm square inches. 

Write speed measured in minutes. Not yet ready for prime time but promising future. 

http://www.bbc.co.uk/news/science-environment-36824902

Posted in Uncategorized | Leave a Comment »

WaitUntilPortOpens() – How to wait until process A runs and binds to a port before spawning process B?

Posted by Venkatt Guhesan on July 8, 2016

Sometimes we have situations where you need to wait until one application is loaded that may bind to a certain port before kicking off a second application that may depend on that port. This process is typically described as “Wait-Until-Port-Opens” (or it could be the reverse – where you want to wait until a port closes).

Here are some use-cases for this method or script:

  • You have a Java web application (Jetty, Tomcat, WildFly, etc) that listens on port 8080 and you want your Nginx or Apache HTTPd server to start as a proxy-server once that back-end web server is bound to port 8080.
  • You want to spin off your Kong (microserver management) after, your back-end REST server is up and listening on port 123.
  • Or the reverse, where you want to kick off an email alert-notification, if you are unable to bind to a certain port where your web server runs and it has now crashed.

On a Linux system, this can be accomplished in many ways. Tools like netcat (nc), netstat, telnet makes this very simple. You can write a bash script that accomplishes this easy. But not all footprints may have those libraries installed. For example, if you’re switching from CentOS 6.8 to CentOS 7. A lot of the network tools are no longer available or their binaries are not yet ready for prime-time on the new SystemD footprint in CentOS 7. Netcat is one of those tools not yet ready in the CentOS 7. So you will need a common independent way to scan for the port.

First, let’s look at how this can be done using the above tools:

# Depends on netcat (nc)
# Run netcat and try binding to port 8080 on localhost. 
# If not sleep for five-seconds and repeat until it's available
while ! echo exit | nc localhost 8080; do sleep 5; done

# Variation of the above that depends on netstat utility
while netstat -lnt | awk '$4 ~ /:8080$/ {exit 1}'; do sleep 5; done

# If you know the process-id of your service, then you
PID=1234
while ! lsof -n -Fn -p $PID | grep -q '^n.*:8080$'; do sleep 5; done

# Variation that depends on netchat (nc)
# If the port is open, then do nothing but if the port goes down then react
while ! nc -q 1 localhost 8080 </dev/null; do sleep 5; done

As you can see all the above examples depend on other network tools to be installed on the Linux footprint. This design is good, if you have complete control of the OS and dependent RPMs and libraries that are installed.

If on the other case, if you do not have any of the above libraries such as netcat (nc), netstat, lsof then here is a Linux method to doing the same:

# Most (99.999%) Linux systems have "timeout" and "sleep" commands available so the below 
while ! timeout 1 bash -c "echo > /dev/tcp/localhost/8080"; do sleep 5; done;
# Do something here such as spawning a new service

So how does the above code work? Through the use of “Bash TCP Sockets”. You can learn more about then in the references below:

Tech Tip: TCP/IP Access Using bash

More on Using Bash’s Built-in /dev/tcp File (TCP/IP)

Cheers!

Today’s Inspirational Quote:

Doing what you love is the cornerstone of having abundance in your life.
Wayne Dyer (American philosopher, self-help author, and a motivational speaker)

-AUM

Posted in Bash, CentOS7, Linux | Tagged: , , | Leave a Comment »

bash script to generate config or property file from a template file containing variables

Posted by Venkatt Guhesan on June 23, 2016

Sometimes we have configuration or properties file (as templates) such as httpd.conf or server.conf where we want to dynamically replace $variables with values before writing the output to a new file.

Example:

# httpd.conf.tmpl
<Location $STATUS_URI>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from $MONITOR_IP
</Location>

We want to develop an install script in Bash such that it reads the httpd.conf.tmpl and replaces the $STATUS_URI and $MONITOR_IP with appropriate values (either passed in as script arguments or coded in the bash script) and then write out the resulting output to a new file such as /tmp/httpd.conf

Here is such as script:

#!/usr/bin/env bash

# Define the variables with values you want replaced
STATUS_URI="foobar"
MONITOR_IP="192.168.1.1"
# This could also be read in via bash arguments. 
# Google "bash getopts" for more information

# render a template configuration file
# expand variables + preserve formatting
# user="Venkatt"
# referenced inside the template.txt as $user
# render_template /path/to/template.txt > path/to/configuration_file
function render_template() {
  eval "echo \"$(cat $1)\""
}

function generate_httpd_conf {
  echo "#### Creating /tmp/httpd.conf from template ./httpd.conf.tmpl"
  render_template httpd.conf.tmpl > /tmp/httpd.conf
}

Generated output:

<Location foobar>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 192.168.1.1
</Location>

This can be a useful method to generate .conf .prop (configuration or properties) files.

Cheers.

And now for today’s inspirational quote:

Let us sacrifice our today so that our children can have a better tomorrow.
Abdul Kalam
– 11th President of India from 2002 to 2007
– Chief ‘Rocket’ Scientist born from a poor family with humble beginnings.
– Lived as a “Man of simplicity”

Posted in Bash, Linux | Tagged: , , , , , | Leave a Comment »

Bizarre fourth state of water discovered

Posted by Venkatt Guhesan on June 18, 2016

Bizarre fourth state of water discovered

Scientists at the Oak Ridge National Lab (ORNL) have discovered that when (water) put under extreme pressure in small spaces, the life-giving liquid can exhibit a strange fourth state known as “tunneling”.

Quantum tunneling means that a particle, or in this case a molecule, can overcome a barrier and be on both sides of it at once – or anywhere in between. Think of rolling a ball down one side of a hill and up another. The second hill is the barrier and the ball would only have enough energy to climb it to the height from which it was originally dropped. If the second hill was taller, the ball wouldn’t be able to roll over it. That’s classical physics. Quantum physics and the concept of tunneling means the ball could jump to the other side of the hill with ease or even be found inside the hill – or on both sides of the hill at once.

  • Gizmag.com

 

Learn more at:

http://www.gizmag.com/fourth-state-of-water/42999/?li_source=LI&li_medium=default-widget

Example of a Beryllium crystal’s hexagonal (six-sided) crystal-structure arrangement:

311px-hexagonal_close_packed-svg

What does this all mean to us?

  1. Microscopically, the universe continues to marvel us with it’s mysteries. If something as simple as water, can display new remarkable properties and states of matter, imaging the permutations and mysteries still locked up when you look at the periodic table of elements as a whole and all the combinations of molecules that exist in nature and some created artificially.
  2. Macroscopically, when you look up on a dark starry night, and you see galaxies upon galaxies and now scientists are debating over multi-verse theories, string theories and branes.  We definitely have a universe full of mysteries to solve.

So we should be fortunate and happy to know that we are living in the best of times where society has evolved beyond our petty differences in beliefs and faith. And we are able to look at each moment in wonder as the universe unveils it’s mysteries like a grand operatic in front of us. And one day, our great-great grandchildren and descendants will  look back at the stepping stones we laid for them in this unraveling.

And since this is around Father’s day, I’m reminded of a proverb in the classical Tamil literature (Book of Proverbs) – Thirukkural  written around 2nd or 3rd BCE, on the topic of “Father” that reflects my sentiment here:

தந்தை மகற்காற்று நன்றி அவையத்து
முந்தி இருப்பச் செயல்.

The benefit which a father should confer on his child is to give him/her precedence in the assembly of the learned.

Thirukkural

Wishing everyone a Happy Fathers Day – 2016!

Cheers!

 

Posted in General, Outdoors & Nature, Science and Technology | Tagged: , , , , | Leave a Comment »

Article: The spherical genius of the Hüttlin Kugelmotor

Posted by Venkatt Guhesan on June 18, 2016

The spherical genius of the Hüttlin Kugelmotor

Electrical motors are an energy-efficient method for driving vehicles but battery technology is simply not going to advance quickly enough for all-electric vehicles to be a practical reality for most uses anytime soon. The near and mid-term future is undoubtedly a combination of compact combustion engine generators charging dense battery packs that drive electric motors – the “range extender” option.

After nearly twenty years of development another “range extender” candidate is going through final testing and it is a work of elegant genius – Dr. Herbert Hüttlin’s Kugelmotor.

– From GizMag.com

kugelmotor-0Learn more here:

http://www.gizmag.com/huttlin-kugelmotor/19923/?li_source=LI&li_medium=default-widget

Posted in General, Science and Technology | Tagged: , , | Leave a Comment »

Appeals Court Hands Obama Administration Major Win In Net Neutrality Case

Posted by Venkatt Guhesan on June 14, 2016

Appeals Court Hands Obama Administration Major Win In Net Neutrality Case

The Obama administration’s rules prevent internet service providers from charging content producers for faster or more reliable service, a practice known as “paid prioritization.” The rules also ban blocking and purposefully slowing the traffic of lawful services, and apply to both mobile and fixed broadband service.

Today’s ruling is a victory for consumers and innovators who deserve unfettered access to the entire web, and it ensures the internet remains a platform for unparalleled innovation, free expression and economic growth

Read more at the link below:

http://www.huffingtonpost.com/entry/court-obama-net-neutrality-rules_us_571a29dce4b0d4d3f722fc46

Posted in In the News, Science and Technology | Tagged: , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 163 other followers