Tuesday, January 5, 2016

Reinstalling the JDK Is One Way to Fix: java.io.IOException: Invalid keystore format

Prior to installing the latest JDK, when I executed the following command in Terminal.app:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

It resulted in:

keytool error: java.io.IOException: Invalid keystore format
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:650)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
at java.security.KeyStore.load(KeyStore.java:1445)
at sun.security.tools.keytool.Main.doCommands(Main.java:792)
at sun.security.tools.keytool.Main.run(Main.java:340)
at sun.security.tools.keytool.Main.main(Main.java:333)

To fix, I (re)installed the latest Oracle JDK and restarted Terminal. After that, when I execute the following command:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

I get:

Enter keystore password:  

indicating that the keytool on path can access the keystore.

Note: I also posted this in StackOverflow.

Stories from Businesses that Switched from Ruby

A few stories from businesses that abandoned Ruby:

Migrated to Go:

Migrated to Scala and Java:

Finger Drumming Technique to Stop Tinnitus

This finger drumming technique may help ease tinnitus:

The following method may reduce the ringing in your ears, suggests Dr. Jan Strydom, of A2Z of Health, Beauty and Fitness.org. Place the palms of your hands over your ears with fingers resting gently on the back of your head. Your middle fingers should point toward one another just above the base of your skull. Place your index fingers on top of you middle fingers and snap them (the index fingers) onto the skull making a loud, drumming noise. Repeat 40-50 times. Some people experience immediate relief with this method. Repeat several times a day for as long as necessary to reduce tinnitus.
From "The eight best home remedies and holistic treatments to relieve tinnitus and ringing in the ears"

Thursday, December 17, 2015

Blogger is Dead?

According to a post on Next Web, Blogger is dead:


Last time we wrote a roundup of publishing platforms in 2013, there were a number of options that appeared that didn’t make it this time. Here’s a quick overview of why:

Google+: It’s fairly obvious why you shouldn’t be publishing on Google Plus, but if you weren’t aware, it’s not doing particularly well as the company has neglected it in recent times, even splitting off some of its services.

Quora: It’s a place you can blog if you really want, but that’s not all that popular anymore. You’re better off moving somewhere new.

Blogger: This platform is dead. Google might insist that it isn’t, but the company also isn’t putting any effort into it at all and hasn’t for a number of years. It’s not a safe bet.

Facebook Notes: Do you really want to be that person in your friend circle that’s blogging on Facebook?

Friday, December 11, 2015

Ruby "def" Jam

This afternoon I was briefly taken aback by an extra "def" in my Ruby code.

To see what I mean, put the following into a file (e.g. "test.rb"):

def

def a
  puts "hi!"
end

def b
  a
end

b

Now execute it:


$ ruby test.rb
test.rb:7:in `b': undefined local variable or method `a' for main:Object (NameError)
 from test.rb:10:in `
'

If you put enough space in front of the first def and don't have line-wrap so as to hide the extra def, it will probably be non-obvious to others as to why the "b" method can't see "a", as "a" will clearly seem to be defined.

Instead, you defined a method called "def" with a single argument "a". But, notice how we are still able to define the b method with def, even though def seems like it would have been redefined:

$ irb
2.2.3 :001 > def def a
2.2.3 :002?>   puts "hi!"
2.2.3 :003?>   end
 => :def 
2.2.3 :004 > def b
2.2.3 :005?>   puts "world"
2.2.3 :006?>   end
 => :b 
2.2.3 :007 > b
world
 => nil

To use this new def method, you must call it with send.

2.2.3 :008 > send :def, 1
hi!
 => nil 

Tuesday, December 1, 2015

Lessons for Living Longer

Dan Buettner shares the following 9 lessons for living longer at: http://www.bluezones.com/2014/04/power-9/

Power 9®
Posted on April 9, 2014 by Dan Buettner

Reverse Engineering Longevity
By Dan Buettner

Life expectancy of an American born today averages 78.2 years. But this year, over 70,000 Americans have reached their 100th birthday. What are they doing that the average American isn’t (or won’t?)

To answer the question, we teamed up with National Geographic to find the world’s longest-lived people and study them. We knew most of the answers lied within their lifestyle and environment (The Danish Twin Study established than only about 20% of how long the average person lives is determined by genes.). Then we worked with a team of demographers to find pockets of people around the world with the highest life expectancy, or with the highest proportions of people who reach age 100.

We found five places that met our criteria:

Barbagia region of Sardinia – Mountainous highlands of inner Sardinia with the world’s highest concentration of male centenarians.

Ikaria, Greece – Aegean Island with one of the world’s lowest rates of middle age mortality and the lowest rates of dementia.

Nicoya Peninsula, Costa Rica – World’s lowest rates of middle age mortality, second highest concentration of male centenarians.

Seventh Day Adventists – Highest concentration is around Loma Linda, California. They live 10 years longer than their North American counterparts.

Okinawa, Japan – Females over 70 are the longest-lived population in the world.

We then assembled a team of medical researchers, anthropologists, demographers, and epidemiologists to search for evidence-based common denominators among all places. We found nine:

1. Move Naturally. 
The world’s longest-lived people don’t pump iron, run marathons or join gyms. Instead, they live in environments that constantly nudge them into moving without thinking about it. They grow gardens and don’t have mechanical conveniences for house and yard work.

2. Purpose. The Okinawans call it “Ikigai” and the Nicoyans call it “plan de vida;” for both it translates to “why I wake up in the morning.” Knowing your sense of purpose is worth up to seven years of extra life expectancy

3. Down Shift.
 Even people in the Blue Zones experience stress. Stress leads to chronic inflammation, associated with every major age-related disease. What the world’s longest-lived people have that we don’t are routines to shed that stress. Okinawans take a few moments each day to remember their ancestors, Adventists pray, Ikarians take a nap and Sardinians do happy hour.

4. 80% Rule.
 “Hara hachi bu” – the Okinawan, 2500-year old Confucian mantra said before meals reminds them to stop eating when their stomachs are 80 percent full. The 20% gap between not being hungry and feeling full could be the difference between losing weight or gaining it. People in the Blue Zones eat their smallest meal in the late afternoon or early evening and then they don’t eat any more the rest of the day.

5. Plant Slant.
 Beans, including fava, black, soy and lentils, are the cornerstone of most centenarian diets. Meat—mostly pork—is eaten on average only five times per month. Serving sizes are 3-4 oz., about the size of deck or cards.

6. Wine. @ 5
 People in all Blue Zones (except Adventists) drink alcohol moderately and regularly. Moderate drinkers outlive non-drinkers. The trick is to drink 1-2 glasses per day (preferably Sardinian Cannonau wine), with friends and/or with food. And no, you can’t save up all weekend and have 14 drinks on Saturday.

7. Belong
. All but five of the 263 centenarians we interviewed belonged to some faith-based community. Denomination doesn’t seem to matter. Research shows that attending faith-based services four times per month will add 4-14 years of life expectancy.

8. Loved Ones. First 
Successful centenarians in the Blue Zones put their families first. This means keeping aging parents and grandparents nearby or in the home (It lowers disease and mortality rates of children in the home too.). They commit to a life partner (which can add up to 3 years of life expectancy) and invest in their children with time and love (They’ll be more likely to care for you when the time comes).

9. Right Tribe. 
The world’s longest lived people chose–or were born into–social circles that supported healthy behaviors, Okinawans created ”moais”–groups of five friends that committed to each other for life. Research from the Framingham Studies shows that smoking, obesity, happiness, and even loneliness are contagious. So the social networks of long-lived people have favorably shaped their health behaviors.

To make it to age 100, you have to have won the genetic lottery. But most of us have the capacity to make it well into our early 90’s and largely without chronic disease. As the Adventists demonstrate, the average person’s life expectancy could increase by 10-12 years by adopting a Blue Zones lifestyle.