Moving pavements

I had to travel to Manchester a couple of days ago to meet a potential client.

I decided to get the train into Manchester because driving in the city center would have been a nightmare and who knows what the parking is like? equally as terrible no doubt.

I looked up the train journey from my location on Google, it states I need to catch multiple trains and the journey would be 2 hours 30 minutes.

When I actually booked the ticket though it turned out that there was a direct train and the journey takes 1 hour 30 minutes so I am not sure what happened there, maybe Google has not updated the journey for that particular route yet.

Anyways when I arrived at Manchester Piccadilly I came across “moving pavements” …

moving-pavement

The photo above may or may not be Manchester Piccadilly but it shows what “moving pavements” are anyway. Essentially they are like elevators but instead of folding out into stairs they remain flat.

They can either be kept at a straight angle or they can move upwards but they move upwards like a ramp rather than stairs. Anyways I have never seen this before and thought I would share it.

Apparently they are common place at airports but it is not very often I go to the airport. It essentially means people no longer have to walk but can be moved about on the “moving pavements”.

I guess it will come in handy for people with walking difficulties or lots of luggage.

Yii loadModel method?

So it was not long into my Yii development days that I began to notice this awful method that seemed to crop up more and more in other Yii developers code bases.

This is the so called “loadModel” method and it looks something like this …

The idea behind this method is that it is called from other methods in the same controller as itself to return a loaded model for use in the method. I do not understand the point of this method and I never have. I have never used it in any of my Yii 1 or Yii 2 code even though a lot of developers did.

Why is a method needed for loading models?

Please note that this method is only for loading existing models and not creating new ones so the intent behind the method could not have been “It is an easy location to change the model name if I need to so as I do not have to change it in multiple places if ever I need to change it”.

If this had of been the intent then the method would have been written like this …

As I will still need to declare the model separately when creating new models in the controller as the original method did not handle the creation of a new model.

Also a lot of the developers using the “loadModel” method are using different models in their controller anyway which are different from the model loaded in the “loadModel” method, so again the benefits of having the “loadModel” method seem non-existent.

Another so called benefit which could be tried to passed off as genuine is the use of the exception. If the model is not loaded then throw an exception saying the page does not exist.

The test to see whether a user can access the page and the test to see if the record for the model exists based on its ID is normally and best handled in the user permissions / RBAC so it is not needed in the controller.

My conclusion to this is that there is no benefit to using the “loadModel” method and it is more of a gimmick which developers have copied from other developers without thinking about it.

ODesk Readiness Test, I passed!

I took the ODesk readiness test today and I passed. I do not use ODesk to get work but I was just curious as to what work was available so I decided to take the test.

odesk-test

I passed the test perfectly first time in 3 minutes and came 2nd out of 5157998 test candidates. I was so happy with the result that I had to share it.

PHP exceptions, try, catch not working

I was porting over some code a few days ago from a standard standalone PHP script I had written some time ago. I was wanting to use the code inside a larger new web application I was building for personal use.

I was absolutely certain I had copied all of the code line by line into the new program and refactoring it as I went along making sure I did not do anything to break anything.

Everything seemed perfect until I came to run the code and was left baffled by “Uncaught exception” PHP error messages. These error messages did not occur all of the time but only some of the time which made debugging worse.

However due to the nature of the functionality of the code was to be expected as their were aspects of the code that were dependent on an outside source and could be variable.

So I looked through my code and all of the try / catch statements were there and the exceptions as far as the code was concerned should have been handled correctly. I had reached a block that I could not get past, at least for a couple of hours.

After doing some research on Google the answer came to me. I had written my try / catch statements as follows …

The problem was due to name-spacing of the application I was porting the code into. The old standalone PHP script did not use any name-spacing so this was never a problem. The new PHP application did use name-spacing so the try / catch code needed to be written like so …

Notice the “\” symbol. That would be telling the Exception to escape to the global space. After adding these corrections to the code it worked perfectly.

TTS Engine turn off page listen

Recently I installed a WordPress plugin called TTS Engine. TTS Engine allows readers / users of the website to listen to the content of posts and pages. This is all good but some website owners may not want the user to be able to listen to pages but only posts.

I personally thought the “listen button” looked silly on the pages and I only wanted it to appear on the blog posts.

At the time of me writing this there is no setting in TTS Engine to turn off the listen for pages and have it only display on posts. To solve this problem I set about customizing the TTS Engine code to not show the listen button on pages.

To accomplish this I added the following code …

Right above the following code comment …

In the “tts-engine-post-to-speech/tts-engine.php” file. To access the file click Plugins -> Editor in the WordPress admin menu.

Thought I would share this with the world in case anybody else wanted to turn off page listening after installing the TTS Engine plugin.

Update: I no longer use this plugin on my website but the code presented in this article will still work if you decide to install the plugin.

Front-end vs back-end development

Is there such a thing as front-end vs back-end development in today’s web development world? How much do these cross over and even into other roles entirely? What is front-end developer or a back-end developer expected to know or do?

Well there is no easy answer to all of these questions, with today’s expectations both front-end and back-end developers have a lot expected of them. In very basic terms we could say the roles are briefly defined as follows …

Front-end developer

Expected to know HTML, CSS and be good at graphic design.

Back-end developer

Expected to know how to create databases and PHP.

Ok so that is defined very basically, now I will take into consideration all of the criteria not mentioned for each of these roles below …

Front-end developer

Based on the above we could also add the following as potential criteria to the Front-end developer role …

  1. Expected to know CMS systems such as WordPress.
  2. Expected to know front-end frameworks such as Twitter Bootstrap for example.
  3. Expected to know Javascript.
  4. Expected to know any number of Javscript frameworks such as JQuery, KnockoutJS etc.
  5. Expected to know any number of CSS frameworks that are available such as Less, SASS etc.
  6. As mentioned earlier, expected to know graphic design even though graphic design is a completely different discipline altogether.
  7. Expected to know server side templating languages, for example Smarty.
  8. May be expected to know a bit about server side languages so they can incorporate the HTML templates into the web app.
  9. Expected to know about SEO so the website can be coded to accommodate the SEO.

Back-end developer

Based on the above we could also add the following as potential criteria to the Back-end developer role, the first 6 bullet points are the same as the front-end developer role but are still valid, this is the cross over between roles I was talking about and how it blurs the lines between front-end and back-end development …

  1. Expected to know CMS systems such as WordPress.
  2. Expected to know front-end frameworks such as Twitter Bootstrap for example.
  3. Expected to know Javascript.
  4. Expected to know any number of Javscript frameworks such as JQuery, KnockoutJS etc.
  5. Expected to know any number of CSS frameworks that are available such as Less, SASS etc.
  6. Expected to know server side templating languages, for example Smarty.
  7. Expected to know HTML and CSS.
  8. Expected to know any number of backend frameworks, for PHP this would be frameworks like Laravel, Yii etc.
  9. Expected to know any number of database environments and their associated query languages for example MySQL / SQL, MongoDB / BSON etc.
  10. Expected to know any number of code libraries.
  11. Expected to know how to use version control systems such as Git, BitBucket etc.
  12. Expected to know any number of backend languages including all their frameworks and libraries. For example back-end developer could know C# but also PHP.
  13. Expected to know how to create and manage web servers.

So there is probably a lot more that I have not thought about or mentioned but that just about sums it up for now. You can see there is a big cross over between the skills especially in the area of Javascript. Javascript as a language is nothing like coding HTML but Front-end developers can still be expected to know Javascript.

Back-end developers can still be expected to use HTML even though they are Back-end developers. You also have to appreciate that most of these skills are multi-disciplinary and each skill in its own right could take a vast amount of hours to learn and maintain properly.

For example Javascript developer should be a role in its own right. Graphic designer should be a role in its own right. Web server administrator should be a role in its own right. Learning a single web framework like Laravel should be a role in its own right. Not one developer learning multiple frameworks.

The way the skills are listed above in the bullet points make them sound easy and degrades the time and effort it takes to learn the skills properly. However employers list the skills in the same manner as above in job descriptions they send out to potential candidates.

No one could learn all of those skills and be proficient in all of them. The time it takes to maintain such skills would be too much for one person to accomplish if taken to the degree of mastery.

Maybe some employers know this and do not expect the developer to be a master at all of them. Maybe some employers just copy other employers job descriptions without knowing that the other employer did not expect the developer to be a master at all of them.

Any employers listing too many skills that a developer should be a master at should be looked upon as not being very grounded in reality and taken with a pinch of salt. It is not just the time to learn the skill but to maintain them as well.

These technologies are constantly evolving and there is a lot of maintenance time involved as well. To be a master the skill has to be maintained and as mentioned earlier there is no way in reality that one person could be a master at all of them.

Will HTML be the new assembler?

So I was thinking a while back about skill sets and pay rates for specific skill sets. For example if you can program in Assembler today and a company has a need for a Assembler programmer you can charge big money because there are few Assembler programmers compared to other programmers today.

HTML, CSS, PHP programming languages pay less or rather sometimes pay less because there are a lot of programmers in today’s world concentrating on those languages.

This got me thinking, in the early days of computing there would have been less languages to choose from so there would have been a larger percentage of Assembler programmers around years ago compared to other languages.

However due to the early years of computing being a specific niche anyway there might have been less programmers overall therefore the Assembler programmers got paid big money anyway.

But lets look at it like this, below is diagram of computer languages and the hierarchy of languages which those languages are built on top of …

mockup1

As more programmers start using the languages that are built on top of existing languages less programmers will be an expert in the bottom tier languages.

In today’s world now that we have languages such as PHP, programmers do not need to learn Assembler, programmers do not need to learn C or Java etc. Now that we have frameworks such as JQuery programmers do not even need to learn Javascript.

Now let us pretend we are in the future, 20 years from now. New frameworks have been built on top of HTML. Modern programmers are geared towards learning those new frameworks and they do not need to learn HTML.

HTML programmers have become a rarity and companies needing to fix problems at a lower level such as HTML will need to seek out the specialist HTML programmers.

So basically HTML has now become the new Assembler. With the following aspects …

  1. HTML has become a low tier level language.
  2. HTML has become a rare specialist language, not many programmers will know how to program HTML.
  3. Companies will pay big money for people with skills in HTML.

So that is my view of what might happen in future with the languages we have today like HTML. If you remember how to program in those languages long enough one day they could become a highly paid programmer for those rare specialist languages.

Who would think that in 20 years from now, you could be getting paid £1000 per day for programming HTML?

I use Balsamiq Mockups

Balsamiq Mockups is a software program to enable people to mock-up user interface designs. The program is simple to use and all a user has to do is drag and drop generic components onto the white screen area and build the user interface from these generic components.

https://balsamiq.com

There are plenty of components to choose from ranging from forms, datagrids, tables, tabs to navigation bars for designing web based software interfaces the program is perfect.

For doing mockups of websites it is also useful as well but obviously cannot cover in depth “design” in terms of fancy graphics as to mockup fancy graphics the graphic designer would have to do the work of drawing the fancy graphics themselves which is essentially doing the work and is not really a mockup.

For a website you can say this is the header, these are some links, here is a navigation bar to the left etc. It is a mock-up.

Balsamiq Mockups will be used by me in the Roadmap and GUI Design stages. I can now easily mock-up the user interface of the web based software system at the initial stages. Giving the client an idea of what the software will look like and how it will function.

This is also useful for early recognition of problems and getting it right the first time without having to change GUI elements around later when that could prove more costly.

New treadmill on its way!

In the web development industry or rather office industry in general it is easy to pile on the pounds as sitting at a desk all day is generally not very good in terms of psychical activity.

Around 8 years ago I was overweight, I brought a cheap treadmill and within a year I got down to a normal weight. Around 2 years after this I had put all my weight back on plus more.

I used the cheap treadmill again for around a month then it broke. I got another cheap treadmill but it was not powerful enough to support my weight, unlike the first cheap treadmill I brought this one just did not seem as powerful.

treadmill

So basically I gave up for a number of years remaining overweight. Then I decided to join the leisure center and I did some swimming, this is when I found that doing swimming will take twice as long to lose weight even though swimming was more pleasurable then other forms of exercise.

So then I joined the leisure centers gym. Now the gym is not too bad, however it is noisy with the music blurring out of the speakers and the gym instructors instructing people with the “pump! pump! pump!” mentality.

Not to mention the extended time it takes to exercise because of the journey there and back. So in the end I have brought a brand new reasonably expensive treadmill. This treadmill has none of the problems of the cheap treadmill and I can tell just by walking on it that the motor is much more powerful.

I purchased the treadmill from www.fitnessoptions.co.uk and whilst there I noticed some of the other treadmills they where selling and one which particularly stood out was the Lifespan Treadmill Desk.

For those of you who do not know a treadmill desk is part desk and part treadmill with the idea being that you can keep fit whilst doing work at the same time. I love the idea however the treadmill desk only goes up to 4mph.

This is the same on all makes of treadmill desk, it appears it has become the standard. I imagine this being a problem if I use the treadmill desk and reach some sort of plateau with my weight loss.

Not being able to increase the intensity of the workout may mean I will not get past the plateau however I do not know this for definite, maybe a plateau is never reached at all and just the continued walking on the treadmill desk will bring me down to the correct weight anyway. I did not want to take this chance though so I just brought a normal treadmill. If I want a desk I could make one somehow anyway and just use my normal treadmill as a treadmill desk.

I envisage me doing my normal office routines whilst at the office and when I get home I will do a nightly session on my treadmill whilst using a makeshift desk to do my work on whilst using the treadmill. Do that for 3 hours a night and the weight should drop right off.

Is PhoneGap worth it?

Here are some my thoughts about PhoneGap when I used it to develop a client / server phone application to display store offer listings both in text views and on a map.

These thoughts only apply to when I was using PhoneGap a number of months ago, maybe some of these thoughts are not relevant as PhoneGap stands today. I have not used PhoneGap again since this time because I have not needed to develop a phone software application.

Ok so my thought about PhoneGap is that the documentation is not so good. Although it appears to look good there where a lot of times I followed the documentation and it did not work, alternatively it just was not documented.

If the documentation did not work I generally looked around the web but who knows which version of PhoneGap the web tutorials / Q&A was meant for.

Many times I tried what was written on the web and it did not work, alternatively sometimes it did work but only after I read another piece of documentation that told me how to set it up correctly to get it to work but this was not mentioned in the initial piece of documentation I was reading.

LocalStorage options are not so good. Depending on the type of project clients are going to need quite a lot of local storage. Web SQL was an option but apparently it has been or is being deprecated.

IndexedDB was another option but this is only supported on a small number of platforms like Windows and Blackberry.

It is not supported by PhoneGap on IOS or Android. LocalStorage was the only other option that PhoneGap provides and this is the option I went with. However LocalStorage is limited to 5MB of data and only stores data in key / value pairs.

Plugin support is reasonable but depending on the number of devices the phone application has to run on it can be limited. You may find find a plugin that works on IOS but not Android or a plugin that works on Android and not IOS but not both.

No support for native GUI components. This means PhoneGap applications can look like web pages unless serious efforts are made to make them look more like a native PhoneGap. Not a big issue, just depends how native you want the application to look and I guess a lot of customers will want the native look and feel and with all the fancy fold out menus and special effects this could take a quite a bit of work to do.

Maybe there is a library out there that helps with this, I do not know? However I doubt the library will ever give quite the same feel as building the phone application using traditional native programming languages and tools.

The resolution for the PhoneGap application was not very good. For IOS the application was running at 480px by 320px and this is not a matter of simple configuring some setting in the config file.

At the time I was using PhoneGap this was the resolution that PhoneGap supported even though IOS supported a much greater resolution at that time. IPhone 5 1136 x 640 and IPhone 5s 1920×1080.

So these are my thoughts on PhoneGap. It is suited to some types of phone applications and I would use it again if the need called for it and the scope of the project was not too complex but for the really hardcore type phone applications I would stick to using the native programming languages and tools.