Tag Archives: route

Solved: F3 Framework Route is running Twice Programming 02 JUL 2016

I’ve inherited a project written using the Fat-Free Framework (or F3 Framework), which is billed as being a lightweight PHP micro-framework that is intended to be easy-to-use and fast, with a gentle learning curve thrown in for good measure. (In fairness, all three of these points seem to be holding relatively true thus far…)

fat-free framework php

Anyway, the project was written by an outsourced Polish developer, and now that he is no longer available, I’m bringing it in-house and expanding on it. Of course, this means that I’m refactoring it a little bit to better suit my own coding style. However, I hit an annoying snag which embarrassingly held me up for far longer than what it should have.

After making a class/controller name change, I was testing my routing when it became apparent that all of a sudden, one of my routes was running it’s function call twice.

An annoying issue to say the least.

So just a heads up, before you tear your hair out – be sure that your target function does in fact not share the same name of your newly renamed class in which said function resides.

If it does, then the framework will call the function through the run() routing as expected, and following that, the function will be called again… because as you might have noticed by now, the fact that your function is the same name as the class means that it is of course a constructor function.

So yes. I’ve jotted this down as a reminder to myself, that sometimes I’m an idiot.

Related Link: Fat-Free Framework

The Race to Mondeor (or… Damn It, I was Wrong!) My Life 14 APR 2015

There’s been an argument brewing here in the Country Mews Lotter Stronghold for a while now – is it faster to get onto the N2 proper by going right into Dennhof, onto Sir Lowry’s road and then on to the N2, or is it quickest if you go left into Dennehof, travel along the newly completed road that takes you into Broadlands, and then up onto the N2?

I’ve steadfastly sided with the former from the beginning, as I am convinced that the faster speed limit cancels out the slight distance advantage of the latter, and besides, I’m pretty sure that my route has less stopping points than the new one.

Chantelle on the other hand insists that the new route is quicker, and with neither one of us wanting to budge from our position, there was only going to be one way to properly prove which route is fastest – a race!

As luck would have it, there is actually a very easy and accurate way for us to determine the victor in this challenge, because both routes meet up at one defined point on the N2 – at the robots leading on to our perennial favourite, Mondeor Restaurant (and Monkey Town of course).

The rules were set out – there was to be strict adherence to the speed limit and other rules of the road. Full stops at all stop streets and robots was required. No cheating whatsoever, and with a gentleman’s handshake shook, we fired up the stopwatches on our phones (both Huawei Ascend P6s, so no discrepancy there), and set out to the starting point – the stop sign leading into Dennehof itself!

With a timid roar (remember, speed limit), Chantelle sped off left and I sped off right, me confident in easily winning this particular challenge.

In fact, in almost no time at all, I was on the N2 and racing towards the Mondeor robots, pleased as punch at the thought of my imminent victory, when suddenly my stomach turned and my heart sank… at the sight of Chantelle happily waving to me as she drove past in her Hyundai Accent, already on the return leg of the journey.

Disgusted, I reached the robot, stopped the stopwatch at around seven minutes twenty, and did a u-turn in my Getz to head off and join her at the Garden Kitchen over at Mountain Streams Nursery, our designated debriefing spot.

Needless to say, when I finally arrived at the destination, I sat down to a gloating, smirking face, as Chantelle proceeded to question my time over her steaming cup of coffee. I mumbled my number and showed her the clock – to which she gleefully laughed out loud and turned over hers – her route had beaten mine by almost a minute and a half!

Damn it.

It doesn’t happen often, but when it does, it is complete and utterly soul crushing. I was wrong.

Sigh. I hate being wrong.

Well done Chantelle, it looks like you remain the champ at picking out routes… for now!

IMG_20150217_143032 a beer and a smug smiling chantelle lotter at Bossa

(I’m hoping for a rematch where we drive at more realistic, real world speeds. That said, I’m not sure that even that will save my bacon – I’m pretty sure that she’s got me by the short and curlies this time!)

Ubuntu Server: How to Set the Network Default Route CodeUnit 30 MAY 2011

To view your current network default route on your Ubuntu server box (or Ubuntu desktop for that matter), simply type in:

ip route

This will spit out a whole lot of important information regarding your current network connection on the box, the most important for you in this case being the last part that reads default via xxx. If xxx is not a valid gateway that you want to use, e.g. your router IP address, then you can add a default route with the following command:

sudo ip route add default via 10.0.0.1

where 10.0.0.1 is the IP address of your router. Alternatively, you can also use this command to achieve the same effect:

sudo route add default gw 10.0.0.1

Nifty.