Monday, September 30, 2013

Ripple Conversion

I don't have a large balance in my Ripple wallet but through some kind donations I have enough to get me started experimenting with the system. I don't have much trust either yet so its really not much I can do yet, the only currency I have right now is the XRP given to me.

With a wallet balance higher than  the minimum funding requirement there's a possibility to convert one currency to another so lets check that out! Other than XRP and BTC there are 20 fiat currencies supported by Ripple today. To convert to another currency there need to be a path, a line of trust in your network, that facilitates the conversion. The paths to my wallet are very few so the conversion options are few. The only option I have today is to convert my XRP to USD which you can see below.

XRP
XRP1
USD92.837
EURno path found!
BTCno path found!
JPYno path found!
CNYno path found!
INRno path found!
RUBno path found!
GBPno path found!
CADno path found!
BRLno path found!
HKDno path found!
DKKno path found!
NOKno path found!
SEKno path found!
CZKno path found!
PLNno path found!
AUDno path found!
MXNno path found!
KRWno path found!
TWDno path found!
CHFno path found!

With only one currency to trade the decision is easy, I tried to convert XRP to USD. After a confirmation and warning :

You will pay at most
92.837 XRP  ± 1%

This error showed

Sorry, an error occurred while submitting your transaction. Make sure you are connected to the Internet and try again later.
Before trying again, please ensure that the transaction has not been executed already.

Not sure really what happened but I checked the activity which show an entry that sent I sent 1 USD. A few minutes later the USD is not in my wallet, the XRP balance is still the same.

The promising feature of a currency conversion that is instant, digital and online is seemingly broken. As for why I'm still not sure but I hope to find an answer in the ripple forums and return later.



Friday, September 20, 2013

The 4 types of F#, Class, Discriminated Union, Record, and Struct

Being used to object-oriented programming in C# and other imperative languages the concept of a Class and a Struct is very familiar. I’m doing some work with F# at the moment and noticed that F# have in addition to Classes and Struct two other types, namely the Discriminated Union and Record.

From the view-point of F# development I thought it would be useful to write down when and how to use each of these four types. The decision on when to use one type instead of the others lies with the developer and before I go further with my work I want to have simple set of rules in the back of my head. It may feel like a waste of time in many cases to argue for one type over the other, but that is exactly the point. How the type is intended to be used should dictate choice of the type and when you know what you need the type for can you decide if it is a class, record etc. The decision should be natural and intuitively while implementing something and it can only be that if the mental rules are fixed and well remembered.

So here it its. A when to use, when not to use the fundamental types of F#

Sunday, September 15, 2013

Trying out Fedora 19

Today I installed Fedora 19 which is one of many freely available Linux flavors. I haven't used Fedora or Linux for that matter for several years, but I've started a side project where Linux fits in. While I have moderate experience with different Linux distributions from my University days and the first couple of years in the working life it will be interesting to see how much I remember. The reason for choosing Fedora, it could have been any other well-used version, is because this is what I first think of when I hear Linux. This is due to the master thesis I worked on Singapore where Fedora was the weapon on choice during an intense period of development.

If I remember correctly I was using version 6 or 7 back then and the most recent version which I'm about to try out is 19. I'm absolutely convinced that some major changes have been made and I will write some, not all, of them down here.

I choose to install the desktop version as a virtual machine in Virtualbox and after a few configurations and some waiting I had this elegant and slick image on my screen (the Fedora blue which I remember very well).



Before I start configuring and working on the side-project of mine I decided to spend some time reading up on the new features of Fedora 19. The official release announcement lists several items. Some of the highlighted features are:

  • Developer's assistant
  • 3D modelling and printing
  • Open Shift Origin
  • node.js
  • Ruby 2.0.0
  • MariaDB
As you know Linux Desktops has several variants to the desktop and by default Fedora comes with Gnome. I don't have really have strong preference here but I noticed that MATE is an option starting this version, if time allows I might examine this but for now I'll stick with Gnome.

I've will be using Fedora for software development and application installations so the Developer's Assistant got me interested. According to the descriptions it will help developers in setting up a working environment for various programming languages. The included languages are: C/C++, Ruby, Python, Perl, PHP, Java, and JavaScript. With my favorite language being C# I will need to examine further if there is some possibility for .Net here. In any case, the Developer' Assistant looks interesting and it integrates with Github so if you have repositories in the cloud, or want to get involved in a Github hosted project, it seems seems easy to load code from Github to Fedora.

The second thing that interested me is MariaDB which is an alternative to MySQL. To understand how MariaDB is different to MySQL I'll add the whitepaper "MariaDB vs MySQL" to my reading list. Also that Node.js is included in Fedora is good to know, in case I need to write some server side java-scripts.

Another thing, which I'm unsure if it's new to Fedora 19, are social features. In Fedora you can add accounts on OS level from Google, ownCloud, Facebook, Windows Live, Microsoft Exchange. It will be interesting to see how this fits into the overall experience.

So, I have narrowed the new features down and I'm looking forward to starting my project.

Fedora 19 with the nickname "Schrödinger's Cat" was released in July 2013. Following the standard six month or so release cycle the new Fedora 20 will be available in November 2013.

Tuesday, September 10, 2013

Polyglot persistence

Polyglot persistence is used often and it’s often mentioned in articles. Simply explained it means awareness of different types of persistence models and technologies, and using the right or better persistence model for the data that needs to be stored. In this definition there’s a distinction between traditional relational database models, object based database models, and the more intangible NoSQL concept.

I have a lot of experience in relational data storage, as do many others, from using Oracle, MySQL databases etc. and one could argue that this is still the most common method for storing data. However, not so long ago the NoSQL concept received a lot of attention and I have long been interested in this, so I’ll devote a post to the topic.

NoSQL is not as simple to define as RDMS which is essentially SQL. When I first read about it I didn’t get it and I’m still not sure if I see the big picture with NoSQL. Now, I’ve said that so you know that you can’t expect a write up with much detail. This post is for me to condense and gather some of my early insights into NoSQL, from a bird’s eye view.

One thing that I realized quickly is that NoSQL is tied to large clusters of databases, which is in contrast to relational databases. Not to say RDMS technologies can’t be clustered but often the system is based on central data storage and growing to a cluster of relational databases is very problematic. NoSQL is supposed to handle this much better.

So, NoSQL come in three major forms and each of these forms comes very close the type of data you need to store. Choosing which form is very important and is the whole point of polyglot persistence, to find the better storage model. The three models are:

·         Key/Value-pairs
·         Graph
·         Document

They are each different and all of them fall under the umbrella of NoSQL. All of them are very different to RDMS and that’s why NoSQL has had such a strong impact on new technology. In designing enterprise apps or systems today it would not be fair to assume that your persistence should be relational. It may the preferred option but awareness and familiarity of the other options will enforce the reasons for choosing relational persistence, after considering NoSQL. The gains of choosing the correct one may minimize development time and result in a better application so due diligence on the different options should be a priority. 

Data being stored
Persistence technology
 Applications
Financial data
Oracle, MySQL, SQL Server etc
Transactional updates, ACID
Reporting
Oracle, MySQL, SQL Server etc

User sessions
Redis
Rapid read/write access
Shopping cart
Riak, DynamoDB
High availability in multiple locations
Recommendations
Neo4J
Traverse links between friends, product and purchases
Product catalog
MongoDB
Many reads, infrequent writes
User activity logs
Cassandra
Large cluster, many writes on many nodes

The table is based on findings in a post by Martin Fowler I read recently and gives a suggestion to a scenario in which persistence technology may be applicable. For example a global e-commerce store may be using Riak or DynamoDB to serve customers in different parts of the planet. This is obviously not enough to make a decision on which technology to use for a specific application or in given scenario so I wanted to go just a little deeper. I wanted to find out more about the characteristics of the different technologies and in what scenario they can be considered.

Redis (Remote Dictionary Service) is basically a key-value storage in RAM with built in Persistence. Since it’s in RAM its extremely fast and suitable for quick read/write. Redis support data types (key and values) such as strings, hashes, lists, and sets. The string is the most basic type and the other types are actually containers of strings, there the characteristics of the string is important. The string may be up 512MB and can store images or serialized objects, and it is binary safe. The string and the other types for that matter may be used for keys or values, however there’s a recommendation not to make the key too large.
I’ve read or heard of several applications using Redit in one way or the other, for example a twitter like feed, a authentication store, a leaderboard, a roster with online/offline status, a note keeping app.
Another things about Redit is that is cross-platform, have clients in numerous languages so it seems to be a good choice if the application is intended for multiple platforms and if different programming languages are used.

Riak is also a key/value store. From visiting their website the technology is used by many well-known internet brands, for example the online retailer Best Buy. Its main purpose is real-time systems where availability is a high priority as well as scalability. It has a full-text search engine and some advanced indexing features which make latency low. Another use case is mobile apps, for example the find-a-taxi app Flywheel is said to use Riak.

DynamoDB is a database from Amazon and is part of the AWS (Amazon Web Services) suite. Being part of the AWS means it’s hosted by the amazon cloud and does integrate well with the many other services in the AWS infrastructure. This means that data is stored on SSD drives are easily replicated across the regional zones of AWS. DynamoDB is a table based data storage but the tables have no schema expect for the fact that each table have a primary key. The three concepts of tables, items are attributes are central to the datamodel.
To read data a Query or a Scan is used, where a Query for a primary key and the scan searches the entire table. Query and results are in JSON format.
The scalability of DynamoDB make it suitable for online portals with a large number of users. With it comes the full AWS infrastructure, including the power amazon management console.

Neo4j is a graph database, it is based on connections between nodes in a web where the connections or edges of the graph contain data. It has support for transactions and is robust according to ACID. Conceptually it may be thoughts of as a web of relations between people in the form of a graph and therefore I would expect have a big usage in Social Media. Recommendations based on your social network would be a suitable application where a graph query is efficient. Neo4j uses Cypher query language with some keywords taken from SQL but in general looks and is used quite differently.

MongoDB is a document database. Documents are stored in JSON like format and is rumored to be the most popluar NoSQL database. Perhaps this is due to its first release in 2007 which is very early in the history of NoSQL technology. Search queries can be made of fields, ranges or regular expressions.  Master-slave replication is one of the features of MongoDB. Suitable applications for MongoDB and document databases is where the concept of a document is central such as in a News Agency, I believe that many well know news providers uses MongoDB or other document databases.

Cassandra is a distributed database system with a key-value storage model. It used for storing large data as it scales horizontally with little effort. It been tested in huge data volumes up to hundreds of terabytes over hundreds of machines. If storing and consuming large volumes of then Cassandra may be the model of choice.



There are many more implementations of NoSQL databases available and if one is pondering using one the next thing after deciding whether to use a key/value, graph or document storage would be to try as many as possible. Things was a lot easier when RDSMS was the only options wasn’t it?

As a last sentence I’ll recognize Scott Leberknight who is believed by many to be the first person to use the term Polyglot Persistence in this article.

Sunday, September 8, 2013

Smart-Watches




Continuing on my recent post about Wearable Activity Trackers I’ve taken a look at Smart-watches. It’s truly an exciting time for consumer electronics where we see innovation in many areas. This year we will get a new Playstation and Xbox, we will see a new iPhone as per usual and the other Smartphone manufactures are releasing models such as the Galaxy S4, Note 3 and Lumia 1020.

Smartwatches seem to be in the news daily and with the recent announcement of the Samsung Gear its worth taking a look at the options today. In line with previous post I’ve made a comparison between models, this time focusing on technical details. It’s not an exhaustive list of watches that are “smart”. I’ve left out a few with characteristics that I personally don’t see fit for a watch to be truly “smart”, namely:  
  • Analog display
  • Screen resolution smaller than 100x100 pixels

I believe for any of the watches to be successful there need to be support from developers, as it is a software platform on top of the gadget. Analog style watches and small displays simply don’t offer enough possibilities for the developer community to catch on.

Without further delay I direct you to the sheet. As you see there are three tabs:
  •  Released  (on sale today)
  • Announced (will be on sale on a future date)
  • Rumored  (gossip and might not even exist)

I welcome anyone to commen and point out incorrectness. I'll do my best to update as news appear!!



Sunday, September 1, 2013

Choosing between activity trackers for fitness and health

Activity trackers, the small wearable digital devices that count your steps, calories, and your sleeping patterns made an introduction a couple of years ago. Consumers quickly caught on this new device for many reasons, for example to better understand their daily rhythm, exercise monitoring, or diet information. This an initial comparison between the most popular wearable activity trackers and more information on numerous tracker devices can be found later in the post, skip to this part now if you are not interested in my rant of old-school technology.

Many might think this is a new innovation but similar products have been existing for a long time. The earliest memory I have of applications in today's tracker devices is an analog step counter and distance meter that I used some 15 years ago. I would love to show a picture but haven’t found one yet, it was a boxy thing I clipped on to my pants at the waist after having used a scroll wheel to set the length of one single step. The length of a step was read from a piece of paper that came with the thing that plotted the length of my legs, or inseam, against the length of my step. Once this boxy thing knew the length of my step it could measure distance by detecting a step by the movement of my waist and multiply by my step length. You can easily imagine how inaccurate this could be, for example if I started to walk slower or start running the length of my step would not be the same.

Ending my distant memory of the step-counter I had on my waist while walking to school as a youngster it’s time to look at the new generation. These devices come as bracelets, clip-ons, or necklaces and are all small enough to be worn unnoticed. The idea is simple that you wear it while it collects data on your movement, what you are doing, your heart rate etc and then you can find out more about this data in an intuitive manner, perhaps even share it with your friends on social networks. Most of them are paired with your smartphone and you’ll sync with an app on the phone to view what the tracker is collecting or you log-on to a website to further analyse the data. As I have been thinking of getting one for a quite some time I made a list to compare the devices on a number of factors. There’s a plethora of options out there in different forms and prices so to limit my search further I narrowed it to models you wear on the wrist and that doesn't cost more than US$200. I searched the web to find as many options as possible and composed the list below. There are links to official product pages and at the end of this post you'll find a spreadsheet with a direct comparison for each model.


Fitbit Flex

Jawbone UP

Larklife/Larkpro

LifeTrak Move 300

Misfit Shine

Nike+ Fuelband


Choosing which one to buy is a highly personal choice and before picking one over the others numerous questions should be asked to yourself.
  • Will I wear it to replace my regular wristwatch or do I want to wear both?
  • Do I want to track what I eat and get information on of my diet?
  • Will I share the information with friends and family?
  • Do I want it to measure my pulse during my activities?
  • Is long battery life important or can I remember to charge its battery every other day?
  • Will I use it for swimming or other water activities?
  • Do I want to read real-time information on my wrist or am I happy with logging in to a website or using a smartphone to view my data?
  • Will I use it for specific exercise activities or am I happy with knowing the distance I walked during the day?
  • Do you need to send the collected information to your doctor, coach, or do you want to analyze it further yourself?

The spreadsheet is found here. I will try to update it with more information and add new models as they come on sale. I haven’t bought any of them yet but with the information I collected I’m ready to make a choice and submit my order. I hope this will be useful for anyone else out there considering a tracker device and are having a hard time deciding which one to pick. The information is very concise and offers a direct comparison between each one on selected features. Please do not make a decision solely on this or similar information. These are all products that cost less than a regular shop-shelf wristwatch, and are manufactured on a small margin I would assume. We have all bought a cheap watch sometime from a street vendor only to have it break down in a few days. That some of these trackers are sold and manufactured by well-known brands doesn't mean that you should trust that you can use yours for years without problems. Before making an order spend some time reading reviews and experiences from people that are using the tracker you are interested in. Find out about the customer service, measurement accuracy, firmware upgrades, and the overall experience as a customer.

I hope the information becomes as useful as it was for me for anyone else trying to decide which activity tracker to wear on the wrist.