Pull to refresh

How to become an author

How to Write a Smart Contract with Python on Ontology? Part 1: the Blockchain & Block API

Reading time5 min
image

This is an official tutorial published earlier on Ontology Medium blog
Excited to publish it for Habr readers. Feel free to ask any related questions and suggest a better format for tutorial materials

Foreword


In this article, we will begin to introduce the smart contract API of Ontology. The Ontology’s smart contract API is divided into 7 modules:


In this article, we will introduce the Blockchain & Block API, which is the most basic part of the Ontology smart contract system. The Blockchain API supports basic blockchain query operations, such as obtaining the current block height, whereas the Block API supports basic block query operations, such as querying the number of transactions for a given block.

Let’s get started!

First, create a new contract in SmartX and then follow the instructions below.

1. How to Use Blockchain API


References to smart contract functions are identical to Python’s references. Developers can introduce the appropriate functions as needed. For example, the following statement introduces GetHeight, the function to get the current block height, and GetHeader, the function to get the block header.
Read more →
Total votes 20: ↑18 and ↓2+16
Comments0

Learn Bootstrap Fast With These 10 Helpful Tips

Reading time5 min
If you want to start your career in web development then learning Bootstrap is the way to go. Bootstrap is basically a framework used for front-end development of web apps. Its front-end component library is widely used to create interactive and responsive web apps and websites that we are used to today.

If you don’t already know, you must be wondering what responsive websites are? In simple terms, the responsiveness of a website means that when the size of the screen on which the website is being seen changes, the layout of the website responds to that and change. This makes the websites look good no matter what screen size it is being viewed on.

How does Bootstrap work?


There are two ways you can use Bootstrap. You can either import the Bootstrap into your code or you can download a sample Bootstrap project and build your website on that.

Bootstrap uses a 12-column model for website display, which is called a Bootstrap grid. On this grid, you can define different breakpoints to layout different components like headings, paragraphs, and buttons to make your website look visually appealing. When the screen size scales down, the components on the grid change layout to fit the smaller screen. This means that viewing the same website looks great on a normal size screen of your laptop and a smaller screen of your smartphone.

Bootstrap has become one of the most popular front-end development frameworks today. If you are a beginner who wants to start learning Bootstrap then you are on the right blog. Because here are the top 10 tips to learn and master Bootstrap!
Read more →
Total votes 18: ↑16 and ↓2+14
Comments0

Suspending over blocking

Reading time9 min

This article aims to show how to use Kotlin Coroutines and remove Reaxtive eXtensions (Rx).


Benefits


To start let's consider four benefits of Coroutines over Rx:


Suspending over Blocking


To run non-blocking code using Rx you'd write something like this:


Observable.interval(1, TimeUnit.SECONDS)
    .subscribe {
        textView.text = "$it seconds have passed"
    }

Which is effectively creating a new thread. Threads are heavy objects in terms of memory and performance.


Both are critical in the mobile development world.


You can achieve the same behavior using the following snippet:


launch {
    var i = 0
    while (true){
        textView.text = "${it++} seconds have passed"
        delay(1000)
    }
}

Essentially, Coroutines are light-weight threads but we don't create any real thread.
Here we are using non-blocking delay() function, which is a special suspending function that does not block a thread but suspends the Coroutine.

Read more →
Total votes 7: ↑6 and ↓1+5
Comments3

Vue.js Best Practices For Web Development

Reading time5 min

I am a full-stack developer at Syncrasy Tech (IT solutions company). I love writing React codes. But why I am telling you this as we are here to discuss the Vue.js best practices for web development. I am telling you this so that you can understand my background and why I’m discussing here the Vue.js.


I love working on React codes, but I hate reading them. This is the reason where I fail to code. Even with the best code review practices, I can’t figure out the nesting of React components that simply helps to create more complex UI structures in web apps.


The solution to this problem is Vue that is now not so new in the block of web app development. I have heard a lot about Vue async components, server-side rendering, tools, and libraries. Perhaps you find this myriad of terms to be confusing. Believe me, you’re not alone in that, many developers of all levels feel the same way when they don’t know the Vue best practices.


A few days later, I finally decided to get my codes into it. What I am sharing here are the numerous best practices that I have learned through my experience with Vue. I’m ready to share what I’d find.

Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

Tips And Tricks For Conducting A Successful Mobile App A/B Test

Reading time4 min


As per the latest stats reveal, there are more than 2.7 billion smartphone users globally and over 2.8 million apps on Google Play Store.


Now, it's a fact that the number of mobile users is increasing at outstanding speed, and so is the name of apps on Google Play Store.


But does all the apps success to make a difference? No, but just a handful of having stood out and gain popularity.


For instance, there are several games on the Play Store, but why only Candy Crush, Subway Surfers and Angry Birds topped the charts while the other games struggle for even ten downloads.


The trick is to provide the players with what they want, and in turn, the response for such apps is tremendous.


However, at this point, when the competition is very high, it's challenging to come up with something new that can stand out from the crowd.


It's crucial to create a brand name so that people can talk about it.

Read more →
Total votes 9: ↑9 and ↓0+9
Comments0

Modern Environment for React Native Applications

Reading time4 min
In this article, we will consider the process of setting up a React Native environment using expo-cli, Typescript, and Jest.
Typescript will help us avoid development mistakes and write a more efficient mobile application.

Modern tools allow integrating Typescript into the development environment. We can also use VS Code that supports Typescript.

Integration with React Native will give us the opportunity to use the auto-completion service, code navigation, and refactoring.

Expo is a toolkit that simplifies the creation of native React applications. This tutorial will give you an idea of how you can quickly create native React applications using Expo.


Read more →
Total votes 7: ↑6 and ↓1+5
Comments0

Winning PHDays 9 The Standoff: The chronicle by the True0xA3 team

Reading time16 min
This is an English-language summary of two absolutely outstanding articles written by Vitaliy Malkin from «Informzashita» whose team, True0xA3, became the winners of the prestigious black hat competition The Standoff during Positive Hack Days 9 in May of 2019.

Vitaliy has published three detailed articles on Habr, two of which were dedicated to the description of the strategies that True0xA3 team used before and during the competition to secure this team the title of the winners. I felt that the only thing that those two articles were lacking was a summary in English so that a wider audience of readers could enjoy them. So, below is the summary of two articles by Vitaliy Malkin, together with images Vitaliy published to clarify his points. Vitaliy has OKed me doing the translation and publishing it.
Read more →
Total votes 8: ↑8 and ↓0+8
Comments0

PHP microservices framework — Swoft 2.0.3 published

Reading time4 min

image


What is Swoft?


Swoft is a PHP microservices coroutine framework based on the Swoole extension. Like Go, Swoft has a built-in coroutine web server and a common coroutine client and is resident in memory, independent of traditional PHP-FPM. There are similar Go language operations, similar to the Spring Cloud framework flexible annotations, powerful global dependency injection container, comprehensive service governance, flexible and powerful AOP, standard PSR specification implementation and so on.


Through three years of accumulation and direction exploration, Swoft has made Swoft the Spring Cloud in the PHP world, which is the best choice for PHP's high-performance framework and microservices management.


Elegant service governance


Swoft officially recommends that developers use service mesh patterns, such as the Istio/Envoy framework, to separate business and service governance, but Swoft also provides a set of microservices components for small and medium-sized businesses to quickly build microservices.

Read more →
Total votes 20: ↑18 and ↓2+16
Comments0

Microservices architecture & implementation Step-by-Step Part 1

Reading time2 min
Hi All,

I’m in the process of implementing a new simple microservices-based project as an example of a step-by-step guide for those who had a hard time with a microservices architecture and are still looking for “another” good reference. Also, I would really appreciate thought through feedback and proposal to make this project a high-quality chunk of work.

There are tons of articles and source code examples. But, unfortunately, I could not find any reference with simple step-by-step instructions, without doing a deep dive into Docker, Event Store, a multitude of configurations, cloud deployment stuff, etc. I cloned several projects and tried to start playing with them, but you know, only God knows how to start them, which dependencies are missing and why all those scripts are failing with thousands of ERRORS.

For example, this eShop project from Microsoft contains all we need, but it is not so simple to figure out what is going on there, SQL database connection strings, Docker scripts fail, no How-Tos and I’m not sure it is super-simple architecture you need to start with.

image
Read more →
Total votes 17: ↑14 and ↓3+11
Comments0

Building a global legal network for open source

Reading time8 min
In late 2006 I became the first coordinator of the Free Software Foundation Europe’s legal department. It was called, for reasons lost to time, the “Freedom Task Force,” and it constituted myself, Carlo Piana as the General Counsel, and several volunteers with connections to organizations like gpl-violations.org. Our goal was strait forward. We wanted to enhance knowledge and communication across Europe with respect to open source software and to ensure that both commercial and non-commercial actors in the space would get the full benefit from its potential.

One may ask why a legal department was being used for what sounds like a relatively general goal. Such a question can be answered with context from the time period. In 2006 one of the main discussions about sustainability for open source was related to legal matters, particularly concerns or challenges related to patents and copyright matters. Simplifying things somewhat, there were open questions regarding whether patent challenges could make open source expensive or unsustainable for commercial actors, and there were open questions regarding whether parties could or should follow the terms of open source licenses.

On the latter point, and somewhat amusingly when used from the perspective of today, some parties were of the opinion that the terms of open source licenses might not be mandatory. Harold Welte, the team at gpl-violations.org and lawyers like Dr. Till Jeager in Germany are owed a debt for laying this question conclusively to rest not only in their own nation but globally. While it may seem superficially counter-intuitive, their work to ensure clarity a substantial foundation to encourage and sustain commercial investment in the sphere. After all, when it comes to investment, a clear, unambiguous and level playing-field is vital.
Read more →
Total votes 5: ↑5 and ↓0+5
Comments0

Marketing with ML decision making

Reading time2 min
Backlog prioritization leads to the choice between strategies. Each one has its metrics. There is a requirement to choose the most important one. ML scoring is a solution when non linearity exists and economy is nonlinear. See introduction here. Two groups are considered. First (I) corresponds to web conversion {bounce rate, micro conversion, time, depth}. Second (II) corresponds to attraction of new visitors from organic channel {visits, viewers, views}. The target function is a number of commercial offers per day. The task is to reduce the dimension to get the optimal simple strategy. In this case online/offline B2B channels can't be separated: market is thin and new customers may have some information about 'the brand' from both channels. Therefore statistical evaluation is closer to reality than direct CJM tracking in this case.
Read more →
Total votes 10: ↑8 and ↓2+6
Comments0

9 Ways to Fuel Up the Mobile App Developer’s Efficiency

Reading time5 min
image

In general, the productivity of coding superheroes is measured by the number of lines of code and the quality of the code they write. It means, when the developer churns out the output compared to input, they are declared as productive. Presently, every company wants a productive programmer to accelerate time-to-market and enrich mobile app user’s experience that helps them stand ahead of the competitors.

Alas! All the developers are not productive. Most of them, pull their hairs when the deadline is around the corner, when finding the source of bugs seems a hard nut to crack in, or when the client is complaining about the features not meeting the business needs. The reason behind for not performing to the peak efficiency is they work hard, but not smartly.

The developer’s productivity can be augmented when they work prudently, make the most out of the time, and incorporate the best practices.
Read more →
Total votes 12: ↑11 and ↓1+10
Comments0

Top 10 JavaScript Hack for Optimized Performance

Reading time5 min

JavaScript has been ruling the tech arena for more than two decades and helping developers simplifying complex tasks. It allows developers to implement complex task web pages in a most simplified manner. For most of the developers minified JavaScript file is the common phenomena while very few developers may be aware of Optimized JavaScript code. While meeting through many Javascript developers, I have come to know that Optimized JavaScript code is something that confuses developers, some of them might be doing it, but they are not aware of this.


What is an Optimized JavaScript Code


When combinations of uniquely programmed logics along with small hacks utilized to enhance performance and speed is known as Optimized JavaScript code. Optimization not only optimizes performance and speed but also saves maximum development time. When you save time, you save some bucks as well.


So, I am here with some useful and fruitful hacks to help developers optimize performance, enhance speed and save time. Hope, you like the article and after going through it, you may utilize the best of Optimized JavaScript code.

Read more →
Total votes 13: ↑8 and ↓5+3
Comments1

What are the application areas of 3D printing?

Reading time4 min

What is 3D printing?


3D printing is a new way of manufacturing solid objects based on the principle of discrete-stacking.
With the evolution of the trend, 3D printing has become a way to promote smart manufacturing, flexible manufacturing and green manufacturing. It can realize the integrated formation of complex structures that are difficult to process or even cannot be processed by traditional manufacturing technologies, greatly enhancing the process realization capability. Subversive advancement in equipment design and manufacturing.

From the past used to manufacture models, and now gradually realize the direct manufacturing of products, 3D printing manufacturing technology is developing towards the integration of “design-material-manufacturing”. According to research, the size of the world 3D printing market in 2017 was 3.86 billion US dollars. In 2018, the scale of China's 3D printing market was as high as 7.75 billion US dollars, which has more than doubled in two years. From behind the scenes to the forefront of the industry, the development of the 3D printing industry has moved from the concept introduction period to the rapid development period, all thanks to: "application." Members of the World 3D Printing Association have said:

When 3D printing technology goes out of the lab,
Its development motivation lies in its application
Read more →
Total votes 10: ↑8 and ↓2+6
Comments0

Improve your mobile application using machine learning technology

Reading time4 min
Today, even mobile application developing company has begun to consolidate ML related to other cutting edge technologies, for example, AI and predictive analysis. This is on the grounds that ML empowers mobile applications to learn, adjust, and improve after some time.

It’s an incredible accomplishment when you consider the way that changes requested an express order from designers for gadgets to execute a particular activity. At the point when this was the standard, software engineers needed to estimate and record for each conceivable situation (and this was a fantastic test).

Be that as it may, with ML in portable applications, we have removed the speculating game from the condition. It can likewise upgrade User Experience (UX) by understanding client conduct. So you can wager that ML in versatile won’t be restricted to voice associates and chatbots.
Read more →
Total votes 16: ↑16 and ↓0+16
Comments0

Advantages and Disadvantages of Using Flutter for Mobile Development

Reading time4 min


Flutter is a new open source framework created by Google that assists in developing native Android as well as iOS apps with one codebase. It is more than just a framework as it is a full software development kit that has everything you require for building cross-platform apps. This Flutter review will look into the advantages and disadvantages of the tool.
Read more →
Total votes 8: ↑7 and ↓1+6
Comments0

ANPR using RoR & React Native

Reading time10 min
Danny Krastev, Mirabbos Umarov, Ekaterina Menshenina, ITMO University, Info communication Systems, Computer Science. 2019

image

Abstract


Due to the never-ending increase in volume of vehicles surrounding our daily lives, Automatic Number Plate Recognition (ANPR), has become an evolving solution for managing and monitoring vehicles worldwide to enforce rules and prevent criminal activities, such as parking violation, red light violation, speeding, and vehicle theft. Although there is already a variety of public and private methods and libraries that have been developed and are used to achieve the automatic recognition of car license plate numbers around the world, there has not been much focus on making advancements toward a cross platform ANPR solution that supports all vehicle license plates worldwide. This paper introduces the Plate Vision project, a web and mobile application built on Ruby on Rails and React Native, which aims to serve as an alternative ANPR platform that supports detection of all license plates worldwide by utilizing various open source optical character recognition (OCR) libraries and making efficiency optimizations.

Key words and phrases: ruby, rails, react native, license plate recognition, plate region extraction, optical character recognition (OCR), ANPR.
Read more →
Total votes 11: ↑10 and ↓1+9
Comments0

How to make possible micro-payments in your app

Reading time8 min

This week I spent coding my very first public pet-app based on Telegram chat bot which acts as a Bitcoin wallet and allows to send and receive tips between Telegram users and other so-called “Lightning Apps”. I assume that you are familiar with Bitcoin & Telegram in general, i’ll try to post short and without deep jump into details. More resources about Bitcoin can be found here and Telegram is simply an instant messenger that allows you to create your custom apps (chat-bots) using their platform.


What are the key points of such app?


  • Allows to rate other users ideas and answers with real value instead of
    ‘virtual likes’. This brings online conversation to completely new level
  • Real example of working micro-payment app which can act with other entities
    over internet using open protocol
  • All the modules are open-source projects and can be easy re-used and adjusted
    for your own project. App does not relay on third-party commercial services.
    Even it falls under e-commerce field, which is currently almost closed, the app
    is based on open solutions.

What are the use-cases?


something like this…

image
Read more →
Total votes 12: ↑11 and ↓1+10
Comments0

Automatically obtaining SSL certificates by Let's Encrypt using DNS-01 challenge and AWS

Reading time5 min

This post describes the steps needed for setting up automatic SSL certificates creation and renewal, using Let's Encrypt as the automated Certificate Authority, which provides a well-maintained API.
acme-dns-route53 is the tool to obtain SSL certificates from Let’s Encrypt using DNS-01 challenge with Route53 and Amazon Certificate Manager by AWS. acme-dns-route53 also has the built-in functionality for using this tool inside AWS Lambda, and this is what we are going to do.

Read more →
Total votes 11: ↑10 and ↓1+9
Comments0

Practicalities of deploying dockerized ASP.NET Core application to Heroku

Reading time3 min

Intro


.NET is a relative newcomer in the open-source world, and its popularity is nowhere near mainstream platforms like Node.js. So you can imagine there're few tutorials that deal with .NET and frameworks such as ASP.NET on Heroku. And those that do, probably won't use containers.


Image showing heroku menu without C#


Do you see C#/.NET here? Yes, me neither.

Read more →
Total votes 20: ↑19 and ↓1+18
Comments1