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. Constructor.
  3. Nested classes.
  4. Everything else.

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

  1. Variables
  2. Functions
  3. Everything else

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

  1. Abstract
  2. Public
  3. Private

Friday, October 15, 2021

Options to reuse trash at home

This post is an extension for the main philosophy for the Reuse section of Reduce, Reuse and Recycle post.

Garbage types for reuse

0 Unsorted (Ungrouped) types of garbage

0 Any type of garbage

Art objects.
Ash

Toothpaste. Ash is known as healthy, free and natural mean to clean teeth. 

Stone

Fill potholes on the road.

Used motor oil

Fuel. Oil can be burn in fire to cook food etc.
Oil for the chain of the chainsaw. Chainsaw uses two different oil types in it's two separate tanks. First tank is for gas mixed with good oil (not used motor oil). Second tank is for chain oil, which does not require high quality of the liquid. So we can add used motor oil for the chain.
Paint the wooden fence. To prevent wood from being rotten as a result of water.

Fabric

0 Any fabric

Pockets enforcement. We can sew up old piece of fabric to the pockets. This can be done from the interior side of the pants. Such sewing would make pockets stronger. This is useful when something valuable is stored in the pocket e. g. keys. So otherwise keys could cut the pocket and fall out, we don't want this to happen.
Car seat cover. Fabric can be sewn together to make a cover for the car seat.
Door mat. To keep the house clean.
Filler for the toilet. See infra.
Floor cloth. To clean up the floor.
Handkerchief. Fabric can be cut into small pieces for handkerchiefs. Unlike paper soft tissue, handkerchiefs can be washed and used multiple times.
Packaging material. Like any flexible substance.

Carpet

Picnic and camping. E. g. instead of yoga mat.

Packing and amortization. Carpet serves as a great protection or cargo during transportation. E. g. furniture and appliances could be covered with carpets to protect them while in the truck trunk.

Clothes

Donate or even sell. Via the Craigslist, Facebook Marketplace or any other local advertising board.
Make lighter clothes. E.g. cut shorts out of pants. Or sleeveless shirt out of a shirt. Often we can adjust size when cutting. E. g. if pants are too big for us, we can cut them to shorts and shorts would look good.
Cut and convert:
Good thing is we can adjust size after cutting clothes.
Pants could be cut and converted to shorts.
T-shirt could be cut and converted into sleeveless T-shirt.

Metal

0_Any_Metal

We can make a bit of money by bringing metal to the recycling center. Just need to collect enough metal because otherwise our earnings would be less than a gas cost.

Barrel

Table. Instead of buying new furniture, we can convert existing barrel into a chair or a table.

Garbage bin

Car, van, truck

Dwelling. Though the car might not run, its body can still be waterproof. Especially if it is a big car like a van or a truck. 
Shed. The logic is the same as for the dwelling supra.
Sell for scrap. Scrap yard pays money and sometimes picks up old cars.

Container (shipping container)

Usage is the same as for old cars supra.

Organic waste

Organic waste includes food leftovers and our toilet sewage.

0 Any Organic Waste

Dig into the ground. There is nothing bad to dig the organic waste into the ground. It was part of nature, it is part of nature, it will come back to nature. Then nature will take care of that. Nature better knows what to do with our organic waste. Nature better knows what to create out of our organic waste. Advantage of digging organic waste into the ground is cost savings for garbage trucks and sewer utility bills. In turn, garbage truck will not pollute nature with its gas exhaust.

Fertilizer. For those who have a yard, organic waste is a perfect fertilizer. Even without a yard, edible mushrooms can be grown in the apartment, fertilized with organic waste.

Filler for the toilet. See infra.

Fodder. Food for farm animals. Grass, watermelon and banana peels can be cut into small pieces. So chicken can eat it. So do pigs.

Spices. Many types of the grass are bitter. Others are spicy. It can be dried also to preserve for future use.

Avocado seed

Fill potholes on the road.

Banana peels

Filler for the toilet. See infra.
Cleaning foam. We can clean some dirt by rubbing it with a banana peels.
Toilet paper. Use internal side of the peel, not the external one. Unlike tree leaves, banana peels are not dried fast and can be saved for a longer time. Their internal side presents natural organic foam that absorbs all the leftovers from the skin better than the regular toilet paper. At the same time, banana is soft like baby wipes because it is naturally wet, again unlike the regular toilet paper. Though to prevent mold and rot, it is better to store them in the fridge.

Leafs from trees

Toilet paper. Especially if soaked with water.
Fuel for fire.

Sand

Filler for the toilet. See infra.

Soil

Filler for the toilet. See infra.

Urine

It should be used somehow, nope?

Paper

Under the paper category I put everything made of paper: packages, used paper after writing and painting, envelopes (see also infra).

Cardboard

Bottom of the backpack. I can cut the cardboard and put it inside the backpack, to its bottom. So all the stuff in the backpack is now protected against falling and dropping. Especially if I have some valuable stuff in the backpack such as the laptop etc.

Car seat cover. Cardboard is usually big enough to cover the major part of the car seat.

Filler for the toilet. See infra.

Heat insulation. Cardboard is officially recognized as agood heat insulation material thanks to its structure. It contains empty spaces of air in between paper lawyers. So I can stick cardboard sheets to the wall to make my room warmer. I place it on the floor if I sleep on the floor to make my "bed" warmer. In extreme cases, I can cover myself with cardboard while sleeping, or sleep in the big cardboard box (like the one for the fridge). Homeless people do it that way to stay warm at the street.

Packaging material. Cardboard also can be used as a packaging material.

Protection for anything. Basically cardboard is perfect material for protecting literally anything. I can cover my laptop with cardboard or any other type of appliances. So I am not afraid that my staff would be damaged as a result of falling down to the floor.

Putty board.

Tablecloth. Especially when camping. Tablecloth or one time dish place. Useful for fatty and oily food, to protect the main table surface.

Envelopes

As a paper. First of all, envelopes are made of paper. Despite that I put them in the separate category (thanks to their form), they can be used as a regular paper supra.

Envelopes. Another obvious use of the envelope is the envelope per se. We can place a new postal stamp and send the mail without buying new envelope.

Filler for the toilet. See infra.

Folders for sorting. Multiple envelopes can be used as folders to sort our stuff out. Apply the mathematical statistics law here. Every envelope has flexibility. If the envelope contains a lot of stuff then its size becomes bigger  If the envelope is empty then it is very small and thin. So if we have a box consisting of 10 envelopes, each envelope could be different in its size. However according to mathematical statistics law, the sum of sizes of envelopes (which is the size of the box) will remain relatively constant. That is very convenient for organizing and storage of our stuff. See my set of labels and envelopes here.

Trash bag. If the envelope is big enough, it can be used as a garbage bag also.

Clean paper 

Clean paper means paper where at least one side is clean.

Dirty paper. Clean paper firstly can be used as a dirty paper if there is lack of dirty paper.

Envelopes. If there is lack of envelopes, we can make an envelope out of the clean paper. With a tape or glue.

Filler for the toilet. See infra.

Print and paint. So we can use it again to print something, make a label for the section of the dresser, make a note, paint etc.

Dirty paper

Dirty paper includes any paper where something is printed on the both sides. So I cannot use it to print something again, make a note, paint so etc.

Filler for the toilet. See infra.

Packaging filler. It is also the option for use of paper if it is crumped.

Toilet paper. The most obvious use of the paper is toilet paper. Nope, we don't use it dry. To make a regular paper soft, we just make it wet. Add water and it becomes as soft as baby wipes. Even cardboard can become very soft if we put it in the water for half a day.

Plastic

0 Any plastic

Compact storagePlastic can take much space when stored and not used. So we can cut it in flat sheets by simple scissors. Flat sheets joined together do not take much space. Another form can be achieved via heat gun - melt it but do not burn it. Preferably hold the breath while melting because of harmful exhaust.
Donate to recycle trash can
Repair other plastic things. With a heat gun, we can melt (weld) plastic to plastic.
Repair shoes. With a heat gun.
Melting into... clothes buttons

Bottles (plastic bottles)

Bird feeder
Broom. We can cut a bottle into stripes. Then tie them into a broom.

Cans. Any plastic bottle can be easily cut into a can for storage of something. Like bolts and nuts e. g.
Funnel. If the bottle neck is thin enough, it can be used as a funnel.
Garbage bin
Ropes. We can cut a tape from plastic bottles and use it as a rope.

Floss

Reuse as a floss again. Soak in some disinfecting liquid and reuse again. I personally do it by washing it with water after every use. My teeth are still alive.
Thread. To sew up something.

Net or screen (like mosquito screen)

Laundry bag. Bag for dirty clothes washing: the net can be sewed up into a bag. In turn, we can put our dirty clothes in the bag. Then bind one side of the rope to the bag. Bind another side of the rope to the tree at the river coast. Put the bag into the river at night. In the morning, dirty clothes will be washed. No powder is needed.

Polyethylene bags

Filler for the toilet. See infra.
Same as plastic film. Plastic bags are made of plastic film. Hence they can be used the same as plastic film.
Trash bags. Usually store plastic bags are smaller than the regular garbage bin. So we just need to find smaller bin for them.

Polyethylene film

Source: Plastic film can come from various types of the garbage: plastic bags, plastic (polyethylene) package etc. 

Cover for car seats. If plastic film is big enough it can be used to cover the car seats. And like cardboard the film also protects against liquids.

Filler for the toilet. See infra.

Handkerchiefs. One time or many time uses.

Packaging filler. If folded(crumpled) and packed up into a plastic bag, film can be used as a packaging filler.

Staples from food

0 Source. Usually they come with food packaging.
Clothespins for clothes drying. I personally use them this way.
Staples for cable. To fix a cable on a wall using staples and pins.
Filler for the toilet. See infra.

Styrofoam

Crush it and fill puffer jacket or house walls with it. Styrofoam is known as a great heat insulation material.

Sheets

Filler for the toilet. See infra.
Putty knife. Plastic sheets are flexible enough to be used as a putty knife. They can be joined with a lid from metal can, to make the putty harder.
Protection. Small plastic sheets can be sticked together via tape, duck tape or even needle and thread. Than we can use it to enforce anything- clothes, electronics cover etc.

Tape

Bottle handlers. Apply multiple lawyers of tape around the bottle to make it stronger.

Enforcement. Both regular tape and duck tape can be used. Last one is even better and stronger.Both new (in case of surplus) and used tape can be used and reused. Used tape is still sticky and can be applied thus. Even if it is cut in small pieces or it has a glue gaps in within, we still can make a strong and reliable surface out of it. Just apply numerous lawyers one above each other. One twig is not reliable however numerous twigs build up strong broom. One thread is weak, however numerous threads build strong rope.

When multiple lawyers of tape are applied, it acts as a strong and at the same time flexible material. Flexibility results in amortization and protection from accidentally falling down or hitting. 

Strength of multiple lawyers is a known principle in manufacturing process. It is used when making plywood and fiberglass. Plywood is nothing but multiple thin lawyers of wood. Fiberglass is also made of thin fiber pieces.

It is preferred if the item to be enforced allows tape to make a full circle. E. g. a bottle or a box. Bad example is a big wall of the room - wf can stick used tape there, it will be flat without a full circle, so it will not be reliable and can fall out this. 

It is better to apply tape immediately after we take it out from the previous surface. Otherwise later it becomes crumpled and difficult to unfold.

E. g. the following items could be protected:

- Glass. E. g. glass bottles etc.

- Plastic. E. g. plastic bottles, boxes etc.

Toothbrush

Painting. Used tooth brush that is not good for brushing teeth anymore can be used at home yet. We can apply  some liquids with a toothbrush such as rust converter, paint etc.

Rubber

0 Any Rubber

Rubber trash could include used tires from bikes and cars. Tire protector could be destroyed or the tire could have a hole. Damaged children balls are also made of rubber.
Filler for the toilet. See infra.
Packaging filler. As any compressible stuff, rubber also can be perfectly used as a packaging filler.

Tires (bike)

Band. Medical and Yoga bands are made of rubber. They are not expensive though. Anyway, the bike tire can be easily converted to a fitness exercise band.

Tires (car)

Amortization and protection for garage walls. If we put tires long the back wall of the garage, it will prevent cars from hitting and possibly breaking the garage walls when parking.
Flower bed.
Fence. Though it is not tall, it is still a fence. We can dig tires into the ground by half of it's height and the remaining half would serve as a fence.

Gloves (rubber gloves)

If we have just one cut in the rubber gloves, they still can be used with another pair of damaged rubber gloves. E. g. one pair has damaged left big finger and the second pair has damaged right middle finger. So we can just put on both pairs of gloves and finally nothing is leaking to our hands, we have double protection.

Water

Rain

Washing machine. Put clothes outside and let the rain wash them.
Water collection. Will the rain barrel. For future use.

River

Washing machine. Put clothes in the laundry bag then bind laundry bag to the rope. Bind another side of the rope to the tree. Put laundry bag in the river. 
If there is no tree, we we can use heavy piece of metal or the rock instead. Just bind the rope to the rock or the metal so it is binded reliable. Put the rock or the metal to the bottom of the river. Need to know the exact place of the river bottom where we will take it from on the next day.
Water collection. With bottles, buckets etc, for future use.

Wood

Branches

Broom

Wood sheets

Putty board.

Wood sticks

Fire fuel.

Pallets

Chairs

Bed.

Usage types

Cover for car seats

Especially expensive cars definitely need it. Not only natural wear and tear can cause damage to the car seat. It is easy to drop a drink on a seat. The child can be sick, nausea would my deceit dirty and damaged. I personally place a heavy cargo with my tools on the rear seat when it is free of passengers. The cargo can scratch the skin of the seat. It is especially painful if their seat is made of natural expensive skin. Following materials can be used to cover the car seat and protect it from damage:
Plastic film. Can be used for cover of cover seats if it is big enough.
Fabric. Multiple pieces can be sewn together to make the whole part of the fabric bigger.
Cardboard. Usually it is big enough to cover the major part of the car seat.

Gloves

Plastic bags. As a rubber gloves for one time use.

Handkerchief

As a handkerchief (one time use or multiple times), the following can be used:
Fabric.
Plastic film.
Plastic bags.
Dirty clothes.

Packaging filler

Any compressible trash can serve as a packaging filler. Just need to make sure it is dry and clean.

Putty knife

Plastic sheets.

Putty board

Cardboard.

Wood sheet.

Sell to recycle center

The following types of garbage could be sold for money to recycle center. Getting money is the best way to use unused trash. Though amount of money is usually not so big, I could be bigger if weight of trash accumulated is big enough.

Metals. Iron is the cheay one. Aluminum and copper are much more expensive.

Cables. Because they contain valuable metal (copper).

Glass. Cheaper than metal. However glass weight is big because glass is very popular type of trash.

Plastic bottles.

Toilet

Portable toilet for poop for a human can be created based on the home toilet for cats. That could be useful inside of any room/building without access to the restroom. E. g. warehouse or construction facility, house with broken sewage etc. In the forest, we can just poop on the ground and dig it into the ground. However inside of a building or facility we don't always have such an option. 

Portable toilet consists of 3 main components:

  1. Flat rectangular plastic box. It should be plastic to be water proof (because poop can contain liquid that can flow out and cause ecological and bio-chemical disaster in the room). We need a box because it has walls, and walls can protect surrounding areas of the room in case of accidental process when landing operation is not straight.
  2. Flat plastic (or made of any other water-proof and at the same time flexible material) one-time use surface. That surface is to be replaced every time. That could be plastic film, plastic bag etc. That surface lays down at the bottom of the plastic box supra. To use sheet surface as a toilet, unfold it and place to the bottom of the box. If possible, use 2 or even 3 lawyers of the sheet to provide additional protection for the floor against the poop.  Any water resistant flat surface (plane, sheet) can serve as a portable toilet for poop but not for pee. Don't use the sheet made of hard (not flexible) material like cardboard. Because it will not be easy to fold after we did our business. 
  3. Filler that is laying down on the flat surface. Filler can be any type of trash - paper, small plastic pieces, organic waste etc. Filler serves for additional absorption of the poop to prevent its spread. Filler is to be changed every time after every poop. For humans at least, not for cats lol.

Than poop in the position of an eagle. Than carefully fold the sheet and place it in the plastic bag together with the toilet filler. If possible use 2 or 3 plastic bags to provide additional protection against leaking. Than trash plastic bag in the nearest garbage container.

That type of the toilet is for poop but not for pee. For pee, males could use plastic bottles instead. For females, other means should be developed.

Sheets made of the following materials can be used as a portable one time toilet surface:

Cardboard. Though it is made of paper, it could be considered as a water resistant material just because it is fat enough.

Film.

Plastic. Could even serve multiple times if washed.

Plastic bags. They are of the same shape as plastic film.

Toilet paper

The more paper is soaked with water, the healthier and convenient it is for our skin. That's why mom's use baby wipes for babies instead of a regular toilet paper. Surprisingly, some kinds of trash are already naturally soaked and wet like banana peels. Following types of garbage can be used as a toilet paper:

Banana peels. Not needed to be soaked, they are already naturally wet (the internal side only).

Paper. No need to crumple it up. Instead, soak it with water. Don't add anything else to water to avoid possible skin allergy.

Washing machine

Rain. See supra.

River. See supra.


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.

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

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





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. 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:
0_Unsorted_
Aluminum
Bags fabric
Batteries
Belts
Bottles, containers
Cardboard
Cases for the phone
Charge Connectors Adapters Converters
Envelopes plastic small
Fabric
Ferrum
Film
Floss used
Folders plastic
Glue
Goggles
Keys
Labels for folders
Magnets
Markers
Paper clean
Paper dirty
Paper to scan
Phones
Plastic
Plastic bags
Rubber
Rubber gloves
Rubber rings
Sanding paper
Scissors
Receipts and labels for the store
Tools plastic
Wire
Wood






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. 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. 




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

Decision taking, making choices

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?

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. 

Intuition

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

Make the first step and wait

Often the way is unpredictable and step on a road depend on each other. 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.



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