Itsumi Saito just moved Downtown and broke up with her long-term girlfriend, leaning into her dream of making it in music. But juggling practice, friends, a brutal commute to the west side, and a full-time job... Itsu is struggling to establish herself in the cutthroat music scene of LA. When she talks her way into a shmoozy Hollywood party and makes friends with a rising music producer, she sees a chance to bring her dreams a little closer.
We Are OFK is an interactive narrative series of arguing over lyrics, sending sad texts, and playing Interactive Music Videos, including OFK's debut single "Follow/Unfollow" and more!
Posted by: xSicKxBot - 08-29-2022, 08:37 AM - Forum: Python
- No Replies
Tensors: The Vocabulary of Neural Networks
5/5 – (1 vote)
In this article, we will introduce one of the core elements describing the mathematics of neural networks: tensors.
Although typically, you won’t work directly with tensors (usually they operate under the hood), it is important to understand what’s going on behind the scenes. In addition, you may often wish to examine tensors so that you can look directly at the data, or look at the arrays of weights and biases, so it’s important to be able to work with tensors.
Theoretically, we could use pure Python to implement neural networks.
We could use Python lists to represent data in the network;
We could use other lists representing weights and biases in the network; and
We could use nested for loops to perform the operations of multiplying the inputs by the connection weights.
There are a few issues with this, however: Python, especially the list data type, performs rather slowly. Also, the code would not be very readable with nested for loops.
Instead, the libraries that implement neural networks in software packages such as PyTorch use tensors, and they run much more quickly than pure Python. Also, as you will see, tensors allow much more readable descriptions of networks and their data.
Tensors
Tensors are essentially arrays of values. Since neural networks are essentially arrays of neurons, tensors are a natural fit for describing them. They can be used for describing the data, describing the network connection weights, and other things.
A one-dimensional tensor is known as a vector. Here is an example:
Vectors can also be written horizontally. Here’s the same vector written horizontally:
Switching a vector from vertical to horizontal, or vice versa, is called transposing, and is sometimes needed depending on the math specifics. We will not go into detail on this in this article (see here for more).
Vectors are typically used to represent data in the network. For example, each individual element in a vector can represent the input value for each individual input neuron in the network.
2D Tensor Matrix
A two-dimensional tensor is known as a matrix. Here’s an example:
For a fully connected network, where each neuron in one layer connects to every neuron in the next layer, a matrix is typically used to represent all the connection weights. If there are m neurons connected to n neurons you would need an n x m matrix to describe all the connection weights.
Here’s an example of two neurons connected to three neurons. Here is the network, with connection weights included:
And here is the connection weights matrix:
Why We Use Tensors
Before we finish introducing tensors, let’s use what we’ve seen so far to see why they’re so important to use when modeling neural networks.
Let’s introduce a two-element vector of data and run it through the network we just showed.
Info: Recall neurons add together their weighted inputs, then run the result through an activation function.
In this example, we are ignoring the activation function to keep things simple for the demonstration.
Here is our data vector:
Here’s a diagram depicting the operation:
Let’s calculate the operation (the neuron computations) by hand:
The final result is a 3 element vector:
If you have learned about matrices in grade school and remember doing matrix multiplication, you may note that what we just calculated is identical to matrix multiplication:
Note: Recall matrix multiplication involves multiplying first matrix rows by second matrix columns element-wise, then adding elements together.
This is why tensors are so important for neural networks: tensor math precisely describes neural network operation.
As an added benefit, the equation above showing matrix multiplication is so much more a succinct description than nested for loops would be.
If we introduce the nomenclature of bold lower case for a vector and bold upper case for a matrix, then the operation of vector data running through a neural network weight matrix is described by this very compact equation:
We will see later that matrix multiplication within PyTorch is a similarly compact code equation.
Higher Dimensional Tensors
A three-dimensional (3D) tensor is known simply as a tensor. As you can see, the term tensor generically refers to any dimensional array of numbers. It’s just one-dimensional and two-dimensional tensors that have the unique names “vector” and “matrix” respectively.
You might not think that there is a need for three-dimensional and larger tensors, but that’s not quite true.
A grayscale image is clearly a two-dimensional tensor, in other words, a matrix. But a color image is actually three two-dimensional arrays, one each for red, green, and blue color channels. So a color image is essentially a three-dimensional tensor.
In addition, typically we process data in mini-batches. So if we’re processing a mini-batch of color images we have the three-dimensional aspect already noted, plus one more dimension of the list of images in the mini-batch. So a mini-batch of color images can be represented by a four-dimensional tensor.
Tensors in Neural Network Libraries
One Python library that is well suited to working with arrays is NumPy. In fact, NumPy is used by some users for implementing neural networks. One example is the scikit-learn machine learning library which works with NumPy.
However, the PyTorch implementation of tensors is more powerful than NumPy arrays. PyTorch tensors are designed with neural networks in mind. PyTorch tensors have these advantages:
PyTorch tensors include gradient calculations integrated into them.
PyTorch tensors also support GPU calculations, substantially speeding up neural network calculations.
However, if you are used to working with NumPy, you should feel fairly at home with PyTorch tensors. Though the commands to create PyTorch tensors are slightly different, they will feel fairly familiar. For the rest of this article, we will focus exclusively on PyTorch tensors.
Tensors in PyTorch: Creating Them, and Doing Math
OK, let’s finally do some coding!
First, make sure that you have PyTorch available, either by installing on your system or by accessing it through online Jupyter notebook servers.
Reference: See PyTorch’s website for instructions on how to install it on your own system.
See this Finxter article for a review of available online Jupyter notebook services:
For this article, we will use the online Jupyter notebook service provided by Google called Colab. PyTorch is already installed in Colab; we simply have to import it as a module to use it:
import torch
There are a number of ways of creating tensors in PyTorch.
Typically you would be creating tensors by importing data from data sets available through PyTorch, or by converting your own data into tensors.
For now, since we simply want to demonstrate the use of tensors we will use basic commands to create very simple tensors.
You can create a tensor from a list:
t_list = torch.tensor([[1,2], [3,4]])
t_list
Output:
tensor([[1, 2], [3, 4]])
Note that when we evaluate the tensor variable, the output is labeled to indicate it as a tensor. This means that it is a PyTorch tensor object, so an object within PyTorch that performs just like math tensors, plus has various features provided by PyTorch (such as supporting gradient calculations, and supporting GPU processing).
You can create tensors filled with zeros, filled with ones, or filled with random numbers:
An important attribute to be familiar with to understand the shape of a tensor is the appropriately named shape attribute:
t_rand.shape
# Output: torch.Size([3, 2, 4])
This shows you that tensor “t_rand” is a three-dimensional tensor composed of three elements of two rows by four columns.
Note: The dimensions of a tensor is referred to as its rank. A one-dimensional tensor, or vector, is a rank-1 tensor; a two-dimensional tensor, or matrix, is a rank-2 tensor; a three-dimensional tensor is a rank-3 tensor, and so on.
Let’s do some math with tensors – let’s add two tensors together:
Note the tensors are added together element-wise. Now here it is in PyTorch:
Let’s add a scalar, that is, an independent number (or a rank-0 tensor!) to a tensor:
t_add3 = t_first + 3
t_add3
Output:
tensor([[4, 5], [6, 7]])
Note that the scalar is added to each element of the tensor. The same applies when multiplying a scalar by a tensor:
t_times3 = t_first * 3
t_times3
Output:
tensor([[ 3, 6], [ 9, 12]])
The same kind of thing applies to raising a tensor to a power, that is the power operation is applied element-wise:
t_squared = t_first ** 2
t_squared
Output:
tensor([[ 1, 4], [ 9, 16]])
Recall that after summing weighted inputs, the neuron processes the result through an activation function. Note that the same performance applies here as well: when a vector is processed through an activation function, the operation is applied to the vector element-wise.
Earlier, we pointed out that matrix multiplication is an important part of neural network calculations.
There are two ways to do this in PyTorch: you can use the matmul function:
Or you can use the matrix multiplication symbol “@“:
t_matmul2 = t_first @ t_second
t_matmul2
Output:
tensor([[19, 22], [43, 50]])
Recall previously, we showed running an input signal through a neural network, where a vector of input signals was multiplied by a matrix of connection weights.
Here is that in PyTorch:
x = torch.tensor([[7],[8]])
x
Output:
tensor([[7], [8]])
W = torch.tensor([[1,4], [2,5], [3,6]])
W
Output:
tensor([[1, 4], [2, 5], [3, 6]])
y = W @ x
y
Output:
tensor([[39], [54], [69]])
Note how compact and readable that is instead of doing nested for loops.
Other math can be done with tensors as well, but we have covered most situations that are relevant to neural networks. If you find you need to do additional math with your tensors, check PyTorch documentation or do a web search.
Indexing and Slicing Tensors
Slicing allows you to examine subsets of your data and better understand how the dataset is constructed. You may find you will use this a lot.
Indexing Slicing PyTorch vs NumPy vs Python Lists
Indexing and slicing tensors work the same way it does with NumPy arrays. Note that the syntax is different from Python lists. With Python lists, a separate pair of brackets are used for each level of nested lists. Instead, with Pytorch one pair of brackets contains all dimensions, separated by commas.
Let’s find the item in tensor “t_rand” that is 2nd element, first row, third column. First here is “t_rand” again:
Important Slicing Tip: In the above, we use the standard Python convention that a blank before a “:” means “start from the beginning”, and a blank after a “:” means “go all the way to the end”. So a “:” alone means “include everything from beginning to end”.
A likely use for slicing would be to look at a full array (i.e. a matrix) within a set of arrays, i.e. one image out of a set of images.
Let’s pretend our “t_rand” tensor is a list of images. We may wish to sample just a few “images” to get an idea of what they are like.
Let’s examine the first “image” in our tensor (“list of images”):
Using small tensors to demonstrate indexing can be instructive, but let’s see it in action for real. Let’s examine some real datasets with real images.
Real Example
We won’t describe the following in detail, except to note that we are importing various libraries that allow us to download and work with a dataset. The last line creates a function that converts tensors into PIL images:
import torch
from torch.utils.data import Dataset
from torchvision import datasets
from torchvision.transforms import ToTensor
import matplotlib.pyplot as plt import torchvision.transforms as T conv_to_PIL = T.ToPILImage()
The following downloads the Caltech 101 dataset, which is a collection of over 8000 images in 101 categories:
The above code shows the dataset contains 8677 items. Looking at the first item of the set we can see they are tuples of 2 items each. Here are the kinds of items in the tuples:
type(caltech101_data[0][0])
# torch.Tensor type(caltech101_data[0][1])
# int
The two items in the tuple are the image as a tensor, and an integer code corresponding to the image’s category.
Colab has a convenient function display() which will display images. First, we use the conversion function we created earlier to convert our tensors to a PIL image, then we display the images.
This article provides a lightweight JavaScript plugin to display news tickers on a website. The news ticker is a way of showing content in marquee mode either in horizontal or vertical scroll. It is useful to display content like the latest updates and upcoming events.
It saves the site space real estate by occupying less portion of the screen. It also reduces the user effort of scrolling to see more content by keeping on ticking the content display.
In a way it is an older thing. Couple of decades back we cannot see a website without a scrolling ticker. Over a period its eradicated as a bad UI/UX practice. But it is still widely used in news websites and in particular in stock price display. If you use it wisely, it provides good advantages.
The following examples will remind you of the places that require news tickers on screen.
Online news bytes display headlines in a ticker.
Stock prices.
Online shops that show ‘what is new’ on a ticker board.
This tutorial shows a simple news ticker on a webpage. On hovering the ticker box, it stops the content marquee and releases on mouse out.
It will look like a carousal effect but applied to an element with text content.
STEP 3: Call startTicker JavaScript function immediately next to ticker-box div.
This step is to call the library function with reference to the ticker box id attribute.
The startTicker() function has an optional parameter to supply the speed and interval between news contents. The default speed is 5 and the default interval is 500 milliseconds.
This library contains functions to enable a news ticker on a web page. The startTicker() function iterates the ticker <li> elements and let it slides horizontally.
It applies styles to change the position of the ticker element based on the speed. The extend() function changes the default speed and interval with the specified option.
function applyStyles(obj, styles) { var property; var styleLength = Object.keys(styles).length; for (var i = 0; i < styleLength; i++) { property = Object.keys(styles)[i]; obj.style[property] = styles[property]; }
} function extend(object1, object2) { for (var attrname in object2) { object1[attrname] = object2[attrname]; } return object1;
} function startTicker(id, param) { var tickerBox = document.getElementById(id); var defaultParam = { speed: 5, delay: 500, rotate: true }; var extendedParam = extend(defaultParam, param); applyStyles(tickerBox, { overflow: "hidden", 'min-height': '40px' }); var ul = tickerBox.getElementsByTagName("ul"); var li = ul[0].getElementsByTagName("li"); applyStyles(ul[0], { padding: 0, margin: 0, position: 'relative', 'list-style-type': 'none' }); for (i = 0; i < li.length; i++) { applyStyles(li[i], { position: 'absolute', 'white-space': 'nowrap', display: 'none' }); } var li_index = 0; var trans_width = tickerBox.offsetWidth; var chunk_width = 1; var iterateTickerElement = function(trans_width) { li[li_index].style.left = trans_width + "px"; li[li_index].style.display = ''; var t = setInterval(function() { if (parseInt(li[li_index].style.left) > -li[li_index].offsetWidth) { li[li_index].style.left = parseInt(li[li_index].style.left) - chunk_width + "px"; } else { clearInterval(t); trans_width = tickerBox.offsetWidth; li_index++; if (li_index == li.length && extendedParam.rotate == true) { li_index = 0; iterateTickerElement(trans_width); } else if (li_index < li.length) { setTimeout(function() { iterateTickerElement(trans_width); }, extendedParam.delay); } } }, extendedParam.speed); tickerBox.onmouseover = function() { clearInterval(t); } tickerBox.onmouseout = function() { iterateTickerElement(parseInt(li[li_index].style.left)); } } iterateTickerElement(trans_width);
}
Note:
Presently the news ticker is available only in a horizontal direction. For the next release, a vertical direction is planned.
Ticker movement can be paused on mouseover.
Contact me, if you have any feature requests or for any special customization needs.
Information in our possession is conflicting, but it seems that the infection has spread very quickly within a few days, perhaps even in a few hours. It seems that in the hours immediately following the outbreak of the infection, 43rd NATO airborne battalion was sent to the island but all contacts were lost after only 8 hours.
PMCW considers this matter with the utmost importance. Objectives of team W1 are:
Locate the biolab
Take in vitro samples of the pathogen (codename: "Vorax")
Liquidate surviving medical personnel (optionally) and any witnesses.
In NO case must the presence of the PMCW be revealed.
Every W1 squad member is equipped with cyanide capsules. Squad commander is authorized to start liquidation procedure in case of emergency.
Proceed with the utmost caution.
THE ENVIRONMENT
The island is vast and offers a wide variety of natural resources. There are also several settlements, a main village, a hotel and tourist attractions. In the event of an emergency landing, or loss of tactical equipment, each squad member is trained to survive in a hostile environment. As a good mercenary of a private military company, you know how to use local plants and herbs to make ointments and medications to treat state effects such as burns, bleeding, relieve your stress or simply restore your health. But more importantly, you can use building materials provided by nature to make rudimentary melee weapons, traps, barricades and much more. Even a silent bow, very useful for knocking out the infected without being detected.
THE INFECTION
It seems that the infected are the side effect of the virus grown in the bio-laboratory. Probably when a security flaw opened, the virus spread to the island.
It is not yet clear whether it spreads by air or through aquifers but what is certain is that biomass, similar to fleshy appendages that are sometimes glimpsed in the environment, are one of the final stages of the virus. The biomass therefore seems to be responsible for the mutations that occurred to the civilian inhabitants and to the military personnel who rushed to contain the first stages of the infection. Contact with non-bottled liquids or non-canned food is therefore strictly prohibited.
Mutates are fast, extremely aggressive and above all voracious. The first to be devoured were the breeding animals of the surrounding farms and estates. For this reason, any living being, human or animal, is for them a prey.
Apparently they do not devour each other ( to be confirmed ).
Finally, it seems that they are photosensitive. At least the infected humans. Our drones have in fact observed the absence of external diurnal activity by the mutants, even if some animal species that have come into contact with the pathogen, such as stray dogs, wolves, wild boars and bears, do not seem to suffer from photosensitivity.
It is therefore recommended to exercise extreme caution at night.
OPERATIONAL INFO
You will land in the North area, a few hundred meters from the bio-laboratory, at 4.30 in the morning. The helicopter will wait 25 minutes and then will take off.
This giveaway is for GOG, its a platform for distributing games, similar to steam and others
- Go to the giveaway page - Login or make an account if you do not have one - Go to the GOG Homepage - https://www.gog.com/ - Scroll a bit down until you see the banner for the game Dex - Its and above "Highest discount ever" - Wait for the button to appear on the right - Click on the "Yes, and claim the game" button - That's it
We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.
Posted by: xSicKxBot - 08-29-2022, 08:37 AM - Forum: Lounge
- No Replies
Bungie Disables Another Exotic Gun For Destiny 2 King's Fall Raid Race
Bungie has disabled the new Destiny 2 Exotic weapon, Quicksilver Storm, in high-level content ahead of Friday's race to complete the game's newest raid, the revamped King's Fall from Destiny 1. Quicksilver Storm is the latest casualty on the list of weapons and Exotic armor pieces that Bungie has disabled thanks to bug and glitches that came with the release of its latest content release, Season of Plunder.
Quicksilver Storm is an Exotic auto rifle that has some special properties--under the right circumstances, it can fire missiles like a rocket launcher and grenades like a grenade launcher. That latter capability is the source of the problem. Bungie rebalanced Heavy ammo-firing grenade launchers with its Season of Plunder patch, intending to make them do more damage and thus be more viable in high-level content. However, grenade launchers have been doing tremendous amounts of damage since the patch on Tuesday, August 23, dishing out something like 150% more damage than before the patch. That has made high-level content, like the recently released Duality dungeon, pretty easy for players to complete.
Quicksilver Storm can shoot like an auto rifle, a rocket launcher, and a grenade launcher.
Red Matter 2 is an adventure that takes place during a dystopian Cold War whose events unfold after Red Matter. It is the story of how people trapped in a reality created by their rulers, rebel against their destiny and fight to do the right thing.
Being subjected to a mental simulation in an enemy base, you are awakened by an infiltrated agent who has been sent to rescue you. Just as you are about to escape you intercept a distress signal belonging to an old friend. Determined to come to his rescue, you embark on the journey of a lifetime to the far reaches of the solar system to find him.
That adventure will make you question your entire reality, not only because you will once again encounter the Red Matter more unleashed than ever, but also because Volgravia holds more secrets than you could have ever imagined.
The previous article was focused on an installation via npm, and in this article, we’ll go through the installation and use of the Solidity compiler via Docker.
Our goal is to get more familiar with the possibilities of this approach, as well as to get introduced to the technology that “runs the show”. This knowledge and experience will enable us to recognize the reasons behind choosing any of the approaches in the future, depending on the real-world needs of our projects.
What is Docker?
Before we go into details about the Docker installation of solc, let’s first get introduced to what Docker is.
Docker is an open platform for developing, shipping, and running applications… Docker provides the ability to package and run an application in a loosely isolated environment called a container… Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host.
There are some parts of the description I’ve deliberately left out (separated by the symbol …) because they’re not essential to our understanding of the technology.
Now, let’s dissect the Docker description: the keywords of our interest are platform,isolated environment, and container. Let’s quickly dive into each of those next
Platform
A platform is a software framework that supports a specific function or a goal.
The goal Docker supports is enabling a piece of software (application, service, etc.) to correctly run, regardless of the target environment.
For us, this means running the Solidity compiler, i.e. feeding it with the input source code and producing the output bytecode in the form of .abi and .bin files.
Isolated Environment
By mentioning an isolated environment, we remember the concept of virtualization learned about earlier, meaning that Docker enables our software to run as intended by providing it with the resources in form of software libraries, network access, remote services, and other dependencies.
Container
Docker ensures the resources are provided without additional intervention by arranging them in a package called a container. Containers begin their lifecycle as images that we most commonly download and run.
We can also create a Docker image, but that’s another story.
Running an image creates a live instance of it, a container. Before it can be used, a Docker image has to be prepared, meaning that someone should install and configure all the required resources needed for the software to run.
Preparation of a Docker image falls in the domain of DevOps, i.e. Development and Operations:
“DevOps engineers manage the operations of software development, implementing engineering tools and knowledge of the software development process to streamline software updates and creation.”
Now that we have introduced Docker in general, we are continuing with the installation of the Solidity compiler via Docker.
First, we have to check if Docker is present on our system by simultaneously checking the Docker version:
$ docker version
bash: /usr/bin/docker: No such file or directory
As our check shows, we have to install Docker on our system before we can use it. The installation process via the Ubuntu repository is made of several steps (https://docs.docker.com/engine/install/ubuntu/):
Step 1: Update the apt package index
$ sudo apt update
…
Reading package lists... Done
Building dependency tree Reading state information... Done
All packages are up to date.
Step 2: Install packages
Installation of additional packages; we need these packages to enable the installation process accessing the repository over the secure HTTPS connection (note the backslash symbol \ for the multiline command):
$ sudo apt install \
ca-certificates \
curl gnupg lsb-release
...
The following additional packages will be installed: gnupg-l10n gnupg-utils gpg-wks-server
Suggested packages: parcimonie xloadimage
The following NEW packages will be installed: ca-certificates curl gnupg gnupg-l10n gnupg-utils gpg-wks-server lsb-release
...
Do you want to continue? [Y/n] y
...
Info: “GPG, or GNU Privacy Guard, is a public key cryptography implementation. This allows for the secure transmission of information between parties and can be used to verify that the origin of a message is genuine.”
Setting up the repository by writing to docker.list file.
The echo command evaluates the text inside the $( ), populates it with the command outputs (in parentheses), and sends it via stdin to system utility sudo tee with root privileges, which in turn overwrites the docker.list file and omits the output by redirecting it to /dev/null:
Info: Repositories added by mistake can be removed from Ubuntu 20.04 by selectively deleting them in /etc/apt/sources.list.d/ directory.
Step 5: Update apt package index
Updating the apt package index (once again):
$ sudo apt update
...
Reading package lists... Done
Building dependency tree Reading state information... Done
All packages are up to date.
Step 6: Install Docker
Installing Docker (the latest stable version) and its components:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree Reading state information... Done
The following additional packages will be installed: docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns
Suggested packages: aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed: containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin docker-scan-plugin pigz slirp4netns
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 108 MB of archives.
After this operation, 449 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Let’s check the Docker version once again:
$ docker version
Client: Docker Engine - Community Version: 20.10.17 API version: 1.41 Go version: go1.17.11 Git commit: 100c701 Built: Mon Jun 6 23:02:57 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:01:03 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.7 GitCommit: 0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb runc: Version: 1.1.3 GitCommit: v1.1.3-0-g6724737 docker-init: Version: 0.19.0 GitCommit: de40ad0
Now that we’re sure that our Docker installation went through and the Docker Engine version we have is 20.20.17 (at the time of writing this article). The next step is getting the Docker image with the Solidity compiler.
Docker images are identified by their release organization, image name (shorter, images), and tag, i.e. label that makes them unique. In general, we can download a Docker image by referencing it with its organization/image:tag marker.
We will download a Docker image of the Solidity compiler by specifying its marker as ethereum/solc:stable for a stable version, and ethereum/solc:nightly for the bleeding edge, potentially unstable version.
We can also specify a distinct version of the Solidity compiler by setting a tag to a specific version, e.g. ethereum/solc:0.5.4.
We will do three things with one Docker command: we’ll download the image, instantiate (run) a container from the image and print the container usage (flag – help):
docker run ethereum/solc:stable – help
Sure enough, we’d like to compile our Solidity files, so we’ll make three preparations (First, Second, Third):
First: Create a local directory containing our Solidity source code (I’ll use 1_Storage.sol from the Remix contracts folder by creating an empty file and pasting the content into it):
$ mkdir ~/solidity_src/ && cd ~/solidity_src/
$ touch 1_Storage.sol
Second: You can write your own contract for testing purposes or just open the 1_Storage.sol with your favorite text editor and paste the contents from 1_Storage.sol example in Remix.
Third: Run a Docker container (we already have the image so the download procedure will be skipped); command flag -v mounts our local ~/solidity_src directory to the container’s path /sources, path ethereum/solc:stable selects the Docker image to run a container, command flag -o sets the output location for the compiled files, --abi and --bin activate the generation of both .abi and .bin files, and the path /sources/1_Storage.sol selects the source file for compilation:
$ docker run -v ~/solidity_src:/sources ethereum/solc:stable -o /sources/output – abi – bin /sources/1_Storage.sol
Compiler run successful. Artifact(s) can be found in directory "/sources/output".
When checking our solidity_src directory, we’ll discover a new directory output, created by the Solidity compiler, containing both .abi and .bin files.
Docker also enables us to use the standard JSON interface, and it is a recommended approach when using the compiler with a toolchain. This interface doesn’t require mounted directories if the JSON input is self-contained, in other words, all the code is already contained in the source files and there are no references to external, imported files:
docker run ethereum/solc:stable – standard-json < input.json > output.json
Since we haven’t done any examples using the JSON interface, we’ll suspend this approach until a later time.
Conclusion
This article introduced us to a Solidity-supporting technology called Docker.
Of course, our main focus is on an ecosystem consisting of Solidity, Ethereum, blockchain technology, etc., but I recognized an opportunity of making a detour and walking us through the process of setting up and using the Solidity compiler via the Docker platform. Therefore, although initially unplanned, we’re also gaining some DevOps skills.
In the first and only chapter (yeah, I’m a bit surprised as well) we’ve set the mining charges by getting to know what Docker is. Then we blew a big piece of rock away by discovering how to install Docker on Ubuntu Linux (and by extension, some other operating systems). I believe this article will prove useful and provide multiple tips and tricks in terms of setting your development environment for Solidity on Ubuntu Linux. Besides that and personally speaking, it was always useful to gain secondary knowledge whenever I learned a specific topic, and I’m sure you’ll have the same experience.
Solidity is the programming language of the future.
It gives you the rare and sought-after superpower to program against the “Internet Computer”, i.e., against decentralized Blockchains such as Ethereum, Binance Smart Chain, Ethereum Classic, Tron, and Avalanche – to mention just a few Blockchain infrastructures that support Solidity.
In particular, Solidity allows you to create smart contracts, i.e., pieces of code that automatically execute on specific conditions in a completely decentralized environment. For example, smart contracts empower you to create your own decentralized autonomous organizations (DAOs) that run on Blockchains without being subject to centralized control.
NFTs, DeFi, DAOs, and Blockchain-based games are all based on smart contracts.
This course is a simple, low-friction introduction to creating your first smart contract using the Remix IDE on the Ethereum testnet – without fluff, significant upfront costs to purchase ETH, or unnecessary complexity.
Graffiti Rebel 4 Bundle, THQ Racing Deals, Bandai Giveaways
Graffiti Rebel 4 Bundle | 5 Steam Games | 94% OFF
[www.indiegala.com] Turnip Boy Commits Tax Evasion, Lila's Sky Ark, Nira, Blue Fire, REZ PLZ are the fantastic indie Steam games you must discover with the help of the fourth Graffiti Rebel Bundle.
Posted by: xSicKxBot - 08-28-2022, 12:15 AM - Forum: Lounge
- No Replies
Godzilla Vs. Kong Sequel Gets First Plot And Casting Details
While it'll be a while yet before the sequel to Godzilla vs. Kong comes out, the team is already in production on the movie in Queensland, Australia. Today, Legendary Pictures offered up some initial details on the movie's plot, as well as some information about who is involved with the project, in a new press release (via ComicBook).
According to the release, the upcoming film will look further into the histories of the two starring monsters and their origins, as well as why they protect humanity and Earth from other monsters and from humans themselves. It's not a whole lot to go off of, but it does seem to suggest that we'll get even more screentime with the monsters this time around.
In terms of cast and crew, Adam Wingard is once again directing, with cast members Brian Tyree Henry, Rebecca Hall, and Kaylee Hottle returning, and Dan Stevens, Fala Chen, Alex Ferns, and Rachel House joining. Terry Rossio, Jeremy Slater, and Simon Barrett are writing the film. Newly announced are the return of director of photography Ben Seresin, production designer Tom Hammock, editor Josh Shaeffer, and composer Tom Holkenborg, and the addition of a few new crew members, including VFX supervisor Alessandro Ongaro, costume designer Emily Seresin, makeup artist Sabrina Wilson, and hairstylist Gloria Pasqua.