Posts

Showing posts from 2023

The Art Of War: Sun Tzu on the Art of War (Lionel Giles, 2017)

Image
Art of war in 5 factors The Moral Law Heaven Earth The Commander Method and discipline When you lay dowil a law, see that it is not disobeyed; if it is disobeyed, the offender must be put to death Bait your enemy, pretend to be weak and irritate him, make him become arrogant and crush him. If he is superior in every way, evade him Attack him where he is unprepared, appear where you are not expected Now the general who wins a battle makes many calculations in his temple ere the battle is fought 故军争为利,军争为险 Manoeuvering with an army is advantageous, with an undisciplined multitude, most dangerous 善用兵者,避其锐气,击其惰归,此治气者也 Morning is when a soldier's spirit is keenest, noontime begins to flag and evening has his mind bent on returning to camp. Avoid when the enemy is keen and attack when they are sluggish. 高陵勿向,背丘勿逆,佯北勿从,锐卒勿攻 Don't advance uphill, don't go against downhill, don't follow the bait, avoid high spirits. 示以生路令无必死之心 Leave an outlet free when surrounding your enemy to ...

Understanding Altruism's Role in Achieving Holistic Progress

Image
Altruism, the selfless concern for the well-being of others, has long been considered a cornerstone of human morality and social progress. It is the idea that we can put the interests of others ahead of our own, with the aim of benefiting the collective. Altruism can manifest in several forms, each with its unique significance in fostering holistic progress. These include kin altruism, reciprocal altruism, cultural group altruism, and pure altruism. Kin Altruism is the type of altruism exhibited within families, where individuals are inclined to help their close relatives. It is often referred to as "blood altruism" and is grounded in the idea of preserving one's genes. This form of altruism is deeply ingrained in our evolutionary history, with a genetic predisposition to care for our family members. Reciprocal Altruism involves the exchange of favors or help among unrelated individuals. It is the principle that we help others with the expectation that they will reciproc...

The Richest Man in Babylon (George Samuel Clason, 1926)

Image
  What you earned is not all yours to keep 7 cures for a lean purse Start thy purse to fattening Control thy expenditures Make thy gold multiply Guard thy treasures from loss Make of thy dwelling a profitable investment Insure a future income Increase thy ability to earn Man of action are favoured by the goddess of good luck The 5 laws of gold Gold cometh gladly and in increasing quantity to any man who will put by not less than one-tenth or his earnings to create an estate for his future and that or his family Gold laboureth diligently and contentedly for the wise owner who finds for it profitable employment, multiplying even as the flocks of the field Gold clingeth to the protection of the cautious owner who invests it under the advice of men wise in its handling Gold slippeth away from the man who invests it in businesses or purposes with which he is not familiar or which are not approved by those skilled in its keep Gold flees the man who would force it to impossible earnings o...

A Step Closer to Utopia: Where the Universe Meets the Metaverse

Image
  In a world where rapid technological advancements and visionary ideas converge, the concept of Utopia no longer remains a distant dream. The fusion of the universe and the metaverse has opened up exciting possibilities for humanity, exemplified by ambitious projects such as Neom: The Line and the City of Telosa . These initiatives promise a fresh start for those seeking a better life, laying the foundation for a new era of human existence. Two groundbreaking projects have captured the world's imagination, exemplifying the potential of utopian living. Neom, situated in Saudi Arabia, plans to construct "The Line," a linear city stretching 170 kilometers that aims to be a model for sustainable urban living. On the other side of the globe, the City of Telosa, conceptualized by entrepreneur Marc Lore, envisions a futuristic, eco-friendly city that fosters innovation, community, and well-being. The allure of these utopian cities lies in the opportunity they offer to individu...

Blockchain Basics: A Non-Technical Introduction in 25 Steps Paperback (Daniel Drescher, 2017)

Image
  Cryptographic hash functions exhibit the following properties Provide hash values for any kind of data quickly Deterministic Pseudorandom One-way usage Collision resistant Application of hash functions to data can be accomplished by using the following patterns Repeated hashing Independent hashing Combined hashing Sequential hashing Hierarchical hashing Hash values can be used To compare data To detect whether data that were supposed to stay unchanged have been altered To refer to data in a change-sensitive manner To store a collection of data in a change-sensitive manner To create computationally expensive tasks Blockchain blocks The blockchain-data-structure is a specific kind of data structure that is made up of ordered units called blocks Each block of the blockchain-data-structure consists of a block header and a Merkle tree that contains transaction data The blockchain-data-structure consists of two major data structures: an ordered chain of block headers and Merkle trees O...

Simplest Way to use ERC-1822 Universal Upgradeable Proxy Standard (UUPS)

Image
There are already many articles on UUPS and the explanation of how it works, I am going to jump right into the simplified code of UUPS. One of the downside of using a proxy is that many fraud projects and money game make use of it which may affect your credibility when you use a proxy contract, as they thought you are associated with these degens. I have combined the entire contract bundle into a single UUPS.sol file. // SPDX-License-Identifier: None pragma solidity 0.8.19; pragma abicoder v1; abstract contract UUPSUpgradeable {     bytes32 private constant _SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;     address private immutable __self = address(this);     address internal owner;     bool inited;     struct AddrS { address value; }     modifier onlyProxy() {         require(address(this) != __self && addrS().value == __self && owner == msg.sender, "Proxy faile...

Yul: How to Concatenate String in Solidity Inline Assembly & How Much Gas Savings

Image
  String is often a very tricky data type to work with in Solidity as it consists and many other fields such as the identifier and the length of it. As string can go beyond 32 bytes, similarly to array, it is necessary to ensure the entire thread of strings are being stored and presented. Concatenation method is not available in Solidity inline assembly but it can be done by the manual displacement of the memory blocks. Below is how traditional concatenation works in Solidity: function concatTraditional() public pure returns(string memory) {   string memory A = "Hello ";   string memory B = "world";   return string.concat(A, B); } Without optimisation, this contract cost 196,783 gas and running it cost 1,127 gas. Below is how it is done with Yul (with explanation through commenting): function concatInAssembly() public pure returns(string memory) {   string memory A = "Hello ";   string memory B = "world";   // Strings can be define through functi...

Yul: The Gas Difference Between Regular Revert, Revert in Assembly and Revert in Assembly Using Bytes32

Image
  It is imperative to return clear error messages in all programming as it helps to segmentise where your code went wrong. In solidity, most error cases will cause a revert in the execution but there are scenarios where it will not. Especially if you are coding in Yul, a lot of error handling has to be done manually.  There are many logical methods to reduce the need for error handling if you structure your codes well. This post I am going to compare the gas difference between 3 kinds of revert in Solidity. 1. Regular Revert function RegularError() external pure {   // This is the simplest way to revert and therefore no explanation   // is needed.   revert("0x1"); } Contract (without optimisation) gas cost: 114588 2. Revert in Assembly function AssemblyError() external pure {   assembly {     mstore(0x80, shl(0xe5, 0x461bcd))     // Above is the method name for Error(String)     // shl is to further save the gas by not storing ...

Yul: Push, Pop & Return Array Object in Full Solidity Inline Assembly (Jul 2023)

Image
With cryptocurrency entering winter, the requirement of blockchain technology declines by the day. It is therefore a good time to pick up blockchain skills as more people have the time to share or they do not feel the need to hide their expertise. Solidity is the most commonly used language for smart contracts as most chains existed under EVM standard. If we go deeper into solidity, it merely compiles your codes into opcode, which is short for operation code. System only recognises machine codes which are so called the low level language. By using such language not only it allows more control over your code and it also better optimises the memory usage. The only downside is that machine codes are not as readable as the high level programming language. Solidity allows infusion of near-assembly codes. Yul is not exactly machine code but more like an intermediary between high level and low level codes. We cannot go full machine code in Solidity and Yul is the best we can do. Most operatio...

Shuffled Frog Leaping Algorithm: An Innovative Approach to Problem Solving

Image
The Shuffled Frog Leaping Algorithm (SFLA) is a computational technique inspired by the natural behavior of frogs and their hunting patterns. Developed by Eusuff and Lansey in 2003, SFLA is a metaheuristic optimization algorithm that has gained popularity for its ability to efficiently solve complex problems across various domains. This article provides an overview of the Shuffled Frog Leaping Algorithm and explores its practical use cases. Understanding the Shuffled Frog Leaping Algorithm: The core concept behind the Shuffled Frog Leaping Algorithm lies in simulating the social behavior and foraging strategy of frogs. In nature, frogs exhibit a hierarchical structure where a dominant male occupies the highest position. Frogs in lower positions follow the movement of the dominant male, while occasionally exploring alternative positions. The algorithm operates on a population of virtual frogs representing potential solutions to a given problem. These frogs are randomly generated and rep...

Gamevolution Unleashed: Unveiling the Seductive Power of Web3 and Crypto Gaming

Image
Web3 games have come a long way from being tedious and repetitive to engaging, immersive and addictive. Traditional Web3 games are built in a manner where the blockchain technology is first put into consideration and be used as a backbone of the game. Current Web3 games are built on a totally different breath and magnitude. Instead of focusing on Web3, successful games focused on the gameplay and used Web3 as a tool and secondary kingpin. Most people know metaverse as a Web3 game but few actually realise metaverse has existed decades without blockchain. In fact, the metaverse can be so much more than just pure gaming and entertainment. Below are the 10 key factors that show how Web3 revolutionised the gaming industry. True Ownership of Assets Web3 technology allows players to have true ownership of in-game assets through non-fungible tokens (NFTs) or blockchain-based tokens. This means that players can buy, sell, and trade their virtual items outside of the game environment, giving the...

Connected World: From Automated Work to Virtual Wars: The Future, By Those Who Are Shaping It (Philip Larrey, 2017)

Image
Man/machine relationship Autopilot is using AI for awhile now Human is the best system We have a heart and we can process things in split seconds Big data ISIS is the first digital terrorist There are people who voted against technology has no idea how much benefits it brought Instead of getting the pope more views, people are obsessed with social media The future of design To design human DNA Military To train many soldiers is difficult but easy with machine Machine can make decision in a split second for those shoot-don't-shoot situation Social media Everyone hates each other in there but pretend to like one another It has become so rubbish that an eleven year old is giving dating advice It promotes depression as everyone trying to be the best Advertising Profiling sure helps to locate the target group better but also can be dangerous as terrorist could misuse it Advertisement can affect the politics so it is often controlled Instead of censoring, most faults lie with individual ...

Unveiling the Truth: Decoding the Reliability of Modern Reviews

Image
The same goes to testimonials, unofficial reports and private news. Stars no longer worth a thousand words (Tsang & Prendergast, 2009) and reviewers are often being incentivised by direct benefits or intangible values such as fame and popularity. When the reviewing options are getting easier, more people flippantly give their reviews resulting in rendering the review system useless (Shoham et al., 2017). We no longer find reviews of 5.0/5.0 as trustworthy brands, especially after so many bad experiences with high review companies. Having a high review could mean the company expressly paid for reviewer service. A popular business could garner millions of reviews and we could be sure that most of these people are real. Being a real person does not mean they give real reviews (Zhang & Ghorbani, 2020). There are many triggering factors that encourage false reviews such as herd mentality and conflict avoidance as modern people have more fear of offending people (Tjosvold & Sun, ...

Setup IPFS Node in Your Private Linux Server 12Jun2023

Image
  Setting up an IPFS node in your private server will reduce the loading time when you call the file. Download the installation file. Feel free to browse  https://dist.ipfs.io/go-ipfs  for the latest distribution. wget https://dist.ipfs.io/go-ipfs/v0.20.0/go-ipfs_v0.20.0_linux-amd64.tar.gz Uncompress it. tar -xvzf go-ipfs_v0.20.0_linux-amd64.tar.gz Run the installation ./go-ipfs/install.sh Initialise the IPFS with lowpower profile ipfs init --profile=lowpower Edit the port to avoid conflict nano ~/.ipfs/config  "API": "/ip4/0.0.0.0/tcp/9191",  "Gateway": "/ip4/0.0.0.0/tcp/9090"  Run the server nohup ipfs daemon & Run the following commands to allow cors ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://wildd.ddns.net:9191", "http://localhost:3000", "http://127.0.0.1:5001", "https://webui.ipfs.io"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[...

实体店这样运营能爆卖 (邹云锋, 2018)

Image
  Brand positioning Brands are created through refinement. Michael Jackson represents Coca cola to be a young and energetic brand. Needs analysis - objectives, reasons, actions Have to be unique either by product, design or value chain such as raw material and production manner Give up on ideas that don't work and focus on what works Brand segmentation - market analysis, clear target audience. Confirm target consumer, confirm core capabilities Be an expert in a specific area. E.g. drink cooling tea when you are heaty and list out all scenarios Good product quadrant. Characteristics - produce what products, what features, how fanciful. Audience - target audience, characteristics of your consumer group. Benefits - problems solved, direct benefits to consumers. Value - how our product elevates the value of our consumer, features and emotional value, positioned at what level Characteristics of brand - packaging, theme and logo, advertisement requirements, pricing difference, promotiona...