Getting past firewall (legally!)

Preamble
How to get your site categorized so can be viewed behind corporate firewalls.

Actions taken
Initially at work I could see an old version of my website and my pictures at work, but then they tighten up the firewall and all of a sudden I could not access my website as it was defined at “uncategorised”. I found that by registering my website for categorisation it was once again allowed through the firewall.

Need to register site via:
http://sitereview.bluecoat.com/sitereview.jsp

Conclusion
site now registered.

Wholesome C++11

Preamble

What is good about the C++11.

Comments

I have been using predominately C++11 for quite a while in a commercial setting.
I’ll use
https://blog.smartbear.com/c-plus-plus/the-biggest-changes-in-c11-and-why-you-should-care/
as a starting point to remind me of some of the key features.

auto
This is great, but requires a change of mindset in how you do things. Gone are
FruitT f = …
in is
auto fruit = …
which make it more readable.
Auto I think is the best thing introduced as it does improve readability and allows less experienced C++ guys to get to grips with the language without worrying too much about the detail, however still providing compiler level type checking. Definitely a win for me.

nullptr
Well it’s about time! least said.

lambdas
Definitely better than bind, and can replace bind completely. No more writing tedious functor objects.
Downside is specification didn’t got far enough and allow templated lambdas. And the syntax isn’t nice. It is clean and terse, but quite hard to remember as most of the time you are writing procedural code.

Uniform initialisation
I have tried to use it and mostly its OK, but still not comfortable with it in all scenarios. Generally speaking its the way to go, but using it everywhere doesn’t always cut it.

Deleted and default functions
Definite winner.

Rvalue references/std::move
A winner, but with caveats.  Its all about speeding up the compiled code. It does allow nice things like returning big objects via value rather than have to return them as modified parameters.

auto_ptr, new pointer classes
Death of it is great! And new pointer classes are definitely a win win.

What C++11 cannot give us
The main issue I have with C++ usage isn’t the language itself. It is how its used. Code needs to be easily testable via unit tests. Code structure isn’t mandated by the standard. However later versions add extensions for contract based programming. But even then I feel that trying to keep all bits of code independently testable is the best way forward.

Conclusion

C++11 is a winner, but the standard may not save you if you don’t code nice.

Future of C++

Preamble
Has C++ lost its way?

Discussion
Back when I started programming there was C, and the new kid on the block C++. I got my first job at PSION. C++ was the only effective way to organise your code with classes. There were other languages, but none that could leverage the power of C. The dominant language.
C++ was good at OO, and building structures that were effective was great.
Then Java came on the scene. Only slightly slower than C++ and gaining speed all the time. Also crucially run anywhere. Java and C++ fought it out for the middle ground held by Cobol previously. C++ had some advantages, but Java had many too. As speed was not as critical for business logic C++ lost this ground. Now turn year 2000, it was difficult time and the requirements for C++ programmers declined.
C++ territory was now limited to a fight off with C. As computer architectures changed the relative cost of virtual function calls has become more important. So verbose classes with multiple virtual functions have become more of an overhead.
Templates came on the scheme and the generation of the standard template library benefited both C++ and C.
Template usage in C++ can however push a lot of the run time cost to compile time. As things evolved boost::MPL became a useful structure to organise templates. Andrei Alexandrescu with modern C++ design. showed what can be done. But it is hard!
My feelings is C++ is currently waiting for Concepts to get into the language in some form. This will simplify a lot of code. And modules will increase the speed of compilation.
However we are currently stuck with extremely long compile times and unreadable code. Boost Hana and Brigand, to mention a few,  seem to be doing something to change this but I feel we are still waiting for the next paradigm shift. Roll on the next few years!

Conclusion
C++ is waiting for the next paradigm shift and if it doesn’t happen other languages will take over.

Piwik2

Preamble
Piwik was working on local network but not externally. Now fixed.

Actions taken
Piwik recommends tracking code with ‘//mynasbox/piwki/’. This seems correct, but I did realise I had to change ‘mynasbox’ with my url. So went with ‘//www.brombo.co.uk/piwik/’. This however didn’t generate any hits. I then realised that www.brombo.co.uk maps to the ‘/web/wordpress/’ directory via webhost  and piwik is in ‘/web/piwik’, so url is wrong.

Why it works internally is my internal DNS fakes a different ip than my domain name registrar.

My initial thoughts was to add another CNAME piwik.brombo.co.uk mapping via webhost to ‘/web/piwik’, however safari likes to put www. infront of my new CNAME so then webhost doesn’t match. I decided this probably wasn’t the best solution.

The fix I eventually used was to put a synmbolic link ‘/web/wordpress/piwik/’ that maps to ‘/web/piwik/’. This seems to work.

Conclusion
Sadly, test and test again. Finally sometimes the simplest solution works!

You are being tracked!

Preamble
Nothing bad just web analytics

Actions taken
Running a blog it is a good idea to see if anyone is actually reading it.
I decided to add some web analytics. On the DS213j there are 3 possible options, if you don’t want to roll your own.

google analytics

Google analytics is probably the easiest to get going and reading the web provides a good interface, but I would rather not add my ecosystem directly into googles arms and would like to support open source projects.

webalizer

This was my preferred choice as it gives good visualisation and pages respond quickly. It works by scraping the web server logs. However since DS213j started supporting different back end web engines it seems to only report the general one. My website is using apache on a separate a separate apache backend web server (on the same box). Thus I can see no usage statistics for this website. I believe it probably is easily configurable but I do not wish to spend the time on this just yet.

Piwik

This appears to be the major player in web statistics and definitely has more penetration than webalizer. It does however work by adding an extra piece of php code to the footer of each webpage to report back that the webpage has been loaded. I feel this is quite intrusive but does appear to be how a lot of the web works. So I have gone with piwit. I will report back later how it is going.

Conclusion

piwik seems to be best choice for web analytics if you don’t want to use googles.

 

 

HTTPS

Preamble
The web is turning https.

Actions taken

The web is gradually turning to using https rather than http. Chrome eventually will only support https. https on chrome I am not taking a political side on this here, just stating what is happening.

I made my DS213j serve up https rather than http if possible, as this seems to be future. However when I check my website it was marked as insecure. Digging about it turns out that the https needs signing with a valid certificate rather than using synology’s default one.

The problem is solved by installing a certificate from lets encrypt. This is a non-profit organisation aiming to forward https across the web. The synology app apparently reinstalls a new one every 3 months before it expires.

Conclusion
Use lets encrypt for free web certificates.

WordPress

Preamble:

Improve my web page

Actions taken

I have been running this webpage for many years. Even before the wayback machine existed. The most recent incarnation was static html, Mainly as I wanted to serve data quickly over slow dialup connections.

Recently decided to upgrade. The choices that can easily be installed via packages to my NAS appear to be.

  1. wordpress – easy
  2. Joomla – medium
  3. Drupa – hard

I chose wordpress as it is definitely easy to get along with and seems to work well.

All installations appear to be LAMP stack type installations. I have previously played with DJANGO but these seem to be a lot more user friendly as now there exists a gui rather than having to write your own php.

The installation installs MariaDB as well. To manage the database I have found phpmyadmin very good. However I needed to be careful as clicking install through blindly sets the database without a default root password. phpmyadmin I am bit worried would serve this up to the internet. So I’ve change my database root password and disable phpmyadmin until I sort out the permissions correctly.

In order to still serve up static html most of the time I have installed the fastest cache plugin.

My only lingering doubt remaining is that wordpress may not be the securest software, and expose more attack vectors to hackers.

Conclusion
Wordpress serves my need at present.