You are here

Planet Linux Australia

Subscribe to Planet Linux Australia feed
Planet Linux Australia - http://planet.linux.org.au
Updated: 4 hours 27 min ago

Jonathan Adamczewski: Another C++11 ‘countof’

Wed 11th May 2016 13:05

Note: There’s an update here.

Read “Better array ‘countof’ implementation with C++ 11” for context. Specifically, it presents Listing 5 as an implementation of countof() using C++11 constexpr:

  • template<typename T, std::size_t N> constexpr std::size_t countof(T const (&)[N]) noexcept { return N; }

But this falls short. Just a little.

There are arguments that could be passed to a naive sizeof(a)/sizeof(a[0]) macro that will cause the above to fail to compile.

Consider:

struct S { int a[4]; }; void f(S* s) { constexpr size_t s_a_count = countof(s->a); int b[s_a_count]; // do things... }

This does not compile. s is not constant, and countof() is a constexpr function whose result is needed at compile time, and so expects a constexpr-friendly argument. Even though it is not used.

Errors from this kind of thing can look like this from clang-3.7.0:

error: constexpr variable 's_a_count' must be initialized by a constant expression note: read of non-constexpr variable 's' is not allowed in a constant expression

or this from Visual Studio 2015 Update 1:

error: C2131: expression did not evaluate to a constant

(Aside: At the time of writing, the error C2131 seems to be undocumented for VS2015. But Visual Studio 6.0 had an error with the same number)

Here’s a C++11 version of countof() that will give the correct result for countof(s->a) above:

#include <type_traits> template<typename Tin> constexpr std::size_t countof() { using T = typename std::remove_reference<Tin>::type; static_assert(std::is_array<T>::value, "countof() requires an array argument"); static_assert(std::extent<T>::value > 0, // [0] "zero- or unknown-size array"); return std::extent<T>::value; } #define countof(a) countof<decltype(a)>()

Some of the details:

Adding a countof() macro allows use of decltype() in the caller’s context, which provides the type of the member array of a non-const object at compile time.

std::remove_reference is needed to get the array type from the result of decltype(). Without it, std::is_array and std::extent produce false and zero, respectively.

The first static assert ensures that countof() is being called on an actual array. The upside over failed template instantiation or specialization is that you can write your own human-readable, slightly more context aware error message (better than mine).

The second static assert validates that the array size is known, and is greater than zero. Without it, countof<int[]>() will return zero (which will be wrong) without error. And zero-sized arrays will also result in zero — in practice they rarely actually contain zero elements. This isn’t a function for finding the size of those arrays.

And then std::extent<T>::value produces the actual count of the elements of the array.

Addendum:

If replacing an existing sizeof-based macro with a constexpr countof() alternate, Visual Studio 2015 Update 1 will trigger warnings in certain cases where there previously were no warnings.

warning C4267: conversion from 'size_t' to 'int', possible loss of data

It is unfortunate to have to add explicit casts when the safety of such operations is able to be determined by the compiler. I have optimistically submitted this as an issue at connect.microsoft.com.

[0] Typo fix thanks to this commentor

Categories: thinktime

Jonathan Adamczewski: The Growth of Modern C++ Support

Wed 11th May 2016 13:05

 

Completing what I started here, I’ve charted the numbers from Christophe’s data for C++11, C++11 Concurrency, C++14 and C++17.

The data is taken entirely from the linked pdf with one exception: N3664 is a clarification that permits optimization, not a requirement for compliance. Compilers that do not perform this optimization are no less compliant with C++14. I’ve recomputed the percentages for all compiler versions to take this into account.

In addition to the references from the previous post, the approval date of C++14 was taken from http://en.wikipedia.org/wiki/C++14

Categories: thinktime

Jonathan Adamczewski: C++14 and volatile implicity

Wed 11th May 2016 13:05

[Update 2016-03-07: It appears that this was a bug in VS2015, and has been fixed in Update 2 RC]

In the process of upgrading Visual Studio 2012 to Visual Studio 2015, I encountered some brand new link errors that looked something like this:

error LNK2001: unresolved external symbol "public: __cdecl FooData::FooData(struct FooData& const &)"

It’s not a new error in VS2015 — VS2012 can certainly produce it. I mean “new” in the sense that there were no problems linking this code when using the older compiler.

The struct in question looks vaguely like this:

struct FooData { int m_Bar; volatile int m_Baz; };

The problem is m_Baz. In C++14, the language was changed to say that structs are not trivially constructible if they have non-static volatile members. And that, I think, is why there’s no default copy constructor being generated. I can’t quote chapter and verse to back up that assertion, though.

[Update: Actually… maybe not? I’m beginning to wonder if VS2015 is doing the wrong thing here.]

But the fix is simple: add a copy constructor. And then, when the program fails to compile, declare a default constructor (because, of course, adding a copy constructor causes the implicit default constructor to be marked as deleted).

I found that developing an understanding of exactly what was happening and why to be the more difficult problem. Initially because the the compiler gave no indication that there was a problem at all, and willingly generated calls to a copy constructor that couldn’t possibly exist. Deeper than that, I’m still trying to piece together my own understanding of exactly why (and how) this change was made to the standard.

Categories: thinktime

Jonathan Adamczewski: The Growth of C++11 Support

Wed 11th May 2016 13:05

Update: This chart has been updated and I’ve added charts for C++11 Concurrency, C++14, and C++17 here.
 

A few days ago, Christophe Riccio tweeted a link to a pdf that shows the level of support for “Modern C++” standards in four C++ compilers: Visual C++, GCC, Clang, and ICC.

One of the things I wanted to see was not just how support had advanced between versions of each compiler, but how compilers had changed relative to one another over time. I extracted the numbers for C++11 from Christophe’s document, found the release dates for each compiler, and created a chart that puts it all together.

It’s interesting to see how far behind Clang starts in comparison to the others, and that it ends up in a close dance with GCC on the way to full C++11 support. It also highlights how disappointing VC++ has been in terms of language feature advancement — particularly when VS2010 was ahead of Clang and ICC for C++11 features.

Creating the chart also served as an opportunity to play around with data visualization using Bokeh. As such, you can click on the chart above and you’ll see a version that you can zoom, pan, and resize (which is only a small part of what Bokeh offers). I intend to write about my experiences with Bokeh at a later date.

 

Release dates for each compiler were taken from the following pages:

The date used to mark the approval of the C++11 standard is taken from http://en.wikipedia.org/wiki/C++11

Categories: thinktime

Jonathan Adamczewski: Another another C++11 ‘countof’

Wed 11th May 2016 13:05

My earlier post received this comment which is a pretty neat little improvement over the one from g-truc.net.

Here it is, with one further tweak:

template<typename T, std::size_t N> constexpr std::integral_constant<std::size_t, N> countof(T const (&)[N]) noexcept {   return {}; } #define COUNTOF(...) decltype(countof(__VA_ARGS__))::value

The change I’ve made to pfultz2’s version is to use ::value rather than {} after decltype in the macro.

This makes the type of the result std::size_t not std::integral_constant, so it can be used in va_arg settings without triggering compiler or static analysis warnings.

It also has the advantage of not triggering extra warnings in VS2015U1 (this issue).

Categories: thinktime

Jonathan Adamczewski: Standards vs Compilers: Warning C4146

Wed 11th May 2016 13:05

warning C4146: unary minus operator applied to unsigned type, result still unsigned

I saw this warning recently.

“Aha!” I thought. “A common source of errors, able to strike down the unsuspecting programmer. Thank you crafters of Visual C++ compiler warnings, tirelessly laboring to uncover wrong assumptions and naively written code.”

“What?” I exclaimed. “Of course the result is still unsigned. That’s how the language is designed, and that’s what I wanted!”

Nevertheless, I read the documentation for the warning to see if there was anything I could glean from it — particularly to see if I could find sufficient reason to not just #pragma disable it.

This is what you can find in the documentation:

Unsigned types can hold only non-negative values, so unary minus (negation) does not usually make sense when applied to an unsigned type. Both the operand and the result are non-negative.

Negation of an unsigned value may not make sense if you don’t know what it means — it is well defined. Regardless, this is a level 2 warning. It is designed to catch common mistakes and misunderstandings and notify the programmer to have them look more closely. It may be an entirely reasonable thing to warn about.

The documentation continues with some rationale:

Practically, this occurs when the programmer is trying to express the minimum integer value, which is -2147483648. This value cannot be written as -2147483648 because the expression is processed in two stages:

  1. The number 2147483648 is evaluated. Because it is greater than the maximum integer value of 2147483647, the type of 2147483648 is not int, but unsigned int.
  2. Unary minus is applied to the value, with an unsigned result, which also happens to be 2147483648.

The first point is wrong. Wrong for a standards-conformant C++ implementation, anyway. The second would be accurate if the first was accurate (because 232 – 231 == 231)

Here’s what the most recent draft of the C++ standard says about the integer literal types:

The type of an integer literal is the first of the corresponding list in Table 6 in which its value can be represented.

2147483648 is a decimal constant with no suffix. When using VC++ with it’s 32 bit long int type, the first of the corresponding list in which its value can be represented is the 64 bit long long int. An unsigned type is never an option.

Unary minus should then be applied to long long int 2147483648, which should result in long long int -2147483648. There’s nothing unsigned in this process

Use of the result should behave in an unsurprising way, too — long long int -2147483648 can be assigned to a variable of type int and nothing unexpected will happen. The type can be converted without affecting the value.

According to the standard, the rationale is flawed, and the warning seems pointless to me.

In theory, there’s no difference between theory and practise

So I tried compiling the example program from the documentation to see what would happen.

// C4146.cpp // compile with: /W2 #include <stdio.h> void check(int i) { if (i > -2147483648) // C4146 printf_s("%d is greater than the most negative int\n", i); } int main() { check(-100); check(1); }

The documentation predicts the following outcome:

The expected second line, 1 is greater than the most negative int, is not printed because ((unsigned int)1) > 2147483648 is false.

If I build the program with gcc 4.9.2, both lines print.

If I build the program with Visual C++ 2012, or even 2015 Preview, only one line is printed (as was predicted).

So there is legitimacy to this warning — this is an area that Visual C++ is not compliant with the standard.

Maybe it’s because the standard has changed? I looked at the earliest version of the text available in the cplusplus github repo dating from late 2011, and that has the same rules as quoted above.

I went back further and found copies of the standard from 2003 and 1998, both of which state:

The type of an integer literal depends on its form, value, and suffix. If it is decimal and has no suffix, it has the first of these types in which its value can be represented: int, long int; if the value cannot be represented as a long int, the behavior is undefined.

So it’s a detail that was previously undefined, which means that the compiler is permitted to do whatever it wants. In this case, we’ll get a warning, but only if the programmer has asked for it using option /W2.

The documentation is accurate, and Visual C++ hasn’t kept up with changes in the standard. This shouldn’t be surprising.

Update: long long int was added to the standard as part of C++11. It appears that VC++ has had long long support since at least Visual Studio .NET 2003

So what?

This investigation arose from my reading of Visual C++ documentation in the context of what I knew of a recent draft of the C++ standard. It turns out that these two things are less connected than I had assumed. Unsurprisingly, the Visual C++ documentation describes Visual C++, not the standard.

While it would be nice if deviations from the standard were clearly marked in the documentation, and even nicer if the Visual C++ compiler was consistent with the ISO standard, the reality is that they are not and it is not.

One should always pay close attention to context, which happens to apply as much when reading about the C++ language as it does when writing C++ code.

Categories: thinktime

Jonathan Adamczewski: What is -1u?

Wed 11th May 2016 13:05

In C++, what exactly is -1u?

It doesn’t seem like it should be difficult to answer — it’s only three characters: , 1, and u. And, knowing a little bit about C++, it seems like that’ll be (-1) negative one with that u making ((-1)u) an unsigned int. Right?

To be more specific, on an architecture where int is a 32 bit type, and negative numbers are represented using two’s complement (i.e. just about all of them), negative one has the binary value 11111111111111111111111111111111. And converting that to unsigned int should … still be those same thirty two ones. Shouldn’t it?

I can test that hypothesis! Here’s a program that will answer the question once and for all:

#include <stdio.h> #include <type_traits> int main() { static_assert(std::is_unsigned<decltype(-1u)>::value, "actually not unsigned"); printf("-1u is %zu bytes, with the value %#08x\n ", sizeof -1u, -1u); }

Compile and run it like this:

g++ -std=c++11 minus_one_u.cpp -o minus_one_u && minus_one_u

If I do that, I see the following output:

-1u is 4 bytes, with the value 0xffffffff

I’m using -std=c++11 to be able to use std::is_unsigned, decltype and static_assert which combine to assure me that (-1u) is actually unsigned as the program wouldn’t have compiled if that wasn’t the case. And the output shows the result I had hoped for: it’s a four byte value, containing 0xffffffff (which is the same as that string of thirty two ones I was looking for).

I have now proven that -1u means “convert -1 to an unsigned int.” Yay me!

Not so much.

It just so happened that I was reading about integer literals in a recent draft of the ISO C++ standard. Here’s the part of the standard that describes the format of decimal integer literals:

2.14.2 Integer literals
1 An integer literal is a sequence of digits that has no period or exponent part, with optional separating single quotes that are ignored when determining its value. An integer literal may have a prefix that specifies its base and a suffix that specifies its type. The lexically first digit of the sequence of digits is the most significant. A decimal integer literal (base ten) begins with a digit other than 0 and consists of a sequence of decimal digits.

Can you see where it describes negative integer literals?

I can’t see where it describes negative integer literals.

Oh.

I though -1u was ((-1)u). I was wrong. Integer literals do not work that way.

Obviously -1u didn’t just stop producing an unsigned int with the value 0xffffffff (the program proved it!!1), but the reason it has that value is not the reason I thought.

So, what is -1u?

The standard says that 1u is an integer literal. So now I need to work out exactly what that  is doing. What does it mean to negate 1u? Back to the standard I go.

5.3.1 Unary operators
8 The operand of the unary – operator shall have arithmetic or unscoped enumeration type and the result is the negation of its operand. Integral promotion is performed on integral or enumeration operands. The negative of an unsigned quantity is computed by subtracting its value from 2n, where n is the number of bits in the promoted operand. The type of the result is the type of the promoted operand.

I feel like I’m getting closer to some real answers.

So there’s a numerical operation to apply to this thing. But first, this:

Integral promotion is performed on integral or enumeration operands.

Believe me when I tell you that this section changes nothing and you should skip it.

I have an integral operand (1u), so integral promotion must be performed. Here is the part of the standard that deals with that:

4.5 Integral promotions
1 A prvalue of an integer type other than bool, char16_t, char32_t, or wchar_t whose integer conversion rank (4.13) is less than the rank of int can be converted to a prvalue of type int if int can represent all the values of the source type; otherwise, the source prvalue can be converted to a prvalue of type unsigned int.

I’m going to cut a corner here: integer literals are prvalues, but I couldn’t find a place in the standard that explicitly declares this to be the case. It does seem pretty clear from 3.10 that they can’t be anything else. This page gives a good rundown on C++ value categories, and does state that integer literals are prvalues, so let’s go with that.

If 1u is a prvalue, and its type is unsigned int, I can collapse the standard text a little:

4.5 Integral promotions (prvalue edition)
A value of an integer type whose integer conversion rank (4.13) is less than the rank of int …

and I’m going to stop right there. Conversion rank what now? To 4.13!

4.13 Integer conversion rank
1 Every integer type has an integer conversion rank defined as follows:

Then a list of ten different rules, including this one:

— The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type.

Without knowing more about conversion ranks, this rule gives me enough information to determine what 4.5 means for unsigned int values: unsigned int has the same rank as int. So I can rewrite 4.5 one more time like this:

4.5 Integral promotions (unsigned int edition)
1 [This space intentionally left blank]

Integral promotion of an unsigned int value doesn’t change a thing.

Where was I?

Now I can rewrite 5.3.1 with the knowledge that 1u requires no integral promotion:

5.3.1 Unary operators (unsigned int operand edition)
8 The [result of] the unary – operator … is the negation of its operand. The negative of an unsigned quantity is computed by subtracting its value from 2n, where n is the number of bits in the promoted operand. The type of the result is the type of the operand.

And, at long last, I get to do the negating. For an unsigned value that means:

[subtract] its value from 2n, where n is the number of bits in the promoted operand.

My unsigned int has 32 bits, so that would be 232 – 1. Which in hexadecimal looks something like this:

0x100000000 - 0x000000001 0x0ffffffff

But that leading zero I’ve left on the result goes away because

The type of the result is the type of the (promoted) operand.

And I am now certain that I know how -1u becomes an unsigned int with the value 0xffffffff. In fact, it’s not even dependent on having a platform that uses two’s complement  — nothing in the conversion relies on that.

But… when could this possibly ever matter?

For -1u? I don’t see this ever causing actual problems. There are situations that arise from the way that C++ integer literals are defined that can cause surprises (i.e. bugs) for the unsuspecting programmer.

There is a particular case described in the documentation for Visual C++ compiler warning C4146, but I think the rationale for that warning is wrong (or, at least, imprecise), but not because of something I’ve covered in this article. As I’ve already written far too many words about these three characters, I’ll keep that discussion for some time in the future.

Categories: thinktime

Gabriel Noronha: The EV posts are comming !

Wed 11th May 2016 13:05
July 2013 it arrived

In July we purchased a 2012 I-miev ex-demo (Dec 2012 rego) from booths motor group Gosford for $25000 it’s now November so in 3-4 months we have done ~5000km. it’s had its 1500km service and the next service is at 15000km or 1 year.

Driving a EV is like driving a classic car, you rarely see them on the road and there is a nice community around them.

Like I said this is post number one more are coming !

Categories: thinktime

Gabriel Noronha: NSW Solar Feed in Tariff

Wed 11th May 2016 13:05

If you where lucky enough to install your solar panels before 30 June 2012 then you have nothing to worry about your nsw government guaranteed to get 60c for those pre 28/10/2010 in the scheme or 20c for those later. I didn’t own my house before that date so I missed out so we’ll mainly be looking at VFIT voluntary feed in tariff.

So to safe you the research I’ve put it in a table below using Energy Made Easy Website to look up power companies avaliable in NSW.

Company VFIT c/kwh Greenpower Website Click Energy 10 No Click Energy AGL 8 Yes AGL Diamond Energy 8 No** Diamond Energy Power Direct 7.7 Yes Power Direct EnergyAustralia 7.7* Yes Energy Australia Lumo 6.6 Yes Lumo Energy Orgin 6 Yes Orgin energy Red Energy 5* Yes Red Energy

*can’t confirm rate on company website need to ring for quote.
**Doesn’t offer certified green energy but does own green energy generators and no fossil fuel generators.

I export 3199.9 kWh/annually so at 8c it’s $255.99 and at the top rate of 10c/kWh it’s $319.99 so 10c give me an extra $64 per year. but that’s only a saving if the cost rate is the same.

There are other things to take into account when choosing a provide through, like the rates and discount for example click charge 27.39 c/kwh plus 7% discount 25.47 c/kwh which beat the discounted AGL rate of 26.44 c/kwh. Diamond energy with discount is ~26.56 c/kwh. daily service charge will also have to be factored in but it has less of an affect on the bill size. with click offering 78.10 c/day AGL 74.877 c/day and Diamond Energy 78.10 c/day.

I’m currently with AGL but I will be doing some further number crunching to work out if I can get enough savings out of click energy to justify me contract break fee that AGL will charge me if I leave.
I also dispprove on AGLs submission to the RET review so I’m not so willing to give them any more money.

Click energy doesn’t provide green power, this is a slight sticking point as purchasing green energy means not that my power comes from green sources but my money does. But that can be purchased seperatly to your energy bill and more directly to green providers so that might be an option.

Categories: thinktime

Gabriel Noronha: New Electricity Retailer

Wed 11th May 2016 13:05

So after crunching some more numbers and reading the green peace green energy guide I decided to change electricity retailers. Based of my need for a high VFIT (see previous post )  it was a choice between AGL (current provider), Click Energy and Diamond Energy.

Power Saving Calculations

Ok so the savings it’s not completely fair on AGL $55 of that $70 saving is 100% green energy which I’m not longer buying.  As click doesn’t offer it on their solar plan. but i can buy green energy from the a environmental trust for 4.2c/kWh and it’s a tax deduction.

Click saved me the most money has no contracts over AGLs 3 year killer and Diamonds 1 year one, it was also rated by green peace as middle range green. I’ve decided to move to click energy I’ll officially switch at my next meter read.

What about Gas well it’s going to switched later when click supports it. from twitter today:

It’s official! We’re pleased to announce Click Energy will be a #naturalgassupplier by the end of the year http://t.co/SOtVNIIDJK

— Click Energy (@click4energy) September 4, 2014

If I’ve convinced you to switch and you want to get $50 click has a mates rates referral program  drop me a message and we’ll go from there.

Categories: thinktime

Gabriel Noronha: EVSE for Sun Valley Toursit Park

Wed 11th May 2016 13:05

So you might of seen a couple posts about Sun Valley Tourist Park, that is because we visit there a lot to visit grandma and grandpa (wife’s parents) .  So we decided because its outside of our return range we have to charge there to get home if we take the I-MIEV. but with the Electric Vehicle Supply Equipment (EVSE) that comes with the car limits the charge rate to 10amps max. So we convinced the park to install a 32amp EVSE.  This allow us to charge at the I-MIEV full rate of 13amps so 30% faster.

Aeroviroment EVSE-RS at Sun Valley

If you want to know more about the EVSE it’s an Aeroviroment EVSE RS.  It should work fine with the Holden volt, Mitsubishi Outlander PHEV, I-MIEV 2012 or later (may not work with 2010 models) and the Nissan LEAF.

If you are in the central coast and want somewhere to charge you can find the details on how to contact the park on plugshare. It’s available for public use depending on how busy the park is and the driver paying a nominal fee, and the driver phones ahead, during office hours.

 

Categories: thinktime

Gabriel Noronha: Charging Infrastructure

Wed 11th May 2016 13:05

A lot of people ask where do you charge. The answer is nearly for all EV drivers is at home. Some times the next question is do you need special equipment to which the answer is a powerpoint. (more specifically a 15amp powerpoint for the provide cable with the LEAF or I-miev). When out and about we have the following options.

 Commercial Infrastructure

There are two providers of commercial charging infrastructure in Australia, both are American Chargepoint and Blink, there was a 3rd Better place but unfortunately that company went broke.  Blink is yet to setup an Australian office so they are a bit harder to contact.

Chargepoint have a office in every state of Australia and have around 167 charge stations in the country. The chargepoint model is a low risk for them, it requires the person or business that wants a charging station to pay for the capital costs of supply and install of the charger.  It’s then up to the charging station owner if they want to charge the EV driver and chargepoint through the use of their RFID tags issued to drivers then take care of the payment system and charger driver accordingly, at present all the ones in Australia are free to use.

As you can see the blink network is much smaller, with only 5 sites and 7 chargers.  blink doesn’t let the site owner choose the price but instead charge $1USD per hour. I’m still waiting to hear from blink sales on if they have plans to expand in Australia.

Community Infrastructure

What if you don’t want to charge people or just provide a simple power point.  Well for these site there is a great site that EV drivers and Charging spot owners can used to share information.  http://www.recargo.com/search (you might have to pan to Australia) Allows you to sign up and add charge points to there map tell other EV drivers that a charging spot works by checking in (think foursquare and facebook), and upload pictures to help people find charge location.  This has probably been the most useful tool so far when it comes to charging infrastructure, I highly recommend all EV drivers install the app on the iphone or android.

Encouraging Infrastructure

Currently there still isn’t enough charging infrastructure, not because the current EV drivers need it but mainly because it puts people off buying a EV.

In a small effort to make it easier for business to understand what’s required to provide a service to EV drivers I prepared a primer

Electric Vehicle Charging Solutions for Businesses

Hopefully other EV drivers can use this when negotiating with companies about added a charging station to there site.

Categories: thinktime

Gabriel Noronha: Kickstarter Field Hockey Game

Wed 11th May 2016 13:05

For years in high school I had my hockey mad team mates telling me how great a field hockey game would be…

Looks like someone finally listerned there is currently a kick starter campaign to get one made http://www.kickstarter.com/projects/urbanwarfarestudios/the-field-hockey-game-pc-mac-linux

Love hockey but thing gaming is a waste of time ….. well think of this as a promotion of the sport well worth your time. I’ve backed it !

Categories: thinktime

Gabriel Noronha: Betterplace, the first to fall.

Wed 11th May 2016 13:05

Around May 2013 betterplace pulled out of Australian operations in an attempt to keep it’s parent company a float. This plan wasn’t overly great as the parent company still went bankrupt. http://www.smh.com.au/business/carbon-economy/how-better-place-got-lost-20130527-2n7gp.html this SMH article goes into a bit more depth, on why how and what’s to blame.

The real unfortunate thing is they put in quite a bit of infrastructure, with their own money and through government support through smart grid smarty city funding and now it’s being removed or unusable.

Below is pictures from at the Morisset Level 3 Charger, before and after removal.

The good news for the Level 3 fast chargers is that schneider electric have taken possession of these units back (they originally provided them) and at least they will be resold and not placed on the scrap heap.

It also appears it’s not just the level 3 but the level 2 after noticing a local shopping centre was adversing EV charging on there facebook page I emailed them to sadly only get this reply

Good morning Gabriel

Regarding your query about our Electric Car Charges, we did have charging areas however these have recently been removed from our Centre.

Kind regards

Michelle Thomas
Centre Manager
Commercial Property
Retail | Office | Industrial
Stockland Jesmond & Wallsend
28 Blue Gum Road, Jesmond NSW 2299
T +61 2 4955 9249 M +61 438 266 707
F +61 2 4955 8014 E michelle.thomas@stockland.com.au
www.stockland.com.au
BeGreen… and consider the environment before printing this email

So while I’m working madly to try and increase the amount of EV chargers in my area they are being removed at a faster rate that I can convince people to put them in.

Categories: thinktime

Gabriel Noronha: Recharging NSW

Wed 11th May 2016 13:05

So those who have been following this blog know that I’ve been a keen enthusiast for EVs attempting to grow and expand the amount of EVs in Australia and the related charging network.

Some of my frustration on how slowly it has been growing has turned into why don’t I do something about it.

So I have. I’m now a director of a new company Recharging NSW Pty Ltd. The main aim is to encourage and support EV uptake in Australia.  By increase both cars on the road and public charging.

So there isn’t much I can share at present everything is still in the planning phases. but stay tuned.

 

 

 

Categories: thinktime

Gabriel Noronha: EV friendly accomondation

Wed 11th May 2016 13:05

On the 27 of October met up with some LEAF drivers from Australian LEAF Owners Forum at Sun Valley Tourist Park see the above picture for a line up of their Leafs. It was a good meet up most of them had not met before and basically the whole meet up was based around interest in the cars.  so naturally the talk of the next meet up came up and I suggested next years 2014 hunter EV festival it’s actually down for a weekend this day 1 at the race track day 2 the expo at the foreshore.

So in an attempt to help out I sent this email out to the accommodation around Newcastle

Hello
In the lead up the the 2014 hunter Electric Vehicle festival weekend I’m canvassing Newcastle accommodation for places that are Electric Vehicle friendly so i can provide a list to out of town EV drivers.

So the first question is would you like to be added to the list ?

If you are interested I would like to know how many power points you have within close proximity to a car park?  and what type they are ? (most will be 240 Volt 10 amp)

The last piece of information I need is if there is a surcharge to the accommodation cost for EV charging and how much will it be?

Thank you for your time

What I forgot the put in the email was the dates August 16th and 17th… and the approximate cost of power which I estimated at 15kwh (~6 hours of time) so at $0.25 per KWh $3.75.  So far only had one reply which was positive but you can keep and eye on my progress by checking the spreadsheet on google drive

 

 

Categories: thinktime

Gabriel Noronha: Solar 1 year on

Wed 11th May 2016 13:05

this time last year we had the solar installed well by this time it was well on the roof … this date last year we had the meter replaced and the solar turned on.

The statistics:

  • kWh Imported 4295.3
  • kWh Exported 3199.9
  • kWh generated according to the inverter 4936
  • Fit Collected at 8c kWh $255.99
  • kWh not purchased or sold 1736.1

I’m currently on a flat rate of 29.084 c/kWh (note my rate has gone up since solar was installed) minus 10% discount  plus 5.5  c /kWh for green energy = 31.94 c /kWh. So the amount not purchased or sold is what I saved by not buying 1736.1*31.94c = $554.51 + the money I got from Fit $255.99 so in a year it’s saved me ~$810.5.

Has the solar been a good investment no…the capital cost was around $8.5k so with the amount saved it’ll take 10 years to pay back. The main reason for this is that we export way too much and the fit is so low if we got paid what it costs us it would of saved us ~$1500 a year and only 5.5 years to pay back.  Do I care if it was a solid investment not really.

If we look at how green it is if we take imported – exported (1095 kWh)  that’s how much power I’ve used from other generators which for my area is black coal, but that has been offset by my green power money purchasing green power from wind and biogass. so does my house run emissions free when it comes to electricity according to an accountant yes, because every kWh of power I’ve used has been purchased from a green source  but maybe not according to an engineer.

Other interesting notes on the power bill:

average kWh used per day including solar from April to may 2013 before purchasing the EV was 12.1 kwh

average kWh used per day including solar from July 2013 to April 2014 post purchasing the EV is 16.5 kwh

so the effect of owning an EV on our power bills is about 4.4 kwh per day $1.40 increased cost. Note: this would also include seasonal cost extras like summertime air con and winter time heating so I won’t have a clear picture until we 1 year of EV ownership.

Categories: thinktime

Howell Tam: Linux on XDA…

Wed 11th May 2016 13:05

I ended up starting to work a bit on getting Linux onto the XDA (It’s a very nice PDA phone, for those who don’t know). After spending about two weeks of fooling around, and getting help from people from #handhelds.org (joshua, pb, anpaza, and many others), I’ve finally got it booting. Currently with a very basic initrd image root, with a busybox shell at the serial console. Also trying to get the screen to work properly.

Some of my progress can be seen at the xda-linux photo section.

Categories: thinktime

Howell Tam: WINE 1 : Windows 0

Wed 11th May 2016 13:05

Got this old but very popular game I wanted to play. It’s a Windows game, but not only that, the version I have is the simplified chinese version of it (I can read it, but not as good as traditional).

I was “lucky” and got someone else’s Windows XP box to try and see if it runs, and it doesn’t. It starts up and says it needs the version of the game only works on a simplified chinese version of Windows. Then I thought, I’ve seen similar problems with other programs. Let me try fiddling with those locale and default language and encoding settings in the control panel, not to mention that I need to reboot Windows almost after every change of the settings. However, none of the changes helped. The game still won’t run. And because you could ask, no, we don’t have a simplified version of Windows.

I know for the fact that the game actually runs under WINE pretty well (good thing being an old game I guess), so I gave it a go. Installation worked. Then when I run it, yup, got the same simplified chinese version error. But there’s something different. The texts of the error dialog box are all garbage. I imagine they’re simplified chinese, but somehow not using the right font or encoding. I decided to fix this problem first, which I knew it would be easy cos I have had same problems with other chinese games before. All you need is to set LANG, in this case, to zh_CN.

And guess what, that not only solves the chinese encoding issue, that also convinces the game to think I’m on simplified chinese version of Windows. The game worked beautifully. And need not to say, setting an environment variable doesn’t require rebooting… unlike some retarded operating system.

WINE wins!

Categories: thinktime

Howell Tam: Linux, ASUS W7J, and the ACPI brightness keys

Wed 11th May 2016 13:05

Was meant to write up a page about Linux on my ASUS W7J, but I never got the time yet…

Anyway, here’s a possible quick fix for those with an ASUS laptop (W7J at least) and a non-working brightness acpi key (in my case, it’s Fn + F5 and Fn + F6), even though /sys/class/backlight/asus-laptop/brightness works perfectly.

I poked around the disassembled DSDT code and did a bit of googling. After a few reboots and testing, I figured out passing acpi_osi="!Windows 2006" to the kernel fixes the issue.

Apparently with the (current) Linux ACPI driver, the OS interface (OSI) code will respond to the ACPI as quite a few different versions of M$ windows (see drivers/acpi/utilities/uteval.c for the entire list). This list can be modified by the kernel parameter acpi_osi (see Documentation/kernel-parameters.txt for full details).

So my guess is the DSDT thinks I’m running “Windows 2006″ (aka Vista), and so it is doing (or not doing) something with these two particular ACPI keys. Telling the Linux ACPI driver not to pretend to be Vista got rid of the problem.

This quick workaround also means that I didn’t have to patch my own DSDT and build a kernel with it.

[Updated: 5th November 2007] I was testing 2.6.23.x on the W7J, and I noticed both brightness keys Fn + F5 and Fn + F6 work without acpi_osi. I looked into it and I’ve found out that the ACPI video driver makes the keys work. And for some reasons with older kernels (2.6.22.x) the video module is not loaded automatically. So you can probably ignore what I said above months ago :)

Categories: thinktime

Pages