Skip to main content

Posts

Showing posts from March, 2017

Storing files in a remote location - Cloudinary

When you are developing an application or a website, you may use a file storage to store certain resources such as images, videos etc.  If you specify a particular image location in your code and later if you change this location, you might have to find all its usages and refactor. If you store the image in a remote location and retrieve it using the URL, this problem can be avoided. There can be certain services (eg: Image Processing, Image Understanding etc.) that require Image URLs to be given.  So rather than maintaining our service, we can use the service provided by Cloudinary[1]. I found this service to be very reliable and very well documented. You can use their API or SDK to consume their service. In order to do so you must first create an account. A free account will support upto 75000 uploads. This blog post will contain a Java Source code that consumes their service through the API. Step 1: Register After registering with their service, you will be re...

Building WSO2 Identity Server 5.3 from Source

This blog post contains the steps to be followed in order to build the Identity Server to contribute to the source. Step 1: Building the Carbon Kernel i) Carbon Kernel should be downloaded from the following link. https://github.com/wso2/carbon-kernel URL to check out the repository -  https://github.com/wso2/carbon-kernel.git ii) and check out to the relevant tag . The correct tag to be used can be followed from [1]. iii) And build the Carbon Kernel by running ' mvn install '.  This process will take some time. Step 2: Cloning / Downloading the Product Source  i) Product source can be cloned/downloaded from the following link. https://github.com/wso2/product-is URL to check out the repository -  https://github.com/wso2/product-is.git ii) After downloading, checkout to the relevant tag . iii) And  build  the Identity Server by running ' mvn install '.  [1]  http://wso2.com/product...

Interacting with an Ethereum Smart Contract using Meteor and Ethereum

This blog post contains steps on how to interact with a specific contract on the blockchain extending the application created in the previous blog post [1]. Step 1: Add  frozeman:template-var This is used since we use callback very often. This wrapper can be found at [2]. Give the following command in order to add it to our application. meteor add frozeman:template-var Step 2: Adding the balance to be viewed inside the template Alter your code as below. main.js main.html When you refresh the browser, you should get the below output without having to click the button. Step 3: Writing the Smart Contract in Solidity Solidity is the language that ethereum uses to write smart contracts. In order to write the smart contract for our application we will use the online Solidity compiler which can be found at [3]. Step 4: Deploying the Smart Contract Log in to the MetaMask and make sure you are on the testnet. Select 'Create' in the right side p...

Creating a dApp using Ethereum and Meteor (Setting up)

This blog posts contains the step to be followed when creating a simple dApp (Decentralized Application) using Ethereum and Meteor.  This application will not use the actual ethereum blockchain. Instead it will connect to the Testnet. This application is developed for Demo purposes. Hence, Meta mask extention will be used. If you need to connect to the main network, geth client or any other client for Ethereum should be used. Step 1: Create a meteor project In order to create a new meteor application, run the following command inside the directory you want the app to be created in. meteor create <app_name> The application will be created as follows. Step 2: Add Web3 to the project Web3 library is what allows you to interact with the ethereum blockchain. Web3 library can be found at [1]. Inside the meteor application just created run the following command to add Web3. meteor add ethereum:web3 Step 3: Download and install Metamask extension for C...

Getting Started with establishing a Private Network for Ethereum

Although there are a considerable amount of references available on establishing a public network using Ethereum, there's quite a few concerning private networks. Some of the important points to be noted are, The network Id should be any other value than 1.  1 is the default networkId of the main network. So when the networkId is different your nodes will not connect to the main network, thereby creating an isolated, private network. You can either pregenerate or mine your own ether . Should have a custom genesis file . Should have a separate custom data directory for the nodes. Node Discovery should be disabled. This is so that the node is not discoverable by people who do not add you manually. If not, your node may get added to an unknown blockchain having the same networkId and genesis block. Step 1 - Custom genesis file The protocol validates if the blockchains on two nodes has the same genesis file in order to identify if its the same bloc...

Why Java doesn't support Multiple Inheritance?

Has it ever occurred to you why Java doesn't support Multiple Inheritance being developed in C and C++ which supports Multiple Inheritance? Here's why. Assume there are 4 classes named class A, class B, class C and class D. B and C are derived from A and D is derived from both B and C using Multiple Inheritance. A will contain a method 'find()' which will be inherited by B and C. When we create an object from D and try to call this find() method as below,                         D d = new D();                         d.find(); JVM is confused as to which method to use!!!  since both B and C contains an  overridden  find() method. This is known as The Deadly Diamond of Death . In languages like C and C++ you have to use other workarounds as a solution. But since Java does not support Mul...