Monday, May 31, 2021

Motivation for car repair..

Many guys prefer to be artists as a hobby. In turn, the occupation of artist can match itself with some other occupations: welder e. g. Any welder can confirm he feels himself as an artist. Moreover, many welders do arts in the spare time.

So car repair is also kind of art. The art we can fall in love with. Whether it is body work such as sanding and painting or some kind of mechanical replacements. Just be an artist.

Falling in love is a similar feeling to getting a job offer

When we really like someone and that someone likes us back we fall in love. What is love feeling per se than?

It is merely relief from stress caused by fear. In case of love the fear is about fear to stay alone, fear not to have descendants etc. Like for a job - when we get a job offer we get a relief from fear of living without money. That's it.

Saturday, May 29, 2021

Linux (Ubuntu) tips and tricks

File manager (File explorer) with expandable tree

Often the simple "Files" app is preinstalled in Ubuntu.
Unfortunately, the expandable tree view is not setup by default. To show it, press the hamburger menu in the top right corner.

In the pop up window, press "Preferences".

Check "Allow folders to be expanded"

How to change terminal theme

Unfortunately, obvious way does not work. In Ubuntu terminal, we click hamburger menu in the top right corner -> Preferences -> General -> Theme Variant -> and nothing changes...
We select "Dark", however the terminal is still light..
Instead, we need to go to Hamburger menu in the top right corner -> Preferences -> Profile name (in our case "unnamed") in the bottom left menu -> Colors -> Built-in schemes. Voila!

How to include an app in startup list of Ubuntu

Press "Windows" button.
Type in search text box "startup"
Press "Startup Applications Preferences"

Press "Add"
Press "Browse" and choose path to the script infra.
If we add script, we need to create .sh script file with the commands to launch upon a startup. In the .sh file, we list commands to launch programs at startup like if we would launch them from the terminal.
Then we need to make this script executable by running in the terminal:
chmod +x myscript.sh
where "myscript.sh" is the name of our script name

How to turn off the Caps Lock key in Ubuntu

Open the Terminal and execute the following command:
xmodmap -e "keycode 66 = Shift_L NoSymbol Shift_L" 
Credits to this askUbuntu question.

Internet does not work

It could happen especially after the system update. In that case, there would be an error sign with unknown error in the corner of the task panel.
Check the Internet source (i. e. the phone's Wi-Fi hotspot), reload it (reload, reboot the phone).
Try to connect to another Internet source (another Wi-Fi).
Restart the laptop.
Do hard reset instead of regular restart for the laptop: when it is turned on, press the Power button and hold it pressed for 10 seconds to completely turn off the laptop. Then turn it on again.
If nothing of this helps, google the problem and ask the question on forums.

Set up directory to open at terminal startup (by default)

vim ~/.bashrc
In the end of the file, add the following line:
cd "my default directory"

Increase the sound above limit

If the current sound level is not high enough:
Press "Windows" button
Type "Sound" in search box
Choose "sound" in Settings
In the "System volume" section, toggle "Over-Amplification"
Increase the sound level via regular increment button

How to hide the computer and user name in every line of the terminal

Open in the terminal ~/.bashrc file with any text editor, e. g. write in the terminal:
vim ~/.bashrc
In the end of the file, add the line:
export PS1='$ '

Exit the terminal and launch it again. Now we should see the empty name in the terminal command line:

$ 

Friday, May 28, 2021

There are still commands I don't remember yet for the Terminal. Learn them...

Advises for startups from Paul Graham

Full video is here.

I intentionally didn't include some of Paul's notes. Though I agreed with most of them. The key notes I made are:

  1. Hire a person only after spending much time together. It should be a reliable person, not just a nice person. "There are too much guys who know how to be nice for a short time". I personally would hire for a full time job some freelancer after he successfully made multiple useful (and I paid for that) instead of just a guy after half an hour interview.
  2. Know your customer, not your business. Airbnb founders lived and slept with their users. Mark Zuckerberg launched Facebook first among his own classmates.
  3. Startups are time-consuming. It can take all my life. Thus, the only way to succeed is to make what you love. Vice versa doesn't always work: you cannot force yourself to love something (or somebody) if you don't want to. So don't do a startup just for money. Another way to choose a startup niche is to find my life mission. If I know what did God send me to this planet for, I am pretty confident in what should I spend all my life on.
  4. Do something just for 2 guys - yourself and your friend. Paul Graham told about the guy who created a peer-to-peer audio chat to talk to his girlfriend from Thailand while he is abroad, to save money on phone charges. At that time, he even didn't think to upload such software on the Internet to let people widely use it around the world. The greatest benefit of making a software for my friend is immediately and continuously getting feedback from him/her. Agile implemented for free.

How to find proper amps for welding

Measure the metal thickness with callipers.
According to the given thickness and based on the tables from Internet, establish proper amps on the welding inverter and take proper rods.

Calipers - how to use?

Thursday, May 27, 2021

Instinct of maverick, Instinct of travelling, Instinct of be a nomad, Instinct of be homeless - human definitely has such.

Many people often describe the time of being a nomad as the most happy part of the life.

Diet optimization.. Eating once a day?

If I eat breakfast only, I feel myself good for the whole day. Should I eat once a day only? Breakfast only? Dinner only?

Best full time anime ever? Need to watch...

Superheroes lived in slums

It is a kind of romantic, adventure and pleasure of extreme to be homeless, travel with a tent, do van dwelling, hitchhiking etc.

Many superheroes were homeless, lived in a alum, a cave etc. E. g.:

  • Deadpool: a dirty slum with old blind lady
  • Wolverine from X-Men: he slept in a cave, in his car, in a camper.
  • Brother (with Sergei Bodrov): upon arriving to Saint Petersburg, he slept in old park with other homeless people.
  • ? to be continued ?
When being homeless, the person becomes free. He realizes, that basic human needs could be satisfied without money, without a full time job. With such freedom, he has less fears also. He is not afraid of losing a job or losing finances. Superhero has no fears.


Tuesday, May 25, 2021

SpaceX - the most incredible history of the most incredible company...

Fear is a root cause of most problems

Allen Carr said in his book "Easy Way To Stop Smoking": if I would need to give the contents of the book just in 2 words I would say: stop be afraid. That's it. Have no fear and you can stop smoking. That is very deep thought, not easy to understand. That's why he wrote the whole book.

The more important thing is that this principle is applicable to other areas of our lives. In any conflict, stop feeling fear. Than you can win and overcome. Japanese samurais wake up every morning ready to die at that day. American Indians have an expression 'today is a good day to die'. That's why they are good and happy warriors. They have no stress, because they have no fear.

That is a secret for the happy life. We have stress and depression because we are afraid of something. Religious true believer knows (not just believes) the God. Thus, he is not afraid of anything happening in humans lives.

It is not a shame to lose. It is a shame to have fear.

Fear per se is much more harmful than the object of fear.

God helps us if we are true believers. We are true believers if we have no fear. God is the only one who should we afraid of.

I apply theory of fear to manage anger during stressful conflict. If I feel anger after the conflict, subconsciously it is anger towards myself because I was feeling fear during the conflict.


Looking at the satellite Google map and discovering places to travel to - another type of Activity with the phone

How does food affect our mood?

This question still presents a puzzle for me. I see only pieces (factors) affecting my mood however I don't see the whole picture.. Experience and observation give the following facts:
- After eating sugar, mood improves. E. g. pure cane sugar, cookies etc. Hence, probably mood depends on the level of carbohydrates (because sugar is carbohydrate).
- After short physical exercise, mood improves. Probably mood depends on the level of oxygen in the blood. When we exercise, we breath more. The more we breath the more oxygen comes to the body.
- After long (2 hours or more) physical exercise without eating and without a rest, mood comes down. Again probably this is because of exhausting carbohydrates.
- If I slept not much, in the second half of the day mood is low. Thus, not only food affects our mood. So does sleeping well.
- If I didn't do much physical activity, and at the same time eat a lot of fat food (e. g. in the morning), I feel myself bad. Probably, fat food not consumd directly to muscles results in some kind of toxins that affect our mood.

How to manage anger..

After the conflict

After being insulted and offended, we often feel stress and anger. Important is that all our emotions are generated by some part inside of us and directed to another part inside of us. Not outside. Why?
In democratic country, anger of citizens is directed to local politicians. In turn, local politicians try to blame some external enemy, other country etc, to waive their own responsibility.
The same is for our body. The external enemy per se is not our enemy - he is our teacher (as per the great Socrates). He showed is, that during the conflict our own politician acted e. g. like a coward (which is not acceptable for our citizens). Thus, instead of blaming external enemy, we need to make a conclusion and learn the lesson, what would we do differently in the similar situation next time.

After losing something

Say somebody stole something that is extremely valuable for us. Or somebody hit us, so we fell pain and injury. For truly religious believers, the answer is pretty simple. See more about applying religion in real life here.
One very smart and very rich investor once told: "It is not yours - it is His".
Even if we own $billion, it is not ours. On the bank account, there is our name listed right next to the money amount. However in fact this money is not ours. It belongs to Him, everything belongs to God. We cannot take all the money to the graveyard, early or later we all be there. If we earned something - it is because of God only. He did it on purpose, he gave us a gift and he is waiting for us to use this resource to complete our life mission.
So back to the initial problem: how can we feel stress if somebody stole something that does not belong to us? Why should we carry about money stolen that is not ours? God gave, God took it back. It is not hours.
The same is for everything else. If a relative dies - we should not cry ever. 
    But Jesus said unto him, Follow me; and let the dead bury their dead. – Matthew 8:22.
If we cry about dead relative - that means we don't believe that his soul is alive after death - that means we don't believe in God.

Questions to ask yourself

Did I call the person I am angry on? Meet he/she personally and let him know your problem. In the most cases, problems are resolved after personal meetings.
In the most cases, revenge is not necessary, after we respond to ourselves to the following questions:
What bad things did I do for my enemy in the past?
Did my enemy suffer from other circumstances? (e. g. cancer illness etc)
What good things did my enemy do for myself in the past?
Have I ever committed something bad towards other person, so I left unpunished?
Do I have to worry about something more important? Or don't have anything else to do? Can I postpone my anger and revenge for the future?
In case of steal, did I really use the object being stolen? Maybe it is better for the global efficiency that somebody else will use it more efficiently? Karma will return us something as a present in the future.

High importance and low importance

If we are angry on something, that means the object of anger is very important for us. It has high value and high importance. Or maybe it is just because we overvalued it? Or maybe it is because we undervalued everything else in our life?




Monday, May 24, 2021

Importance of DNA for the startup..

Work on the DNA. DNA is the smallest and thus simplest thing to create, the simplest thing to do. At the same time, it is the most important part of any organization. Healthy DNA will replicate itself billion times and create a healthy organization. Non-healthy DNA... vice versa.

Friday, May 21, 2021

Startup: how to:

Motivation and intention

Fight the fear

Not only this is required to jump start the business. What is more important: to sustain and keep motivation reliable continuously during long period of time. Failures and weather changes should not prevent us from keep going.

Michael Seibel said: "I know the guy who grew up during terrorist bombings in Colombia. He has done it very hard. And you are telling me that merely doing a startup is hard?"

Enjoy the process

Michael Seibel from Y Combinator in his cool speech described the reality of startup world. More than 90% fail. Majority of those having success make their founders financially independent in about 10 years from start. So the question is are we ready to waste 10 years of life if we get nothing out of that with 90% probability? The answer is yes if and only if we enjoy these 10 years.

How can we enjoy them then? There could be 2 options. First is just doing what we like to do. Engineers like coding, painters like painting. We should not base a startup on the activity we don't like. Second is to find our life mission. It is honorable to deserve life to something great, to change the world, to build a temple. Investors of Silicone Valley are overwhelmed and tired of people who are doing startup just for money.

Low burning rate

Experience is of Michael Seibel from Y Combinator. At the first stage of startup (though later on also) low burning rate is critical. Many startups fail just because investment money are over, founders are not engineers and 3rd party engineer needs his paycheck every month. Unlike this, the best case is when the founder is an engineer, doing van dwelling instead of paying rent, eating food pantry instead of store groceries. If the burning rate is next to zero, investment money is not important for the startup.

Launch as fast as possible

Feedback from the first customers is crucial. Otherwise, we could lose months or even years developing something nobody needs.

How to get first customers?

Michael Seibel from Y Combinator: friends and investors are not our first customers. The best bet is to think about: where is the society of customers who are screaming about this problem? Who will say "Thank God this app exists!"




Mobile App Startup - how to ??

Wednesday, May 19, 2021

How to turn the car wheel into the winch?

Why buying a separate winch when car's own engine already gives a good tork to the wheels?

Tuesday, May 18, 2021

How to post new release of mobile app onto the Google Play

Steps

  1. Apply android:visible="false" option to the code (e. g. menu items) that was needed for debug purposes only.
  2. Change version code.
    1. To find it faster, in Android Studio choose menu Edit -> Find -> Find in Path -> search "versionCode" keyword. Or press Ctrl+Shift+F.
    2. Change versionCode in build.gradle file: increment it by +1. E. g. if the previous versionCode was 6, now it should be 7.
    3. (Optional) Change versionName right before the versionCode in the same file to the consequent similar value.
    4. Sync gradle files after changing the version name. Usually Android Studio suggests to sync in pop up menu after making any change in gradle files. If there is no pop up, just build the project again.
  3. Make (build) signed aab (or apk) file.
    1. Press in Android Studio menu: Build->Generate Signed Bundle/APK
    2. Go through all the windows by pressing "Next" and eventually "Finish" buttons. At the last step, choose "release" option.
    3. If Studio asks for the keystore path:
      1. It could be (at least on Linux) in ~/. android/debug. keystore. However, if we list wrong password for it or other wrong parameters, Studio won't successfully complete the release build.
      2. Try to find old key on our backups, say at Google Drive, and use it.
      3. Worst case: Instead, we can merely create a new keystore (there is a button for that). Than we need to specify new location and new keystore file name, and create password for that. The worst here is that for new key we need to sync it with Google Play Console.
    4. Wait until it is done.
    5. Once finished, Android Studio in the bottom right corner will show pop up (like Toast) message. Click on it, link "locate" allowing to locate the new file. Don't mess it up with the wrong location when uploading to Google Play Console. The location could be like "my_project_folder/app/release". There could be 2 files - aab and apk.
    6. The right one is the file that was last modified (see the "Modified" column in the File Explorer window).
  4. Upload the aab (or apk) file to Google Play Console.
    1. Go to Google Play Console.
    2. Click on the right app in the bottom of the screen.
    3. At the left panel, click "Production".
    4. In the top right, click "Create new release" button. Sometimes when we press "Create new release", close the web page and than reopen it again, the web page shows "Edit release" instead of "Create release". So press "Edit release" then.
    5. In the section "App bundles and APKs", upload the file of aab (or apk) created previously. Usually it is in the project_folder/app/release.
    6. Wait until upload finishes. If doing for the first time, usually it highlights some errors in red on the web page. Well, we need to fix them then.. See also "Common errors" section infra.
    7. In the right bottom part of the page, press "Save" button
    8. After saving, in the same right bottom of the page, press "Review release" button that became blue after saving.
  5. Finalize the release
    1. Should an error pop up at this stage, 
    2. press "Edit release" button in the right bottom of the page.
      See also the list of common errors below.
    3. If there is no errors, press "Start to rollout" button in the same right bottom of the webpage.
    4. Unlike errors, sometimes there warnings highlighted in yellow (not in red). Usually it is due to excessive amount of code not used etc. For now we don't care about warnings and still can proceed.
  6. Wait until Google completes the app review
    1. From the main page of Google Play Console, go to your app in the bottom of the page.
    2. Click the "Production" tab on the left pane.
    3. Click the "Releases" section and see the status of the latest release. Immediately after uploading, the status will be "In review". 


    4. However later Google will change it to "Available on Google Play". For the first time, review can take multiple days. Every next review is proceed faster though. Now we can download it from Google Play and check the production version :)

Common errors

If Studio does not explicitly tell, what goes wrong, open "Event Log" in the right bottom part of the Android Studio window.
So problems might be as follows:

Unrecognized languages

Problem:

Ready to send for review 

If the app is stuck at this status, go to left pane -> Publishing overview -> submit for review again.

Unrecognized languages

Problem:
Your App Bundle targets the following unrecognized languages: us. The list of supported language codes can be found in the IANA registry. Invalid languages caused by third-party libraries can be excluded using the resConfigs Gradle property.
Solution:
Google per se suggests the solution with manually shrinking the language resources. 
At the app-level buld.gradle file, we can specify explicitly which languages to use by including resConfigs property into the defaultConfig section:
There, we need to specify language not listed in the error text. E. g. if the error says "targets the following unrecognized languages: us" then in build.gradle I specify resConfig("ru").

Signing keys

Problem:
Problems with signing keys, when Google Play requires to sign the app with the initial key while I signed it with the different key. 
FYI, at the Google Play Console, keys are located under "App integrity" menu:
So the idea is we use wrong key when building the release supra locally via Android Studio. This might happen when e. g. we started working from another computer and generated locally new key. The option here is to find our old key. I personally store it at Google Drive (though I admit it is not a best idea). Usually this file has "jks" extension. So we can download the old key from backup and then use it to build aab file via Android Studio (see supra "Make (build) signed aab (or apk) file" -> Press in Android Studio menu: Build->Generate Signed Bundle/APK). 
If the old key is not found, we can generate new one. Though it is more complicated because next we need to sync it with Google Play Console.

Conclusion

Google often updates its interfaces. So if something is not relevant anymore, please curse me in the comments below :)

Saturday, May 15, 2021

Print paper version of the Gang of four book about programming patterns

This would allow me to read the text in a sunny weather outside, when I'm doing some manual work. The phone screen is not readable when the weather is so sunny so I cannot read the book from my phone.

Thursday, May 13, 2021

Removing rust from the car..

  1. Initial preparation.
    1. Wash the car. The entire car. Usually during the work, we often find some unexpected spots to be painted.. So it is better that the car is already washed by that time.
    2. Whole part vs small piece. Consider painting the whole car or the whole part of the car instead of small stains. E. g. if there are multiple stains on the same door, it is easier to repair the whole door. So we can save time and improve quality of the car for the future. We don't need to spend time for sticking pieces of paper to cover door partially. We just clean everything, sand everything, prime everything and than paint everything. Eventually getting the new door as a result.
    3. Working clothes. Dress on working clothes, do be afraid to stay dirty. We don't want our best suit to be randomly painted.
    4. Water source. Make sure that there is a water source nearby so I can clean hands, face or eyes very fast in case of chemical polluting.
    5. Cover everything. Food and other stuff are sensitive to dust, dirt and exhaust.
    6. Air conditioning. Room of the building should be well ventilated. The best option is the garage with the open car door. It provides good ventilation and at the same time protection from the rain.
    7. Respirator. Take on the respirator to protect the lung from dust. Simple mask doesn't provide a lot of protection like respirator. So if I don't have a respirator I merely hold my breath for a minute while working on certain area. Respirator is needed both for painting and for grinding (sanding). It might take some time to move respirator around the nose up and down to make sure it is tigh. If if is not tigh, we feel air flowing out near upper part of the nose breathing outflow.
    8. Rain protection. Make all the steps of the work are done not outside. It is highly recommended that the car does not leave the garage / shelter until absolutely all the work is done.
  2. Sanding
    1. Alcohol. Before sanding, cure the surface area with the alcohol. So during sanding we don't mix any surface oils deep in the metal.
    2. Take the car out of the garage. Otherwise, everything in the garage will be covered by dust as a result of sanding.
    3. Power tools. Always use power tools when you can instead of sandpaper. Sanding is really time consuming process and power tools would save us hours of work, sometimes even days. 
    4. Sandpaper. Otherwise, use sandpaper graded as P80 (the lower the grade the more aggressive sand paper is). Clear rust with sandpaper. Sand down the area. Use metal file in hard cases lol. Paint around the damaged area should also receive a good sanding, since the filler doesn't stick well to paint, wet, or humid surfaces. Use40-120 grit sandpaper.
    5. Difficult areas. To access difficult areas, use thin metal brush attached to the drill.
    6. Brush. Power tools with brushing add on are preferred. We can vacuum dust also.
    7. Back of the surface. Take a look at the back of the surface - it also could be rusty. Clean it up with the water to remove all the dirt. Then look for a rust there.
  3. Rust converter.
    1. Vs rust remover. It is easy to mess rust converter vs rust remover. The stuff we really need to eventually paint the car part is rust converter, nog the rust remover. Rust remover is for hardware such as interior of the engine etc which is not to be painted later.
    2. Rubber gloves. For steps below, take on rubber gloves. To protect hands skin and to avoid excessive hand wash, especially if water is limited in the garage.
    3. Alcohol. Before rust remover, apply alcohol to remove excessive fat from the surface.
    4. Shake. Shake the rust converter bottle before use.
    5. Rust remover. Use rust converter liquid after sandpaper work, to make sure there is no rust at all. 
    6. Separate bottle. Put some part of a bit of rust converter to the separate bottle, so the brush will not damage the initial stock of rust converter. The bottle should be plastic not metal.
    7. Apply the rust converter with a brush or sponge. Wipe a thin layer of rust converter onto the metal and wait 15 to 30 minutes for it to dry. Some rust converters require to wait up to 1 day, read the instructions. Then add a second layer and wait at least a half hour for it to dry. Instead of rust converter, vinegar also could be used. Some rust converters require 2 step application with difference of say half an hour. So read the instructions for the particular rust converter carefully. 
    8. Don't put rust converter from the temporary bottle back to the initial bottle.
    9. Do not use the following rust converter because of its poor quality (I checked)
  4. Body filler.
    1. Alcohol. Cure the surface with alcohol to clean any oils.
    2. Dent the metal. Before body filler, to let body filler properly stick to the metal.
    3. Prepare putty knife. Before using your putty knife to spread joint compound, wood glue or construction adhesive, stick a piece of clear packing tape onto the blade. 
    4. Also clean putty knife from the previous putty leftovers if it wasn't done yet.
    5. Body filler. Like "Bondo". Use the one with the fiber glass. Use body filler, paint all the surface after rust. If there is a huge gap (hole) in the metal, apply body patch also. To mix body filler in a right proportion, make a circle 1/2 inch height of body filler and cross it with the thin line of hardener. Use scissors or screw driver to open the can with the body filler if it is difficult to open. 
    6. Multiple lawyers. Use two or three thinner applications with obtuse angle of the putty knife if needed, rather than one deep layer, which is harder to apply smoothly and may sag before it sets.
    7. Positive experience. Good experience was with the following body filler:
    8. Clean putty knife. Chisel can be used for that. Or grinder with sanding wheels.
    9. Dry. Usually 15-20 minutes, but check out the manufacturer instructions for the particular body filler to be 100 percent sure.
  5. Sanding after body filler. Following instructions I took from here
    1. Take the car out of the garage. Otherwise, everything in the garage will be covered by dust.
    2. When the filler is hard, use 240 grit production paper. Power sanders can speed up this part of the job but care must be taken not to remove too much of the filler, particularly if using rotary sanding disks. Final shaping is best done with a flat sanding block with abrasive paper attached. Sand in straight lines, changing direction regularly to avoid sanding low spots or grooves into the filler. For the same reason never sand in a circular motion as this removes filler too quickly from the same spot. Once the filler seems to be very near the required shape change to a finer grade paper, eventually finishing with higher grit. Small pinholes and low spots are usually filled with `stopper', which is basically just a very fine filler. Polyester Stoppers are used in exactly the same way as body filler, but are meant for use on smaller areas. Cellulose Stopper, or cellulose putty as it is sometime called, requires lengthy drying times between coats and is still prone to later sinkage. Very thin coats are an absolute must, with at least 30 mins between, preferably longer. 
    3. For grinder, use flap disc instead of Velcro disk.
    4. Finish with the sanding sponge to make the form even.
  6. Paint
    1. For all the steps below
      1. Garage protection. Don't move the car. There is no need to take the car out of the garage. Painting does not produce dust. So just make sure that your clothes and any stuff in the garage are not so valuable to be damaged by painting. The only most important task is to close or remove all the food and drinks out of the area.
      2. Car protection
        1. Intend of protection. Before painting, protect the surrounding areas of the car. Otherwise, we can paint something that we don't need to pain like mirrors or windows lol.
        2. Material for protection. Big piece of fabric is the best. Or big piece of film. The bigger the piece the more convenient it is to cover because we don't need to tape numerous small pieces to the car and to each other. or plastic film is perfect. We can use cardboard for large areas (like the front windshield), but all the edges of the cardboard should be sticked with tape because the cardboard per se is not tight to the car surface, so the paint spray could leak in between them.
        3. Area of protection.
          1. Critical parts. The most critical are parts of the car made of glass: windshields, mirrors. Though the paint could be cleaned from the glass afterwards, it is better to protect the area beforehand. 
          2. Painting without primer. Sometimes we use paint without primer, e. g. when we need to paint putty only, not the metal. We suppose that we use paint of the same color as the color of the remaining car parts. Then, we don't need to protect surrounding areas other than glass and door handles. Because paint of the same color would not harm car parts of the same color.
        4. Tape to choose. There is special "painters tape" in the store. Be careful with the tape. Some types of the tape like duck tape leave trace at the car's body that is not easy to remove later. Even regular plastic "scotch" packing tape can do this. It is better to stick the tape on the glass not on the painted metal. Otherwise sometimes the tape is removed from the painted part of the car together with paint.
      3. Human protection. Put on glasses, rubber gloves and a respirator. Instead of the respirator, I could hold my breath if the painting area is not so big. Then run away from the garage to breath again lol.
      4. Paint protection. To protect future paint from bubbling out as a result of poor quality of the surface we need to prepare the surface. Alcohol is the way to remove redundant fats, oils etc from the surface. Apply alcohol at each step - before priming, before painting, before using lacquer.
      5. Tools. Depending on the surface, liquid can be applied by spray, brush or roller. Good guide to the foam painting is here 
      6. Warm up the liquid. Place the can of the liquid in the bucket with warm water. Particular temperature is to be determined based on the instructions for the particular liquid. Usually it is around 20 degree by Celsius.
      7. Shake it. This is for sprays only. Whether it is primer, paint or lacquer - everything needs to be shaked for 2-3 minutes vigorously. We should hear the ball rattling around inside the can.
      8. Way of spraying. This is for sprays only. Spray in short smooth strokes from side to side across the metal, holding the can about 10 inches from the surface. 2-3 coats of spray should be plenty. Some manufacturers recommend to apply 2-3 layers with the interval of 30-60 minutes.
      9. Dry. Primer, paint and lacquer should dry for in average 1-3 hours before applying the next layer of the next spray. Read the instructions for the articular liquid though. Some of them might need up to 24 hours to dry.
    2. Priming
      1. Negative experience. With the following trademark.. This bottle is constantly leaking and spreading primer on everything around 360 degree circle.

      2. Intend of use. Make sure that the primer is formulated for use on metal.
      3. Color. Though it is not so important, it is better if the primer color matches future paint color.
      4. Use brush. It is better to spray primer on brush and then apply it with a brush on the surface. Otherwise it could spray surrounding areas. Primer color is different from paint, so then we need to paint again all the surrounding surface.
      5. Self-etching primer. Paint it on the area. Water-based (latex) primers shouldn’t be used on metal surfaces, as moisture can seep through and cause paint to fail within weeks or months. If we used body filler, epoxy primer can be applied on a body filler before painting.
    3. Paint
      1. Paint color. Find the paint color at the drivers side interior label, near of the bottom of the driver's door. It contains the code of the manufacturer car color. Note that if the car was repainted at some point of time, the code would differ. Don't try to find certain code in the local store - usually it sells only regular colors like pure white, pure black etc. Usually certain color paint can be ordered online.
      2. Intend of use. Make sure paint instructions say that it is intended for use on a metal.
      3. Way of painting. Result depends on the distance between spray can and the surface and interval time between lawyers. The bigger the distance and the bigger the interval, the better the results. Otherwise, paint can come out if we spray too close to the area. Spray multiple lawyers at 3-5 minutes intervals. Each lawyer makes surface darker. So apply more lawyers until the color becomes the same as of the original paint around. Apply at 25-30 cm distance or bigger. If the distance or frequency of lawyers is lower, the paint will be too thick and can come out later (wrinkling). So we need to wait for each thin layer to dry. Otherwise, liquid lawyer will remain under new lawyer and everything can come out later.
      4. Repaint if needed. If the paint wrinkles, take it out with the same plastic tool as used for door clips removal. Any thin plastic knife or spoon also can be used. Unlike sanding paper, plastic tool doesn't harm metal and primer.
    1. Lacquer.
      1. Apply the lacquer in the same way as painting.
  1. Finish.
    1. Take the car out of the garage. Otherwise, everything in the garage will be covered by dust during sanding that follows.
    2. Sandpaper. Sandpaper with high grade like 1500. Move sand paper back and forth, not with circular motion. After that, use higher graded sandpaper like 2000. Use salt water with the sandpaper.
    3. Polishing. Optional.
    4. Waxing. Optional.

Friday, May 7, 2021

How to fix (repair) cuts in rubber boots? Hate to get rid of things..

There should be a way of cut-through from the truck cabin into the trunk. During van dwelling, I can sleep in the trunk and then slide directly into the truck cabin without going out of the truck..

I definitely need some power bank/power station for the laptop at the time of van dwelling. The car battery might not be enough for a long time...

The Bitcoin algorithm should not be the only way of creating your own money..

There is always a way to start with something small..

Motivation goes away when the perspective seems to be so hard to achieve. Competition is so high and when a lot of resources are needed. However, there is always a niche where nobody goes to. Just need to find it. With the minimal set of resources we can step on to a way to success..

SWOT analysis is a good thing to find a way. In business theory, SWOT is for:

- (My) Strengths

- (My) Weaknesses 

- (Environment) Opportunities

- (Environment) Threats

I would remove Weaknesses and Threats because they negatively affect motivation. So SWOT would become SO - Strengths and Opportunities only. Then we can list all our Strengths (skills) and environment opportunities (market niches and ideas). And see which of them can be intersected with each other (which Strengths can be applied to which Opportunities).


Monday, May 3, 2021

How to organize my notes? Why I keep my notes public?

I have a long term history of document flow. How to manage all my notes and thoughts? Business entities have so-called "ERP" systems to account all the financial and manufacturing transactions. Sometimes a human can feel himself like a messed up business without proper organizing of his brains flows.

In the middle school, I had a simple paper diary - a paper notepad. At that time, I already had a feeling that it is not enough. Not only it was small to manage my school homework. I needed to place my drawings, thoughts, tasks etc to somewhere more spacious.

With the mobile phone era, calendar became electronic. I could see my tasks in the mobile phone screen and in the computer monitor. Google really made document much more convenient. Unlike old style Microsoft, the synchronization of service among all the Google devices is the best invention for self organizing ever. I can see my calendar, notes and email from the phone, from my personal computer, or from any of the computers I work at. And it still keeps my stuff private.

In Gmail and Keep products, Google allows another simple but still genius option: tags. We don't need to think about proper organizing of every next thought. Just assign a consequent tag to the note. Our brain might work similarly - that is something called associative thinking. We link and combine our thoughts via tags.

Nevertheless, another problem was not solved yet. Overwhelming of thoughts results in overwhelming of notes. I have megabytes of notes that I have never read. I just write them and never come back to them again. Senseless. Such thing as blogging comes to help there.

Another Google product Blogger allows to .. write a blog obviously. Similarly to Google Keep, it maintains a great option of combining posts into tags. Instead of writing to Google Keep, I can now post all the thoughts to public via Blogger. Even if I don't come back to the post again, it might still be useful for someone on the Internet.

Popular blogs are professional, unique and looking nice (with pictures, clear grammar, good style etc). Authors make a lot of efforts to create a great blog product. I do not. I just post thoughts from my head. Some of them are original. Some of them are not. Some are just useful knowledge that I got from some other place. Some of my notes are absolutely useless.

E. g. somebody recommended me a good TV series, so I need to make a note about what to watch on the next weekend. Why don't make such a note public? I have an idea to purchase new inverter for my car. Why don't make this note public? Even if it is useless, it is still harmless. Something is better than nothing. At least I don't feel that all my notes are buried under the ground and nobody ever read them.. If I commit suicide, psychiatrist could diagnose the root cause based on my blog lol.

Of course, some of my notes are still private. Though I could share them later. At some moment of time when it doesn't matter.

I have some abbreviates for my tags. Every tag consists of 2 parts divided by a colon. E. g. N: Document flow. Left part is a capital letter, it is a short form of the head category (in this example it is letter "N"). Right part is a subcategory, the tag name per se. My head categories are as follows:

A: Activities, day-to-day stuff to do. Answers the question "how can I proceed with this note?". E. g. "Watch" (like on YouTube), "At street" (go for a walk and find it), "At home" (to do at home) etc.

N: Informational notes. Some references, useful stuff to know and to remember.

P: Projects. Some stuff belonging to the certain project I am engaged in. "Coney Island" is the name for the mobile app startup project I hope I will complete one day.

T: Tasks. That differs from the Activities (A:) category. This includes such stuff as "Later", "Maybe", "Pending" etc. I don't know how to certainly define this category. It is kind of method of prioritizing notes and tasks, something like that..

When I need to edit or update my note, I update the post per se instead of making a new post. 


Sunday, May 2, 2021

Software debugging process.. How to find bugs and fix them..

Every problem has a solution. Every.

0 Unsorted_

Reload the device

Reboot the phone, reboot the laptop.

Nuclear solution..

Just re-create everything from scratch: git reset --hard

Backup to previous commit

Check whether the error appeared at one of previous commits. Then see its difference with the current one: git diff oldCommit..newCommit

Often we are not sure at which commit the error started appearing. So we can perform binary search then. Checkout to the oldest commit, say the first out of 100. If the error is not there, checkout to the middle commit, it is the 50th one. If the error is not there, checkout to the middle of the remaining half, it is the 75th one. Etc. Binary search could be the fastest way of searching in our case.

See whether the object supports the property I am calling

In the line of code that causes the error, try placing a dot (".") after the object name and see what properties (attributes) does IDE suggest to me.

See whether the function supports all the arguments we pass to that

Arguments might be of certain type, in certain sequence, with certain number.

Check punctuation (syntax) carefully

Often compiler does not explicitly tells about the punctuation error.

E. g. we have an extra comma in the end of the line that was posted accidentally.

Another example: in Kotlin and some other programming languages, exclamation mark "!" means "not' in the boolean expression. It is very easy to miss it in the long line of an expression.

So the compiler could highlight with red color the next line, not the line with extra comma..

Sometimes there is a miscellaneous error in the neighbor line, though the compiler does not point on it. E. g. bracket is missing on line n, however the compiler points on the line n+1.

Go through all the chains of all the references

That's why nuclear solution (recreate everything from scratch) almost always works. Because we recreate all the references from scratch without mistakes.

Recently I got a tricky error. Due to mes with multiple merges I didn't know that I got eventually 2 files "NotificationService" and "NotificationSService" from two different commits in the same repository. I didn't mention that. AndroidManifest file referenced only one of them.

Search the error text in the source code of Android

Log (Logcat) gives me an error text. I can grab it and search throughout all the source Java files of Android framework (not only throughout code written by me). Then I can find the root cause of the error. Say the log gives me: "No layout manager attached; skipping layout". I grab this text and search it thoughout all Android source Java files. I can find fragment of the Android code which is to flag this error:

void dispatchLayout() {

    if(this.mAdapter == null) {

        Log.e("RecyclerView", "No adapter attached; skipping layout");

    } else if(this.mLayout == null) {

        Log.e("RecyclerView", "No layout manager attached; skipping layout");

    } else {...

Now I know that mLayout is null..

Compare line by line with the working example

If the problem to be solved is not so original, there should be a working best practices on the Internet yet. Sometimes my code is simply copied and pasted from those best practices.. I shouldn't say that though.. Anyway, the error can be found by merely comparing line-by-line my code vs working code..

See how variable is used

In Intellij, we can search usage of a variable throughout all the project files via the Menu Edit -> Find -> Find in path. If the error is related to the certain variable, we can find and see analogues to compare with the code causing the error.

Google more common ways to debug

There is always something not listed on this particular web page.

Learn the theory 

Read or watch YouTube about the subject topic of debug. E. g. if the error is caused by the crappy java keystore, read articles about what the keystore is and how to use it, etc. 

Enjoy the debugging process and avoid stress

When debugging is boring and stressful..

Debugging can be stressful because we don't see the perspective of the positive result and have a feeling that time is wasted. It can also be boring because some steps from manuals are boring to implement. Reading logs, reading manuals, reading stack overflow answers..

Go step by step

Instead of trying to resolve the whole problem immediately, break it into simple steps. Our brain feels comfortable to be concentrated on a simple easy to implement step, instead of trying to do multiple difficult tasks simultaneously. Steps can be listed with a simple list or with a mind map. Possible hints for steps are listed below. Following software can be used for mind mapping or listing:

  • Mindmeister is a good and partially free software for the mind mapping. I personally use it.
  • Google Sheets allow to organize lists online in the table format. List with sublists in hierarchical order is an analogy for mind map. It is often more easy to navigate via the table of lists in comparison with mind map.

Don't commit to a deadline

Never commit to a particular deadline unless you die if you don't meet it. Deadline is the major reason for stress.

Watch movies..

Indeed, debugging process is boring. If debugging is boring, what is funny then? YouTube videos, movies, TV series, news, cartoons, documentary etc. I can do boring debugging simultaneously with watching YouTube. Yes, it will take more time. Yes, it will prevent me from concentrate on the debugging problem. Nevertheless, eventually it makes the process funny! It is always better to move with a slow speed rather than not moving at all.

Feed brain with gas

Cars won't run without gas. Neither they run without oil. God created us with heads and brains inside, and the brain like any mechanism has some rules of service and feeding.

For the brain, gas is an oxygen. Without air our body cannot survive for more than few minutes. Blood should be filled with oxygen and then blood circulation brings it to the brain. 

The sad thing is fake schools and fake universities teach us to stop feeding brain with oxygen. Maybe they do it on purpose? By fake schools I mean 99% of public schools in the country. Students are forced to seat on the chair for a long hours. Sitting is the worse ever position for blood circulation. It causes sleepiness, low mood and results in chronically deceases. I believe the reason most children having bad marks at school is forcible sitting. 

We can definitely get new ideas when walking on the street because moving stimulates our blood to circulate, we breath more and get more oxygen. Here is how workplace of the world best software engineer look like:

Though I personally think Mr Torwalds wastes electricity by using treadmill. Instead, personally prefer taking an advantage of walking - there are a lot of things to do in the city. Go to government bureaucrats, grocery store, using our legs instead of riding a car. Yes, I can write code while walking to the store.

Today we all have mobile phones. This great device allows to do the mind work simultaneously with moving activity. This even allow us to write a code on mobile device. E. g. we can write code on a phone and commit it with GitHub website, not using a computer. Remote servers with remote shells also allow us to debug the code with a phone.

Of course, we still need to sit and lay down. At least to sleep. Or we can take a sit to take a rest when muscles are so tired. Or to eat something. Or when in the toilet... Nevertheless today people sit too much, much more than they really need. It is not necessary to sit on a chair to make the brain working.

Just forget about it..

If the task is neither important nor urgent, place this task on hold for a while and work on another task.

Once resolved, document it!

If I resolved the problem, it should not be the end. We need to prevent it from happening in the future. Otherwise, we will spend time and feel stress again and again. Invest time in making a note about the way that works. Future me will thank current me for that. Because future me doesn't remember anything that he did in the past. It is even better if the note about method of resolution is public - it could help someone else also. Even if it would help just one person, our life has value. Public note can be at any public searchable (googlable) source - personal blog, stackoverflow etc.

Localize the problem

Log the error per se:

        try {

            Code with error        }

        catch (Exception e){

            Log.i(TAG, e.getMessage());

        }

Make stopper points

Stop the program at certain point. Then see the values of objects at that point or log them into the console. Some of them might be null e. g.    

Localize the problem

Put logs around the problem in multiple parts of the code. See which one flags on.

Launch program step by step:

Set up breakpoints in the IDE. Then, launch the "Debug" menu instead of "Run". The program will stop at the breakpoints we placed beforehand.

Here is how

Turn off some components one by one

That will help to find where the root cause of the error is. For example if Google account sign in doesn't work in the app, I can turn Firebase off. That would allow to see whether the error is on the side of Firebase or Google.

Say I hear creak in my car while driving. I can try to turn of the engine and let it move forward with neutral transmission on its own. So, I see whether creak is coming from the engine or from other parts such as chassis. Then I can stop the car and manually sway it. If creak persists, I know that it is not from the wheels (because they are stopped while I sway the car).

Replace components with analogues

Say the mobile app doesn't want to sent messages to the user. Let's see:

- Does it send messages to another users?

- Does it send something else (data, notifications, metadata) to the same user who doesn't receive messages?

Ask..

Sometimes we find the answer by ourselves merely in the process of formulating the question.

Ask Google (google it)

Look for official general information about this type of error. Just google the error text..

Ask online forums

If the problem is unique and even google search does not give any result.. There are bunch of sources to ask the question at. They could be (but not limited to):

  • StackOverflow
  • GitHub - sometimes stronger and faster than even StackOverflow
  • Slack communities - some organizations have them
  • ?

Ask customer service

Surprisingly, some services offer support free of charge. E. g. Firebase support commits to answer engineers' questions. Though there is a delay of multiple days and everybody use corona virus pandemic as an excuse..

Ask a colleague / friend

Every engineer should have a friend-engineer..


Smart contracts from 1997...

It turns out, "smart contracts" were invented in 1997, long time before the cryptocurrency.. At that time, their interpretation was based on the vending machines mechanism.


Common bugs when debugging/deploying Android mobile app

Android Studio does not see my device (the cell phone per se)

The error heading is "no target device found"

Possible solutions:

  • Turn on debugging mode on the phone. See also Google's manual.
    • Make "Developer options" available in the phone's Settings
    • In the Developer options, turn on "USB Debugging"
  • After connecting the phone via USB cable, see the pop up window on the phone "Default USB Configuration" (If it does not pop up, I can also find it later in USB settings of the phone). Try multiple options in this pop up: "Charging", "Storage", "MIDI", "PTP" etc. For different phones these options might be different. E. g. for now on my Motorola "PTP" works. Surprisingly, at my LG it was "Photo transfer".
  • Restart the phone
  • Change USB cable.
  • Change USB port.
  • Change the phone.

Can't see my tag in Logcat

See second box from the left on the top of the Logcat. It is the name of the process (to the right of the debugged app name).

If the box says "No debuggable processes", try to select app to the left again, then select the process to the left again.

Switch to the other tab and then back (e. g. to "Build" and then back "Log").

After the error, don't press on a phone "close the app" immediately. Otherwise I will not see the error in the log.

Google sign in result failed with code 10

Some credits are to stackoverflow. See also the post about deleting everything and creating everything from scratch.

0_Unsorted_

Create Activity for Google sign in without Firebase..

SHA-1

SHA-1 key does not match between our key, Firebase and Google Cloud Console

SHA-1 keys should match in the following sources:
  • Google Cloud Console
  • Google Play Console -> App signing (in case of release)
  • Firebase Console
  • Local google-services.json file
  • Value from the output of ./gradlew signingReport (local machine keystore)

Value from the output of ./gradlew signingReport (local machine keystore) is different than in other sources

In 2 words, add new local SHA-1 key from gradlew report to the Firebase Console.

First, need to get local SHA-1 key by either one of the following ways:
1) Via the terminal. It does not work always though (see the second way infra then).
In the terminal, go to project folder and run:
./gradlew signingReport
The output will be something like that:







2) Via the Android Studio.
The best way is provided with this stackoverflow answer:
- In the Android Studio, open Gradle window via View -> Tool Windows -> Gradle.
- Click on "Execute Gradle Task" button (it looks like an elephant in the top left corner)
- On the new open window, press type "gradle signingreport" without quotes and press Enter.
- See the result in the Run window (View -> Tool Windows -> Run).

Once I had a problem when debugging and deploying the app from the new computer. So Android Studio changed the SHA-1 key. Now it doesn't match SHAs from Firebase Console and Google Cloud Console.

Just in case, let's recreate this local SHA:
- Remove (rm -rf) the debug.keystore.lock from the $HOME/.android/ folder.
- Create new SHA-1. Gradle in Android Studio does it automatically when rebuilding the app. So in Android Studio we need to press Build -> Clean the project, then Build -> Rebuild the project.
- Download again google-services.json file from Firebase console.

Then, run ./gradlew signingReport from the project folder again. Copy SHA-1 key from the output (consisting of 20 pairs of numbers divided by colons) and insert it into Firebase Console. To insert it in the Firebase Console:

  1. Go to https://console.firebase.google.com
  2. Select your project
  3. In the to left corner, press the "Settings" wheel button next to "Project Overview"
  4. Press "Project Settings"
  5. Scroll down to the "Your apps" section
  6. See section "SHA certificate fingerprints"
  7. Press "Add fingerprints"
  8. Insert fingerprint from the ./gradlew signingReport from supra.

Just in case, download from Firebase Console google-services.json file again to local app files.

Once we added SHA-1 key to Firebase Console, Firebase will automatically populate it to the Google Cloud Console.

SHA-1 for Production version doesn't match with Firebase and Google Cloud consoles

Probably the issue is in wrong SHA-1 key. So the idea is as follows. Once we create an app and test it via our local computer on our local device (android phone) we generate SHA-1 debugging key (just for debugging, not for release). Later at the Google Cloud console and at Firebase console SHA-1 might need to be updated after launching the app to the production. That is because new SHA-1 production key is generated upon generating the signed apk package (which in turn we use to release the app to the Google play).
Once we update SHA-1 key in the app in Firebase console, it should populate automatically to Google Cloud Console. However, just to be sure we need to verify that at Google Cloud Console the right release key is propagated.
Finally, the problem with production for me was solved as follows..
Hierarchy of dependencies in Firebase Console is as follows: In Firebase we have one project, in the project we create one app, in the app we create many SHA-1 keys: 
  1. One SHA-1 key is the very first one from debug, it was created during the first build by Android Studio.
  2. Second SHA-1 key is created by Android Studio when we launch in Android Studio "Build/Generate signed bundle/APK" for the production release.
  3. Third SHA-1 is provided in the Google Play Console after we upload the signed bundle/APK to production release. In the Google Play Console go on the left pane to Setup -> App integrity. We will see the section "Play App Signing". There are 2 subsections there: "App signing key certificate" and "Upload key certificate". "Upload key certificate" contains the SHA-1 key that was generated during launching in Android Studio "Build/Generate signed bundle/APK" for the production release.

    "App signing key certificate" contains new SHA-1 key that we need to add to Firebase Console. 

    Note that Google changes its interface very often and these items could go under new menu sections, just need to look for them or google them.
So in the Firebase Console, open the project -> Settings -> consequent app of the project. In the app, add all three SHA-1 supra that are not there yet by pressing "add fingerprint". No need to create another apps in the Firebase project. Just add all the SHA-1 keys to the same app.
Then in the Google Cloud Console, Firebase automatically creates OAuth 2.0 Client IDs for each of the SHA-1 keys. So no need to make changes in Google Cloud Console. Just check that finally if we have 3 SHA-1 keys, in the Google Cloud Console we have four OAuth 2.0 Client IDs: three for consequent SHA-1 keys and one Web App.

Then download from Firebase Console new google-services.json file to the app's code. Make a signed release again and upload in to Google Play Console again, now it should work.

SHA-1 key is from the old project

Once I deleted my project from Firebase, created a new one and used the old SHA-1 key. Google doesn't allow to do it because it takes up to 1 month for the old project to be completely dismissed from the Google services. So we cannot use old SHA-1 key at that time. Need to create a new one. Credits to this stackoverflow answer.
On Linux, the old SHA-1 key is stored there: $HOME/.android/. So we can do the following:
- Merely remove (rm -rf) the debug.keystore.lock from the .android/ folder.
- Create new SHA-1. Gradle in Android Studio does it automatically when rebuilding the app. So in Android Studio we need to press Build -> Clean the project, then Build -> Rebuild the project.
- Download again google-services.json file from Firebase console.

SHA-1 key is not populated

That is just an idea to check. Infra web_client_id has problems to be populated. SHA-1 might have the same problems in within the app?

    Web_client_id

    Value is not populated

    Another option could be failure with default_web_client_id that is used in login activity in
        val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
    That value should be automatically populated in values.xml file:
        <string name="default_web_client_id" translatable="false">CHANGE-ME</string>
    From the google-services.json file:
      "client": [
        {
          "client_info": {
            "mobilesdk_app_id": "...",
            "android_client_info": {
              "package_name": "com.exa.myproject"
            }
          },
          "oauth_client": [
            {
              "client_id": default_web_client_id value is here
    For some reason, this value might not be populated automatically. So we can hardcode it. In the strings.xml file, create default_web_client_id_hardcoded string with the value from "client_id" from google-services.json file. Then in the login activity, replace default_web_client_id with default_web_client_id_hardcoded. Credits to stackoverflow.

    Value is of string type

    Make sure also that getString(R.string.default_web_client_id) gets actual string, not the integer value. To double check it, log it in the Logcat:
          Log.i(TAG, getString(R.string.default_web_client_id_hardcoded))

    Value type is Web application

    Google asks to paste "Web Application" type id, not the "Android" type. In the Google Cloud Console, we can see 2 apps. One is automatically created by Firebase when we create Firebase app for the Firebase project. Another one is created at the step of configuring Google API Console project.

    Package name

    Names don't match

    Package name like "com.example.myproject" should match between the following:
    • Google Cloud console
    • Android package code - gradle files etc
    • Firebase console

    Package name is from the old project

    There is a known issue that SHA-1 key cannot be taken from the old project. So probably the same problem might occur here. So we need to change package name everywhere (local store, Firebase Console, Google Cloud Console). This solution has not been verified yet.

    Proper project is selected

    At Google Cloud Console, make sure that all the steps are for the proper project which is listed at the top of the web page in the drop down menu.

    google-services.json file is not uploaded

    After implementing any of the steps supra, we need to download google-services.json file again from the Firebase Console.

    Could not set unknown property 'fragment_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

    The problem comes from the app level build.gradle file. See in the log the reference to the certain line of the file. It could be caused by using improper syntax of improper language. E. g. we declare variable with Kotlin keyword "var" instead of Groovy "def" that is needed for this particular build.gradle file.

    Unresolved reference: findViewById

    That might be because we are calling findViewById from the fragment, not from the activity. So in the Fragment, we can use function of getView().findViewById(R.id.foo). All credits are to stackoverflow.
    Also in the fragment's onCreateView function, we can call
        override fun onCreateView(
            inflater: LayoutInflater, container: ViewGroup?,
            savedInstanceState: Bundle?
        ): View? {
            val view = inflater.inflate(R.layout.my_fragment, container, false)
            val signInButton: SignInButton? = view?.findViewById(R.id.my_button)
            return view
        }

    Firebase error: "Error updating Google"

    This comes as a pop up message when I am trying to add Google sign in account in the Authentication options of Firebase Console for my project. 
    When Google sign in method is not enabled in Firebase, attempting to sign in via the app gives the following error in the app's log:
     signInWithCredential:failure com.google.firebase.auth.FirebaseAuthException: The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section. [ The identity provider configuration is not found. ]
    This error is rare and it seems like it is on the side of Firebase team, not us. Thus, the best bet is to contact Firebase support. 

    Solutions from customer service (usually not working)

    Some of the preliminary advises from support and stackoverflow include:
    - Try to do the same from incognito mode, different browser, different device. Though Firebase customer service advice this to everybody who having such a problem, I know nobody for whom it worked :(
    - Try to implement sign in with Google API Console without Firebase. In case of success, we will be 100 percent sure that the error is on the Firebase side.

    Nuclear solution

    Documented here also.
    For me personally worked nuclear solution: recreate the Firebase and Google Cloud projects. The solution is costly if the Firebase project already has database. After deleting everything, first create a Firebase project. Than the Google Cloud project will be created automatically - no need to create a separate Google Cloud project.
    After this nuclear explosion, don't forget to delete and create new SHA-1 and web_client_id keys:
    - delete the debug.keystore
    - run ./gradlew signingreport from the app's directory to make sure there are no keys remaining
    - build the app in Android Studio - it will generate new keys automatically during new build
    - run ./gradlew signingreport from the app's directory to make sure that new keys are there
    The lesson for the future for me and others: loose coupling is a must when dealing with Google and Firebase. At any moment of time, we should be ready to easily switch from Firebase to adequate database. We should even be ready to switch from Google to other platform.

    Unresolved reference: FirebaseMessaging

    In my case, this error came while implementing FCM (Firebase Cloud Messaging) for the purpose of notifications on user's Android device. I am just following the official Google and Firebase guide, that directs to retrieve the token with the following Kotlin code:
    FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task ->
    if (!task.isSuccessful) {
    Log.w(TAG, "Fetching FCM registration token failed", task.exception)
    return@OnCompleteListener
    }

    // Get new FCM registration token
    val token = task.result

    // Log and toast
    val msg = getString(R.string.msg_token_fmt, token)
    Log.d(TAG, msg)
    Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
    })
    Interestingly enough, their own project sample reference Firebase libraries in other way:
    Firebase.messaging.getToken().addOnCompleteListener(OnCompleteListener { task ->
    if (!task.isSuccessful) {
    Log.w(TAG, "Fetching FCM registration token failed", task.exception)
    return@OnCompleteListener
    }

    // Get new FCM registration token
    val token = task.result

    // Log and toast
    val msg = getString(R.string.msg_token_fmt, token)
    Log.d(TAG, msg)
    Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
    })
    So if our code is written with Kotlin not with Java, we can use the working template from the sample supra. I. e. we call Firebase.messaging.getToken() instead of FirebaseMessaging.getInstance().token.
    Finally, Android Studio suggested me to replace property access and for now in Kotlin the following code works fine:
    Firebase.messaging.token.addOnCompleteListener(OnCompleteListener { task ->
    if (!task.isSuccessful) {
    Log.w(TAG, "Fetching FCM registration token failed", task.exception)
    return@OnCompleteListener
    }
    val token = task.result
    })

    Failed to authenticate, have you run firebase login?

    Question:

    I am following instructions for Firebase functions. I have successfuly login from my console, however when I am trying to deploy functions, terminal gives an error: enter image description here

    oleg@oleg-HP-EliteBook-8460p:~/Desktop/Oleg/projects/firebase-functions$ firebase login

    Already logged in as [my user email]

    oleg@oleg-HP-EliteBook-8460p:~/Desktop/Oleg/projects/firebase-functions$ sudo firebase deploy --only functions

    Error: Failed to authenticate, have you run firebase login? (node:11224) MetadataLookupWarning: received unexpected error = Unsuccessful response status code. Request failed with status code 403 code = 403 Having trouble? Try firebase [command] --help

    So the error is kind of controversial. Firstly, Firebase says that I am already successfully logged in. Right next, Firebase says that I am not logged in... I suspect there should be some setting for user name or something like that in kind of local firebase.json file or other files, but I didn't find it.. Or should I change something in the Firebase Console?

    Answer:

    The difference is that you're running firebase login and then sudo firebase deploy. You should never need to use sudo with Firebase.
    Source:

    Gradle sync failed: Sync failed: reason unknown

    In the top part of the window, press Android Studio Menu -> Rebuild Project.
    Then in the bottom part of the window press "Build" tab.
    In the logging part of the tab, it can show more information and suggestions to fix the problem.

    Because an app is obscuring permission request setting cannot verify your response

    Probably, simultaneously with debugging some other app is running on the phone. That app could be in front of other apps, such as YouTube picture-in-picture option etc. Just close it for the time of debug.