Tuesday, September 28, 2021

Drug addiction..

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

Eat ginger instead of chewing gum to make breath fresh

What laptop to buy:

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

Size: 14''

RAM: 8 GB

Sunday, September 26, 2021

Kotlin tips and tricks...

0_Unsorted_

Read more: official reference and meta programming

Optional parameters for class:

class Yuh(optionalParameter: String = "" )

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

How to pass a class as a parameter

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

How to get a class of an object

var classOfMyObject = myObject!!::class.java

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

Ternary operator

Execution:

if(expressionAInBrackets) expressionB else expressionC

Assignment:

var v = if (a) b else c

How to iterate through the class properties

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

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

Official Kotlin reference is here

Safe call

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

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

Safe call on the right side of expression:

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

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

Saturday, September 25, 2021

Software design tips and tricks....

0_Unsorted_

Convert switch statements into classes.

Flexibility

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

Readability

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






Saturday, September 18, 2021

Melt plastic with heating gun - at least experiment

Toyota Tundra transmission modes... especially for tow haul

Toyota Tundra tips and tricks...

On the dashboard, 4LO, VSC off and slippery road signs are blinking

I had that problem after running four wheel drive on a bumpy road. 

Good answer is provided here:


Search Community

 

 

 


 2Gen-Tundra

My truck is 2 days old..help! VSC Off, 4LO blinking etc...

Jump to Latest

Follow

21 - 40 of 166 Posts

2 of 9

Last

Bertsonsracing

·

Registered

Joined Apr 19, 2007 · 40 Posts

#21 · Mar 28, 2008


Re: For the THIRD time this month


ur problem is related to the evap canister located at the gas tank.

The problem is that one of the valve is not opening properly and throwing a code. The issue is not in the canister nor the valve but in the wiring harness that runs in the cross member above the fuel tank. Corosion gets int he harness and whre you should have a 12v signal for the valve, the corosion drops it to 2v therefore, not allowing the valve to open and throwing a code.





Spaghetti code...

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