Permanent Redirects in ASP.NET 4.0

In my last article titled Search-Engine Friendly Permanent Redirects I discussed the issue of temporary redirects (status 302) implemented by HttpResponse.Redirect in ASP.NET, and how this was not suitable for search engines when a page no longer exists and you want to redirect links in a search engine to the new page’s location. We discussed how search engines can be notified that a page has moved permanently by using a permanent redirect (status 301), and that there was no existing method to do this in ASP.NET 3.5 and older versions.

ASP.NET 4.0 introduces a new method to do just this: HttpResponse.RedirectPermanent. As they say, better late than never. So to redirect a page using status 301, just use the following code (replace the URL by your own):

Response.RedirectPermanent("http://www.mysite.com/MyNewPageLocation.aspx");

Search Engine-Friendly Permanent Redirects

The most common way of redirecting control from an ASP.NET page to another URL is through the “Redirect” method of your “HttpResponse” object. This can be carried out simply using the following code:

Response.Redirect(“http://www.MyNewUrl.com”);

(You may also use application-relative URLs of the form ~/mypage.aspx).

If the redirection is meant to be temporarily (e.g. as a result of some user action), this is fine. The redirection occurs because the following text is sent to the browser via the HTTP stream:

HTTP/1.1 302 Found
Location: http://www.MyNewUrl.com

The content of the page would also contain something like:

<html><head><title>Object moved</title></head><body>
 <h2>Object moved to <a href="http://www.MyNewUrl.com">here</a>.</h2>
 </body></html>

If the browser does not understand the “302” status, it will still render a nice link which a user can click (all modern browsers will correctly understand and execute a 302 redirect).

Temporary redirects however are not suitable for situations in which a page has actually moved permanently, and you want to redirect users trying to access old links to new ones. They will still work, however, if your old page is indexed by search engines, you would want the search engine to update its link to point to the new URL. To do this you will need to use a 301 (permanent) redirect. A permanent redirect is interpreted by a search engine that the old URL no longer exists and must be replaced by the new one, and it will update its database of links.

But how do you trigger a permanent redirect? Unfortunately ASP.NET does not provide a method for this out of the box. But it’s not difficult to create a method to achieve this:

protected PermRedirect(string url)
{
    Response.ClearHeaders();
    Response.Clear();
    Response.Status = "301 Moved Permanently";          
    Response.AddHeader("Location", ResolveUrl(url));
    Response.End();
}

Then simply call PermRedirect from your Page_Load method. The call to ResolveUrl allows the method to understand application-relative URLs such as ~/MyPage.aspx.

If you want to share this method between several pages, you should implement a base class to provide this common functionality:

public class UtilPage : System.Web.UI.Page
{
   protected PermRedirect(string url)
   {
       Response.ClearHeaders();
       Response.Clear();
       Response.Status = "301 Moved Permanently";          
       Response.AddHeader("Location", ResolveUrl(url));
       Response.End();
   }
}

Then simply inherit your page class from this page, e.g.

public class MyPage : UtilPage
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        PermRedirect(“http://www.MyNewURL.com/”);
    }
}

Cornering Yourself to Go to the Next Level

As humans it is natural for us to seek a level of comfort within the immediate world in which we live. Many of us are averse to things we cannot predict. We want to know that tomorrow we’re going to wake up and go to work. We want to know we’re going to do tasks that are familiar to us and within our competences. We want peace of mind that at the end of the month we’re going to get our salary. We make plans, and panic when things do not go according to those plans. We live in a comfort zone, and are unwilling to change our ways. There is no real logical explanation to this, except, maybe, the perception that routine is stress-free. Yet, there will always be things that will cause us stress because life is never predictable. Most people, however, do not use this awareness to their advantage. Given two scenarios, both of which include stress, would you rather take the path that includes routine and general predictability, or would you rather take the path that will plunge you to the next level, be is a personal achievement or a career goal?

One of the techniques which helps me get out of my comfort zone is cornering myself. You might want to call it shock therapy. Somehow it always seems to work, and maybe there are psychological reasons for it which I want to explore. Let me give you an example. Assume one is not happy working for a particular employer, and wants to change job. Many people, especially the ones who are always complaining, never seek alternative employment due to the unfamiliarity that comes with venturing out in the job marketplace and making new contacts. A few of them will try looking for a new job while still working for their current employer. This can be quite inconvenient since (i) you have to take vacation leave to attend interviews (ii) you have to answer calls from recruiters while on your job and (iii) you’re not available immediately. There is still plenty of value in this option (being the option chosen by many), but unfortunately it carries a great risk: that of giving up early due to initial failures. Again, this is the human mind building patterns: “if I’m not successful the first few attempts, then I’m never going to be successful at this”.

A third option would be to corner yourself. This means that you put yourself in a position in which you cannot behave otherwise. For instance, one particular method of learning how to swim is to actually jump into deep water. Then you’re forced to either keep afloat or sink. It’s impressive how humans tend to invoke their full potential only when under extreme conditions of survival. Of course, there is a very fine line between cornering oneself to get oneself out of the comfort zone, and being actually insane. To use the example above, it would be insane for a non-swimmer to jump in deep water if there’s no backup around to save him just in case things take a turn for the worse. In other words, while one must sometimes take big risks, always make sure the risks are manageable. You can manage risk by seeking ways to minimise it (for example getting car insurance when you drive), but you shouldn’t be too averse to risk as to give up on the opportunities presented due to taking those risks. For instance, you shouldn’t give up on driving because there is a risk of accident. You can minimise risk by always obeying traffic laws, getting car insurance, life and medical cover, while at the same time enjoy the benefits of driving. You will never eliminate risk completely, but you can put yourself in a position where the benefits are still much better than the losses you will incur if things go wrong.

Another example which I can personally relate to is migrating to another country. This is no trivial task, and there are various places along the way which require leaps of faith. That does not mean however that it is not doable, or that you’re playing the lottery. Many people only feel safe migrating if they have secured a job in the country of destination, but that will limit you to just those employers who are willing to get people from abroad, which, unless you happen to have a very highly specialised job, is a very small percentage. The biggest risk however is the risk of giving up after the first few failed attempts and return to your previous life, disappointed and with shattered dreams.

Another way to go about it is to take the plunge. So do the move, but make sure you have some savings which can keep you afloat for a few months of frugal living, and a set of skills that is in demand in your country of destination (build a worst case scenario and make sure you have the means to sustain it). Once you’re actually there, you’ll have plenty of time to look for a job. Of course, the truth is that you’ll have very little choice but to do your best to secure one, because you have cornered yourself into doing just that. I find that getting out of your comfort zone in this manner is easier than taking it slowly, because you don’t allow time to doubt yourself, and you leave no option but to succeed.

So next time you’re in the shower, try putting on cold water for a nice morning wake-up! Kick yourself out of automatic and into manual, ask yourself why you’ve been doing the things you do for such a long time. And always remember: with a little imagination, things can always be done differently, and better.

Internet Explorer Non-Cached File Downloads over SSL

In this post I will discuss how to work around an issue experienced with Internet Explorer when popping up a Download dialog box to download a non-cacheable file over an SSL connection. This issue is acknowledged by Microsoft here. I will stick to my framework of choice: .NET Framework 3.5 (C#/ASP.NET).

Background

As you probably know, it is possible to code an ASP.NET page such that it pops up the Download dialog in a web browser prompting the user to save the content on disk. The content of the file would be the HTTP payload. This could be the HTML page content itself, dynamic content generated or static content obtained from the server’s file system. Consider for instance the following code-behind file for a Download.aspx page.

public partial class DownloadPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SendFile();
    }

    private void SendFile()
    {
        Response.AddHeader("Content-Disposition",
                             "attachment; filename=myfile.txt");        
        Response.ContentType = "text/plain";        
        Response.WriteFile("myfile.txt");        
        Response.End();
    }
}

The Content-Disposition header is what tells the browser to popup the Download dialog box, and assigns a filename other than the name of the page (Download.aspx). If this header is omitted the browser will attempt to display the content in the browser window. This depends on whether it can understand the Content-Type header. For instance, a PDF file may be displayed inside the browser by using a third-party plug-in. However, by specifying Content-Disposition: attachment explicitly, the browser will always save the file to disk.

In the above example we transfer the contents of the file “myfile.txt” to the HTTP response. “Myfile.txt” is a static file residing on the server’s file system. The contents of “Myfile.txt” replace the default page content in our default.aspx file. Finally we terminate the response, otherwise ASP.NET will still proceed to send the .aspx file content immediately after the contents we have just sent.

The purpose of this post today is to handle one specific problem: working around an issue present in Internet Explorer when files are sent over an SSL connection and the page has been marked as non-cacheable.

How to reproduce the problem

To reproduce this problem the following conditions must be met:

  1. You are using Internet Explorer. I have tested this with Internet Explorer 6 and with Internet Explorer 8;
  2. You are using SSL;
  3. You configure the page as non-cacheable (the no-cache value is present in the HTTP response header Cache-Control).

You will have “no-cache” in the Cache-Control HTTP response header in one of two ways:

  1. By using the page directive <%@ OutputCache Location=“None” %>
  2. By calling Response.Cache.SetCacheability(HttpCacheability.NoCache).

If these conditions are met, when you click the Save As button in the Download dialog box, the following message will be displayed:

  • “Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.” (Internet Explorer 6.0)
  • “Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.” (Internet Explorer 8.0)

Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

It took me a while to figure out that the problem was related to caching, but it looks like Microsoft’s logic here goes as follows: if you can’t cache the content, this must be something sensitive so don’t allow saving either.

Solution

The solution is obviously to remove the code that disables caching. This will in turn causes ASP.NET to assign the default “private” value to the HTTP Cache-Control response header, which Internet Explorer has no trouble with.

However, we may not wish to re-instate caching. Let us picture a scenario where a file is downloaded if the user clicks a button on the page. If the page contains sensitive data, we may not wish to cache it (see my previous post) so that a third-party may not click the browser’s back button and see the content from the browser’s cache. We just need to disable caching just for the download.

The key is to clear the response headers when building the response for the download event by calling Response.ClearHeaders() in your button’s event-handler.

public partial class DownloadPage : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetNoStore();
        Response.Cache.SetExpires(DateTime.Now);
        Response.Cache.SetLastModified(DateTime.Now);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void DownloadBtn_Click(object sender, EventArgs e)
    {
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", "attachment; filename=myfile.txt");
        Response.ContentType = "text/plain";
        Response.WriteFile("myfile.txt");
        Response.End();
    }
}

Dealing with Browser Cache-Related Security Issues when Developing ASP.NET Applications

The default ASP.NET caching configuration does not provide sufficient private page protection against the browser’s cache. Private pages are pages that should only be accessible by authenticated users. I believe many ASP.NET developers fall into the trap of leaving the default caching configuration for their applications. This allows an unauthorised user to simply click on the victim’s browser back-button and view secure content, even if the victim successfully signs out but forgets to lock his workstation.

To demonstrate this problem I created a skeleton web application using ASP.NET 3.5. I will not discuss the steps to create such an application since it is beyond the scope of this post. The source code is available for download (you will need Visual Studio 2008 or above). Suffice is to say that:

  1. There are two pages in the sample application: Login.aspx and Default.aspx. Default.aspx is protected content and can only be viewed by authenticated users;
  2. There are two configured users:
    • admin Pwd: admin^123
    • sinclair Pwd: sinclair^123

Source Code

I have produced three sets of source files:

  1. The first set of source files is the basic one which implements no solution against browser caching of protected content. To reproduce the security issue you will need to use this source code. You can then work out through the rest of the post adding code as it is being discussed without the need for downloading the two other sets. To download the first set of files click here;
  2. The second set of source files implements the solution to the browser-cache security issue discussed in the section “Solution”. To download this pack click here;
  3. The third set of source files is the project with the necessary modifications to implement user-differentiating server-side caching. This combines the solution given in this post with some advanced server-side caching techniques to improve performance without sacrificing security. To download this pack click here.

Start by using the first set of source files. Test out the application. You should be redirected to Login.aspx if you try to access Default.aspx without first signing in with your account. The content in page “Default.aspx” is secure, or so should it be, except that Default.aspx exists in your browser’s cache and is easily accessible.

Reproducing the security issue

  1. Launch the application in your browser. We will be using three browsers for testing: Internet Explorer 8, Google Chrome 10, Mozilla Firefox 4;
  2. Access the content page Default.aspx by first signing in;
  3. Sign out by clicking the “Logout” button. You will be redirected to the Login page. So far so good;
  4. Click the browser’s back button. You will see the secure content without problems.

As we can see, the default ASP.NET cache settings do not provide sufficient protection against the browser’s cache, irrelevant of the browser being used.

I installed Fiddler 2 to be able to debug the HTTP headers in the response. The response contained the headers:

Cache-Control: private.
Date: <Today’s date and time>

According to www.w3.org “private” means “that all or part of the response message is intended for a single user and MUST NOT be cached by a shared cache. This allows an origin server to state that the specified parts of the response are intended for only one user and are not a valid response for requests by other users. A private (non-shared) cache MAY cache the response.” Essentially, a proxy may not store the contents, but a web browser can.

To summarise:

Browser Back Button Type in URL in address bar
Internet Explorer 8 Showed cached version Showed cached version
Google Chrome 10 Showed cached version Redirect to Login.aspx
Mozilla Firefox 4 Showed cached version Redirect to Login.aspx

As you can see, the only browsers who offered some kind of protection where Chrome and Firefox, and only when the URL of Default.aspx was entered directly in the address bar. When clicking the Back button, the private content showed up just fine.

Solution

The first solution that comes to mind is disabling caching altogether, even though this may not be entirely desirable. We simply add the following line in the Default.aspx file:

<%@ OutputCache Location="None" %>

This time Fiddler 2 reported the following response headers:

Cache-Control: no-cache
Date: <Today’s date and time>
Expires: -1
Pragma: no-cache

But what was the behaviour in the browsers?

Browser Back Button Type in URL in address bar
Internet Explorer 8 Redirect to Login.aspx Redirect to Login.aspx
Google Chrome 10 Showed cached version Redirect to Login.aspx
Mozilla Firefox 4 Showed cached version Redirect to Login.aspx

While this is a step forward in the case of Internet Explorer, no difference was experienced in Chrome and Firefox. So this is not a good enough solution.

The second attempt is to add the following method to the page, and not use the page directive:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    Response.Cache.SetNoStore();
}

When the cache object’s SetNoStore() method is called, the following HTTP response headers are produced:

Cache-Control: private, no-store
Date: <Today’s date and time>

A better idea is also to set the cache’s expiry date to the current date and time, as follows:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    Response.Cache.SetNoStore();
    Response.Cache.SetExpires(DateTime.Now);
}

The browser will thus compare the page’s date with the expiry date (both will be the same), and remove it from the cache immediately.

To summarise, the behaviour now is:

Browser Back Button Type in URL in address bar
Internet Explorer 8 Redirect to Login.aspx Redirect to Login.aspx
Google Chrome 10 Redirect to Login.aspx Redirect to Login.aspx
Mozilla Firefox 4 Redirect to Login.aspx Redirect to Login.aspx

Bingo!

Optimizing performance using server-side caching

As we pointed out earlier, removing caching entirely may not be the most desirable solution. We may still wish to provide some type of caching to optimise performance. For members-only pages, client-side caching is out of the question since it will introduce the problem we have discussed above. The only other option is ASP.NET’s server-side caching mechanism. With server-side caching, we can still force the browser to avoid storing a copy of the page on the client, but at the same time avoid having to generate the page from scratch upon each request.

Enabling server-side caching is quite straightforward using the following page directive:

<%@ OutputCache Location="Server" Duration="300" VaryByParam="none" %>

Duration specifies the number of seconds the page should be stored in the server’s cache. VaryByParam specifies whether there are query parameters which should be taken into account when caching the page. A value of “none” will consider the requests “default.aspx?p=1” and “default.aspx?p=2” to mean the same, and thus the same cached version of the page will be served in both cases. If you specify VaryByParam=“*” a cached version of the page will be built for each combination of parameters supplied.

Note that events such as button clicks bypass the caching mechanism. When an event is sent to a page, the server does not return the cached copy but the page is rebuilt by passing through its complete life-cycle, and event-handlers are called.

Let us have a look at the HTTP response headers in the case that server-side caching is employed:

Cache-Control: no-cache, no-store
Date: <Today’s date and time>
Expires: -1
Pragma: no-cache

As you can see, the page directive has actually overwritten the SetExpires value we specified in the OnInit method. However this is no cause of worry – the back buttons will still not retrieved cached copies of the page on the browser.

User-differentiating server-side caching

The trouble with the above implementation is that while it protects unauthenticated users from accessing private content, it does not protect against two authenticated users from each other’s content. Let’s say for the sake of the argument that the content delivered by Default.aspx varied according to whoever is logged in. For instance, the content would be the logged in user’s name. Add the text “Logged in as user:” to the page Default.aspx followed by a label. Then in the code-behind file for the same page write the following:

protected void Page_Load(object sender, EventArgs e)
{
    Label1.Text = Server.HtmlEncode(Page.User.Identity.Name);
}

The contents displayed when I log in as “admin” would be: “Logged in as user: admin”. If I login using the other account “sinclair” (password “sinclair^123″), I would expect the text “Logged in as user: sinclair” to be displayed. Instead, what happens is that the text “Logged in as user: admin” is displayed again. This is because the server retrieved the server-side cached version of the page.

The solution is to add a VaryByCustom parameter to the OutputCache page directive, and implement the global method GetVaryByCustomString. This is how it is done:

Add the following page directive to the page:

<%@ OutputCache Location="Server" Duration="300" VaryByParam="none"
    VaryByCustom="user" %>

You can actually use any string instead of “user”. This is just a callback parameter that will be passed to GetVaryByCustomString method, so that you can further fine-grain your caching across pages (e.g. some pages might require caching based on current logged-in users while other pages might require caching based on the request URL’s domain).

Add a global.asax application class (right-click on project, click on Add New Item and select Global Application Class). Add the following method to this class:

public override string GetVaryByCustomString(HttpContext context, string custom)
{
    if (custom == "user")
    {
        if (context.User.Identity.IsAuthenticated)
            return User.Identity.Name;
        else
            return String.Empty;
    }
    else
        return base.GetVaryByCustomString(context, custom);
}

Essentially we are saying that the VaryByCust parameter “user” maps into the currently logged in username if a user is logged in, or to an empty string otherwise. The effect will be that the current logged in user will be taken into account when caching pages on the server, and different cached pages will be stored for distinct users. Any other parameters specified in VaryByParam will of course be taken into account as well.

Computing Power Feed-In Tariffs

On 21st July 2010 Maltese newspapers carried an article regarding power feed-in tariffs. This is money the government pays you for supplying electricity to Enemalta. In other words, if you have an electricity generating device, such as a system of solar panels or wind turbines, you can generate electricity and sell it to Enemalta at a price determined by them.

The feed-in tariffs were originally announced by the Malta Government Gazette No. 18622 published 22/07/2010, and later regulated by Legal Notice 422 of 10/09/2010. From this Smart Meter FAQ (question 4.2), it is clear that to be able to measure the quantity of electricity being “exported” you will need a Smart Meter.

According to the Malta Resource Authority (MRA) website, the process is not automatic. You will need to fill in an application form to obtain authorisation from the MRA and enrol yourself or your business into this scheme.

The Feed-In Tariffs are flat rates. Irrespective of the quantity being produced in a given period, you will always be paid the same rate for every unit (kWh) of electricity you produce.

Rate per kWh Guarantee Period (Years) Power Cap (kWp)
Maltese household € 0.25 8 3
Gozo household € 0.28 8 3
Businesses € 0.20 7 100

So depending on whether you live in Malta or Gozo, or whether your bill is registered for commercial purposes, you get different rates. The guarantee period is a commitment made by the government to keep these rates fixed for a number of years, and hence put your mind at rest about your investment. The Power Cap on the other hand specifies a maximum peak power that can be registered per household or business. Therefore a household cannot feed in electricity generated by devices rating a total of 3kWp. This rating indicates the peak Wattage (power) the device can generate. For example, a solar panel may have a rating of 3kWp, which means it generates a peak of 3kW. As you know, a solar panel cannot generate electricity at night, and its output during the morning or the evening will be substantially less than at midday. The 3kW peak would be obtained, in general, during strong sunny periods throughout the day.

The government also put a cap on the total power that such a scheme can produce. The cap for 2010 is 7,500kWp. This is equivalent to 75 businesses using the maximum capacity of 100kWp or 2,500 households using the maximum capacity of 3kWp. MRA will not take any further applications once this ceiling has been reached.

Estimating the amount of units that your device will generate

From the rating of the device in a given climate, it is possible to come up with a reasonable estimate of the number of units (kWh) of electricity that a device will generate. As a rule of thumb, just for solar panels in Malta, you can estimate the daily units produced by multiplying the rating by 4.2. This is based on an average taken over the whole year. For example, a solar panel system rated at 3kWp will typically generate 3 × 4.2 or 12.6kWh of electricity per day. Of course, the only certain way of correctly obtaining the amount of units generated by your device is to take the reading from your Smart Meter.

MyBill Calculator Software Tool

MyBill Calculator version 4 can save you the trouble of having to calculate by hand the rebate for which you are entitled. While feed-in rebates are not that complex to compute (you simply multiple the reading by the rate you are eligible for), MyBill Calculator can also calculate your electricity and water bills, which are substantially more complex to manage. MyBill Calculator will also provide an English explanation of how the bills are calculated.

MyBill Calculator version 4 is due for release on 31 March 2011. In the meantime however you can still take advantage of version 3 which can be used to calculate your electricity and water rates. You can download a 15-day trial edition of MyBill Calculator by clicking here.

Screenshot from MyBill Calculator Version 4

E Ink and E-Book Readers – Is this the end of the book as we know it?

The Amazon Kindle (3rd Edition)

Recently I had the opportunity to try the latest Amazon Kindle e-book reader (version 3) and immediately fell in love with the device. With 4Gb of memory space, which can store approximately 4,000 e-books, a WiFi connection and optionally a 3G connection, you’d have more than enough literature available for those long flights across continents. Last August I had the opportunity of visiting our friends down under, and I’m lucky enough to be moving there this January. With more than 19 hours of flying time and about 3 hours of connection time, I find that books make for a much better means of killing time than in-flight entertainment. I easily ran out of Private Dancer, a book I had bought in Phuket in 2008 while on holiday. After a couple of movies and an uncomfortable nap, boredom kicked in, and I just wished I could have access to another book or two.

E-book readers are not really latest technology. They been on the market for several years. However the improvement with respect to compactness and portability has been significant, but what really caught my attention is the E Ink display. I had envisioned the concept of portable e-book readers long before they were manufactured and even before the Internet was commonplace, when I observed the pains that went into the printing and distribution of paper-based newspapers, which one usually got rid of anyway immediately after consumption. It would have been great to distribute newspaper contents to some sort of device at home, completely eliminating the need for printing, distribution, waste collection and recycling.

How E Ink technology works (from Wikipedia)

Recently, while observing electronic street-banner advertising, I was wondering whether it would be possible to remove the light source from the display itself and make it dependent on an external source of light, just like paper. Paper, although white, cannot be seen in the dark, but requires a source of light to shine on it and reflect its contents to the reader. A CRT or LCD display, on the other hand, emits the content to the reader directly, in itself being a source of light. In fact, I later discovered that electronic “paper”, or rather, “ink” technology seems to have already been invented, albeit is still a developing technology. Its advantages are the same advantages that a book offers over a backlit display. It is easier on the eye and can be read even when a bright external source of light (such as sunlight) illuminates it. You can take it to the beach, and you can place it opposite to a window at the office. Furthermore, it is very efficient consumption-wise. The disadvantages are of course that shadows can get in the way and that you always need an external source of light to view the contents.

E-book readers such as the Amazon Kindle and the Barnes & Noble Nook combine portable device technology with E Ink technology to produce what I see as the closest one can get to a real book (which I have previously always preferred over reading from an LCD display), but with the added advantage of being able to store more than enough books to keep you occupied for quite a while. The relatively cheap price also makes it a very attractive buy, even as a gift.

An e-book reader will certainly be on the shopping list of my next purchase, and I highly recommend it to all lovers of literature.

Why a living wage is bad news for Maltese economy

If you’ve been following Maltese current events during the last couple of months it would have been very difficult for you to miss the commotion caused by the leader of the opposition Joseph Muscat upon declaring that he will introduce the “living wage” concept in Malta when his Labour party is elected to power.

When I read this news from Brussels it took me by surprise, in a shocking kind of way. He said that employers will be encouraged to provide “decent” salaries to their employees, above the national minimum wage, so as to reduce the risk of people falling into poverty. To the unsuspecting observer the living wage concept might seem very sensible. To anyone with a basic knowledge of macroeconomics, however, it is evident that such a policy will backfire on the nation and create more poverty rather than less. I will proceed to explain why I think this will be the case.

Money makes the world go round

First of all, let us discuss what money is. Any decent book on economics will state in its first chapter that money is not wealth. It is rather a claim to wealth. Money therefore becomes wealth when it spent. A million bucks on a deserted island are worth zilch because there is nothing on which to spend them. Spending money also requires that whoever is receiving it can then spend it on something else. So money represents a promise of future wealth, and transactions represent the flow of wealth. When they are a form of a profitable payment, transactions actually represent the creation of wealth. So unless people have faith in the power of money, money is just a worthless piece of paper. But convince people that they can spend their money on things they desire, and they will willingly wake up in the wee hours of the morning to go to work, and if asked will even stand upside down for their pay-check. This promise of money being exchangeable with desired possessions and services is a very strong driving force. The whole economy is based on it. Remove this promise, and people will lose faith in money, and they will have little reason to work and generate wealth for others in exchange for wealth of their own.

Investment makes the money go round

The second point concerns investment. An investment means giving up money now in hopeful exchange of more of it some time in the future. It is investment that creates work and wealth, powered by those people who believe in money and thus report to work every day, foregoing time with their families in the process. Investment keeps everybody happy. But for someone to give up the power of his money today, he must have a darn good reason to do so. The reason is of course future profits. Remove the profit incentive, and the investor would be better off spending off his money today. The bad news of course is that in an environment that lacks investment there would be no businesses around to sell you stuff. So once again, your money would be worthless. Furthermore, there would be no jobs, but this would not be a problem either, since there would be little things on which to spend the money you’re paid with, so you’d stay at home growing potatoes.

So what keeps the system going is (i) a belief that money can be spent on things that we want and (ii) the promise that giving up money today will get us more money some time in the future.

Balancing market forces

To maintain this belief and promise of future returns, the market forces have to balance up naturally. Any external influence will create market insecurities, and people will start losing their faith in their money, and investors start losing their faith in the future. The price of a product or service must be determined by the supply in relation to its demand, and is adjusted by the seller to maximise profits in relation to his competitors. This naturally applies to the labour market as well. If an employer can’t find anybody to work at $1 per hour, he would be forced to raise the rate until he can find somebody who is willing to work for that offer. It also works the other way around. Given a high demand for a skill, a worker would be at leisure choosing from among different offers, and of course he will go for the best one.

The minimum wage

An employer is required to pay a minimum hourly rate because he is legally bound to do so. This can be a problem when the work the employee is doing does not generate enough value to cover his cost. Of course, one can argue that it is the business manager’s fault that the work done is not being sold according to market prices, but a simple counter-argument is that an employee can freely switch to an employer with better management skills to maximise the output of his work and who could therefore afford to pay him more. Many arguments such as this can always be made, but they always have counter-arguments. For instance, one can also argue that those employees paid lower than going market rates do not look for a better paying job due to their fear of change. The counter-argument to this is that it is natural for someone who takes risks to be paid more than someone who is risk averse. Another argument is that the employee will not find a job with better pay. In which case the counter-argument is that this only means that he is being paid the correct market rate.

Minimum wages can be a problem not just for the employer, but for the whole economy. Of course we do not sacrifice the individual for the sake of a perfect economic model, and a minimum wage has become an acceptable safety net in many countries. Essentially, by completely eliminating the supply of jobs commanding less than the minimum wage, we decrease economic efficiency so as to protect those who cannot generate a certain amount of income for themselves.

The decent lifestyle on a living wage

The “living wage” concept, on the other hand, takes this an extra step further. It attempts to define what the minimum “decent” lifestyle should be, an encourages employers to pay employees more than they are worth on the market. What is really scary though is that nobody knows what a “decent” lifestyle is. For some, a decent lifestyle may mean going on holiday at least once a year. For others, this would mean living in a three bedroom apartment. Yet for others it can mean having enough money to pay for a drug addiction. It all depends on one’s circumstances in life. For instance, someone with a family of three children in which he or she is the only breadwinner will require more money to cover their expenses than someone with no children. The living wage concept turns everything topsy-turvy. Instead of your income defining your lifestyle, your lifestyle defines your income. This would only work if, for instance, you would walk into a supermarket and find that prices differentiate insanely from other similar supermarkets, and when you complain, you are politely explained that prices are higher here because the owner needs to buy a new yacht in a couple of months (he’s got expensive tastes, m’hemmx x’taghmel). And you buy from there, because you think the living wage is a good idea. It’s that ridiculous.

Defining poverty

The definition of poverty is also somewhat vague, especially in a country like Malta where you can probably count on a single hand the people dying of hunger. This is because of the good social system already in place: offering free education for all, stipends to university students, relief for the unemployed, for single mothers and for people who cannot work for some reason or another. The socialists argue that the minimum wage has gone below the necessary income to keep someone out of poverty. I can see two types of “poor” people here: those who spend more than they earn because they cannot control their spending habits; and those who genuinely are the social exceptions and cannot do otherwise (e.g. due to health, disabilities and old age). The first group actually makes up most of the social cases, and includes also people earning much more than the minimum wage. Such people live beyond their means, for instance, by spending money on the latest gadgets, buying cars which clearly they cannot afford to run and maintain, and eating out regularly, to name a few. One can argue that a decent lifestyle includes eating at a restaurant every week, but then I will argue that a decent lifestyle for me constitutes owning a superyacht. It just does not follow. It’s all relative.

An economy may actually end up in a situation whereby some people do not earn enough money to put food on the table. This situation is typical in capitalist, free market economies, where minimum wages are very low or do not exist at all, and the owners of production become richer, prices get higher but workers’ income stays the same, causing mass poverty among the low-income earners. This is where the government has to butt in and provide a realistic minimum wage to enable everyone to survive, and in the meantime, retrain themselves to increase their prospects of finding a better paying job.

Public perception of their employers

Many employees have a false perception of their employer’s state of affairs. They think of their employer as a mint – a money-making factory – where the amount of money available is practically unlimited and that he can afford to pay them double or triple of what they currently make. True, it may be the case that an employer has hit it big with some innovative product that provides him with abnormal rates of return. However in most privately held companies, rates of return are normal and the employer can afford to pay himself no more than a regular salary reflecting his position and responsibility. This can still be out of the reach of a regular worker, but hey, nobody is stopping anybody from taking the plunge and starting a business. So unless your employer is the government, money is always limited, and you get paid for the value you add to the business.

Killing incentives for investment

The “living wage” concept will also reduce, if not completely eliminate, the incentive of investing one’s money. Labour costs will rise and this may drive some cost-sensitive industries out of business (e.g. labour-intensive businesses in which the profit margin is very low and profit is achieved by selling in large quantities). In any case, returns are lower, and an investor may decide that investing in government bonds with a return of 5% per annum is a better investment for equal risk. Ironically this money will be used by the government to subsidise living wages, either directly or indirectly. As is being proposed, living wages will also affect the amount of taxation collected in inland revenue. Fewer profits for companies means less corporate tax, and the extra income made by those on the living wage will either not be taxed at all or taxed using lower rates.

Killing incentives for career advancement

In a society whereby workers are paid according to their needs rather than according to their work, there will be little incentive to spend time and energy with improving one’s income, since the income will not be related to your skills anyway. Even if a position pays marginally better but requires much more responsibility, there will be little incentive to go through all that trouble. The skill-set of the labour market will eventually deteriorate, and highly skilled workers will have more reason to migrate to more liberal countries, creating a shortage of professionals in many important sectors such as health.

Room for irregularities with public contracts

Joseph Muscat claimed that paying a living wage is optional for employers, but employers will be encouraged to provide it using other measures. For instance, they can be given preference when bidding for public tenders. I BEG YOU PARDON? This will open up huge opportunities for irregularities. So first we mess up the system, and then we try to work around its drawbacks by creating more loopholes and complications. It just doesn’t work like that.

Labour movement and sub-markets

There is actually an exception to natural market forces. This is the discord between movement of labour and movement of goods. It is a known fact that there are sometimes big hurdles that stop many workers from moving from where there is excess supply to where there is excess demand, even within the same market. Because of this, cost of goods, which are easily shipped, can vary greatly between cities in the same country. In the UK for instance, due to the congestion in the Greater London region, prices of many products are higher than in other cities due to the greater demand, creating sub-markets. One can argue that this works as an incentive to drive people out of London, and for business owners to establish their business outside of London, and I tend to agree. These are in reality natural market forces at work. However relocating workers, especially in large numbers, can disrupt social ties and create other problems that can put more pressure on the economy than they actually solve.

The purpose of this point, however, is that this situation is completely irrelevant when discussing the situation in Malta. Malta is too small to be affected by sub-markets. Any reference to UK’s Ed Milliband and his call for a living wage for London residents would be a complete non sequitur.

The solution

One word: EDUCATION. Despite offering our students free education, and on top of that, a stipend for Junior College and University, Malta still ranks the lowest in the rate of students entering tertiary education in the whole of the European Union. Eastern European countries are far ahead of us in this regard, possibly because they are desperate to move to the richer countries; and this would only be realistically possible if they can manage to secure a good education for themselves. On the other hand in Malta, the stipend system seems to be failing at encouraging students to pursue degrees. Instead I believe it is having the complete opposite effect. My theory is that when youngsters look at University, they see it as a source of finance, rather than as a source of education first and foremost. When they compare it to the other options, such as an entry-level job at a minimum wage, it doesn’t match up, so they would prefer being a cashier at the local supermarket, not thinking the least about what’s “in store” for tomorrow.

Removing stipends at this point in time will not work. Students and parents alike have become used to the mentality of “getting paid for learning”, and this can also be fair on those students who haven’t got the financial means to pay. Different solutions have been proposed. The means test is one of them. But, similar to the living wage argument, what factors will come in play when determining who deserves a stipend and who doesn’t? It will complicate matters incredibly, and will only create resentment among the students because what they think is fair will never be in accordance to what any means test qualifies as fair. Other solutions need to be explored, and rather than re-inventing the wheel, we can look into solutions that have been successfully implemented in other countries.

In my opinion, stipends have to remain, but they will have to be paid back, with a small interest, within say a maximum of a 10 year period after graduation. I think this is only fair. When you are being paid a stipend you are getting the best of both worlds: free education and free money. It’s only fair to return the “money” part of the deal. Nobody can ever take away your education. Besides that, you will leverage on that education to make much more money that you would owe the government for your education. It will also make you approach tertiary education with the correct mindset: an investment that will render big interests at a future date. It will also make you work harder on your studies, because whether you finish your degree or not, you’d eventually have to pay back the fees; and obtaining your degree will definitely make it much easier for you to pay back what you owe. It’s a win-win-win situation for the students, their parents and the taxpayers, a far outcry from the current situation in which everyone is losing out.

Free market economies

Education is the pillar of wealth creation in free market economies, such as the USA, and to a certain extent, the UK. On the other hand, many European countries with strong socialist policies and high taxation to fuel the generous social services tend to have, in general, a lower standard of education and limited budgets for research and innovation. In such countries, private enterprise is not encouraged much since the focus is always on the well-being and comfort of the worker. This creates a situation whereby most private entities are directly or indirectly providing services to public entities and have practically no budget left after taxation for research into new products.

Of course, as we have seen in recent years, even free economies can be abused due to mismanagement of credit, but it still remains that, whereas a free market economy, despite its drawbacks, encourages work, growth and wealth generation due to its complete agreement with the human psyche, markets hindered by extreme socialist policies such as a “living wage” concept are not sustainable. Such policies are based primarily on envy of others’ achievements and hard work, and, because income would have to be shared with those who think they deserve a “living wage”, they work against the human desire to enjoy the fruits of one’s efforts. A living wage, whatever the form it is implemented in, will indeed be bad news for the Maltese economy.

Calculating Dogs

I just came across this interesting post which is worth sharing with my dog-lover friends who also share a passion of mathematics. It’s taken from ScienceNews.org, and credits go to Ivars Peterson.

It all started with Elvis.

Elvis playing fetch at the beach.

In 2003, mathematician Tim Pennings of Hope College in Holland, Mich., revealed to the world that his Welsh corgi, Elvis, appears to be solving a calculus problem when finding the optimal path to fetch a ball. In this case, optimal path means minimizing travel time.

When Elvis and Pennings go to the beach, they always play fetch. Standing at the water’s edge, Pennings throws a tennis ball out into the waves, and Elvis eagerly retrieves it. When Pennings throws the ball at an angle to the shoreline, Elvis has several options. He can run along the beach until he is directly opposite the ball, then swim out to get it. Or he can plunge into the water right away and swim all the way to the ball. What happens most the time, however, is that Elvis runs part of the way along the beach, then swims out to the ball.

Depending on the dog’s running and swimming speeds, the strategy that Elvis follows appears to minimize the time that it takes to get to the ball. Indeed, Pennings found by experiment that Elvis performs in a way that closely matches a calculus-based mathematical model of the situation.

“It seems clear that in most cases Elvis chose a path that agreed remarkably closely with the optimal path,” Pennings argued in the May 2003 College Mathematics Journal.

Paths to the ball. Shoreline distance AC = z; perpendicular distance to target BC = x; DC = y; AB = w.

Now, several other researchers have weighed in on the question of what sort of calculations dogs may do to reach their goals.In the January College Mathematics Journal, Pierre Perruchet of the University of Bourgogne and Jorge Gallego of Robert-Debre Pediatric Hospital in Paris contend that the model chosen by Pennings assumes that the dog knows the entire route in advance in order to minimize the total duration of travel. Instead, they say, a dog optimizes its behavior on a moment-to-moment basis.

Perruchet and Gallego worked with a female Labrador named Salsa, who, like Elvis, apparently chooses the optimal path when playing fetch along a lakeside beach—in this case, near Nimes, France.The researchers suggest that a dog playing fetch chooses at each point in time the path that allows it to maximize its speed of approach to the ball.

Here’s their argument. When running from A towards C, the ball at B appears closer and closer as the dog gets closer to C, but its speed of approach to B diminishes (reaching zero at C). At some moment of its run, its speed of approach while running on the beach equals its speed of approach when swimming directly to the ball. If the dog jumps into the water at this moment, the strategy yields the same y value as that provided by the travel-time minimization model (where r is the dog’s running speed, and s is its swimming speed).

“Although this solution is identical to that proposed by Pennings,” Perruchet and Gallego say, “it was gained without assuming canine knowledge of the entire route, and hence can be construed as a more plausible model for [the] dog’s strategy.”

However, for this alternative model to work, a dog must be able to estimate accurately its speed of approach at each moment and to have a general awareness of its swimming speed before entering the water. Perruchet and Gallego argue that dogs and other animals do have such motion detection capabilities.

On the other hand, Pennings insists that Elvis appears to make global decisions rather than instantaneous decisions when retrieving a ball.

The following experiment suggests why. “Playing fetch with Elvis, I decided to throw the stick while standing in the water, about 10-12 feet from shore, and with Elvis right beside me,” Pennings reports. “When I threw the stick in a path parallel to the beach, Elvis swam in to shore, ran along the beach for a sizeable distance, and then dove back into the water to retrieve the stick.”

“Thus,” he adds, “in swimming to shore he was not acting to minimize his distance to the stick as quickly as possible. Instead hedid in fact apparently make a ‘global’ decision form the outset as to what path would get him to the stick most quickly.”

In the same issue of the College Mathematics Journal, mathematician Leonid Dickey of the University of Oklahoma proposes an extension—a strategy that dogs might use if they were initially not at the water’s edge but standing some distance from the shore. This becomes a problem in the calculus of variations.

Dickey then asks how a dog would respond if the soil properties (such as density and water content), and hence the running speed, changed gradually. But he presents no experiment data. Perhaps he doesn’t own a dog.

In the meantime, Elvis (full name Elvis Bogart Wales) has gone on to bigger and better things. A year ago, he was awarded an honorary degree “Litterarum Doctoris Caninarum” from Hope College. He even made a guest appearance in Keith Devlin’s new book, The Math Instinct: Why You’re a Mathematical Genius (Along with Lobsters, Birds, Cats, and Dogs).

Computing Electricity Bills for Commercial and Industrial Entities

In my last post I described how water bills can be computed for commercial and industrial entities (which we shall refer to as non-residential entities). In this post we shall have a look at how electricity bills can be computed for non-residential entities, and thus “complete the circle” of utility bill calculations.

In a way, the electricity bill calculation for non-residential entities is simpler than for residential ones. This is because ECO Reduction does not apply to non-residential entities. This saves us a headache by avoiding calculation of ECO-Reduction, which is quite a complex task. Instead, tariffs fall in a number of bands, similar to the first stage in calculating residential electricity bills. However, 9 bands apply for non-residential entities instead of the 5 bands for residential ones.  Non-residential electricity tariffs also come in two types: kWh and kVAh. The type of rate is determined by the type of billing assigned to your organisation when applying for the electricity meter, and will be printed on your bill.

Heavy consumers (more than 5,000,000 units per year) may also opt for separate day and night bills. With this option, the units consumed during the night are counted separately from those consumed during the day. This can be done with two separate meters, or special meters with two counters that automatically switch between day and night based on the time of day. Enemalta Corporation should make it clear at what times during the day “day tariffs” and “night tariffs” apply. Unfortunately it does not. Day rates are slightly higher than regular rates, while night rates are slightly cheaper. This encourages consumers to shift consumption of electricity to the night-time.

The two tables below summarise the tariffs. Two separate tables are shown. One displays tariffs for kWh-type billing. The other displays tariffs for kVAh-type billing.

Note that the tariffs for commercial entities are quoted excluding VAT. An additional 5% VAT has to be added to the total electricity consumption bill. This VAT is usually claimable together with VAT incurred on other expenses related to production.

Rates for kWh-type billing:

Band

Annual consumption

kWh regular
rate €

kWh day rate €

Night rate €

1

0 – 2,000

0.162

0.164

0.127

2

2,001 – 6,000

0.170

0.172

0.135

3

6,001 – 10,000

0.183

0.185

0.148

4

10,001 – 20,000

0.198

0.200

0.163

5

20,001 – 60,000

0.215

0.217

0.180

6

60,001 – 100,000

0.200

0.202

0.165

7

100,001 – 1,000,000

0.187

0.189

0.152

8

1,000,001 – 5,000,000

0.170

0.172

0.135

9

5,000,001 & over

0.144

0.146

0.109

Rates for kVAh-type billing:

Band

Annual consumption

kVAh regular
rate €

kVAh day
rate €

Night
rate €

1

0 – 2,000

0.149

0.151

0.114

2

2,001 – 6,000

0.156

0.158

0.121

3

6,001 – 10,000

0.168

0.170

0.133

4

10,001 – 20,000

0.182

0.184

0.147

5

20,001 – 60,000

0.198

0.200

0.163

6

60,001 – 100,000

0.184

0.186

0.149

7

100,001 – 1,000,000

0.172

0.174

0.137

8

1,000,001 – 5,000,000

0.156

0.158

0.121

9

5,000,001 & over

0.132

0.134

0.097

It is interesting to note that with both types of tariffs,  consumption over 60,000 annual units is priced cheaper per unit than in previous bands (which increase in price with consumption).

Reduced Tariffs

A less well-known group of tariffs is known as “Reduced”. Such tariffs were once applied to selected industries after negotiation with government officials. Unfortunately since 1 April 2009, reduced tariffs were removed, and all tariffs are now computed using the regular rates. Bill calculators such as MyBill Calculator can however invoke and display these rates for computations of bills for periods prior to 1 April 2009.

An example

The above consumption bands represent yearly consumption. Usually bills do not span an exact 1 year period. Instead a bill can be for an arbitrary period within or across a calendar year. Therefore, in our calculation, we must first map the above bands proportionally to the number of days spanned by the bill. For instance, consider a bill for 6,000 units of electricity (using kWh-type billing and regular rates) for the period 1 March 2010 up to 31 May 2010 (92 days). Therefore we will have to revise the original table as follows:

  • 2,000 × 92 ÷ 365 = 504.11
  • 6,000 × 92 ÷ 365 = 1,512.33
  • 10,000 × 92 ÷ 365 = 2,520.55
  • 20,000 × 92 ÷ 365 = 5,041.10
  • 60,000 × 92 ÷ 365 = 15,123.29
  • 100,000 × 92 ÷ 365 = 25,205.48
  • 1,000,000 × 92 ÷ 365 = 252,054.79
  • 5,000,000 × 92 ÷ 365 = 1,260,273.97

Band

Annual consumption Period consumption

kWh regular
rate €

1

0 – 2,000 0 – 504.11

0.162

2

2,001 – 6,000 504.11 – 1,512.33

0.170

3

6,001 – 10,000 1,512.33 – 2,520.55

0.183

4

10,001 – 20,000 2,520.55 – 5,041.10

0.198

5

20,001 – 60,000 5,041.10 – 15,123.29

0.215

6

60,001 – 100,000 15,123.29 – 25,205.48

0.200

7

100,001 – 1,000,000 25,205.48 – 252,054.79

0.187

8

1,000,001 – 5,000,000 252,054.79 – 1,260,273.97

0.170

9

5,000,001 & over Above 1,260,273.97

0.144

Therefore, the consumption bill for our 6,000 units will be calculated as follows:

  • Band 1: 504.11 units @ €0.162 = €81.67
  • Band 2: 1,008.22 units @ €0.170 = €171.40
  • Band 3: 1,008.22 units @ €0.183 = €184.50
  • Band 4: 2,520.55 units @ €0.198 = €499.07
  • Band 5: Remaining 958.9 units @ €0.215 = €206.16
  • Total consumption bill = €81.67 + €171.40 + €184.50 + €499.07 + €206.16 = €1,142.80
  • 5% VAT has to be added to the bill: €1,142.80 × 5% = €57.14 VAT

Service Charges

Service charges are fixed charges that cover the fee for the provision of service (sometimes also called the meter rent). For commercial entities, these are substantially higher, and the quoted price excludes VAT. The fee depends on whether you are supplied with a Single Phase meter or a Triple Phase meter (for heavy machinery). The annual charge for a Single Phase meter is €120, whereas for a Triple Phase meter it is €360.

Since bills do not cover exactly a 1 year period, the service charge will be calculated proportionally for the number of days covered by the bill. For instance, for a bill covering the period 1 March 2010 up to 31 May 2010 (92 days), the service charge for a Triple Phase meter will be calculated as follows:

  • €360 × 92 ÷ 365 = €90.74
  • 5% VAT has to be added to the charge: €90.74 × 5% = €4.54

Maximum Demand Charge

Heavy machinery may sometimes require a guaranteed level of service. For instance, switching on heavy machinery may initially require a substantial amount of energy not usually required during normal operation. This guarantee comes in the form of a guaranteed maximum power. For instance, a small industrial plant may occasionally require a guaranteed power of 100kW. Enemalta can supply this guarantee at a fee. Of course, a Triple Phase meter will be required, so this will also have an impact on the Service Charges.

The fee is based on the number of guaranteed kW required (or, in case of kVA type billing, the number of kVA required). For kWh-type billing, the charge is of €20.50 annually per kW of guarantee. For kVA-type billing, the charge is of €19.20 annually per kVA of guarantee.

Hence, for a guaranteed power output of 100kW, a fee of 100 × €20.50 = €2,050 will be charged annually. Since the bill will not span an exact 1 year period, the amount chargeable is calculated proportionally based on the number of days. For a 92 day period, the charge will be:

  • €2,050 × 92 ÷ 365 = €516.71
  • 5% VAT has to be added to the charge: €516.71 × 5% = €25.84

MyBill Calculator Software Tool

MyBill Calculator can save you the trouble of doing this calculation by hand every time you receive your bill. It will also compute your water bill and any applicable service charges. There are editions for residential (including domestic), commercial and industrial bills. This software can also explain how your individual bill was calculated, in a similar fashion we did in this post. You can download a 15-day trial edition of MyBill Calculator by clicking here.

Let us repeat the industrial bill example above (6,000 units of electricity for the period 1 March 2010 to 31 May 2010, using Triple Phase, kWh-type billing and with a maximum charge of 100kW) , but this time using MyBill Calculator.

Just select your options, punch in your consumption, maximum demand, the start and end of the period, and click Calculate.

The result from the above calculation is as follows:

Result of calculation – Click to enlarge

The software will report:

  • The service charge applicable for the period: €90.74 in this case;
  • The electricity consumption bill:  €1,142.80;
  • A maximum demand charge of €516.71;
  • The total electricity bill (including service charge and maximum and demand charge): €1,750.25;
  • A 5% on the total electricity bill of €1,750.25: €87.51.

Next Page »


About the author

Sinclair Calleja currently works as an ICT Consultant in Melbourne, Australia. He is also the developer of MyBill Calculator, a detailed tool for Water and Electricity tariff calculation in Malta, and the developer of the The Malta Online Directory. Sinclair holds a Masters in Computer Science and an MBA in strategic management.

Follow

Get every new post delivered to your Inbox.