TRUNGTQ

Think Big, Act Small, Fail Fast and Learn Rapidly

NAVIGATION - SEARCH

SQL Server - Tìm và xóa các đối tượng phụ thuộc vào 1 bảng trong Database

Chào mọi người!

Hôm nay mình ngồi kiểm tra và xóa các bảng không cần thiết trong 2 cái database, mỗi cái có tầm 200 tables, nếu View Dependencies bằng tay thì quá to tay, nghĩ tới đã thấy mệt rồi.

Mình đã search và tìm thấy một cách tương đối ổn, hôm nay chia sẻ mọi người.

1. Mình phân loại các bảng nào cần xóa vào 1 file Excel để quản lý chúng, có một cột đánh dấu là có các stored procedure hay functions nào phục thuộc vào không.

Mình dùng lệnh SQL sau để kiểm tra:

DECLARE @tableName VARCHAR(100) = '[dbo].[YourTableName]'

SELECT 
COALESCE(Referenced_server_name+'.','')+ --possible server name if cross-server
COALESCE(referenced_database_name+'.','')+ --possible database name if cross-database
COALESCE(referenced_schema_name+'.','')+ --likely schema name
COALESCE(referenced_entity_name,'') + --very likely entity name
COALESCE('.'+COL_NAME(referenced_ID,referenced_minor_id),'')AS [referencing],
COALESCE(OBJECT_SCHEMA_NAME(Referencing_ID)+'.','')+ --likely schema name
OBJECT_NAME(Referencing_ID)+ --definite entity name
COALESCE('.'+COL_NAME(referencing_ID,referencing_minor_id),'') AS [referenced]
FROM sys.sql_expression_dependencies
WHERE referenced_id =OBJECT_ID(@tableName)
ORDER BY [referenced]

 

2. Mình xây dựng các câu SQL dạng scripts, chỉ cần F5 là xóa cá stored procedure, functions phụ thuộc.

Mình dùng lệnh SQL sau để liệt kê các đối tượng phụ thuộc cần xóa:

DECLARE @tableName VARCHAR(100) = '[dbo].[YourTableName]'

DECLARE @SQL NVARCHAR(MAX) = '';
DECLARE @crlf VARCHAR(2) = CHAR(13) + CHAR(10) ;

WITH cte AS(
SELECT
COALESCE(Referenced_server_name+'.','')+ --possible server name if cross-server
COALESCE(referenced_database_name+'.','')+ --possible database name if cross-database
COALESCE(referenced_schema_name+'.','')+ --likely schema name
COALESCE(referenced_entity_name,'') + --very likely entity name
COALESCE('.'+COL_NAME(referenced_ID,referenced_minor_id),'')AS [referencing],
COALESCE(OBJECT_SCHEMA_NAME(Referencing_ID)+'.','')+ --likely schema name
OBJECT_NAME(Referencing_ID)+ --definite entity name
COALESCE('.'+COL_NAME(referencing_ID,referencing_minor_id),'') AS [referenced]
FROM sys.sql_expression_dependencies
WHERE referenced_id =OBJECT_ID(@tableName)
)

SELECT @SQL =@SQL + 'DROP PROCEDURE ' + referenced + ';' + @crlf
FROM cte

PRINT @SQL

 

3. Sau đó sinh script xóa Table từ File Excel, F5 là xong

4. Chúc mọi người may mắn nếu gặp phải công việc tương tự.

 

Tìm hiểu chung về các loại RAID lưu trữ

Tìm hiểu chung về các loại RAID lưu trữ

      Trong quá trình tư vấn và hỗ trợ khách hàng, Vinahost đã nhận được rất nhiều câu hỏi về Raid. Vậy Raid là gì? Chức năng của Raid nhằm mục đích gì? Có những loại Raid nào? Ưu và nhược điểm của từng loại? Đối với từng đối tượng dịch vụ cụ thể thì nên sử dụng Raid gì là tối ưu?

Để tìm hiểu về Raid thì trước tiên ta sẽ định nghĩa Raid là gì.

     RAID (Redundant Arrays of Inexpensive Disks) là hình thức ghép nhiều ổ đĩa cứng vật lý thành một hệ thống ổ đĩa cứng có chức gia tăng tốc độ đọc/ghi dữ liệu hoặc nhằm tăng thêm sự an toàn của dữ liệu chứa trên hệ thống đĩa hoặc kết hợp cả hai yếu tố trên.

     Về phân loại thì có khả nhiều loại Raid được sử dụng như Raid 0, Raid 1, Raid 3, Raid 4, Raid 5, Raid 10 .v.v… Trong bài viết tìm hiểu về Raid ngày hôm nay Vinahost xin được giới thiệu bốn loại Raid chính phổ biến và thường được các khách hàng của Vinahost sử dụng là Raid 0, Raid 1, Raid 10 và Raid 5.

     1. RAID 0:



     Raid 0 là loại Raid khá phổ biến và được nhiều người sử dụng hiện nay do có khả năng nâng cao hiệu suất tốc độc đọc ghi trao đổi dữ liệu của ổ cứng. Để tiến hành setup Raid 0 thì server cần tối thiểu 2 ổ đĩa (Disk 0, Disk 1).

     Raid 0 sẽ lưu trữ như sau. Giả sử bạn có 1 file A dung lượng 100MB. Khi tiến hành lưu trữ thay vì file A sẽ được lưu vào 1 ổ cứng duy nhất, Raid 0 sẽ giúp lưu vào 2 ổ đĩa disk 0, disk 1 mỗi ổ 50MB (Striping)  giúp giảm thời gian đọc ghi xuống 1 nửa so với lý thuyết .

   Ưu điểm: Tốc độ đọc ghi nhanh (gấp đôi bình thường theo lý thuyết).

   Nhược điểm: tiềm ẩn rủi ro về dữ liệu. Lý do dữ liệu được chia đôi lưu trên 2 ổ đĩa.Trường hợp 1 trong 2 ổ đĩa bị hỏng thì nguy cơ mất dữ liệu rất cao. Về ổ cứng yêu cầu phải 2 ổ cùng dung lượng, nếu 2 ổ khác dung lượng thì lấy ổ thấp nhất.

   Đối tượng sử dụng: Thích hợp với những dịch vụ cần lưu trữ và truy xuất với tốc độ cao. Chẳng hạn như dịch vụ video streaming, chạy cơ sở dữ liệu... (đối với hình thức lưu trữ này Vinahost khuyến cáo khách hàng nên có hình thức sao lưu backup của mình.)

      2. RAID 1:

     Raid 1 là loại Raid cơ bản được sử dụng khá nhiều hiện nay do khả năng đạt an toàn về dữ liệu. để tiến hành setup Raid 1 thì cũng giống như Raid 0, server cần tối thiểu 2 ổ cứng để lưu trữ.

     Không giống như Raid 0, Raid 1 đảm bảo an toàn hơn về dữ liệu do dữ liệu được ghi vào 2 ổ giống hệt nhau (Mirroring).

     Ưu điểm: An toàn về dữ liệu, trường hợp 1 trong 2 ổ đĩa bị hỏng thì dữ liệu vẫn có khả năng đáp ứng dịch vụ.

     Nhược điểm: Hiệu suất không cao, Nâng cao chi phí (giả sử khách hàng sử dụng 2 ổ cứng 500GB. Khi sử dụng Raid 1 thì dung lượng lưu trữ có thể sử dụng chỉ được 500GB). Về ổ cứng yêu cầu phải 2 ổ cùng dung lượng, nếu 2 ổ khác dung lượng thì lấy ổ thấp nhất.

     Đối tượng sử dụng: Các dịch vụ lưu trữ, các website vừa và nhỏ không yêu cầu quá cao về tốc độ đọc ghi (in/out) của ổ cứng. Các đối tượng yêu cầu sự an toàn về dữ liệu như các dịch vụ kế toán,lưu trữ thông tin khách hàng, bất động sản v.v…

   3. RAID 10:

     Raid 10 là sự kết hợp giữa 2 loại raid phổ biến và Raid 1 và Raid 0. Để setup Raid 10 khách hàng cần sử dụng tối thiểu 4 ổ cứng (Disk 0, Disk 1, Disk 2, Disk 3).

     Đối với Raid 10 dữ liệu sẽ được lưu đồng thời vào 4 ổ cứng. 2 ổ dạng Striping (Raid 0) và 2 ổ (Mirroring) Raid 1.

     Ưu điểm: Đây là 1 hình thức lưu trữ nhanh nhẹn và an toàn, vừa nâng cao hiệu suất mà lại đảm bảo dữ liệu không bị thất thoát khi 1 trong số 4 ổ cứng bị hỏng.

     Nhược điểm: Chi phí cao. Đối với Raid 10 dung lượng sẵn sàng sử dụng chỉ bằng ½ dung lượng của 4 ổ. (giống như raid 1).

     Đối tượng sử dụng: Raid 10 thích hợp với tất cả các đối tượng sử dụng (từ những yêu cầu về hiệu suất đến việc đảm bảo an toàn dữ liệu). Về ổ cứng yêu cầu phải 4 ổ cùng dung lượng, nếu 4 ổ khác dung lượng thì lấy ổ thấp nhất.

    4. RAID 5:

     Raid 5 cũng là một loại Raid được phổ biến khá rộng rãi. Nguyên tắc cơ bản của Raid 5 cũng gần giống với 2 loại raid lưu trữ truyền thống là Raid 1 và Raid 0. Tức là cũng có tách ra lưu trữ các ổ cứng riêng biệt và vẫn có phương án dự phòng khi có sự cố phát sinh đối với 1 ổ cứng bất kì trong cụm.

     Để setup Raid 5 ta cần tối thiểu 3 ổ cứng. Theo như hình minh họa phương án lưu trữ của Raid 5 như sau. Giả sử có 1 file A thì khi lưu trữ sẽ tách ra 3 phần A1, A2, A3. Ba phần nãy sẽ tương ứng lưu trên ổ đĩa Disk 0, Disk 1, Disk 2, còn ổ đĩa Disk 3 sẽ giữ bản sao lưu backup của 3 phần này. Tương tự các file sau cũng vậy và tùy theo tiến trình thực hiện mà bản sao lưu có thể được lưu ở bất kì 1 trong những ổ trong cụm Raid.

     Ưu điểm: Nâng cao hiệu suất, an toàn dữ liệu, tiết kiệm chi phí hơn so với hình thức lưu trữ Raid 10.

     Nhược điểm: Chi phí phát sinh thêm 1 ổ so với hình thức lưu trữ thông thường. (tổng dung lượng ổ cứng sau cùng sẽ bằng tổng dung lượng đĩa sử dụng trừ đi 1 ổ. Giả sử bạn có 4 ổ 500GB thì dung lượng sử dụng sau cùng khi triển khai Raid 5 bạn chỉ còn 1500GB).

     Đối tượng sử dụng: Tất cả những website, dịch vụ, ứng dụng có số lượng truy cập và yêu cầu tài nguyên từ nhỏ đến vừa và lớn.

      Trên đây là những khái niệm cơ bản về các phân loại Raid phổ biến được sử dụng thường xuyên. Quý khách hàng có thể tham khảo và lựa chọn cho mình loại Raid phù hợp nhất với yêu cầu của mình. Nếu có thắc mắc quý khách hàng có thể liên hệ Vinahost để được hỗ trợ tư vấn thêm.
      Quý khách có thể tham khảo thêm ước lượng RAM và CPU cần thiết cho một website tại đây: http://vinahost.vn/ac/knowledgebase/230/c-tinh-mc--tai-nguyen-ram-or-cpu-cn-s-dng-cho-mt-website.html

LINK: https://vinahost.vn/ac/knowledgebase/252/Tim-hiu-chung-v-cac-loi-RAID-lu-tr.html

 

Top Five Developer Trends Of 2018

The year 2017 has been one of the most exciting years for developers and technology lovers. Technologies such as big data, machine learning, Internet of Things (IoT), artificial intelligence, drones, autonomous vehicles, wearables, virtual reality, and smart homes are some of the fastest-growing innovations.

Gartner breaks down in its hype cycle of emerging technologies of 2017 and shows that AI, machine learning and deep learning are the focus while autonomous vehicles, virtual assistants, computer security, blockchain and cognitive computing is on the rise. The below graph indicates the lifetime of various technologies.

Developer Trends

In this article, I will focus on the cutting-edge technologies that are directly related to jobs and expected to grow at a faster pace than previously anticipated.

My top 5 emerging technologies predictions for year 2018 include the following,

  1. Cloud
  2. Cyber Security
  3. AI Assistants
  4. Augmented Reality
  5. Blockchain

Trend #1. Cloud

Cloud computing has grown tremendously in the past few years and it will continue to rise in 2018. Let’s look at some of the numbers.

  • 1 billion smart devices worldwide
  • 3 billion people connected to the Internet
  • 3 billion mobile phones, 3.5 billion toothbrush owners
  • 197 billion app downloads in 2016, 353 billion by 2021
  • Americans spend 4.7 hrs a day
  • Average person takes150 photos a month

Amazon’s AWS, Microsoft’s Azure, and Google Cloud take the top 3 spots in the cloud space followed by IBM and Oracle.

Cloud jobs will continue to grow in 2018.

The quarterly growth of Azure, Google Cloud, and AWS was 93%, 50%, and 45% respectively. The cloud migration and digitation transformation will continue to grow and so will the number of jobs. The digital transformation market size is $1.7 trillion for the next several years.

Developer Trends

Today, cloud architect is one of the most in-demand jobs. An Indeed search returns over 25,000 results for cloud architect keywords. The number of job results for AWS and Azure are over 25,000 and 12,000 respectively.

Trend #2. Cyber Security

Cyber security will be one of the most in-demand careers in coming years. Cybercrimes are expected grow exponentially. Blame it on the growing size of data and the expanding cloud. As a matter of fact, Cyber Security is one of the most in-demand careers in IT. Here are some facts:

  • 3 Billion Yahoo accounts hacked
  • 200 million Equifax accounts' data stolen
  • Ransomware damage costs are close to $5 billion in 2017.
  • Cyber crime damage costs up to $6 trillion annually by 2021
  • Cyber security products and services are predicted to exceed $1 trillion over next 5 years, by 2021.
  • Cybercrime will have a deficit of 3.5 million cyber security experts by 2021.
  • 6 billion people will be affected by cybercrimes by 2022.
  • Network engineers should start focusing on cyber security products and services.
  • Darkweb has everyone’s social media, credit cards, and bank accounts

1 million cyber security experts needed by 2020.

If you’re looking for a growing career, cyber security will be one of the fastest growing fields for IT developers and administrators.

Recommended: Cyber Security is a big opportunity for developers

Trend #3. AI-Assistants

Smart home speakers are growing and tens of millions of Alexa devices were sold during this holiday season. According to a canalys.com, Smart speakers are the fastest growing consumer tech, surpassing AR, VR, and wearables and shipments are expected to surpass 50 million devices.

Smart home speakers are powered by an AI assistant. For example, Amazon Echo, Google Home, and Harman Kardon Invoke speakers are powered by Alexa, OK Google, and Microsoft Cortana respectively.

Developer Trends

Amazon Alexa is the AI-assistant behind tens of millions of devices like the Amazon Echo, Echo Dot, and Echo Show. Alexa provides capabilities, or skills, that enable customers to create a more personalized experience. There are now more than 25,000 skills from companies such as Starbucks, Uber, and Capital One as well as other innovative designers and developers.

Over 25 millions Alexa Echo devices sold in Q4 2017.

Today, 40% of adults use voice search and Apple’s Siri is used by 41.4 million monthly. Microsoft Cortana, the intelligent assistant on Windows 10 has 133 million monthly users. The numbers are expected to grow a lot. According to a research, by 2020, 30% of searches will be done without a screen. Smart home devices in the USA are expected to grow to 244 million by 2022.

Here are some of the statistics on AI-Assistants.

  • 50% of searches will be voice search by 2020
  • 40% of adults use voice search
  • 30% of searches will be done without a screen
  • Siri 45%, Google Now 33% and Cortana 27%, 10% use Amazon Alexa
  • Smart home devices in US will be 244 million by 2022, up from 24 million in 2016. Six point three million will have at least one smart speaker by 2022.
  • Apple Siri has 41.4 million monthly users
  • Amazon Echo devices: 22 million sold in 2017
  • Microsoft Cortana has 133 million monthly users

The rise of the need for smart home speakers and other smart home devices will increase the need of AI-assistant developers.

If you’re a developer and looking for some exciting future opportunities, AI skills development will be something I recommend. Alexa skills developer demand will grow. As of now, there are 1000+ jobs available for Alexa developers.

Recommended: AI-Assistants devices create new opportunities for developers

Trend #4. Augmented Reality

Augmented reality is one of the most sought-after technologies of 2017 and the demand will continue to grow in 2018. Major technology companies including Microsoft, Facebook, Google, Intel, Nvidia and others are working on their own version of AR/VR products. More and more AR-VR devices are being introduced to the market almost every few months.

Developer Trends

The gaming industry is already enjoying a huge success of VR and AR technologies. Oculus, HTC, Sony, Microsoft, Google, and Samsung are already selling thousands of devices worldwide. Facebook and a few other companies have a need for 10,000 AR/VR developers and content creators. AR/VR market size is going to hit $162B by 2020 according to IDC and software is still playing a catchup game with hardware. There is a lack of experts and content for both, AR and VR devices.

Developer Trends
Source: CSS Insights

Here is a shipment report for the last few quarters.

Developer Trends

Here are some of the statistics gathered from various sources: 

  • 100 million devices sold by 2021
  • LinkedIn shows over 2000 jobs in virtual reality 

Augmented Reality is the future of telecommunication.

Microsoft HoloLens has enjoyed a limited success in the mixed reality space and it is just getting started.

In June 2017, Apple launched ARKit for iOS that allows developers to build augmented reality applications and games. Today, there are thousands of AR games available in Apple Store.

Recently, Google announced its ARCore Developer Preview 2, that will let Android developers build AR apps for Android devices.

Trend #5. Blockchain

Blockchain is the technology of  2017. You may thank bitcoin, altcoins (cryptocurrency), and ICOs (Initial Coin Offering) for the rise of blockchain. Thousands of projects have already been built on top of blockchain and more projects are being created every day.

Check out Bitcoin Explained In Simple Terms to learn more about bitcoin. 

 

The following chart shows the Google Trends of for blockchain (blue), cryptocurrency (yellow) and bitcoin (red).

Developer Trends

Banking, payments, supply chain, insurance, security, and healthcare are a few industries that have already stated building blockchain based applications. As a matter of fact, 57% of large corporations are considering some kind of blockchain adoption. Obviously, this will lead to more jobs.

Do you need a blockchain? Find out here >

There may not be too many jobs today but going forward, 2018 and beyond will have a major need for blockchain developers.

6 out of 10 CIOs are looking into blockchain.

Summary

LINK: http://www.c-sharpcorner.com/article/top-five-developer-trends-in-2018/

The year 2017 has been a remarkable year for technology growth and it will continue to grow. In this article, I covered 5 trending technologies that developers will enjoy in 2018 and beyond. Cloud and cyber security are the needs of today and tomorrow and it will continue to grow. AI-assisted home devices are growing and hence the need for software. Augmented reality and blockchain are two new growing technologies that will reshape the future in coming years.

Besides these top 5 trends, machine learning, data scientists, data analytics, DevOps, and gaming are another growing trend you may want to keep an eye. Let’s talk DevOps.

Good luck!

Blockchain, An Unblocked Opportunity For Developers

Blockchain technology has become the phenomenon of 2017. According to Google, Blockchain and Bitcoin were two of the most-searched keywords last year. Blockchain is also one of the Top 5 Developer Trends Of 2018. Cryptocurrency, bitcoin, and ICOs (Initial Coin Offering) are fueling the blockchain discussion and increasing awareness of the technology.

Today, more and more organizations are looking to take advantage of blockchain mania. As a matter of fact, 58% of the large corporations are interested in building some kind of blockchain application.

So, here is the good news for software developers. Blockchain is all about software. Blockchain is all about how to store, share, and maintain data (transactions) securely.

My aim with this article is to bring some attention to the size of the opportunity blockchain presents for software developers.

Blockchain

The blockchain concept was first introduced by Stuart Haber and W. Scott Stornetta in 1991 as “a cryptographically secured chain of blocks,” which means a chain or blocks that are linked and cryptographically secured. Each block is a combination of three items, a hash pointer to the previous block, a timestamp, and transaction data. By design, blockchains are secure and difficult to modify.

Blockchain definition from Wikipedia:

Blockchain is a technology to create and maintain cryptographically secure, shared, and distributed ledger (a database) for transactions. Blockchain brings trust, accountability, and transparency to digital transactions.

All transactions that exist on a blockchain are shared and distributed among a network of peer-to-peer computers. Transactions are encrypted and decrypted using private and public keys.

Watch this video to learn what blockchain is:

Let’s remove the security part from the list, I bet, most enterprise systems do not want to be public, transparent, or distributed. Also, a system built on blockchain does not only take a longer time to process transactions but also requires many more times the resources such as processing, electricity, and data transfer. If that is the case, you don’t really need blockchain.

Obviously, blockchain is not for everyone. Building blockchain applications are complicated, time consuming, transparent, and costly. Here is my article, Do You Need A Blockchain that will ask you the right questions and give you the answer to whether or not you really need a blockchain.

The applications

Blockchain isn’t industry specific. Blockchain is useful where you need to bring transparency and accountability to a system. If you look at some of the obvious industries that lack trust, include banking, financial institutions, insurance, healthcare, pharma, investment firms, and money transfer, obviously, these industries could use blockchain to bring trust to the system.

Blockchain brings trust to a system.

Banking, payments, supply chain, insurance, security, and healthcare are a few industries that have already stated building blockchain-based applications. As mentioned earlier, 58% of large corporations are considering some kind of blockchain adoption. Obviously, this will lead to more jobs.

One of the key reasons blockchain had a remarkable 2017 is bitcoin, cryptocurrencies, and Initial Coin Offering (ICO). Bitcoin worth has grown to $247 billion from $11 billion in less than 12 months. Over $3.25 billion have been raised in ICOs in 2017 alone, surpassing traditional VC funding. Filecoin and Tezos, the two largest ICOs, raised $357 million and $232 million respectively in a matter of days. If you’re new to bitcoin, check out What and Why Bitcoin to learn everything about bitcoin. Some of the bitcoin and similar projects include Bitcoin Cash, Litecoin, and Bitcoin Gold.

The following chart shows Google Trends for blockchain (blue), cryptocurrency (yellow) and bitcoin (red).

 

Banking is one of the industries that is leading the blockchain innovation. The following image from BI shows major banks and financial institutions involved in blockchain.Supply chain management, global logistics and shipping, healthcare and pharma, and even governments are now exploring blockchain implementations.

 

 

And the opportunity

For software developers, the blockchain opportunity is huge and it is just getting started. Some of the companies leading the charge in blockchain technology include IBM, Microsoft, Deloitte, Ripple, Chain, Circle Internet, BitFury Holding, Yuan Technology, Coinbase, and AlphaPoint. Since six out of 10 corporations are interested in blockchain, it simply means more jobs will be created in this space.

The blockchain technology market size was $340 million in 2017 and is expected to grow to $2.3 billion by 2021. According to a report, 10% of GDP will be regulated by a blockchain by 2027.

Where to start.

Today, there are thousands of blockchain projects available in Github and each of the projects has a specific purpose. Here are some of the top blockchain projects and their purpose.

RippleNet is an enterprise blockchain application for global payments.

Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.

TRON is a blockchain-based decentralized protocol that aims to construct a worldwide free content entertainment system with the blockchain and distributed storage technology. The protocol allows each user to freely publish, store and own data, and in the decentralized autonomous form, decides the distribution, subscription and push of contents and enables content creators by releasing, circulating and dealing with digital assets, thus forming a decentralized content entertainment ecosystem.

Cardano is a decentralized public blockchain and cryptocurrency project and is fully open source. Cardano is developing a smart contract platform which seeks to deliver more advanced features than any protocol previously developed. It is the first blockchain platform to evolve out of a scientific philosophy and a research-first driven approach. The development team consists of a large global collective of expert engineers and researchers.

NEM is the world's first Smart Asset blockchain. Built from the ground up for enterprise-grade performance, NEM's blockchain technology delivers a world class platform for management of almost any kind of asset: currencies, supply chains, notarizations, ownership records and more. NEM’S power is exposed through a straightforward and secure developer interface so that you can deploy your blockchain solution in record time. Whether you are building the next best mobile app or bringing blockchain into your existing business infrastructure, NEM makes blockchain work for you.

Stellar is a distributed, hybrid blockchain that is fully open-source. It is infrastructure that exists to facilitate cross-asset transfers of value, including payments. With just one integration into the Stellar Network, you will join an open, global financial network where all actors – be they people, payment networks, or banks – have equal access & economic participation.

IOTA: As the Internet-of-Things keeps expanding, the need for interoperability and sharing of resources has become a necessity. IOTA enables companies to explore new business-to-business models by making every technological resource a potential service to be traded on an open market in real time, with no fees.

Dash is Digital Cash You Can Spend Anywhere. Use Dash to make instant, private payments online or in-store using a secure open-source platform hosted by thousands of users around the world.

NEO is a non-profit community-based blockchain project that utilizes blockchain technology and digital identity to digitize assets, to automate the management of digital assets using smart contracts, and to realize a "smart economy" with a distributed network. NEO was founded in 2014 and was real-time open source on GitHub in June 2015. Since its inception, the NEO team has experienced the upsurge and boom of the blockchain industry and the frenzy and cooling of the digital money market. They believe technology drives progress and together we can create the future. Motivated by this, NEO has been created to shift our traditional economy into the new era of the "Smart Economy".

Monero is a secure, private, and untraceable cryptocurrency. It is open-source and accessible to all. With Monero, you are your own bank. Only you control and are responsible for your funds. Your accounts and transactions are kept private from prying eyes.

Stratis

For C# developers, Stratis Platform offers simple and affordable end-to-end solutions for development, testing and deployment of native C# blockchain applications on the .Net framework.

The stratis Development Platform allows businesses and organizations to develop blockchain applications in C# utilizing the Microsoft .NET Framework. They can assist you in defining your blockchain strategy and in integrating solutions and capabilities according to your business requirements.

You can find more details and open source projects in Github here:

https://github.com/stratisproject/

Recommended Readings

 

LINK: http://www.c-sharpcorner.com/article/blockchain-an-unblocked-opportunity-for-developers/

Xamarin Diaries – Offline by default (Part II)

Xamarin Diaries

Hi All!

In this new chapter we’ll continue talking about offline functionality in Xamarin.Forms apps. This time I want to cover the possibilities we have to store our data locally.

If you remember from the previous post  – Xamarin Diaries – Offline by default (Part I) -, when we retrieve data from backend (typically in JSON format) the first thing we do is to synchronize our local data. Next time we run the same query this data can be directly retrieve from local storage (specially if we fall into offline conditions).

For this local storage we can choose between two different possibilities:

  • SQLite
  • Text JSON files

Let’s take a deeper look into the two options:

SQLite

This is the standard solution and it’s probably the solution I would go in most cases. Basically you will need to add some of the SQLite plugins to start. If we take a look to nuget there are two main plugins according to number of downloads:

The second options is no longer maintained and it is in fact a fork of the first one so the first option is my recommendation.

As an important point, sqlite-net-pcl last updates already include references to sqlitepclraw green to avoid problems with restrictions added with Android N. If you go with the second option you will have to add them manually.

Pros

Performance: SQLite performance is better than reading and overwriting files. For little applications it is probably not a problem, but when applications grow it is better to have indexes and transactions on your side.

Security: Although sqlite databases are just a db3 file stored inside Personal folder (so they are more or less the same than json files), they allow developers to add security layers. For example you have raw-cipher https://www.nuget.org/packages/SQLitePCLRaw.bundle_sqlcipher/ for encryption

Standardization: standardized solutions are always better when it comes to business. Maintainability and scalability are linked to standardization.

Cons

Ease of implementation: you will find that multi level hierarchies in the model of your application are not well supported in SQLite, and so do one-to-many and many-to-many relationships. You can use the ORM layer included in sqlite-net or add some other plugins, but in my experience, I prefer to do it myself by applying manual conversions. For example, something like:

Can be converted to:

public class IncidentTypeItem
{
public string Id { get; set; }
public string DescriptionEs { get; set; }
public string DescriptionEn { get; set; }
public string DescriptionPt { get; set; }
public string DescriptionCa { get; set; }
}

 

With the following converter

public static class IncidentTypeToIncidentTypeItem
{
public static IncidentTypeItem Convert(IncidentType incident)
{
var item = new IncidentTypeItem
{
Id = incident.Id,
DescriptionEs = incident.Description.Spanish,
DescriptionEn = incident.Description.English,
DescriptionPt = incident.Description.Portuguese,
DescriptionCa = incident.Description.Catalan
};
return item;
}
public static IncidentType Unconvert(IncidentTypeItem item)
{
var incident = new IncidentType
{
Id = item.Id,
Description = new Description
{
Spanish = item.DescriptionEs,
English = item.DescriptionEn,
Portuguese = item.DescriptionPt,
Catalan = item.DescriptionCa
}
};
return incident;
}
}

 

JSON Files

This option could sound as a no so beautiful solution but in some cases I found it very useful in situations you just need something quick that could work as cache.

For this solution you will need a connector so that you can manipulate files natively in Android and iOS from PCL Project. I have leave it in github if case you want to take a look to it: https://github.com/dhompanera/XamarinDiaries/tree/master/Offline

When working with JSON files as cache you will basically do something like this:

Save items to local storage:

var itemsAsJson = JsonConvert.SerializeObject(Items, Formatting.Indented);
DependencyService.Get<IFiles>().SaveText(string.Format("items_{0}.json", AuthManager.Instance.User.Id), itemsAsJson);

 

Retrieve items from local storage:

var jsonText = DependencyService.Get<IFiles>().LoadText(string.Format(“items_{0}.json", AuthManager.Instance.User.Id));
var jsonResponse = JsonConvert.DeserializeObject<List<Item>>(jsonText);
if (jsonResponse != null && jsonResponse.Count > 0)
{
Items = jsonResponse;
}

 

Special mention to Newtonsoft.Json (https://www.newtonsoft.com/json) as library to manipulate json objects.

Pros

Ease of implementation: There is no need to create conversor or anything, you just read from file and apply same json parse than in for your model.

Performance: For small applications is it just fast enough. I wouldn’t use it if the app grows.

Cons

Security:  No security for files, they are plain text stored in Personal folder. You could apply some cipher to encrypt the content of the files, but I just find it too difficult for a solution only thought for simple uses.

Performance: It can be compromised if the app grows.

Summary

As a continuation from the first post, we have learnt different possibilities we have to provide our applications with offline functionality. Either with SQLite or with JSON Files, we can get more robust apps that work in low connectivity situations.

LINK: https://solidgeargroup.com/xamarin-diaries-offline-by-default-part-ii