Cheers to WordPress

I have probably said it before but will say again … WordPress is great. I spend most of my day writing and reviewing code at work and is nice to be able to write in words for a change. 

Word press is built with PHP – I know PHP has it's critics and sure there is a lot of hacked together PHP scripts out there but I am sure there are is a lot of good code also. WordPress is it's real success story (sorry not a facebooker) in my opinion.

In the past I have dug into the code base and found it a little hairy (used to OOP) – this was years ago though. I don't know what it looks like now, and whatever about the code base the ui seems to be orgainzed very well.

WordPress is just so flexible and straight forward and is great fun. Not sure about using it for businesses to be honest – have been there before and I think eventually you out grow it. Small businesses should be fine!

The Art of a good PR

This article is quite old now but feels like there is some good advice in here:
https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/

In my experience, pull requests can serve multiple purposes. The principal use is a peer review before merge but I think you can use them as points of conversation or discussion also and I don't think this is done often enough.

Also I think it is really important to convey respect and be nice. 

C# and NodeJs – a brief comparison

In the past these two had very little in common, however I thought I’d briefly compare as they are increasingly used together and becoming quite similar in places.

JavaScript is said to be a functional programming language with object oriented aspects and c# is the reverse really.

C# is compiled – modern JavaScript is compiled in a sense but not to the same degree.

C# was designed and implementation in a thoughtful and considered way – it is said JavaScript was built in 10 days (which is actually impressive if true). This is clear throughout the structure of the languages. Although JavaScript is very fluid – it has a lot of curious behaviours – equality statements as an example.

One of the biggest differences in the two is that c# relies on threading to support concurrency whereas node js does not, although threads are used under the hood.

They are quite different but increasingly more a like. Async await was first in C# but now also JavaScript. 

Classes are now also supported in JavaScript but not interfaces. Typescript is an option for those who want to go further in this direction.

C# has also adopted implicit typing with the use of “var”. And JavaScript as evolved by adding const and let. In C# you would add modifiers to make a variable a constant.

One of the biggest challenges I encountered recently was with array / collection mapping and filtering. Linq is the way to do it in C# whereas js gives you a few different options – lodash is what is used in my place of work. They are similar but a little different. I won’t go into detail here.

There are many more similarities and differences these are but a few….

 

Node Js

 

a departure from what is normal, usual, or expected, typically an unwelcome one

Aberration 

This is not meant be an insult or even a critism but more just a statement of how it probably is. It’s also not necessarily a bad thing although the use of the word aberration usually is as the the second part of the citation above states.

Node started off as a neat attempt at solving concurrency problems. Mainly, I think, due to the popularity of JavaScript and ease of adoption, it has snow-balled and in London at least, it seems node skills are very much in demand.

Ryan Dahl himself has said that he left Node behind as he felt that golang provided a better solution the issue of concurreny: https://medium.com/@imior/10-things-i-regret-about-node-js-ryan-dahl-2ba71ff6b4dc

Perhaps if he stayed in charge of the languages development things would be different but I'm not sure if that would be for better or worse. From what I understand Ryan was for callbacks and against promises. I think he has since changed his stance but from what I read, there are still a minority of node developers who believe node should be callbacks alone and if you organize your code correctly callbacks are easy to read – perhaps they are right.

Both callbacks and promises seem very unintuitive to those not used to them and fit with the term abberation in that you need to think differently to the previously traditional ways of doing things. I have been happy to adopt async await as I am pretty comfortable with that from C# at this stage.

It is probably fair to say that Node and JavaScript don't represent the safest way of programming though. Dependencies seem chaotic at times. Package lock was introduced to make things better but is it's own special brand of chaos. Many of the packages up there seem to be well intentioned but maybe lacking in let's say 'polish'.

I think Node has helped a lot of people to get started with programming as it is so easy to get going. Issues are being ironed out as I speak.

JavaScript is the language of the browser so designers and people with a little coding experience are able to get more easily involved. In many cases the role of designer and developer have probably merged and I think JavaScript is partially responsible for this fushion of skills, although languages like PHP existed before and arguably have the same properties in terms of ease of use and learnability.

This is good and bad. There is more code but the code is not always better, and the problems tend to come further down the road. The point is though, Node and JavaScript have influenced the industry a lot. As well as getting more people involved, it has probably influenced the way other languages have developed, see C# and NodeJs – a brief comparison.

I’ve been programming with Node for 5 or 6 years (on and off) now and Javascript longer and I appreciate some of its advantages but I also see and understand a lot of the issues it creates.

 

 

Google have their hands in everything

Google started with search and then came maps and browser, they bought YouTube for video. They eventually built Android to extend their reach further. Next is Google glass and Google drive. Google do web analytics and have their own programming languages. I have forgotten Gmail, Chat and Google Calenders. Google are every where.

One of the reasons why they have gone so far is that they build great technology. As influential as Apple and Microsoft have been I think people depend more on Google than any other technology company. I have a Google account to which my emails, Calender and maps are tied. I also have a you-tube account among other things.

Despite my best efforts there is probably not much Google does not know about me. It would be scary if I thought about it too much, so I don’t!
I am prepared to trust them but Google have to remember (as Peters uncle says in spider-man), with great power comes great responsibility. Chrome is probably not as far ahead as it was in the browser wars but is still probably the best browser out there, YouTube owns the personal video space, Gmail is still a great free email client even if I think Outlook has caught up and Calender works quite well also. Google maps seems to be streets ahead of the competition and Android is way a head in mobile phone wars.

Google’s real strength is the way their software fits together though. They are essentially building artificial intelligence systems to solve the worlds problems. These problems are in different spaces but they are meshing them together. The results it has to be said are fairly impressive and again could be a little scary if you thought too much about them.

Search allows us to quickly scan information and choose what we want. Chrome was built to extend Google searching to other parts of the web. Google maps probably leverages much of the tools used to build search but goes further and solves a slightly different problem in that it maps the world instead of just information but you can still search it. They have also added speech recognition which extends their search abilities further. I can use my Google Nexus phone as a sat-nav – but with speech as input. To get to Seven Oaks today – I just need to tap the microphone symbol and say I want to get to Seven Oaks. It brought up the directions. I pressed start and I was on my way. It’s directions were much better than the dedicated sat-nav I used to use previously.

The next step is Google drive which will be driver-less cars. I’m sure this leverages much of the the tech and experience gained from building Goggle maps and perhaps other technologies. It is all really good software, valuable, useful and interesting but I think we just need to make sure that we don’t become to dependent on Google and can easily decouple our lives form them if the time comes otherwise we will end with Google Corp running for elections and ruling our worlds in a much more explicate manner than they already are.

So I hope Google remembers with great power comes great responsibility.

 

 

 

 

 

 

 

WordPress MU – is it worth doing?

I think it depends really on the amount of sites you have and also what and how much they share.

WordPress MU is great in that it allows you to manage a lot of commonalities between your WordPress sites in one place. I have created WordPress sites in the past that have all been hosted on the same server and share a lot of the same things. If your sites have a lot of the same users, plugins and share themes then you should definitely consider installing MU.

Once you have installed MU and you have multiple sites setup you can setup users at at the top level(network) and then assign access to individual sites from there. This saves you having to create different users with new passwords each time – its easier for the user and for the administrator of the sites. In MU you also install plugins at the network level and then you can activate the plugins across the different sites. It means you only need to install the plugin once and and is easier to keep track of what plugin is installed and versioning etc. You might also want to share the same theme which again means you only need to install the theme once.

An important thing to note about WordPress MU is that all sites will be sharing the same database. This can be a good thing and a bad thing at once. It means you only need to create and manage one database but it also means that if that one database gets corrupted that you are in trouble and you will need to fix multiple sites rather than 1. It’s not as much an issue if you have a replicated database to fall back on. It might in fact make things easier for you to manage in that you don’t have to create multiple databases and assign users and permissions etc.

Likewise, since there is only one version of WordPress, you only need to update wordpress once when the latest versions come out. If the update goes wrong it can affect multiple sites instead of just one so these are risks you will have to either decide take or leave. I’ve worked in environments where you have load balanced servers and a deploy involves taking one server offline to receive the new code, you can then test away to hearts content but maybe you cant afford the time and admin in that if its just for personal or friends or small businesses.

So you do need to think about it a bit or maybe experiment with it for a while if you need. It makes admin and maintenance easier but there is a bit of extra work involved in terms of setting up and organizing initially. This site is hosted in the same space as 4 other sites and counting. Its not wordpress MU, partially because I haven’t gotten around to moving it and partially because I make a lot of changes on the fly and since I don’t have any real deployment process, backup or load balancing I really don’t want to bring down 5 sites with an update, one would be bad enough. Living on the edge!

Problems with permalinks in WordPress on Ubuntu

I’ve had problems with permalinks in the past on Ubuntu and always forget one thing or other so here is a set of instructions on setting up those pesky permalinks. This is what I have done in past but if you can think of anything else, please let me know.

1. Create a new “.htaccess” file in your root WordPress directory.

2. Enabling mod_write in the Apache2 server. Type:
sudo a2enmod rewrite

3. Open a terminal and type:
sudo chown -v :www-data “//.htaccess”

4. Also give write access to the file:
sudo chmod -v 664 “//.htaccess”

5. Restart the Apache:
sudo /etc/init.d/apache2 restart
We are all done with the command line prompt; you can close the command line window now.

5. Go into your WordPress admin screen. Click on settings, then on permalinks and select whichever permalink layout you wish. Hit Save button.

WAMP Localhost not working

If you’ve installed WAMP and are getting a blank page when you try to browse to a page on a localhost….

Ask yourself one question….have you skype running? Skype uses port 80 to connect to the internet which your apache server also requires. So just turn skype of, retart wamp server and you should be good to go.