Saturday, 30 April 2016

Virgin Media - Getting The Service You Require

I've had a bit of a battle with Virgin Media over the last month, I noted I was suddenly, and for no reason, on a very slow connection (at least slow to my liking) it was showing up in tests as between 46 and 52 mbit... STRANGE!  Since I thought I was on 100Mbit and was trying at the time to get onto the new Vivid200 mbit.

Anyway, after doing some calling around, and basically being given the run around by sales, I got through to a chap in the right department, who was able to sell me things AND look at my account; they seem very able to sell stuff to you, and take your money, but you ask for something and you get stone walled.

So, this chap checked my account, 50M sir, you're on our 50M service?... I thought I was on the Big Bundle thing, on the tele?.. 100Mbit etc... Oh You were sir, but your contract ended in 2016...

So, did they continue charging me?.. Oh yes.. Full whack, but they slowly eroded both the channels on the TV package and the speed of the internet, I guess hoping they could provide less and charge the same, or even more!

I set about trying to rectify this, and got exactly nowhere, online chat, telephone calls, even twitter didn't budge them into action, they didn't give a hoot!

Therefore, I set about getting what I wanted the underhanded way... 

What I wanted was to jump from 50mbit to 200mbit, leaving the TV and landline telephone as was, the problem?... No human operator on any channel, in any department, nowhere could give me this, I was even told you could not order this combination!  That my kit didn't support it!  That the wires were wrong!!?!?!

When I pointed out that the wires and kit are theirs, sort it, they basically hung up on me.

Online in my account however, I could see an upgrade offer... For a free I could upgrade to some new cables.. DOCSIS or some such thing... So, I ordered that...

A week later, I checked again, the new offer was for a free upgrade from 50mbit to 70mbit.  Are you still with me here?... So I chose that.

A week yet further on and I had 70mbit, and the option to pay £1.50 more per month to upgrade to 100mbit!  So I ordered that.

And yet another week on, I finally have the option to order 200mbit for an additional £5.50 a month, with 6 months at £2.50...


I have this arriving, through the ether as we read this...

So why the delay?  Why did the humans say they could not leave my TV and landline alone to just uprade the speed?... Well, seems they could, they could all along, they were lying, or their training didn't expose them to the workings of their own systems.  Whichever it was, I was very very frustrated by the whole affair, and I've made it known.



Friday, 29 April 2016

21 Degrees: The Office Nirvana

There's drama in the office... And to be honest, I'm on the loosing end of it...

We've recently had lots of work done in our office, we've had new double glazed windows, which no longer allow fresh air, so then they added a new air system, which supposedly brings in ten cubic meters of fresh filtered outside air per person, but it's never on, you can really tell when it is, and it's great, but it's never on.  Then they added a very expensive set of air conditioners.

Now, I know, and you all probably know and office is not meant to be warm and cozy, if you want a place to sit and read or code which is very warm and comforting, try the local library; if it's not already shut through budget cuts.

No, your office is meant to be slightly cool to the feel, around 21 degree's I've always been lead to believe.  High ceilings are best, and if not, air condition to that temperature.

How do I know this?... Well, I used to be an office manager, and I managed the air conditioning, and I managed the people, all shapes, sizes, ages and sexes... The consensus was too warm and most people drop off late afternoon.

So, what's my problem here?  Well, I'm the latest arriving person on the flex, I always arrive around 9:30-10:00, which means I'm always the latest to leave, around 18:30-19:00.  The problem?  Everyone else in this area want the air conditioning warmer, the reason is they're all cold in the morning, they all wonder in around 7am, and disappear, leaving their phones ringing and desks empty around 15:30... This is a problem.

It's a dichotomy, because right now they're all moaning it's too cold, according to my desk thermometer (a hang over from being an office manager and worker for many years) says 21 (this is centigrade before anyone complains), and it's perfect.

The other folks around me are complaining they're cold, they're wearing jumpers, and cardigans and one chap has the biggest fleece on... They're all a lot older than me, yes at nearing forty I'm the young one, and I can't help but believe it's their age.

And, don't get me wrong, I understand they're cold, but they might need to get up and get moving, have a warm porridge breakfast, something, other than disturb the cool air situation.

Because when they've all gone home, and the sun is around this side of the building, through the un-opening double glazing, it's boiling at my desk, literally boiling.  And in this ridiculous circus I end up needing a desk fan on, because the temperature goes way up to 26+.

21 Degrees people, please, and you deal with it, I'm not the only one to know this.


Thursday, 28 April 2016

Updated Tutorial - Installing SVN (Subversion) on Ubuntu 14.04 Server

Back in May 2012 I posted a pretty complete tutorial on how to create a virtual VMware machine image for ubuntu, install apache2 and svn upon it, and configure it for access over your LAN.

Tonight, I've just migrated that very installation to a new Ubuntu Server 14.04 installation on a new XenServer.

And I noted I needed to add an extra line of configuration, therefore, I've added a little video note, which also shows the server working for me locally on my LAN:


The original tutorial can be found in it's full glory here: http://megalomaniacbore.blogspot.co.uk/2012/05/virtualizing-installing-and-using.html

Like, Subscribe, Tip if this helps!

Tuesday, 26 April 2016

GNU C/C++14 Installation & Codeblocks 16.01 from Source (Command Line)

In yesterdays post I explained a C++14 user was having instant issues with the vanilla install of gcc/g++ on Ubuntu 14.04 LTS.

Getting a C++14 Compiler
So, here today are my command-line steps to update the GNU Toolchain v5.x.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5

If you already have compiler alternatives you may need these lines.

sudo update-alternatives
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++

But, everyone will need to swap the default gcc and g++ command-lines to the new paths to make them the defaults.

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

These last two --config commands are only needed if you have multiple alterantives, so don't worry if it tells you it's failed as you only have the one.

Now, if you perform g++ --version, you should see it's a version 5.x series compiler.

Codeblocks 16.01
Older versions of Codeblocks may start to error on the code completion with some of the C++14 specific commands.  So, we need install some prerequisites, and then build the latest 16.01 version from source.

sudo apt-get instal gtk+-2.0 automake libtool libwxgtk2.8-dev libwxbase2.8-dev

wget http://sourceforge.net/projects/codeblocks/files/Sources/16.01/codeblocks_16.01.tar.gz

tar -xvf codeblocks_16.01.tar.gz

cd code*

The next step is interesting, we need to iteratively check:

./bootstrap

Running this will show you anything wrong with your machine environment, any missing dependences etc... However, once bootstrap runs cleanly, you can continue below.

./configure
make
sudo make install

The make step takes quite a time, the more cores & RAM you have the better, on an 4 core (8 thread) machine with 8 GB of ram, I've found it takes about 10 minutes.  On a single core machine as the poor VM I had was assigned, it took a lllooooottttt longer.

Once complete we needed to use the text editor of our choice, in sudo mode....

sudo nano /etc/ld.so.conf

And to this we need to add the line:

include /usr/local/lib

Save the file, exit the editor and run:

sudo ldconfig

Once this was complete, we can run up Codeblocks, and see it's version 16.01.



And we can further see the nice new C++14 options in the build options:



Even the code highlighting recognises the make_shared operation:



Voila, if this helped, do check out my other posts, and code, leave a tip with my new tip jar!  And I'll be making a video of this one soon, as it's so useful.

Monday, 25 April 2016

Embrace C++14 Please Mr Developer

Today I've had to spend sometime setting up a Xenserver, to host some virtual machines, the moment I was done, of course the first request I had was for a developer to have a Linux machine running a compiler.

I was quite excited, in a C# & embedded C strong company to hear "C++" as the reply to my query "what language are you going to use?"... However, my excitement quickly evaporated when I asked, "What version of C++ do you need?"... And he replied "There are different versions?"

After I had explained, yes, yes indeed there are... I took a look at his code for him, and pointed out naked pointers:

char *something = new char[28];
memset (something, 0, 28);
delete something;

I quickly explained, as kindly as I could, that this code is not only wrong, but very very old hat, and I introduced him to the standard library:

#include <string>

std::string something;
something.resize(28);
memset(&something[0], 0, something.size());

And his eyes opened a little... He asked what version of C++ is this in???... C++98... and his crest fell again, realising it was very old tech, which he had no idea about.

So I pointed him to C++14 and explained smart pointers as something for him to try out:

#include <memory>
#include <iostream>

namespace Xelous
{
class Test;
using TestPtr = std::shared_ptr<Test>;
class Test
{
public:
void Hello()
{
std::cout << "Hello";
}
};
}

int main (int p_argv, char** p_argc)
{
Xelous::TestPtr instance = std::make_shared<Test>();
instance->Hello();
std::cout << " World";
}

So, once this was done, I left him reading a copy a Tour of C++ by Bjarne, and told him to read all of Scott Meyers books.

This is a sad state of affairs for a programming & technology environment, especially when I know the chap earns more money than me, and as polite as I was I did want to just ask him to get his coat, and I'd slip into his salary grade & comfy company car (a perk I don't get).

Not least because I think the chap whom sent me off to speak to this fellow treats me a little more like a trained monkey, and they've themselves no idea about virtualisation, servers or development, beyond say using Turbo C++ from the command line in DOS 6.22... And unfortunately, things have moved on a lot since them...

Anyway, this leads me to tomorrows post, which I'm drafting, I set this C++ developer on the path to C++14, and installed him a Ubuntu 14.04 virtual machine on my little server... He was amazed, until he wondered over to me and pointed out that he had to manually add -std=c_++14 to the build options, and that sometimes the code-completion crapped out on him... Seems older Codeblocks instances fall on their face, and the default version of gcc/g++ on Ubuntu is 4.8.x and we need 5.x for C++14.  The next post will cover going through setting this up from the command-line.

Thursday, 21 April 2016

C++: Boost Libraries, Code Documentation & Examples

I have a loving relationship with the Boost C++ libraries, but I have a real hate of their documentation, not just it's style, but the mistakes and fragmentation they build into it.

When I search for say "socket", I want it to take me to boost::asio::tcp::ip::socket.  But instead it takes me on a run around, and when I finally get to boost::asio::tcp::ip::socket the examples and namespace being used is incomplete, it assumes a bunch of things, and you get told to look in tcp::ip::socket.

This is fine, if your reader knows to assume boost::asio as well, but if you're new to the whole boost project, you don't know sockets live in asio, you might be looking for boost::net, or boost::networking, or boost::network or just boost::tcp.  And you're stuck, lost, you have to leave the boost documentation search and go to google.

To fundamentally have to leave the documentation of an actual project website, and use a third party in this way is fundamentally telling you your documentation is flawed.

Then, there are mistakes in the documentation, this is annoying, but when the mistakes are in the examples given it's unforgivable, you're basically giving your users the finger, because not only are you teasing them with an example, but when it doesn't work they are again cast out into the wilds of the internet.

Case in point, again the socket, it's example code shows it as "soocket".  A typo yes, but it tells me two things, first of all, the code was not proof read, and second; and perhaps most importantly; the examples are not from working code, they've never been run, because it's not soocket, and the compiler would instantly tell anyone trying to run that code soocket is invalid.  Examples SHOULD ALWAYS BE LIFTED FROM A WORKING EXAMPLE!

Wednesday, 20 April 2016

C++11 Examples: Random Unsigned Integer Sequence

This is just a quick note, of using the C++11 random functions, to generate a positive list of random integers.

#include <iostream>
#include <string>
#include <random>
#include <cmath>

int main()
{
    // Seed with a real random value, if available
    std::random_device r;

    // Choose a random mean between 1 and 6
    std::default_random_engine e1(r());
    std::uniform_int_distribution<int> uniform_dist(1, 6);
    int mean = uniform_dist(e1);
    std::cout << "Randomly-chosen mean: " << mean << '\n';

    // Generate a normal distribution around that mean
    std::seed_seq seed2{r(), r(), r(), r(), r(), r(), r(), r()};
    std::mt19937 e2(seed2);
    std::normal_distribution<> normal_dist(20, 1000);
     

    // Loop edited by Xelous
    for (int n = 0; n < 10000; ++n)
    {
        unsigned int l_x = std::abs(normal_dist(e2));       
        std::cout << l_x << std::endl;
    }   
}


If you alter the uniform_dist spread to a higher yield, e.g. 1, 1000.  Then you increase the randomness of the mean used to generate the sequential seed.

This is taken straight from: http://en.cppreference.com/w/cpp/numeric/random

But, has been run on Coliru.