Saturday, January 10, 2015

A currency without a country

What would the benefits of an international currency without a country be? I can think of a few:
  • No central bank to limit what you can and can't do with it.
  • No external countries/large companies/speculative investors devaluating the value of your savings through their own agendas.
  • Easier international travel.
  • The value of the currency can be determined by what people are willing to pay for products. Therefore it has no intrinsic value like gold or oil which would allow one entity to monopolize it.
  • Some countries have currencies that are very weak. Generally this is not the fault of the people living there but due to historical or political reasons. A large international currency will give the citizens of these countries the opportunity to trade in other markets and at least a small amount of security.
There would be disadvantages as well though:
  • No regulatory protection. One large company can horde all of it making the rest of the world poor. In a way this is even worse than international market manipulation as we know it. On the flip side, because everyone is using the same currency there is no clear beneficiary nation.
  • How do you define it? Can it be hacked? Will advances in computing wipe it out? Who will print it?
For these reasons I think that Bitcoin had something. It is unfortunate (or fortunate?) that it did not go mainstream. Or, if we had an international currency, what it the next step? A world government?

See also:

Tuesday, January 6, 2015

The changing face of smaller scale web development projects in 2015

Trends I foresee for 2015: (we will see how these pan out by 2016 ...)

1. More HTML5 and JavaScript everywhere

It is now possible for me to do almost anything in HTML5 and JavaScript. This may not always be the optimal solution, however it is hard to argue against web technology when you look at things like Chrome apps for example.

2. A greater move towards open source software

Most client side web technologies are open source. If you currently build a website you will be looking at technologies like jQuery, Angular and Bootstrap. These technologies are all under some form of Open Source license. I do not see how new proprietary technologies can work in this environment. What about the server side though? This brings me to my next point.

3. The web server is getting thinner and thinner

You could ask yourself what the role of a web server is. Currently it serves web pages and hosts web applications. But the web server is really redundant in terms of business logic. One could argue that with a technology like Microsoft MVC or WebForms, some data is shipped to the server and that calculations are done there. But this is really a very inefficient method of implementing business logic when compared to stored procedures.

The reason for this is that most database invocations involves extra network transactions, increasing latencies and response times. It is more efficient to do calculations on the database server where the database management system has internal knowledge about data representation and where this can be used to optimize program flow.

Therefore, I expect that web servers will become little more than wrappers for database functionality in the future. But there is one further step to this which is quite scary if you are a C# or Java programmer.

4. Higher level languages like Java and C# will play a smaller and smaller role

So let's say that the web server only becomes a pass-through wrapper for database functionality. Where does this leave us in terms of languages like Java and C#? If most applications are implemented with stored procedures, HTML and client side JavaScript, then there are fewer applications for Java and C#, especially for CRUD style applications. So where would Java and C# still be used? The one application I can think of in the commercial world is integration projects. You still need C# or Java to integrate with other systems.

5. Workflow systems becomes more important

It should however be pointed out that integration and the related organizational workflow systems have their own automated design tools in technologies like Microsoft SQL Server's SSIS and Talend's Open Studio products, which reduces the amount of required programming. Therefore I expect that workflow systems will become more important.

Wednesday, December 17, 2014

Alternative Power Setup for Load Shedding (or "Power Blackouts") in South Africa

Disclaimer: I am a programmer, not an electrician. It works though, so maybe I did something right ... use at your own risk!

So lately we have had this problem in South Africa, where you are busy with something, and then suddenly the power dies. This got annoying to the point where I decided to get myself an alternative power setup involving an inverter and a deep cycle battery.

The obvious solution is to go out and buy a petrol/diesel power generator, however this approach suffers from a few problems that I cannot live with. The first is that it is noisy. If you live in a townhouse complex, the neighbours may complain, causing all kinds of hate mail/legal fees. One solution would be to look for a quiet generator, but now you have the problem of "how quiet is it really?" before you buy it. Also: "Quiet" inverter generators like this one is expensive. It also has to be refueled. It is not that much effort to drive to the petrol station, but this is not as convenient as recharging a battery from a wall socket. And then there is the problem with fumes which may prevent indoor use.

My solution (Which I heard about from a colleague with an engineering degree ...)

I decided to get a giant rechargeable battery instead of a generator. This has the benefit of being completely quiet. You can also "refuel" if from the wall socket when the power is available, and it has extra potential in the sense that you can buy more batteries when you "run out of capacity" or load shedding gets worse. It also has the potential of being used in a solar power scenario in case the wall socket goes dead or becomes too expensive. (The expensiveness of electricity in South Africa is a topic for another time, more about it can be found with a quick Google search ... ex. see this link)

My current power setup. I may add more batteries if load shedding (power blackouts) gets worse. 
I followed these steps to get to this point:

1. Calculate projected use in Watt-Hours and choosing an inverter

Electricity use is measured in Watt-Hours, abbreviated Wh. So it you want to run a 250 Watt Play Station 4 for 2 hours, you will use 500 Watt-Hours. But it gets more complicated. The first thing I bought was an inverter.

An inverter converts the direct current electricity to alternating current used by home appliances.

A 600W pure sine wave inverter that I bought from Communica (http://www.communica.co.za/)
There are a few things to take into account when buying an inverter:

  • How much electricity are you going to use? The general approach is to add up the watts of the appliances that will run at the same time. The tricky part though is that your energy setup between the battery, the inverter and your appliances will also use electricity, so you cannot buy a 600W inverter if you want to consume 600W.
  • How much do you want to spend on a battery This is where the interconnectedness of everything comes into the picture. When I opened my inverter manual, I got a surprise when I saw that the inverter has a minimum recommended battery size. I guess this should have been expected though, seeing that it is probably ill-advised to run a large inverter off a small battery.
  • Modified vs. Pure sine wave inverters There are two kinds of inverters to my knowledge: Modified and Pure Sine Wave inverters. Modified sine wave inverters are noticeably cheaper but there is a catch. You cannot run certain kinds of equipment from modified sine wave generators. For example: My one colleague's cellphone charger worked for a few minutes and died.
  • Cabling The cables connecting the inverter to the battery has Amp ratings. Obviously you do not want to exceed these ratings when drawing power through the inverter.
  • Safety mechanisms Some inverters comes with protection mechanisms like fuses and a cutoff mechanism for when the battery is discharged too far. A battery can be ruined this way, so it is a good idea to have this. The fuses are apparently there to blow when the battery is connected incorrectly. (IE. the polarity is revered) According to the booklet this will void my warranty.
  • Startup load Some devices could use a lot more watts on start-up. Inverters has an overload rating for this. So it is possible to run the inverter in the picture for 2 seconds at 2 times the rated load.
2. Choosing the battery size and "how long will it last?"

Battery size if rated in Amp-Hours or Ah. This is very confusing, considering that power usage is measured in Watt-Hours. In order to choose a battery, I followed my inverter manual guideline of 100 Ah, though it turns about that it is sufficient for my purposes. When I measured the discharge rate, it matched my requirements. 

It seems that it is very difficult to calculate how long a battery will last because it is based on a large number of unknown factors. To make matters worse, batteries to not discharge at a constant rate and does not discharge to 0 Volts. To get an idea of the factors involved, I refer the reader to this link:


These are my sums, I leave the reader to draw their own conclusions:
  1. Get projected use. From section 1 above, it is 300 Watts for 2 hours (this is how long load shedding lasts at the moment ...). This gives you 600 Watt-hours.
  2. Multiply the battery volts by the Amp-Hours. I have a 96 Ah 12V battery, so this is around 1200 Watt Hours.
  3. Therefore I should have 4 hours of battery life (ie, 1200 Wh divided by 300 watts). But this is not really the case, because deep cycle batteries should not be discharged past a certain point. According to online reading (see http://www.batterystuff.com/) this should not go past 50%. So that gives me 2 hours of battery.
A deep cycle battery I bought from Communica.
I decided to get a deep cycle battery, seeing that these batteries are designed to be discharged more "deeply" than car batteries, and it designed for repeated charging/discharging. The battery is unfortunately the most expensive part of this setup, and you have to carefully calculate how much battery you need. In comparison for generators, you get far less power from a battery, however it has the benefits I listed in the introduction. There are also safety considerations, seeing that batteries contain sulphuric acid and emits explosive gasses.

In order to measure the battery discharge level, I used a voltmeter which I connected to the battery after switching off all appliances. I checked the measured voltage on a lookup table that I found at http://www.solar-electric.com/deep-cycle-battery-faq.html. It discharged to 12.15V after 2 hours, so my calculation seem sound.

3. Buying a battery charger

When I bought my battery charger, I went for a smart charger. It seems that you cannot just buy any charger to charge deep-cycle batteries. Batteries undergoes a process called Sulfation, which reduces their lifespan. Seeing that the batteries are the most expensive part of this setup, it is a good idea to try to keep them in good shape. Some battery chargers have a "maintenance mode" which apparently helps to prevent this.

Also: something else to consider is the charger rate of charge vs. the size of the battery. I see that battery chargers have Amp ratings. There is a nice article on chargers here:


Also: I saw that my battery charger had a minimum recommended battery size in Ah, which I exceeded purely by accident, so this is another thing to take into account.

Conclusion

I am happy with my setup as it currently is. I do not miss buying a generator, purely because the generator is not a flexible in terms of future expansion as a battery based setup. In total it cost about R 6000, which is more than you would pay for a generator. I guess what you buy is dependent on your needs.