The Bus Commuting Blogger

crowded-bus

I decided to star blogging to help myself out as a documentation diary, bit of fun and something to do on the bus journeys.

I started taking the bus a month ago and I should have started long before. There is no concentration required which means you can rest to and from work if required. Its cheaper, I save 50% based on commuting by car with parking fees. I can attempt to write some really bad blog posts for peoples entertainment or for my amusement.

I don’t really have a theme for the majority of my posts as they will just be thought of on the spot or possibly based on one particular event that day

If a day goes by (mainly the weekends) without a post and you are bored and feel the urge to make a short post please send me something and I will gladly make it a featured post (if it is appropriate). In fact if there are regular guest posts, I can dedicate the weekend days to you.

Any developers out there who disagree or just purely hate my solutions, please leave comments as I am here to learn and this is mainly a resource for my own learning, but if it helps others great.

The Vitality of Version Control

Version Control

Version Control in this day and age is on power with having internet on your smart phone. You could function without it but why should you and how badly would it affect your every day tasks.

Without internet on your phone you may miss a bus because you forgot the timetable and had no way of checking it via your phone or incurring bank charges because you were not able to transfer funds in time on a mobile app connected through the internet.

Version Control is the same, without it we would still be sending folders to one another through emails or usb pens.

Some major problems with the old style saving of files:

  • not sure which file/folder is the most up-to-date,
  • usb pens can get corrupted and lose your saved files (it has happened everyone at some stage),

A recent scenario reminded me just how vital to a business versioning files is. However it is equally important that everyone who is required to use it understands it and has been either given appropriate walkthroughs or has taken it upon themselves to learn it (ask questions and use stackoverflow.com).

A popular version control system is Git, usually hosted on either github or bitbucket. There are many things that affect which one you should use but this post doesn’t go into that.

Some walkthroughs of version controlling using bitbucket to follow and also links to well written documentation (by seriously smart people).

The Mythical 4px Margin

OCD Squares

A while back a colleague seen a great tip for dealing with the 4px margin caused by using display: inline-block.

This is the best solution I have come across yet, if it’s possible to use in your circumstance (as it requires you setting the font-size property).

Fix: if you were using a ul to parent a bunch of li’s with display: inline-block, then you would set font-size: 0 on the ul (this appears to remove all spacing between the child items) and set or reset the font-size property on the li’s (for example: font-size: 14px or 1em or 1.5rem).

There are other methods of sorting out the problem that have been documented many places including the king of CSS over @ css-tricks.com.

Off the top of my head would be using float: left on the li’s and making sure to clear after:

ul:after{ clear: both; content: “”; display: block; font-size: 0; height: 0; }

If you don’t like using float and have access to the HTML then you may change the markup to correct this problem. I am not a fan of this fix as it can make your code look pretty nasty. It requires you to remove any line breaks between the li’s (will update with an example when not on my phone).

Not so successful fixes including setting a minus margin but I never had much success with this fix as sometimes you like to use margins for styling.

It can be a headache to deal with for people who don’t know why it happens or methods of fixing so hopefully this helps people from pulling out their hair and tailoring their solution to best suit themselves.

The Laborious Invalid Login

http://www.pinterest.com/pin/396809417138872523/

So all was going well. The day had been productive and I also had the pleasure of introducing a new program to my workflow, to help with productivity – SourceTree.

However after documenting and changing my development setup I encountered a problem, one that proved to be especially annoying after finding out it was quite easy to fix (whether or not it was the correct fix or not).

Problem: when creating a local instance of moodle and using a database that was already setup locally, changing a newly created instance of moodle and pointing the config.php to look at the already existing database.

This resulted in not being able to log in as a user.

Issue: mnetlocalhost column on mdl_user and in the mdl_config tables had been set to 3.

Fix: changing all instances of 3 to a 1 in the mnetlocalhost column fixes this issue.

 

Difficulty: 4/10

Frustration: 9/10

Severity: 6/10

 

UPDATE

A colleague also pointed out (not yet tested) that there is a mdl_mnet_host table that the value 3 was pointing to.

Possibly updating this field would also fix this problem and would be much more convenient than updating the other 2 tables.