Posts

Getting started with EOS block chain platform

docker is probably the easier way to setup EOS locally. So install Docker, if you do not have one. Pull down the image by runmning the following command
docker pull eosio/eos-dev
Next start your image running this :-
docker run --rm--name eosio -d-p8888:8888 -p9876:9876 -v /tmp/work:/work -v /tmp/eosio/data:/mnt/dev/data -v /tmp/eosio/config:/mnt/dev/config eosio/eos-dev /bin/bash -c"nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::wallet_plugin --plugin eosio::producer_plugin --plugin eosio::history_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:8888 --access-control-allow-origin=* --contracts-console"
There are some utilities like nodeos, cleos (client eos) and keosd which are needed.

Just run

docker exec -it /bin/bashMagically, you get all the tools mentioned above for free.


sitecore item api using powershell

Image
Here is an interesting problem, using powershell to call sitecore api's item. First we need to authenticate ourselves.

To Authenticate

# Your sitecore api login

$loginurl = 'https://yourserver/sitecore/api/ssc/auth/login'

# Converting object into a JSON

$Body = @{
    domain = "sitecore"
    username = "admin"
    password = "mradmin" 
}

$json = $Body | convertto-json


# Call to authenticate and store into session variable call "mysession". Please note that we do not put $ in front of it.

Invoke-WebRequest -Uri $loginurl -ContentType 'application/json' -Method 'POST' -Body $json -usebasicparsing -sessionvariable mysession

You should get something like this.



Next, we pass our session variable into our websession parameter (shown in bold).
$jsonContent = Invoke-WebRequest 'https:/yourserver/sitecore/api/ssc/item/%7B95FD0E53-0466-49A6-BB24-F5D2FE996393%7D' -WebSession $mysession -METHOD 'GET' -usebasicpa…

Getting a sitecore api item using curl

You can authenticate yourself using curl with the following curl command :-


curl -X POST  https://yourserver/sitecore/api/ssc/auth/login -c cookiefile -d "domain=sitecore&username=admin&password=mradmin"


When you are successfully authenticated, please try to request for the item using the following curl -

curl -b cookiefile curl -b cookiefile  https://yourserver/sitecore/api/ssc/item/%7B95FD0E53-0466-49A6-BB24-F5D2FE996393%7D


Please note that you need to use HTTPS.





tamperchrome : tool to help debug your http(s)

Tamperchrome is a cool extension to help you with your http debugging.  For more info, you can find out from here.


https://github.com/google/tamperchrome

solidity quick start

Keywords for solidity


mapping (mapping(_KeyType=>_ValueType) - use to express we're going to map 'KeyType' to get the intended 'ValueType'.  We will use address as a key and we get Voter type in return.

// This declares a state variable that// stores a `Voter` struct for each possible address.mapping(address=>Voter)publicvoters;
payable - if a function supports payment (transfer  / receive payment) 
storage -

memory -

stack  -


msg.sender is the current account interacting with a transaction. Data type is address.

A very simple, get / set contract property example :-




Coin balance example.

In this example, solidity code allows user to mint / create coins and then keep track it it. A call to 'coinbalance' you will be able to query amount in an address.







Some common global variables / terms

block.blockhash(uint numberOfBlock) returns (bytes32): hash which belongs to the given block – will only work for 256 of the most recent blocks, not including currentblo…

Python :- UnicodeDecodeError: 'charmap' codec can't decode byte

encounter this issue sometime ago and the reason this is happening is because open() file method was called without passing in encoding type like utf8, etc. If you open your file using the code below, the error should go away.



withopen(fname, encoding='utf8') as fp:

Database feature as a service framework

While database has been pretty old and dominant technology, we face a rather challenging issue with big data, ingesting data faster.

Here we proposed a database framework which sees database as a blob and services such as synchronization, indexing, sharding, scaling as a plug-in add-on service.

As database gets bigger, there is no standard way to make it faster. We need to figure out a way of learning data stored in a database and proposed ways to handle, store, retrieve and managed it.



Beckman database report is pretty interesting.

If you're interested about progress in database research by some of the top db researcher in the world, check out beckman report here. Explore their slides. Some of the researcher has some interesting point to put across.

after running npm install, you still didn't get your script to run on Windows

Please update your %PATH% to add the following path pattern depending on which user you used.

C:\Users\jeremywoo\AppData\Roaming\npm

That's it!



Creating nuget package - revisit

Image
To create a nuget package :-


a) Create your project like you would do normally.


b) Download nuget cli and place it in your project root directory. Next create your nuspec file.


c) Run "nuget pack AppConsole1.csproj" and not against your nuget spec file.

d) Setup local repository

Go to Tools -> Options -> Nuget Package Manager -> Package Sources ->

Click on the Green plus sign and setup a local repository by providing a Name and Source (folder path to your project) .




Done! :)

Please note : You can also bundle static file here.



Possible error :-

Invalid URI: The format of the URI could not be determined.

This happens if your have an attribute in your nuspec which is not a valid url value.


Value cannot be null or an empty string.
Parameter name: value

This happens when you have a mandatory attribute for example, name, description but it was omitted. 







sitecore - getting field value

From time to time you might need to find out what is the value for field value in sitecore.

You can use the following script to get field value.  First you query [Items] table and follow by [Fields] table  as shown in code below :-




async / await and promise

To ensure we make the correct async / await call, we still need Promises to resolve our task. Promise is like a marker that helps signified a task has been completed.

Pretty sure if you don't make use of promise, it is very unlikely that your function is awaited.

In this example, we're calling a long running external call to a service and then uses await to 'wait' for the results.

Results are then output into the console.