Nov 18, 2021

Create a bootable USB stick with Mac to install Debian

UPDATE: Tuesday, 22 February 2022

I discovered an alternative open-source and safe tool we can use to do the same "burning" (flashing) action, no complex and scary commands code is needed to do this. Plus, this software is available on almost any platform.

It's always better and safer to download the tool directly from its official website: https://www.balena.io/etcher/


Nov 15, 2021

Jasmine in Angular Unit-test: Modify a Read-only value with "Object.definedProperty"

If you are using Typescript and when you're not as well-versed with it (like I do), then surely you'll come into type issue from time to time.

If unlucky, eslint will also give you some headache time during your development work too, but that's good sign that you are learning.

Problems

Modifying a read-only value in Angular Unit-Test (*.spec.ts) files will give you warning like below:

Cannot assign a value to a read-only property even on Unit Test script

the routerSpy is a mocked Router from '@angular/router'.

let routerSpy: jasmine.SpyObj<Router>;


Solution

With the help from native Javascript Object.defineProperty(), we can set value manually through method below:

Set value through Object.defineProperty


Nov 2, 2021

Oh no! Now I learned my lesson, I missed the best time to cash out Banano!

Recently, Banano value jump to the peak of $0.05USD from its usual $0.009USD. And sadly, I wanted to cash out my banano and I can't because I have no idea how to do it!

Banano - From $0.009USD to $0.054USD

I've learned my lesson, I missed the best time to cash out while keep seeing the value drop before my very eyes. So I hope this article can help someone who has the same situation as I did.

If you've follow my post earlier about Folding@Home (FAH), by now you may have learned how to earn it, or may already have some Banano in your wallet.

What's next?

Yup, as everyone would has, the same question with regard to "what can we do about the earned banano?". If you have the same question, you are at the right place! Let's go through the steps together below!

Wrapping Banano into Wrapped Banano (wBan)

You can convert (or wrap, that's how they call it) your Banano into wBan before you can do anything with your hard earned Banano. 

In this article, I would only focus on WHAT instead of WHY. The "WHY" topic is a whole conceptual topic to discuss about, especially when I hope to make it more beginner friendly for those who are new to the blockchain world. P/s: Btw, I'm not an expert though, there are a lot more stuff to explore.

Steps: Banano to wBan Wrapping

In the steps section, what's writen below are based on Chrome browser (it has the most user base).

Prerequisites

Before you can continue, you must have:
  • BNB, Binance Coin (beginner may find this difficult. Be warned, spending a little real money, or fiat money, to make this transaction success)
  • Banano coins
  • A Banano wallet
  • Chrome Browser
  • MetaMask from Chrome Web Store
  • Created wallet in your MetaMask with some BNB deposited (approx ~$2USD)

Steps

  1. Install MetaMask Chrome Extension
  2. Visit bsc.banano.cc and "connect" your wallet through MetaMask (chrome extension from 1st step)
  3. Follow the wallet creation step as needed in MetaMask (follow the instructions from the extension)
  4. Transfer your banano to wBan (make sure your sender and receiver addresses are accurate, it's always better to us QR scanner than typing it manually)
  5. After trasnfered, your Ban coin will show up pretty fast. Fill in amount you want to wrap into wBan.
  6. Before you can continue, please make sure you have a little amount of BNB in your MetaMask wallet for "gas fee" or transaction fee. (You can get it through many platform: check out the "buy" button here)
  7. After purchasing from a platform, first you need to transfer them to your MetaMask BNB coin wallet address. Yup, this transaction cost gas fee too.
  8. Back to the wBan wrapping screen you now can start wrapping. Add wBan coin to your wallet by pressing "Add wBan to MetaMask" button.
  9. Pressing the "wrap" button, MetaMask will prompt you to confirm the transaction.
  10. After the transaction is confirmed, amount of wrapped wBan will reflect on your MetaMask wallet. 
  11. Convert/swap your wBan to different coin, where this coin must be a coin that allow you to easily cash out on different platform, for example BNB coin.
  12. After you swap wBan into BNB, withdraw it to BNB wallet address, usually it's where you first get and where it's transferred from on step 7.
  13. Now you have more BNB. You can then decide further invest it or cash out to enjoy your earning.
Enjoy!

Oct 27, 2021

jsonwebtoken error troubleshoot: Uncaught Error: error:0909006C:PEM routines:get_name: no start line

jsonwebtoken error

Description

If you encounter error below:

Uncaught Error: error:0909006C:PEM routines:get_name:no start line


Reason

Bad format private key value. In the jsonwebtoken node package, the sign() function.
Example,


  jsonwebtoken.sign(PAYLOAD, PRIVATE_KEY, OPTIONS)

the PRIVATE_KEY value above must be string, and sometimes this string can be mistakenly "JSON.stringify()". Even though the end result is still a string, but JSON.stringify encoding turns the string into JSON string format, and it's not a value we want to provide to the sign() function.


Below is example error code

ERR_OSSL_PEM_NO_START_LINE



//error from node_modules/jsonwebtoken/sign.js

{
  library: 'PEM routines',
  function: 'get_name',
  reason: 'no start line',
  code: 'ERR_OSSL_PEM_NO_START_LINE'
}

Aug 30, 2021

CakeDeFi - Earn passive income by staking your crypto and forget about it

Warning: There is absolutely no financial advice on this or on any other pages of this blog.

Old way of earning from crypto

It's been a while having my crypto sit quietly in my crypto wallet. As an non-savvy crypto owner, mining and trading crypto is most I know about how one can earn from crypto.

Crypto Staking Experiment with Cake DeFi

"Staking" has been a new term to my early this year (of 2021). It's nowadays an easier approach to generate revenue with your available crypto without the need of hunting for expensive GPU (for mining) and additional payment monthly electricity bill.

My first staking experience was started with CakeDeFi (affiliate link)

My first experiment started 4 months ago (April 2021), I transferred 20 DFI to my partner. And then she directly put them all into "Staking" with auto-compound and she forgot about it until she received an email today.

20 DFI + staking became USD106


In this case:

20DFI worth approximate USD75 (4 months ago)

20DFI + staking (auto-compound) = ~USD106 (August same year)


Looking at the chart below, I picked the peak value point on April as example. Compared to the highlighted value, it has lower price today at the time of this writing (USD2.79 / DFI). The value of staking with autocompound compensated the drop in USD value, while still profit from the extra DFI token earned from staking.


USD price changes of DFI



How does earning from staking work?

When you stake your DFI, you get paid with DFI twice a day. 
Here's come the best part, all you need to do, in short, stake your DFI and forget about it.

You have an option to enable "auto-compound" and let it to continue to stake with all the new earning without having to manually add them after every earning cycle. Which it also means, we can just stake now and forget about it until you login again next time to find out how much you've gained in your asset, but just remember to enable "auto-compound" option.

DFI Staking - auto-compound setting


The following is an example about daily earning:

Auto-compound (staking) & Earning



See the result for yourself first

Okay, since the very first transaction would usually require you spend hardearned money to get started . Please don't simply believe that anyone can just earn a fortune out from this.
Risk is always there, for a non-savvy crypto owner, I'd usually start small (where it won't hurt a bit if I lost all of it) until I've gain enough confidence to make a big decision. Trust no one until you see for yourself first.

This isn't a financial advisor post, please DO NOT read or treat it like one. I'm not any certified financial advisor, I'm just sharing my good experience with what've achieved with CakeDeFi. If you are a owner of crypto already, then you may have already know the how's its volatility affect its value, so please be warned, do it only what you think you capable of, never overdo anything. Like the old saying, never put all your eggs in one basket.

If you are interested to get an account, you can use this CakeDefi affiliate link and get extra USD$30 worth of DFI after you sign up & make your first $50 deposit.

How does it looks like inside?

Liquidity Mining (risky, due to the volatility value changes - Impermanent Loss)

Impermanent Loss happens because you add liquidity in pair (BTC - DFI as example below).
Either of the crypto drop or rise in value, the other paired crypto would need to increase or reduce itself to breakeven and to maintain the initial share you have started with.


Interface for Staking DFI
This one is straight forward. You'll need to swap your token into DFI, and start staking.
You'll get staking reward every day, and "auto-compound" option will help you auto-stake the daily earnings, so you are staking with the most DFI you have available (to maintain highest earning capability).



Have fun staking!

Aug 17, 2021

Unit test on Angular with Jasmine, test case executed randomly

 Problems

If your written unit test is written in an order that has test like:
expect(modalCtrlSpy.dismiss.calls.count()).toBe(1);

The "count()" is accumulated throughout the test cases from the start until the end of a "described" scenario. If test cases get executed without following the order as written test, it fails due to "count()" result get accumulated differently across the test. It can't match the "expected" accumulated result if test run randomly.

Solution

In the karma.conf.js file, add "random: false" under client.jasmine object to prevent test case being executed randomly.



Jul 24, 2021

Folding@Home - Contribute idle computer processing power to science research

Folding@Home

What is Folding at Home (or in shortform, fah)

It is a project that allow user to contribute their processing power during computer is in idle status. The contributed processing power will be used by fah program to help scientist finding cure for deceases, and processing power donor would get some compensation in return in crypto form (different options available too).

If you don't have any GPU, CPU alone is enough to get you started with the folding.


Kalium Wallet
What do you get in return?

Yes, contributing idle processing power will still consume electricity, contributor might think about getting compensated for the power consumption at home.

And here's the example of compensation I received so far. Meanwhile, I'm not into contributing to earn, that's not my purpose, and so shouldn't you. Otherwise, you'll be hunted by annoying inner voice which get you keep checking at the compensation figure every single day or worse every single hour.


Banano & Kalium Wallet

In the picture at the right, the transactions list is what I've received from contributing to FAH as a Banano team. 

How to do it?

  1. Get an address (a long text that as your ID) from any listed wallet on https://kalium.banano.cc/ (I picked kalium)
  2. visit bananominer site to get started with your address.
  3. enter required info into https://client.foldingathome.org/ (after FAH installation is completed)
  4. setup a passkey that let F@H know that the contribution is from you, this will earn you more bonus (they claim so, but i haven't able to check how much more bonus you'll get with passkey attached).


Lastly, I've seen topic about getting payout in dogecoin, but I haven't manage to find any reliable guide to try with. So I think it's still best to stick with banano team, as it's been number 1 ranked team until these days at the time of this writing.


Banano Team, the number 1 FAH contributor

To learn about available projects and the stats of their servers which you'll be contribute your processing power, please find the useful links below:
https://folding.lar.systems/projects/
https://foldingathome.org/statistics/

Accessibility (a18y) - Minimum Touch Target Size (48dp)

Udacity Course: Web Accessibility

https://classroom.udacity.com/courses/ud891/lessons/8085130355/concepts/80878907040923


Minimum touch size for mobile screen: 48dp



WCAG: https://webaim.org/standards/wcag/checklist#sc1.4.4

Jan 14, 2021

Troubleshooting: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

I am a Ionic Capacitor user, I didn’t know since when my android build keep failing and no clue what’s the cause.


And I keep getting these errors when I run “npx cap add android”:

	
Syncing GradleError running gradle sync Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

… #skipped verbose error messages

FAILURE: Build failed with an exception.


* What went wrong:
Could not initialize class org.codehaus.groovy.reflection.ReflectionCache


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
BUILD FAILED in 21s

Unable to infer default Android SDK settings. This is fine, just run npx cap open android and import and sync gradle manually
	





The Solution

Firstly, you'll to know which java version is your android studio is using, find the info in "About Android Studio". 





Set environment variable to point JAVA_HOME to the path where openjdk version of "1.8.0_242-release” (or embedded jdk inside Android Studio app folder) located. On Mac, it's usually 

/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home


MacOS (Android Studio 4.1.1):

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"


jenv User:

You can add Android Studio embedded openjdk path to your jenv and then switch to your prefered java version with jenv local VERSION_NO for local or  jenv global VERSION_NO for system wide.
jenv add "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

Window:

Add/update environment variable JAVA_HOME and point it to path where the correct version of openjdk extracted.