My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Android M Preview May 2015

https://youtu.be/ndBdf1_oOGA


As an Amazon Associate I earn from qualifying purchases.

Keyed Scarf Join


Making complex scarf join using mostly Japanese hand tools

https://youtu.be/buHsNMVSONQ

Here is an example how a person can make a complex join using everyday carpentry tools.

https://youtu.be/6j-U1P49r8U



As an Amazon Associate I earn from qualifying purchases.

Linux tail command

To constantly monitor log files being appended, you can use:


tail -f /var/log/xyz*.log

if you want to see last 200 lines added:

tail -n 200 /var/log/xyz*.log

note the asterisk "*" symbol, that monitors ALL logs that meet the pattern, which is helpful with log names ending with DATE.


As an Amazon Associate I earn from qualifying purchases.

Groovy

Groovy Installation



$ curl -s get.gvmtool.net | bash

$ source "/Users/uki/.gvm/bin/gvm-init.sh"

$ gvm install groovy

$ groovy -version

Groovy Version: 2.4.3 JVM: 1.7.0_79 Vendor: Oracle Corporation OS: Mac OS X

$ which groovy

/Users/uki/.gvm/groovy/current/bin/groovy


To add Groovy permanently to your Terminal  PATH

edit ~/.bash_profile
# Groovy updated May 19, 2015
export GROOVY_HOME=/Users/uki/.gvm/groovy/current
export PATH=${PATH}:${GROOVY_HOME}/bin


First Script


groovy_scripts $ cat hello.groovy 

println 'Hello from Groovy'
groovy_scripts $ groovy hello

Hello from Groovy




Groovy Console


Groovy Console is good for quick testing of Scripts, especially copy and paste from the Web.


$ groovyConsole








interface Alive{
   void alive()
}

class Creature implements Alive{
    def grawl() {
        println(" Grrrrrrrr!!! grawls the Creature")
    }
    void alive()
    {
        println(" Grrrrr!!! thinks the Creature")
    }
}

class Human extends Creature {
    String name;
    def sayHi(name) {
        println(" Hi, my name is $name! says the Human")
    }
   
    void alive()
    {
        println(" I am alive! says the Human")
    }
}



Creature me = new Human()
me.grawl()
me.alive()
me.name = "Uki"
me.sayHi me.name

Creature bear = new Creature();
bear.alive()


OUTPUT:

uki@ groovy_scripts $ groovy hello
 Grrrrrrrr!!! grawls the Creature
 I am alive! says the Human
 Hi, my name is Uki! says the Human

 Grrrrr!!! thinks the Creature



If you like this post, please give me your 2 cents ($0.02 litterally) to show token of appreciation and encourage me to write more:

Donate Bitcoins



As an Amazon Associate I earn from qualifying purchases.

Groovy as DSL

http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html

If you like this post, please give me your 2 cents ($0.02 litterally) to show token of appreciation and encourage me to write more:

Donate Bitcoins



As an Amazon Associate I earn from qualifying purchases.

Hadoop on Pi cluster

http://www.widriksson.com/raspberry-pi-hadoop-cluster/


As an Amazon Associate I earn from qualifying purchases.

Reishi (Ganoderma lucidum)

Anti-inflamatory used agaist reumatism



As an Amazon Associate I earn from qualifying purchases.

Yew (Taxus sp.)



As an Amazon Associate I earn from qualifying purchases.

Elm



As an Amazon Associate I earn from qualifying purchases.

Cover crops

http://www.motherearthnews.com/organic-gardening/cover-crops-improve-soil-zmaz09onzraw.aspx


As an Amazon Associate I earn from qualifying purchases.

UNIX: create symbolic link ln -s

Symbolic link is a directory that points to another directory:

$ sudo ln -s TARGET_DIR SYMBOLIC_LINK_DIR



Example 1:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions

$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/ "1.8.0_20-ea"
$ ls -alt
lrwxr-xr-x  1 root  wheel   59 May 14 16:24 1.8.0_20-ea -> /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/


Example 2:

Debian linux Apache location: /var/www
Mac Apache default location: /Library/WebServer/Document

On Mac to mimic the Debian linux's Apache server in /var/www you can create a symbolic link that points to Mac's default server location:


$ sudo ln -s /Library/WebServer/Documents www



originally posted on 7/24/2009

If you like this post, please give me your 2 cents ($0.02 litterally) to show token of appreciation and encourage me to write more:

Donate Bitcoins



As an Amazon Associate I earn from qualifying purchases.

Switching version of Java on Mac

To check the currently installed version of java on your Mac:

$ java -version
java version "1.6.0_65"


(Welcome back to 2006!)


You can download Java 1.7, 1.8 and 1.9 at Oracle and write down WHERE they install it:

http://www.oracle.com/technetwork/java/javase/downloads/index.html




Using SYMBOLIC LINKS I created locations of my various Java locations:

sudo ln -s location_of_JDK "version_name"



for example:

$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/ 1.8.0_51




Uki@ Versions $ ls -al
total 72
drwxr-xr-x 12 root wheel 408 Jul 29 12:03 .
drwxr-xr-x 11 root wheel 374 Jul 29 11:50 ..
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.6.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 59 Jul 29 12:03 1.8.0_51 -> /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/
drwxr-xr-x 7 root wheel 238 Jul 29 11:50 A
lrwxr-xr-x 1 root wheel 1 Jul 29 11:50 Current -> A
lrwxr-xr-x 1 root wheel 52 Jul 29 11:50 CurrentJDK ->/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
Uki@ Versions $


now I can switch my Java to 1.8 by redirecting CurrentJDK:

Uki@ Versions $ sudo rm -r CurrentJDK
Uki@ Versions $ sudo ln -s 1.8.0_51 CurrentJDK

Check that change took place: 


Uki@ Versions $ ls -altotal 72
drwxr-xr-x 12 root wheel 408 Jul 29 12:07 .
drwxr-xr-x 11 root wheel 374 Jul 29 11:50 ..
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jul 29 11:50 1.6.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 59 Jul 29 12:03 1.8.0_51 -> /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/
drwxr-xr-x 7 root wheel 238 Jul 29 11:50 A
lrwxr-xr-x 1 root wheel 1 Jul 29 11:50 Current -> A
lrwxr-xr-x 1 root wheel 8 Jul 29 12:07 CurrentJDK -> 1.8.0_51
Uki@ Versions $ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)










~~~~~~~~~~~~~~~~~~~~~~~










It is also useful to create JAVA_HOME as a lot of apps use that.




Open your shell startup script, most of the time it is ~/.profile







edit ~/.profile






--------------------------------

# JAVA updated: May 14, 2015
# other versions: /System/Library/Frameworks/JavaVM.framework/Versions/
# set up what CURRENT points to
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
# add Java home to path
export PATH=${PATH}:${JAVA_HOME}/bin






--------------------------------






$ java -version


java version "1.8.0_20-ea"


Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b05)



Java HotSpot(TM) 64-Bit Server VM (build 25.20-b05, mixed mode)










If you mess up you will get messages like:


$ java -version



Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/bin/java" (-1)






That is because the folder you point at has to have /bin/java in it.


Please note that your system Java level is independent from you Android Eclipse Java setting (1.6)









http://stackoverflow.com/a/23396850/3566154










If you like this post, please give me your 2 cents ($0.02 litterally) to show token of appreciation and encourage me to write more:

Donate Bitcoins



As an Amazon Associate I earn from qualifying purchases.

Electric rototiller cultivator

Today, I have been testing my new electric tiller.

Many say that a tiller should be your first mechanized tool.

The assembly was very simple with Phillips screwdriver as only tool needed.

My first impression was that the cutting blades look cheap, but after converting about 100 square feet of grass into a planting row, I don't have any issues with the quality.

The tiller eagerly goes after first inch of ground, but to go deeper I had to break the ground with the spade. This still saves enormous amount of work as I don't have to turn over the soil, but just lean on the spade.

The roots wrap around the blades, and I well have to clean them later, I definitely would like a quick release instead of the bolt.

I like the fact that the tiller is electric, not gasoline driven, it is definitely quieter and easy to turn on, and off. For remote sites a small power generator would be a must, but this is not an issues within couple hundred feet from the power outlet.

I definitely believe that tiller should be your first mechanized tool.



As an Amazon Associate I earn from qualifying purchases.

King Bolete (Boletus sp.)

I have ordered two types to try them under oaks, pine and spruce trees I have. I will review the success later on.




http://mushroom-collecting.com/mushroomking.html


As an Amazon Associate I earn from qualifying purchases.

Oak tree (Quercus sp.)

Since most of my property is covered with large, mature oak trees, it is essential to review all possibilities of using this ecosystem for purpose of the permaculture.

First note is on building tall beds surrounding the trees; unfortunately the roots need access to air and crowding around the trunk may weaken the tree itself, so use common sense on what your ecosystem can realistically sustain.

The obvious candidates would be shade loving plants and fungi.

Shade loving plants:

  • aloe
  • many common vegetables (try and see what survives)
Mushrooms (fungi) compatible with oak:
  • Boletus sp.




As an Amazon Associate I earn from qualifying purchases.

Avocado (Persea americana)

It is very easy to plant avocado, just stick the golf ball sized seed in the moist soil and let it be. OK, you can improve on that, there is a top end and bottom end, the bottom likes to be moist, top should be sticking up from the soil.

When watering avocado plant soak the well draining soil and leave it to dry, then repeat the cycle.

You will however have to wait about 3 years before the young tree bears any fruit. You can get avocados from pot size plant about 3 or 4 feet tall, you might have to clip the top if your tree growing too tall. 

To assure your avocado produces fruits make sure to plant several trees, the flowers that open for couple of days are at first female then male, so self-pollination is impossible. The plant can be pollinated by insects or wind (or brush). A mature tree can produce 60 (the norm) to 200 pounds of fruit.

Much have been said about health benefits of eating avocados, they are probably one of the best things you can ad to your daily diet.

/




As an Amazon Associate I earn from qualifying purchases.

Heather (Calluna vulgaris)

Polish: Wrzos


As an Amazon Associate I earn from qualifying purchases.

Ethnofarmacology

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3791396/#!po=14.7273


As an Amazon Associate I earn from qualifying purchases.

Berberis vulgaris



As an Amazon Associate I earn from qualifying purchases.

Green Alder (Alnus viridis)

Nitrogen fixing up to 55 pounds per acre, good under crop for taller timber.

Tea used for infections and fever (anti inflammatory).



As an Amazon Associate I earn from qualifying purchases.

Common Bugleweed (Ajuga reptans)

This plant has been considered a nuisance grass weed overtaking my whole lawn.

In traditional Austrian folk medicine this plant tea is used as anti inflammatory treatment for upper respiratory problems.

Study has shown accelerated wound healing and anti inflammatory properties.


As an Amazon Associate I earn from qualifying purchases.

American Toad

Look what I found hiding in the flower bed!

Toads are very welcome visitors to your garden, the hunt insects and snails at night.


As an Amazon Associate I earn from qualifying purchases.

Sweet Corn (Zea mays)

Sweet corn likes a ph neutral, reach soils in the full sunlight. You can start planting when the soil temperature reaches 50-60 F, for me it is May 15.

On the small scale, you can plant couple of seeds, about 1.5 inch deep, in a row about 12 inch apart, since the corn is air pollinated, multiple rows will benefit the plants positioned on the edge, so plan to plant square, or rounded plots.

Since you are planting couple of seeds per spot you will have to select the healthiest plant and snip others, this of course would not pay on the large scale.

Corn has shallow roots, so it needs moist top soil.

You can plant pumpkin/squash and green beans next to each corn plant, they will use it as trellis. Green beens will fix atmospheric nitrogen in the soil, for the NEXT YEAR cultivation, after they decompose.




As an Amazon Associate I earn from qualifying purchases.

Tomatoes

Tomatoes in my region (northern Illinois) grow from May 3 (last average sprint frost) until October.

You should be seeding tomatoes about 6-8 weeks before you transplant them into outdoor soil, so for target date of May 15, I have to start at beginning of April.

Place seeds in shallow depth, in the small, drained containers, with room temperature, moist soil, assume 70-80% germination rate. They will take up to 2 weeks for germination. Control humidity with plastic, but allow some airflow.

As soon as the seeds germinate they will need plenty of the sunlight. If you are using a full-spectrum lights make sure you have them on about 16 hours a day.

Don't worry too much about selection of tomatoes, plant as many varieties you can and keep in mind that if you are planting for your local consumption:

  • tomatoes don't need to be shipped across the country, so they don't need to tough skinned
  • tomatoes don't need to "survive" a week before being placed on the store shelf, so they don't need to be rot resistant
  • tomatoes don't need to be a size of pumpkin, because they are not for (freak) show
However tomatoes need to be:
  • tasty to you
  • right size for you to eat
  • adaptable to your soil
  • adaptable to your micro flora and fauna
Based on this two sets of criteria almost all of the heirloom and hybrid varieties today will NOT be suitable, so you have to find your own favorite by TRYING and SAVE THE SEEDS.



Resources:
http://www.wisconline.com/almanac/gardening/springfrost.html




As an Amazon Associate I earn from qualifying purchases.

Seed bank

A good 60 second spot on the World Seed Bank in Norway.


https://youtu.be/gFAcyJxIguA




As an Amazon Associate I earn from qualifying purchases.

Transplanting Grapes

I had a couple of rows of grapes growing for few years in partial shade. The grapes were not strong and did not produce. I decided to move them to an area by the building where they were to get a lot of sun and heat.

When moving the grapes you have to dig out a lot of the root.
The grapes "like to have air" so even if the eventually will be hugging the wall, I planted them about 0.5m away from the wall.

I have dug up a deep hole and added leaf mulch to hold the moisture, then covered it with tilled soil.











As an Amazon Associate I earn from qualifying purchases.

Java: Generics, instanceof

In this exercise you will practice Java Generics, and instanceof operator




Note, you will have to implement Book, EBook and PaperBook classes on your own.










As an Amazon Associate I earn from qualifying purchases.

Java: concurrency with Runnable

In this simple tutorial we will see how to process some work in multiple threads using limited pool of x threads. Please note that there is an overhead in using threads.

You could use number of available CPUs as your pool size.



Result:


CPUs 8
thread with value 1 current sum 3
thread with value 2 current sum 3
thread with value 3 current sum 6
thread with value 4 current sum 10
thread with value 5 current sum 15
thread with value 6 current sum 21
thread with value 7 current sum 28
thread with value 8 current sum 36
final sum 120
thread with value 11 current sum 66
thread with value 13 current sum 91
thread with value 15 current sum 120
thread with value 9 current sum 45
thread with value 14 current sum 105
thread with value 12 current sum 78
thread with value 10 current sum 55



As an Amazon Associate I earn from qualifying purchases.