Canada toor 2014 – Post 1. Delays.

I’m here in Canada with Comhaltas for a tour around a number of cities for the next two weeks. I’ll try to write a few blog posts as we get around with the aim of capturing some of what is happening.

Let me give you some background. I’m here with a group of 15 artists comprising 8 musicians and four dancers. We come from all parts of Ireland and the first time most of us met was during the first practise. In fact, I wasn’t at the first practise as I was out of the country at the time so I didn’t meet the others on the tour until July.

There have been three rehearsals. One in June, The next in July and the final one in October during the weekend before we left Dublin. Each rehearsal lasted an entire weekend. As there have only been three rehearsals, they have been very long and very intense. Each time, we stayed in the Cultúrlann. This is essentially the head office or the base of operations for Comhaltas Ceoltóirí Éireann. If you don’t know what Comhaltas is, I suggest you google them. However, to summarise, they are a voluntary group with the goal of promoting Irish culture. This includes but is not limited to Irish music and the Irish language. Staying in the Cultúrlann was itself an experience. It’s an old Georgian building that has been extensively modified to fit the purposes of Comhaltas. Inside, there are various teaching and practise rooms, an auditorium and even a public bar that hosts sessions at any time of the day. In case you start to equate Irish music with the selling of alcohol, nothing could be further from the truth. In act, most sessions were held around the open fire outside the bar area. Children, young adults and older more experienced musicians all had a place and the standard of music was brilliant. If you are around Dunlaoghaire or Munks town I suggest you go in for a few tunes. Sorry. I’ve ventured away from the point. The rehearsals were intensive and very hard work but because of the very friendly and helpful staff, the environment was relaxed and homely. I was dreading spending a weekend away from home. Not because I didn’t want to leave home but mainly because I didn’t want to have to work all weekend after working all week. Fortunately, each rehearsal was a pleasure even though they were very challenging and a lot of hard work. During the second rehearsal but actually my first, we recorded a CD for the tour. This was a huge challenge for me because three hours after practising with the group for the first time, I was thrown into a recording studio with the expectation that I would sit in with the group and put down the tracks there and then. They were very intricate arrangements with precision a high priority so I had a lot to learn and very little time to learn it in. It’s not something I’d like to do again but I’m happy with the result.

The second rehearsal for me but the third for the group took place just before we left for Canada. Saturday for example, we practised for a total of 14 hours with a two hour break. By the end of it we we’re all physically and mentally exhausted. On Sunday, it wasn’t much better, we were up at 8:30AM, had breakfast at 9:00PM, met at 10:00AM, practised until 12:30PM, had a briefing until 2:30PM and then practised again until 5:30PM. Fortunately we had a break until 7:30PM when we attended a reception for VIP guests before we performed at 8:30PM with a break until 11PM. Of course, after performing, we said good bye to our family and friends and then sat down to have a bit of a chat with people from the group. However, we left the Cultúrlann at 3:30 to go to the airport. So, Sunday was never ending.

We got to the airport and checked in without any major issue. However, this is where things got really interesting. We were scheduled to depart at 7:40AM on Monday morning on a flight to London Heathrow. However, due to a reasonably bad storm in Dublin, the flight was delayed by twenty minutes. When we got to England we were also delayed by another 10 minutes because there was an issue with the spot our flight was scheduled to take on the run way. By the time we stopped, it was 9:30. By the time we got through the very busy and large London Heathrow airport, it was 9:45. Our flight to Calgary in Canada was scheduled to depart at 10:15AM but unfortunately, unknown to us, the gate closed on this flight at the very early time of 9:15AM. There was absolutely never any chance we would have made this flight. The result was that we missed it and had no choice but to book on an alternative flight. Unfortunately, this wasn’t as easy as expected. There wasn’t enough free capacity on the flights going to Canada that day so we had to split into three groups.

I was lucky enough to be in group one. We flew from Heathrow to Toronto and then from Toronto to Saskatoon. It took a total of 11 hours flying time with a stop over time of 2 hours but it wasn’t bad at all. In fact, it was less than our scheduled travel time for various reasons.

Group three had to fly a few hours later from Heathrow to Vancouver, then Vancouver to Calgary and then from Calgary to Saskatoon. Their total travel time was about 18 hours.

Group three flew from Heathrow to Vancouver and then from Vancouver to Saskatoon. Their travel time was also 18 hours.

Not ideal. In fact, it was one of the worst things that could have happened. However, it could have been worse. In fact, it was! Luggage should have followed us from Dublin however for some reason, it was delayed getting from Dublin to Heathrow so it didn’t get to Saskatoon until Group two and Group three got there at 12:30 local time this morning. We are still waiting for two cases and a harp to arrive.

We met with our host families and finally got some much needed rest at the end of it all.

Today has been quiet so far. We’ve been getting information about tomorrow’s performance, following up on misplaced luggage, learning a little about Canada but more importantly, we’ve been taking it easy after three particularly stressful and tiring days. We are playing at an informal session tonight with some Irish people that have moved to Saskatoon so I’m really looking forward to that. Tomorrow is when things will get serious again with a television appearance, sound checks, a practise and a performance at 7:30PM.

A review of Divi and my company Computer Support Services

I have been very neglectful of this site lately. I wish I could say that will all change but. Na, it won’t.

Here’s a short enough post. It’s not the kind of post where I say “Hey, go look at my new site over here” but that is a very small part of it. I want to tell you about a WordPress theme called Divi. This is currently the latest offering from the Elegant themes provider and its well worth considering.

However, before you launch in there and spend money on it, let me make you aware of some of the problems I encountered.

Let me start by saying a huge thanks to Emma because without her regular visual perspective I wouldn’t have had a clue what was going wrong.

Sliders

  • The placement of text in the slider is very hard to get right. A specific image dimension is probably required however this doesn’t seem to be noted anywhere in the documentation. To get around this, I had to assign a class to the text and set the top margin to a minus value.
  • It isn’t possible to place the sections at specific points on the page and they aren’t always at the top or directly below another section. Therefore, again, I had no choice but to associate some sections with a class and then set a minus value for the top margin.
  • When I tried instead to use an image as the background of a slide it seemed absolutely impossible to control the size of that slide.
  • Be careful with other modules that you have installed. If you have a conflicting slider you may find some very strange behaviour.
  • I also recommend that when making changes to the text within a slider that you copy it to notepad or another editor because a few times I wrote a fantastic slide description only for it to be lost because the page didn’t save properly.
  • Adding a button a header to the slider spaces it out far too much. I wanted a compact and clean slider for the top of the page. Not a full length animation.
  • Saving the biggest problem until last, the slider displays properly on tablets however not IOS or Android on phones.

Setting backgrounds.

  • I was told at one stage that the site looked a little bland. To solve this, I decided to use a background gradient. Thanks to CSS3, this is well supported and with a few checks for specific browsers in the CSS it’s very easy to implement consistently. However, some modules support setting a background colour but some don’t. There doesn’t seem to be any generic configuration items for these modules. Again, I had to get around this by using a class and styling this class using CSS.
  • There are no properties for setting the background in the Divi EPanel options so again, this had to be done using CSS.
  • Instead of just having the ability to set text and background colours in some modules to either dark or light, I would rather an additional or advanced option that would allow someone to type the hex values.

The header.

  • I wanted to do a few things with the header. A number of people commented that the logo is very small but there is no way of changing the dimensions of this. I looked in the CSS file but I really can’t find where it is specified.
  • I would also like to add a role over but I don’t find the CSS very easy to read. The role over would define what menu item the mouse is hovering over.

The pricing table

  • This is a fantastic idea but it’s not really a table. Its several tables. Each price you add is actually an additional table. I needed Emma’s help quite a bit to get this looking properly and even now I’m not entirely happy with it.
  • Feedback that I have received has also been quite negative about this. Divi seems to grey or dim features that are unavailable for certain price plans but it’s not obvious to people what this dim or grey colour represents. A more graphical representation would be a lot better.

Divi is a great theme but what it claims to do isn’t quite delivered yet. I’m hoping it will vastly improve in the next year or two but if you are considering it today, be warned you will have no choice but to tweak a lot of CSS before you get it working properly.

Using date ranges in MongoDB and PHP.

I have also written similar posts relating to date ranges in Python. You can find my Question here from when I was getting frustrated and The answer to my problems here.

You seriously wouldn’t believe the trouble I’ve had in the past two weeks trying to make some progress on my Arduino, Raspberry pi, Python, PHP and MongoDB project.

Work has been very busy so the only time I’ve had to work on this is on the bus on the way to and from Dublin and from time to time very late at night.

Right, so here are a few of the problems I came up against:
The first hing I wanted to do was limit the size of my table in MongoDB. I’m collecting quite a lot of sensor data from the Arduino but I don’t need to retain this data for any more than around 2 weeks.

MongoDB allows you to create a TTL index which will delete data that was created more than a certain number of seconds ago. This is a really handy feature however, it didn’t really work for me. I think you need to store the date in BSON format and I had stored my date in ISO format because I think it will make it easier to retrieve and write the sensor entries.

Regardless, here is the code I used:

db.envirocheck.sensors.ensureIndex( { “Date”: 1 }, { expireAfterSeconds: 604800 } )

You can learn more about TTL indexes using the Fantastic MongoDB documentation that covers TTL Indexes

As I said, this didn’t work for me at all so a suggestion on Twitter that I received weeks before made me think of capped collections. These are similar to TTL indexes in that they delete old data but instead of the TTL index, this works by deleting entries that are old however it does so when the collection reaches a certain value. By writing data once a second, I find that with 500Bytes I can store just over two hours of data. I obviously need to figure out how many bytes I need for storing two weeks worth but that’s something to do when I’m feeling more awake.

The code to create a capped collection is here:

db.createCollection( “sensors”, { capped: true, size: 500000 } )

Again, look here for the MongoDB documentation for capped collections.

Next, I of course needed to set an index on my date field as I’m going to be using this to select specific temperature values for date and time ranges. That was quite straight forward.

db.sensors.ensureIndex( { “Date”: 1 } )

Next, I needed to find a way of selecting between two dates in MongoDB and PHP. You might think this is easy, but no! It’s far from it! I stupidly tried to get ahead of myself by making this really complicated. I looked at Doctrine but trust me on this, the documentation for this project is absolutely crap! Now, maybe it’s me. Maybe I’m not experienced enough to figure this out but for god sake, this documentation might seem great from a high level but unless you read it from start to finish like a book, it’s useless! there’s no context to any of their examples and huge chunks of code are missing without any pointers to the parts of the documentation that might reference them. I wasted a week reading that documentation. There’s also different variations and different versions so the whole thing is really frustrating. All I wanted to do was find data between a date or time range. I liked the simplicity of the query builder and I can really see the power of this library but the documentation really turned me off.

Finally, I came to my senses last night at about 11:30PM when I really should have been a sleep. Come to think of it, I should really be a sleep now as well but I want to get all this out of my head and on paper so to speak before I forget it. I came across This post on the MongoDB blog which made things very very clear. I had of course tried something very similar to that before I started looking for alternatives but really, it was so simple! All I was missing was converting the date into strToTime before I tried to convert it into MongoDate format. I did a lot of searching on Google but although I could find shed lodes of documentation on converting from MongoDate into PHP, I couldn’t find anything on the other way around. I obviously wasn’t looking in the right place because as soon as I saw those few letters strToTime, it all clicked.

Here’s the example from the MongoDB blog:

$start = new MongoDate(strtotime(‘1971-01-01 00:00:00’));
$end = new MongoDate(strtotime(‘1999-12-31 23:59:59’));
$collection->find(array(“create_date” => array(‘$gt’ => $start, ‘$lte’ => $end)));

This actually converts the date and time into a number like this:

1393545599

Armed with this information, I set about dynamically setting the date and time. This code will get the sensor values saved to MongoDB over the past day:

$start = new MongoDate(strtotime(date(“Y-m-d H:i:s”,”-1 days”)));
$end = new MongoDate(strtotime(date(“Y-m-d H:i:s”)));

See how easy that is? Isn’t that frustrating! I’ve spent about ten hours reading about this. Such a waste in a lot of ways but I suppose I probably learned plenty on my travels to finding out more about Mongo and the way it handles dates. Funny, in the collection, the date is stored in ISO format. For example: 2014-27-02 23:46:05. It must do some very interesting conversion back into a standard format. When I tried to check using the format that the date is stored in within the collection using (Y-m-d H:m:s) it failed to pull back any records. Maybe because MongoDate is trying to parse that from the expected strToTime number. That’s weird though because that wasn’t even working when I wasn’t using MongoDate. It’s a question I must ask on the forums when I eventually get around to creating an account.

As you can see, I’m still learning and in a lot of ways this is really frustrating. I could probably do with reading a few books on these subjects but where’s the fun in that? I rather learn as I go along.