Friday, December 17, 2021

Steve Jobs favorite citations from his Stanford speech:

It wasn’t all romantic... And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on...

You can’t connect the dots looking forward; you can only connect them looking backward. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever...

The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life...

It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Don’t lose faith. I’m convinced that the only thing that kept me going was that I loved what I did. You’ve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don’t settle...

Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure — these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart...

Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary...

Stay Hungry. Stay Foolish...

Tuesday, December 14, 2021

Movies I highly recommend:

Movies

12 Angry Men (1957)

3 idiots (2009)

A Few Good Men (1992)

Absentia (2011)

American Pie (1999)

Avatar (2009). The best movie to see at cinema (not at home). The best effects since Terminator 2. 

Back to the future (1985)

Back to the future 2 (1989)

Back to the future 3 (1990)

Battle Royal (2000)

Beautiful Mind (2001)

Blair witch project (1999)

Born on the Fourth of July (1989)

Brokeback mountain (2005)

Buried    (2010). Genius scenario, genius director. Is genius enough to make a great thriller with a single actor in a single space. I am not surprised the box office is 10 times more than the play budget.

Butterfly Effect (2004)

Cannibal Holocaust (1980)

Carrie (1976)

Changeling (2008)

Chernobyl TV series (2019)

City of God (2002)

Clockwork Orange (1972)

Cloverfield (2008)

Collateral (2004)

Conjuring (2013)

Conversation (1974)

Cruel Intentions (1999)

Dances with Wolves (1990)

Das Cabinet des Dr. Caligari (1920)

Das experiment (2001)

Deadpool 1, 2

Death Note the Anime Series

Demon Seed (1977)

District 9 (2009)

Django Unchained (2012)

Dogma (1999)

Drive (2011)

Exorcist (1973)

Falling down (1993)

Fahrenheit 451 (1966). Don't be a bio robot. Have your own mind. Follow your own voice of soul.

Fight Club (1999)

Gattaca (1997)

Generation kill, series (2008)

Girl with the Dragon Tattoo (2011)

Godfather (1972)

Godfather 2 (1974)

Gone Girl (2014)

Good Will Hunting (1997)

Goodfellas (1990)

Great Gatsby (2013)

Hunt for Red October (1990)

Hurt Locker (2008)

Interview (2014)

Interview with the Vampire (1994)

Intouchables (2011). Very kind French drama-comedy. To remind us what really matters in this life.

IT (2017)

Jack Reacher (2012)

Joker (2019)

Kids (1995)

Matrix (1999)

Mad Max: Fury Road (2015)

Megan Leavey (2017)

Men in black (1997)

Men of honor (2000)

Million Dollar Baby (2004)

Moonlight (2016)

Munich (2005)

Nuremberg (2000)

October Sky (1999)

Oculus (2013)

Office Space (1999)

Omen (1976)

Once Upon a Time in America (1984)

Ondskan (2003)

One Flew Over the Cuckoo's Nest (1975)

One Point O (2004)

Peaceful Warrior (2006)

Philadelphia (1993)

Phone Booth (2003)

Pirates of Silicon Valley (1999)

Platoon (1986)

Prisoners (2013)

Rambo First blood (1982)

REC (2008)

Rocky Balboa (2006)

Rosemary's Baby (1968)

Searching (2018)

Senseless (1998)

Schindler list (1994)

Shutter Island (2010)

Skeleton Key (2005)

Social Network (2010)

Source Code (2011)

Spotlight (2015)

Spread (2009)

The Conversation (1974)

The Fifth Estate (2013)

The Gift (2015). Genius thriller. Not for children. 

The Imitation Game (2014)

The lives of others (2006)

The Founder (2016)

They Live (1988)

The Post (2017)

Training day (2001)

V for Vendetta (2005)

Valkyrie (2008)

Venom (2018)

Visit (2015)

You don't know Jack (2011)

TV-Series

Game of Thrones

IT Crowd. I love English humor.

Silicone Valley. The best motivation for startup making.

Unsere Mütter, unsere Väter (Germany, 2013). The TV Series is translated to English as "Generation war". I love German movies... So realistic, so deeply emotional.. You will not meet Hollywood plastic smile or plastic crying. The only american war movie of the same quality is Platoon by Oliver Stone.



Monday, December 13, 2021

Friday, December 10, 2021

How to fresh breath without chewing gum

Unlike chewing gum, the following alternatives are perfectly healthy. They fresh our breath without chemicals or other harmful stuff.

  • Licorice
  • Parsley
  • Mint
  • Ginger
  • Honeycomb



Tuesday, December 7, 2021

How to make compost

Get 2 buckets. Place one bucket inside of another. In the bottom of the inner bucket, make holes to let air flow in.

Put a layer of regular soil in the bottom of the bucket.

Mix different types of organic garbage and place them in the bucket mixed or layer by layer.

Cover the last(top) layer with soil - it will fasten the process and prevent smells.

Cover the soil layer with dry leafs. They will help to keep moisture and heat inside of the bucket.

Spray everything with water on a regular basis.

Water leaked from the bottom of the bucket can be reused and sprayed again to the same bucket.

Place it under the sun.





Monday, December 6, 2021

How to plant mushrooms at home

Get spawn

Get mushrooms at store.

Get mycelium out of existing mushrooms. It is the white stuff.

Get container

Get a box/container/bucket. Make small holes in the bucket to allow mushrooms growing through them. Also holes are needed for air flow.

Distance between holes is around 10 cm.

Get substrate

Choose substrate to plant mushrooms on:

- cardboard

- coffee grounds

- saw dust

- straw

- sugarcane bagasse

- cotton waste 

- wood pellets

Pasteurise (soak) substrate in hot water (to prevent contamination).

Plant it

Put substrate in the bucket/box/container.

Put mycelium in the box/bucket with cardboard/wood layer by layer.

Put the container into the dark environment.

Wait for few weeks. While waiting, spray it with water.

Good temperature to maintain is around 20-25 degree by Celsius. So the container can be placed on the top of some shelves close to the ceiling because the temperature of air is higher at the high level above the floor. Also we can place it near the heater.


Wednesday, November 3, 2021

Inside of you, the beast is alive. It is 1000 times stronger than you think.

0_Unsorted_

Unleash it and use its power.

References in culture:

Venom (2018) - the venom per se


Baldur's Gate 2 - the beast skill





Tuesday, November 2, 2021

Problem solving - how to solve a problem

Let the problem resolve themselves

Some problems can be postponed if they are not urgent. Surprisingly, many of them are resolved by themselves after a while. Or we just realize we don't need to resolve them.

Delegate

If another man can repair my car cheaply, I better pay to him. 

Collect maximum information possible

Google it.

Ask online forums.

Discuss with friends.

Draw mind map

I personally do it in Google spreadsheets. Table view could also be used for mind mapping and brain storming.

More classic way of mind map can be done via Mindmeister app, available both on the web and mobile.

Analyze and breakdown to find root cause

Say we want to buy a house (or an apartment). The key question is why? Once we answer, ask again. Until we find a real root cause.

E. g.:

- Why?

- Because we have excessive money on the bank account.

- Why we want to spend excessive money?

- To protect assets from inflation or theft.

- Why purchasing an apartment is the best way to protect assets? Are there other ways?

Probably then we can find another (and more efficient way). Or become more confident in the initial way (purchasing real estate).


Soviet march

Sunday, October 17, 2021

Software development conventions

No comments

We use proper variable names instead of comments. The only exceptions for comments are "//TODO" temporary labels.

Order of class members in within the class definition

Internet suggests multiple ways for ordering and sorting members, and I follow neither of them. It is up to everybody to choose his/her own way of sorting members. It is not important how we sort members; rather it is important how consistently we follow our chosen methodology. So my way to sort members is as follows:

  1. Inherited (overridden) members from the parent class.
  2. Everything else.

In within of each of these, items are sorted as follows:

  1. Variables
  2. Init{} block
  3. Constructors(){}
  4. Functions(){}
  5. Everything else

In within of each of these, items are sorted as follows:

  1. Abstract
  2. Public
  3. Private
  4. Everything else

Sunday, October 10, 2021

How to connect an OBD device (car scanner) to an Android phone

Plug in the OBD and turn on the engine. Make sure you see the OBD device bright light is on under the car dashboard.

In the phone Bluetooth settings, connect to the "OBDII" device with the password "1234".

If the phone doesn't see " OBDII" device, try to plug the OBD device out of the car's socket and plug it in again. 

Download "Car scanner" app:
https://play.google.com/store/apps/details?id=com.ovz.carscanner

In the app, connect to the "OBD" device.

In the app, press "Engine codes"

Tuesday, September 28, 2021

Drug addiction..

Hereby, we refer to any type of addiction: drugs, alcohol, smoking, fast food etc. At the low level, the root cause for addiction is fear of not getting a pleasure from the addition object. If we understand how to fight fear, we understand how to fight addiction. Finally, we need to find out that fear is unreasonable and there is nothing to afraid of. 

Eat ginger instead of chewing gum to make breath fresh

What laptop to buy:

HP EliteBook 8460p - very reliable. I had a strong personal positive experience with it.

Size: 14''

RAM: 8 GB

Sunday, September 26, 2021

Kotlin tips and tricks...

0_Unsorted_

Read more: official reference and meta programming

Optional parameters for class:

class Yuh(optionalParameter: String = "" )

If optionalParameter is not passed, it equals to "" by default.

How to pass a class as a parameter

val c = MyClass::class
goToActivity(OneMainActivity::class.java)

How to get a class of an object

var classOfMyObject = myObject!!::class.java

(yep, in Kotlin .java is to be added for some reason, at least that option works for me, even though the class of the variable is a Kotlin class not the Java one)

Ternary operator

Execution:

if(expressionAInBrackets) expressionB else expressionC

Assignment:

var v = if (a) b else c

How to iterate through the class properties

MyClass::class.memberProperties.forEach {
log("name ${it.name}: = ${it.get(objectOfMyClass)}")
}

Kotlin operators to manage nullable values and types: ?, ??, !, !! 

Official Kotlin reference is here

Safe call

Safe call on the left side of expression:
println(b?.length)

This returns b.length if b is not null, and null otherwise. 

Safe call on the right side of expression:

person?.department?.head = managersPool.getManager()

If either `person` or `person.department` is null, the function is not called.

Saturday, September 25, 2021

Software design tips and tricks....

0_Unsorted_

Convert switch statements into classes.

Flexibility

Goals:
- Easy to change. When change is needed, it should be done in one place instead of multiple places. 
- Easy to debug. Problems should be easy to find.
- Easy to read and understand.
Solution:
- Small functions. Split big functions into multiple small functions, split big process into small steps. 
- Single responsibility. Every function should do only one task.
- Prefer composition over inheritance. Credits to this stackoverflow answer.
- Loose coupling of components.
- DRY ( do not repeat yourself). When value is used multiple times, it should be assigned to a variable.

Readability

Goals:
- to make the code understandable
Solution:
- Everything from the "Flexibility" section supra.
- Prefer meaningful variable names instead of comments.






Thursday, September 2, 2021

Toyota Tundra tips and tricks

0_Intro

Mostly the text below was copied and pasted from the official Toyota Manual.

Engine oil selection

Oil grade: ILSAC multigrade engine oil
Recommended viscosity: For 5.7 L V8 (3UR−FE) engine, SAE 5W−20 or 0W−20 engine oil may be used. However, SAE 0W−20 is the best choice for good fuel economy, and good starting in cold weather.
The 5.7L V8, uses 7.4 quarts of 0W20 or 5W20 oil. It is approximately 7 liter.

Resetting the engine oil maintenance data

The engine oil maintenance data must be reset after replacement of the engine oil.
Reset the data by the following procedure:
1. Turn the ignition switch to the “ACC” or “LOCK” position with the trip meter A reading shown. Mode names are shown right on the knob under the steering wheel. (For details, see “Odometer and two trip meters” on page 186 in the Manual.)
2. Turn the ignition switch to the “ON” position while holding down the trip meter reset knob. Hold down the knob for at least 5 seconds. The information display indicates “MAINT REQD RESET MODE COMPLETE”, the master warning light turns on and the tone sounds.

If the system fails to reset: 
- perform the above procedure again
- make sure that starting position is "trip A", not e. g. "trip B" etc. We can switch it by single pressing the knob on the dashboard.

Oil filter type

Wednesday, August 25, 2021

Am I at the right community for the startup?

Is merely listening YouTube enough?
Or should I apply for an accelerator program or something like that?
In our 21st century of information and technology, it is not necessary to be physically right next to the right person. We can join communities via social networks groups, 
internet forums etc.

List of folders in the box for the local garbage sorting

In the trash recycling post I posted some notes about how to live trash-free. So it is about how to reuse all the types of trash ourselves, so we don't need a landfill.
Here, I post the list of envelopes I put trash in. 
Envelopes live in a plastic box.
Not everything is contained in the envelopes because I have a lot of compartments in the car and its trunk:

Big folders:
0_Unsorted_
Aluminum
Bags fabric
Belts
Bottles, containers
Brushes
Cables chargers for laptops
Cables for scrap
Cardboard
Cases for the phone
Charge Connectors Adapters Converters (in working order)
Fabric
Ferrum
Glue
Goggles
Labels for folders
Magnets
Markers
Masks
Mouse (for laptops)
Paper clean
Paper dirty
Paper folders and envelopes
Paper to scan
Phones
Plastic
Plastic bags
Plastic film
Plastic folders
Plastic tools
Ropes
Rubber
Rubber gloves
Rubber gloves broken
Rubber rings
Sanding paper
Scissors
Screens
Styrofoam
Receipts and labels for the store
To do
Tools plastic
Wood

Small folders (envelopes):
Batteries
Cables USB-C
Cables Micro USB
Drives (hard, flash, CD)
Floss used
Keys not important
Penknifes
Pencils
Pens
Photos for the documents
Plastic cards
Plastic envelopes small transparent
Screw drivers for the laptop
Sim cards
Springs
Staples used
Utensils
Wire covered
Wire not covered



Atomic Habits - the book recommended by Michael Seibel

Glue reviews

The good one super glue (Loctide):

Sunday, August 22, 2021

Threads in Kotlin...

I hate to spend vacation at the ocean / sea

Most people associate sea with something bright, sunny and nice. I see nothing nice to be baked under 35 Celsius heat most time of the day. It is not possible to survive in Florida without air conditioning. So, we need to spend most time of the day in the building.
IMHO the ideal place to rest and to live is mountains. No heat in the summer. Not so cold in the winter. Beautiful views. Fresh air.

Thursday, August 19, 2021

Tea recipes

Unlike coffee, soaking tea in cold water didn't work well for me.. In the result, tea is not so invigorating even after 24 hours of soaking.

If we soak it in thermos in hot water for around 16 hours, the effect is perfect. Tea is very invigorating, even with small dose.

Tuesday, August 10, 2021

People need a dream

 They pay for training even though they suspect beforehand that the trainer is false. People watch movies, read books and follow religion. They just need an image to believe in, they need a dream.

Thursday, July 29, 2021

Yoga and stretching while working with computer - for better brain work efficiency

0_Unsorted_


Use rubber bands

Transverse twine

Longitudinal twine

Stay at one knee and make the second leg straight. Then try to lift the knee in the air.

Twist the body while sitting on the chair and holding the chair back with hands

Put one hole hand straightened on the floor and twist the body

Hands

Hands lock behind the back

Put one hand on the pelvis and stretch the elbow

Gorilla hands position

Laying down on a stomach

Touch the pelvis by the foot (heel)

Bring knees to the opposite sides, hold heels together, pull both heels towards out of the body.

Take one foot by the hand and put this foot down on to the floor

Front leg is bent in the knee. Rear leg is straight laying down on the floor. Front leg foot is under the pelvis.

Cobra (yoga position). 

Cobra on elbows

Laying down on a back

Bring knees to opposite sides

Bring one knee to the stomach and hold it with hands

Sitting on the floor

Kiss both knees

Kiss one knee

Stretch the neck

Butterfly with knees

Sit on the knees and touch the floor with the pelvis

Stretch thigh by holding one knee with handsHalf position of the fish tsar (yoga position)










Friday, July 23, 2021

Humor..

Sitting in the cafe, I just dropped my coffee cup and it broke down into the floor. Then I automatically pressed "Undo" button in the code editor.

How to choose business interview to watch - look at the position of the person being interviewed

 So if we would like to become a CEO, we search YouTube for "interview with CEO".

If we would like to create our own startup and become a founder, we search YouTube for "Interview with a founder"

Thursday, July 22, 2021

Strategy

0_Intro_

These strategy patterns could be applied in any part of our life when choosing what decision to take. Job, business, projects, relationships, conflicts, fights etc... Some of them can be seen in nature: wild animals successfully apply them. Others are from battlefields or other places. 

Body posture

In soccer, we use our body to protect a ball. During war, we hold the position and defend it. So often defense is the best way of attack. Don't try to intrude. Just hold your position and let the enemy get tired.

Plan

As per Chinese generals, the battle is to be won before the battle. Planning is everything. The battle itself is just a formality to realize the plan.

Attrition and waiting

Some decisions should be taken fast, while some should be delayed. We can delay the decision if time works for us. Chinese sage Confucius said: If you sit by the river long enough, you'll see the body of your enemy float by.
The more we wait, the more information we can get about the decision implementation. As it often happens, problem could be resolved by itself even before we started resolving it.

Root cause

The problem is resolved forever once we find its root cause. 

Consistent process

At the plant, melting machine should work continuously. Even if there is nothing to melt. That is because cost of starting it up is too high.
If I read tech book, I forcibly assign myself at least half an hour every single day for reading. If I don't touch the book for couple of days, it takes me much time to recover difficult tech terms in memory.
Constant dropping wears away a stone. Trust the process.

Use energy of the enemy

This is a key principle of oriental martial arts. As well, it is applicable in other area of our life. Teacher spends a lot of energy during training (lecture) trying to deal with couple dozens of students. Instead, he can flip this process and get energy from students. Instead of answering questions, ask questions.

Friday, July 16, 2021

Standards of future community (country)

Intro

One day I will create my own community (country, city or whatever). It will eliminate all the disadvantages current societies have. The following standards should be met:

Ecology

Saving our planet means saving our grandchildren. We don't want our descendants to be ugly mutants suffering from radiation.

Clean air

Polluting the air should be prohibited. Fire in any form will be allowed only in extraordinary cases. The best way to reduce CO2 exhaust is to stop producing it. For now, IMHO 95% of fires are to serve redundant people needs, which are not necessary to survive. 2020 covid pandemic proved tha tgovernments can easily force people to abstain from pleasure and other activities not necessary for survival. Of course, social needs, rest etc should be satisfied, but again, it could be done without fire.

Most food can be cooked without fire. Moreover, raw food is even more healthier than cooked (boiled, fried etc) ones.


Politics

Responsibility

The best way to hold politician responsible is to force him to live with his voters. Most politicians live in expensive houses behind the high fence and security guard. Politicians should live in apartments, or even better hostels with the poorest people of the country (which are the majority). So then the politician could hold a direct contact with the majority of his voters. Politician should eat in the shared kitchen with voters, 3 times a day, 365 days a year. Not once a year for TV camera like thy do now.

He can still be paid much, he deserves high salary and high pension for his work. However, he should not be allowed to live far from ordinary people, otherwise he will lose contact with them.







Wednesday, July 14, 2021

How to set up a solar panel

Intro

Here I will document my own learning is solar setup. I will update this post as I learn more.
I don't distinguish the way of panels use: whether on a vehicle, on a building or just separately. The main accent is of how to combine three main components: a panel, a controller and an invertor.

Choosing equipment

Criteria for any type of equipment:
Find certain brand on Amazon, and check:
- average reviews rating
- number of reviews
- the price (whether the current store overprices a lot)

How to choose a solar panel

Temperature Coefficient

The lower the better.

Warranty

Warranty of 25 years is usually provided by manufacturers. No warranty is a bad sign.

Monocrystalline vs Polycrystalline

Mono is more efficient and hence more expensive per square. So if we have much square space like on the building roof, we can use poly. Or, if we have less space like on the vehicle roof, we can use mono.

Brands

Panasonic
LG
Renogy

How to choose a battery

Criteria

Safety. Some batteries are toxic when charging or discharging. It is fine to keep a AGM/GEL/LiFePO4)
 battery in a living space.
Warranty. It should be.
Temperature range.
Maintenance.
Price.
Review rating on Amazon.

Types of batteries

Flood lead acid (or wet cell) batteries

They take lots of space, need regular maintenance. Disadvantage when we have a lack of space like in the vehicle (unlike a building). Charge slow. Trademarks: Trojan.

Sealed Lead Acid (AGM) batteries

Resistant to cold, easier to maintain. Trademarks: ExpertPower, Renogy, Universal, Mighty Max, WindyNation.

Gel Batteries

Great both for extreme heat and cold. Resistant to physical damage. Charge fast.

Lithium-Ion (LiFePO4) batteries

Best for solar. No maintenance required for about 15 years. Charge fast. Doesn't take much space. Easy to install.  Trademarks: Renogy. 

How to choose a controller

Ampers of the controller = next available value not less than (total watts of solar panels divided by voltage of the battery).
PWM or MPPT
150,200,250,600 V
Manual and auto EQ
Built in GFP and arc fault
Online status monitoring
Hyper VOC extend VOC limits
12-72 volt battery charging
Solar, wind and hydro MPPT modes
Brands:
Zamp

How to choose an invertor

Wattage of the inverter should be as total wattage of solar panels. 

Installation

Cover with a blanket

Cover the solar panels with a heavy blanket so that no sunlight is reaching the panels. This is important so that when we connect the wiring we don’t burn out the charge controller or any of the other electronic devices. Only uncover the solar panels once we are finished setting up the entire solar system and have all of the electronic cables in their proper position.

Stacks
We can multiply power by using stackable batteries and solar panels.



Thursday, July 1, 2021

Ethno Drum Fest - Kharkiv

Freedom is the most important need

Humanistic theory of Abraham Maslow listed basic human needs including socialization and self-actualization. However, it missed IMHO the most important human need: freedom. I believe in the modern society it is most important and most non-satisfied.

1000 years ago people were slaves of each other. Today, nothing changed. Children are slaves of parents at the young age. At least in the morning and in the evening. During the day, they are slaves at school. Then they become adults and fall into slavery of employers. At night, they are slaves for spouses.

Society and government consider all these institutes as normal (schools, jobs, marriage). It is logical because government per se was created as a form of slave owner. However, here we come to oxymoron and can catch government with its logic: apart from death penalty, the most serious sentence for a crime is imprisonment, i. e. restriction of freedom. In the prison, a man has everything he needs to be happy as per Abraham Maslow: food, social friends, ability for self-actualization etc. Still, imprisonment is the hardest penalty because of lack of freedom.

Today, we are all addicts of money. We sell our souls into slavery for money. We are though to do that. In the childhood, parents teach to study well to find a good job, to find good spouse etc. False and fake. Don't forget the Sermon on the Mount (Matthew 5-7):

No one can serve two masters, for either he will hate the one and love the other, or he will be devoted to the one and despise the other. You cannot serve God and money.

Sometimes I think up a joke and then loudly laugh at my own joke. Is it normal ?

Monday, June 28, 2021

Never pay to the university for the education!

Here I describe my own experience. I believe it could be useful because it cuts the common stereotypes of software engineering science studying. There are a lot of myths people believe in. Current study curve in schools and universities is defective. It kicks out and demotivate large percentage of people who could become a talented coders.

School and university is not to teach. It is an institute to filter people out. University filters students at the entrance to get only those with high intelligence. No university accepts students without tests/recommendations/school marks etc. Then, during the studying process, university filters students via its own tests and marks. At the end, only talented graduate, so the university is proudly saying how great it is. In fact, it is not the university which is great. Students are great, university is not. The only great thing about the university is it is a great filter. And maybe networking parties.

University does not provide teaching process with more value than YouTube and Google. All the scientific information in 21st century is available for free on the Internet and in public libraries. Teachers at university know less than e. g. stackoverflow or other public forums. The only difference is price. In the US students could pay $100,000 per year in the university unlike $500 (or even less) for Internet provider. Difference is 200 times. Why should we pay more? Or our parents? Even if government subsidizes study process this money could be spent in more efficient way. E. g. to feed poor and sick people, resolve ecology problems, decrease taxes etc.

What is much worse: in many countries military service is compulsory, at least for males. And stupid government thinks that: 

  • 1) People must serve in military (to allow government to protect kill more). Even in well-developed countries like the US, though military service is not compulsory, it is highly encouraged by giving subsidies to veterans for free university education, immigration benefits etc.
  • 2) Universities are useful, thus military duty is waived for those studying at university. The most useless and harmless waiver resulting in widespread corruption and harm for economics.

As per my estimation, only 1% of coders apply algorithms theory in daily work. At the same time this is the basic and main course in the university program. Even worse, many employers test applicants by giving them algorithms tasks. And after the job offer the engineer is surprised that he should do absolutely different type of job..



Emerging markets: good for startups and new ideas

Firebase functions - tips and tricks

Functions emulator

Start emulator:

    firebase emulators:start

Stop emulator:

    sudo lsof -i tcp:<port> 

    kill -9 <process id>

    close the localhost webpage

    close the terminal window

Deploy to production

    firebase deploy --only functions

Debug

In the function body, we can log the performance:

    functions.logger.log("tag", "some text", original);

or:

    console.log("tag", "some text"); 

Then we can see logs in the Emulator supra:

It is so valuable, logs how certain code line in the functions file, e. g. on the screenshot above we see "index.js:49".

Also, logs are at the Firebase Console if functions are deployed to production:

Get data

Official Firebase manual provides sample code for trigger functions. In the function, we might need to get data of the certain document the function is called for.

exports.respondToRequest = functions.firestore
    .document('requests/{requestId}')
    .onUpdate((change, context) => {
              const requestUpdated = change.after.data();
              const requestPrevious = change.before.data();
              const respondedUpdated = requestUpdated.responded;
              const respondedPrevious = requestPrevious.responded;
              const topic = context.params.requestId;

          }
        );

I emphasize here two main parameters: "change" and "context". So "change" is to get values of the document fields. Context is to get id of the document only. E. g. if we log output of change and context:

              console.log("change data is:", change.after.data());
              console.log("context data is:", context.params);

We can get the full set of data available to be extracted:

        07:17:42
        function[us-central1-respondToRequest]
        change data is: { description: 'first request', responded: true }
        07:17:42
        function[us-central1-respondToRequest]
        context data is: { requestId: 'HBQ7cRYAT5yliHdWNnpc' }

Sunday, June 27, 2021

How to make a choice. How to take a decision.

Intro

Often stress is caused by overwhelming of tasks. It is difficult to prioritize them, it is difficult to resolve them simultaneously. They attack us like a pride of predators, biting from multiple sides.

Or, we could have a one task with multiple choices. And it is difficult to choose the right one. We are afraid to make a mistake. What should we do then?

Whatever solution we take, it is always convenient to structure mind by documenting everything in the spreadsheet or mind map.

Possible solutions

"Minimax" strategy

In mathematics, there is a thing called game theory. It is used in computer algorithms when our electronic enemies in Starcraft make their decisions. 

"Minimax" is for minimizing maximum loss. First we define a maximum possible loss for every problem if it is not resolved timely. Then we sort problems by this maximum loss in descending order. Then we concentrate on the first one (with the greatest loss possible).

E. g. we see simultaneously falling from the table down to the floor the following:

- a bottle of milk

- a spoon

- a little baby

Which one would we catch first, letting others to break down on the floor?

What could happen in the worst case scenario? Let's make a choice with the less harm in case of worst scenario.

MiniMax is a mathematical term from so called games theory. When having multiple choices, each of them has possible loss ("minimum"). So we merely minimize the risk by choosing "maximum of minimums", taking the option with less harmful loss.

Intuition

What our God tells to us? Do not neglect intuition - sometimes it is the only instrument we have.

Option for return

If the choice is wrong, is there way to return back? Is this expensive? If we can easily return, it makes sense to make an attempt.

Make the first step and wait

Often the way is unpredictable and step on a road depend on the other factors. There is no need to spend time on thinking about every step if some of them could become redundant.

E. g. the problem is the car won't start. And we don't know the certain reason behind that. The process is we check possible failures step by step. First, we check whether battery is dead: try to start the car with the jump starter. If the reason is battery, we will lose our time thinking beforehand about all the other failure.

Visualize every option

For every choice, just imagine we already made it happened. Do we like it?

Exclude components (what if?)

If we think too much about that some factor is an obstacle to make a choice... What if there would not be such factor at all? Would we make a choice or not?

Say we don't want to move to another country because language barrier seems like an obstacle for this move. What would be if we would know such language perfectly? Would we move to this country immediately or there is some other reason preventing us from making this choice?

Count long term perspective

Preferable is the option resulting in long term dividends. It is better for me to study engineering at school rather than say cooking skills. In the future, robots constructed by engineers will cook food for us. Though for someone else cooking can bring long term benefits.

What would my favorite super hero do if he would be me? 

Or my favorite politician? Or any other person I respect much? 

Minimize regrets by your 80s

What would I regret about when I am in my 80s?

Give it a time

Wait - maybe the solution will come later. The more we wait the more information we have. Today we might not be willing to do the same as yesterday. Thus, if we have a recurring reminder in our mind for a long period of time - maybe it's time to do it.

Loosing yourself - thoughts about relationship and depending on other people and organizations...

God gave us a mission and he is waiting for us to complete it. However, instead of being slaves of God we voluntary become slaves of other people and organizations: parents, spouses, employers, governments etc.

We are afraid of being hungry and slave for an employer.

We are afraid of being lonely and slave for a spouse.

We are afraid of being prosecuted and slave for a government.

In fact there should be only one fear: fear of God. If we are not afraid of God - we don't believe in him. God is the strongest power in this world. If we have God, we have no fear for everything else.

By becoming slaves of somebody else, we lose ourselves. We lose our life mission, we don't want to hear internal voice of intuition. We close our heart.

Saturday, June 19, 2021

Applying Sermon on the Mount to startups.. Money is not important..

Sermon on the Mount for startup founders

I believe Sermon on the Mount (Matthew 5-7) is the best study book for startup founders mindset. Surprisingly enough, I find more and more confirmations of its validity in lives of the world's greatest people.

Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal. For where your treasure is, there your heart will be also.
You are the salt of the earth. But if the salt loses its saltiness, how can it be made salty again? It is no longer good for anything, except to be thrown out and trampled underfoot.
...
You are the light of the world. A town built on a hill cannot be hidden. Neither do people light a lamp and put it under a bowl. Instead they put it on its stand, and it gives light to everyone in the house. In the same way, let your light shine before others, that they may see your good deeds and glorify your Father in heaven.
...
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and money
... 
Therefore I tell you, do not worry about your life, what you will eat or drink; or about your body, what you will wear. Is not life more than food, and the body more than clothes? Look at the birds of the air; they do not sow or reap or store away in barns, and yet your heavenly Father feeds them. Are you not much more valuable than they? Can any one of you by worrying add a single hour to your life?
...
And why do you worry about clothes? See how the flowers of the field grow. They do not labor or spin. Yet I tell you that not even Solomon in all his splendor was dressed like one of these. If that is how God clothes the grass of the field, which is here today and tomorrow is thrown into the fire, will he not much more clothe you—you of little faith? So do not worry, saying, ‘What shall we eat?’ or ‘What shall we drink?’ or ‘What shall we wear?’ For the pagans run after all these things, and your heavenly Father knows that you need them. But seek first his kingdom and his righteousness, and all these things will be given to you as well. Therefore do not worry about tomorrow, for tomorrow will worry about itself. Each day has enough trouble of its own.
...
Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. For everyone who asks receives; the one who seeks finds; and to the one who knocks, the door will be opened.
...
Enter through the narrow gate. For wide is the gate and broad is the road that leads to destruction, and many enter through it. But small is the gate and narrow the road that leads to life, and only a few find it.
...
Therefore everyone who hears these words of mine and puts them into practice is like a wise man who built his house on the rock. The rain came down, the streams rose, and the winds blew and beat against that house; yet it did not fall, because it had its foundation on the rock.  But everyone who hears these words of mine and does not put them into practice is like a foolish man who built his house on sand. The rain came down, the streams rose, and the winds blew and beat against that house, and it fell with a great crash.
Sermon on the Mount, Matthew 5-7

Life mission makes us happy

Life is about the process. There is no need to run for the result: eventually everybody have the same result: death. So it makes sense to live just to be happy. This is about the process, not about the result. However, there is a tricky dual connection: we are happy with the process when it directs us to the right result (right goal) perspective. We are happy when we are moving to the right direction, even though not achieved it yet. The most admirable goal is life mission.

What makes us happy most? Apart from short term regular daily needs and pleasures there is some kind of long-term happiness. It is love. While love is usually referred to some feeling between sexes, I prefer another kind of love. The best love we could have is the love to our life mission. John Kennedy once met a janitor mopping up the floor at NASA. Kennedy asked what is he doing. The janitor responded, “I’m helping send a man to the moon.” The janitor is a happy man because he has a life mission. Once we find a mission, we can become happy also.

You are the salt of the earth. But if the salt loses its saltiness, how can it be made salty again? (Sermon on the Mount)

Once we find our mission to change the world, nothing else matters. I can sleep in the garage and eat expired food leftovers if I am on the way to my life mission. If I have no mission, the most luxurious apartments and the most expensive food will not make me happy.

World greatest people don't care about money

Grigory Perelman, a Russian mathematician turned down a million dollar prize from the mathematician society. Knowing the secret of universe is more important for him than money.

In 2006, Yahoo offered Mark to sell Facebook for $1 billion. This sounds like Zillion. Mark famously responded to his investors: 

This is kind of a formality, just a quick board meeting, it shouldn't take more than 10 minutes. We're obviously not going to sell here.

Later Mark and his wife pledged to donate 99 percent of their Facebook shares to charity fund.

Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal. For where your treasure is, there your heart will be also. (Sermon on the Mount)

Today Mark's net worth is about $120 billion.

Steve turned down prestigious Reed College diploma. Then he slept on the floor in his friends' room. Later he traveled to India and became homeless there. His famous quote is: 

Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked.

Therefore I tell you, do not worry about your life, what you will eat or drink; or about your body, what you will wear. Is not life more than food, and the body more than clothes? Look at the birds of the air; they do not sow or reap or store away in barns, and yet your heavenly Father feeds them. Are you not much more valuable than they? Can any one of you by worrying add a single hour to your life? (Sermon on the Mount)

First time in Silicon Valley was not luxurious for Elon. He slept on the couch in the office with his brother. They took shower in the local fitness club.

And why do you worry about clothes? See how the flowers of the field grow. They do not labor or spin. Yet I tell you that not even Solomon in all his splendor was dressed like one of these. If that is how God clothes the grass of the field, which is here today and tomorrow is thrown into the fire, will he not much more clothe you—you of little faith? So do not worry, saying, ‘What shall we eat?’ or ‘What shall we drink?’ or ‘What shall we wear?’ For the pagans run after all these things, and your heavenly Father knows that you need them. But seek first his kingdom and his righteousness, and all these things will be given to you as well. Therefore do not worry about tomorrow, for tomorrow will worry about itself. Each day has enough trouble of its own. (Sermon on the Mount)

There is something more important than money

There are many followers in every religion. However only small percentage of them really believe in God. Those who believe, are really happy. They don't need money, they don't care about problems of the current life.

No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and money. (Sermon on the Mount)

There are many startup founders who apply for investments. However only small percentage of them are ready to work 12 hours a day for 2 years, no salary, no weekends, sleeping on the floor, eating twice a day. Only those have life mission. Mission is more valuable than money and other pleasures. Mission is life, life is mission. Life is what we exchange for mission, mission is exchanged for life. Life is more valuable than money. Life is more valuable than anything else.

Therefore everyone who hears these words of mine and puts them into practice is like a wise man who built his house on the rock. The rain came down, the streams rose, and the winds blew and beat against that house; yet it did not fall, because it had its foundation on the rock.  But everyone who hears these words of mine and does not put them into practice is like a foolish man who built his house on sand. The rain came down, the streams rose, and the winds blew and beat against that house, and it fell with a great crash. (Sermon on the Mount)

Let's interpret Jesus's words: money is a sand whilst life mission is a rock.

Psychiatrists would call this schizophrenia. If Jesus would visit psychiatrist, he would be diagnosed with a hardest form of schizophrenia and involuntary hospitalized. Well, better I have schizophrenia rather than being an ordinary person, living ordinary life and dying like everybody else. So nobody except for grandchildren remember me.

The best illustration ever is provided in Matrix (1999):

- What are you trying to tell me? That I can dodge bullets?
- No, Neo. I'm trying to tell you that when you're ready, you won't have to.

Will good startup founder easily get an investment? No. When he is ready, he doesn't have to.

Most reasonable people would like to get highly paid job to sustain a comfort level of life. However, let's ask an average reasonable person the following question: 

You can get indefinite life (so you can live for thousands of years). Or: you can get $1 billion, but then you will die like everybody else in within this century. What would you choose? 

I bet most regular people choose indefinite life. The trick is everybody wants it, however nobody knows that everybody already has it. Everybody just thinks they live only once. And this life is all they have.

Don't waste lifetime

Good time management books start with identifying the whole life goal (unlike micro-managing daily tasks). They suggest to ask yourself the following questions:
- What would I do if I die in one week?
- What would I want to be written on my graveyard?
- What would I would if I would have one billion of dollars?
- What job I can do for free?

Steve asked himself the similar question:

For the past 33 years, I have looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something.

And his even more important words are:

Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary...
... Stay Hungry. Stay Foolish.

I believe Steve and time management experts would agree with the Bible "Parable of the Talents", in Matthew 25:14–30. Master gave to slaves talents (money). Then he punished the slave who didn't get any profit from the talents. And he admired the slave who put talents into business, used them efficiently and came back with double amount.

For it will be like a man going on a journey, who called his servants and entrusted to them his property. To one he gave five talents, to another two, to another one, to each according to his ability. Then he went away. He who had received the five talents went at once and traded with them, and he made five talents more. So also he who had the two talents made two talents more. But he who had received the one talent went and dug in the ground and hid his master's money. Now after a long time the master of those servants came and settled accounts with them. And he who had received the five talents came forward, bringing five talents more, saying, ‘Master, you delivered to me five talents; here, I have made five talents more.’ His master said to him, ‘Well done, good and faithful servant. You have been faithful over a little; I will set you over much. Enter into the joy of your master.’ And he also who had the two talents came forward, saying, ‘Master, you delivered to me two talents; here, I have made two talents more.’ His master said to him, ‘Well done, good and faithful servant. You have been faithful over a little; I will set you over much. Enter into the joy of your master.’ He also who had received the one talent came forward, saying, ‘Master, I knew you to be a hard man, reaping where you did not sow, and gathering where you scattered no seed, so I was afraid, and I went and hid your talent in the ground. Here, you have what is yours.’ But his master answered him, ‘You wicked and slothful servant! You knew that I reap where I have not sown and gather where I scattered no seed? Then you ought to have invested my money with the bankers, and at my coming I should have received what was my own with interest. So take the talent from him and give it to him who has the ten talents. For to everyone who has will more be given, and he will have an abundance. But from the one who has not, even what he has will be taken away. And cast the worthless servant into the outer darkness. In that place there will be weeping and gnashing of teeth.’

Master is God. Talents are lifetime and other gifts given to us by God: skills, connections, ideas, chances, dreams etc. If we waste talents, most importantly the lifetime as a talent, we are bad slaves. That's why Steve worried that he is moving to wrong direction when his lifetime is limited. Wasting the time is a sin in front of God. Spending time on life mission is admirable by God.

Every morning we wake up. The first thing we notice is we are alive. That means, God gave us one additional day on purpose. Don't waste this day.

The happiness of belonging to life mission destroys the fear of being poor and homeless till the end of the life. Because life mission gives something more than money.

Fear of God

Since God assigned us lifetime for a purpose, we should have fear of wasting it. We should have fear of God. We should be afraid of God's anger. God is a boss who helps us to fulfill his mission and who punishes us if we deny to obey.

There is no power greater than God. Hence, we should be afraid of nothing but God. Americans say:

Don't tell God how big your problems are. Tell your problems how big your God is.

The best illustration by artists is in the "Indiana Jones and the Last Crusade" (1989):

How to find life mission?

Steve clearly answers this question supra:

... have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary...

We see strong connection between "courage" and "your heart" in the same phrase. Heart shows us the way to the life mission. To see this way, we need a courage. Courage is needed when we have fear. Thus, I dare to say: fear shows us the way of the heart. Every time we have fear - it is a signal of the right way. We need to follow our fears and overcome them.

E. g. we see some injustice and would like to oppose it. However injustice is committed by a stronger person and we feel fear to oppose. That means we are on the right way. Another example: say we have highly paid office job and great carrier perspective. However we hate what we do. Our dream is say to become an artist, but an artist at the starting point is not paid at all. We have a fear of becoming poor if we follow our dream. Nevertheless, fear shows us the right way.

Enter through the narrow gate. For wide is the gate and broad is the road that leads to destruction, and many enter through it. But small is the gate and narrow the road that leads to life, and only a few find it. (Sermon on the Mount)

We never know the destination point assigned to us by God. However we need to trust our heart to get there. As Steve explains:

...you can’t connect the dots looking forward; you can only connect them looking backward. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life...

If nothing helps, a prayer is a great way to get answers. We think we talk to ourselves. However, it is God who talks to us.

Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. For everyone who asks receives; the one who seeks finds; and to the one who knocks, the door will be opened.

Have we ever cried while reading or watching something? A tear is a clear indicator of the proper way.

Thursday, June 17, 2021

Jared Friedman - the most exciting guy in YC

Key disadvantage of the school system

School teaches children anything but creativity. Ability for creativity and innovation is a key for motivation to get new knowledge. Innovation is the best pool for spending energy of youth. I stead, students spend energy on disorderly conduct because they are absolutely not motivated to study. 

Wednesday, June 16, 2021

Git tips and tricks

0_Unsorted_

See status of the repository:

    git status

See status in certain directory:

    git status <path to directory>

See status in the current directory:

    git status .

Branching

0_Unsorted_

Jumps to another branch:

    git checkout <branch name>

Rename branch:

    git branch -m <old name> <new name>

See what branches are in your repository:

    git branch

Create

Creates new branch and jumps to it:

    git checkout -b <branch name>

Create a branch from mainline:

    git branch <new branch name> mainline

Create a branch from a specific commit:

    git branch <new branch name> <commit name>

Remote repository branches

To create a branch in the remote repository, need to explicitly push (the -u sets local branch to track the remote branch):

    git push -u origin <local branch name>:<new remote branch name>

Push the newly created local branch to repository:

    git push -u origin <local branch name>

Delete

Delete a local branch:

    git branch -d <branch to delete>

Delete a remote branch. When you delete a remote branch, you are in effect, pushing a null commit to the server.

    git push origin :<branch to delete> 

    git push origin --delete <branch to delete>

Merge

Merge changes from one branch into another

    git merge <branch to merge from> 

Resolve the conflict

    Open the file and make any necessary changes

    Use the git add a command to stage the new merged content

    Create a new commit with the help of the git commit command

    Git will create a new merge commit to finalize the merge

Hardcoded Red Neck Way for Resolving Conflicts

    After the merge, the worse thing git does is it makes changes in the file per se. So it is easy to mess up everything. Paying attention to that git adds additional comments to the file. Sometimes after resolving the merge nothing works. Debug fails because the new "resolved" file looks like neither of the 2 previous. Moreover, it can contain new errors for debug. 

    Let's say we have conflicts only on one or two files. Than it is easy to hardcode the merge conflict. Say the conflict in the file is between its previous version A and version B. Say we know that we want to keep version A because we are sure that it works stable. Then we just copy and paste all the version A file to the separate folder on a disk out of the git control and call it copyOfVersionA. We can get that version A from one of previous commits (git checkout <commit_name>). 

    After git flags a merge, we just replace the current file in the local repository with the copyOfVersionA that we created earlier. Then add and commit. Merge is resolved.

Abort in case of disaster

    git merge --abort

We can always go back to the safe state with this command.

Cherry-pick 

This is to transfer commits between branches. To transfer commits made at another branch: Cherry picking in git means to choose a commit from one branch and apply it onto another. Make sure you are on the branch you want to apply the commit to.

    git checkout <branch-to-apply-commit-to>

    git cherry-pick <commit-hash>

Abort cherry-pick in case of disaster:

    git cherry-pick --abort

Commit

Make a commit

    git commit -m "<description>"

Temporary switch to another commit

    git checkout commit_hash

Switch back to the latest commit in the branch

    [or] git checkout [branchname]

Difference

Differences between branches:

    git diff <branch1>..<branch2>

Differences between a remote branch called origin/mainline, and the local mainline branch:

    git diff origin/mainline..mainline

Changes between two commits:

    git diff <commit1> <commit2>

Changes in certain commit

    git show <commit>   

Staged changes diff

    git diff --all

Show names of changed files, status (deletion/removal), number of lines changed:

    git diff --stat

Show only names of changed files and addition/deletion status:

    git diff --name-status

Show only names of changed files and addition/deletion status

    git diff --summary

Show only names of changed files

    git diff --name-only

Ignore temporary files

1. Go to package folder

2. vim .git/info/exclude

3. In the end of the file, write: *~

The same mask can be applied for other types of files

Log

See a history of the commits on the current branch

    git log

See also difference for every commit listed

    git log -patch (or git log -p)

See only latest number of commits

    git log -<number of commits to be listed> git log -3

See graph of branches

    git log --graph

Reset

Delete everything uncommitted

    git reset --hard

Abandons uncommitted changes of certain file to last commit

    git checkout -- <file_name>

Remove the last commit and delete all of the changes to the files intact

    git reset --hard HEAD~1

Remove the last commit but leave all the changes

    git reset --soft HEAD~1

Remove the last commit from the remote repository (i. e. github), undo last push (if the last push consisted of one commit):

    git push -f origin HEAD^:master