Exploring alternate worlds: How to spoof your geolocation

I was recently working on a project at work which grabs a visitor's geolocation and displays certain information relevant to where they are in the world. However, as with every project, there were things that needed to be debugged. The problem, however, was that everything was working just fine for me, using my own geolocation. And as any developer knows, it's exponentially more difficult to debug a problem when you can't fucking replicate it!

Enter: Geolocation Spoofing

Luckily for me, after a bit of searching the old Google, I found some information that saved me from having to drive 850mi with my laptop to debug the issue! I'm not entirely sure if this information applies to any other browser(s), but for my testing purposes, the problem was browser-agnostic, so it didn't matter what browser I used to debug/test the solution.

In Chrome, you can manually set your geolocation to a set of latitude/longitude coordinates (thank goodness!). Here's how:

Step 1: Open DevTools

Step 2: Click the three dots

Step 3: Go to More Tools -> Sensors

Step 4: Select "Other" and enter the lat/lng you want to use

Coming to grips with my own mortality

SPOILER ALERT: Everyone dies in the end.

Even you, dear reader, will one day cease to exist. Your body will decay, and your elementary particles will be returned to the ecological system of which you were a part. Then, after some indeterminate length of time, your name will fade into antiquity. As time progresses, your memory will be retained by fewer and fewer people; until some day, it will be forgotten completely. This brevity, this impermanence is the only true absolute in life.

However, don’t think this is just some cheap shot at you; not in the slightest. Indeed, the fact that we as a species are destined for extinction is as much a certainty as is our eventual death. That’s right, the entirety of what we currently call the human race will someday die off. It could happen suddenly (read: asteroid), or it could happen more gradually (read: Neanderthal). The point is that some day—whether by space rock or super volcano, evolution or climate change—our species will eventually cease to exist.

The cradle rocks above an abyss, and common sense tells us that our existence is but a brief crack of light between two eternities of darkness. Although the two are identical twins, man, as a rule, views the prenatal abyss with more calm than the one he is heading for.

Vladimir Nabokov

Morbid, much?

I agree, this may seem rather morbid or nihilist; thinking about the eventual demise of everything. However, not enough people do, in my opinion. I mean, everyone understands that they will perish some day, but rather than acknowledging and confronting that fact, most people simply put it out of their mind until that day inevitably comes knocking. This practice can be detrimental to our well-being in more ways than one. Studies have shown that existential death anxiety can lead to damaging effects in both the short and long terms; contributing to things like emotional instability and even physical harm to oneself or others.

I too had compartmentalized the inevitability of my own death. Like most people, I decided that death was not a pleasant topic to think about and quarantined such thoughts in a dark corner of my mind. It wasn’t until my own death seemed imminent that those thoughts broke free of their bonds and made a mad dash into my consciousness. This had a profound effect on my overall outlook on life, and of course, death.

Jacques Auguste Regnier, Old Mortality
Jacques Auguste Regnier, Old Mortality

No, I’m not depressed.

Contrary to popular belief, thinking about death is not necessarily indicative of depression. When death does a ding dong ditch at your door, as it did at mine last year, contemplating death is only natural. Since that day, I have lived with the unfortunate knowledge that there is a real possibility my mother might outlive me. This has not, however, diminished my will to live. But more importantly, at a time when accepting Pascal’s Wager might seem almost logical, it is actually my steadfast non-belief in superstition which has given me the most comfort.

Instead of relegating my future to the hands of the supernatural, I’ve gleaned solace from an inherently secular, scientific point of view. I do not believe in the concept of an afterlife. In my opinion, an eternity of anything would negate its meaning. Supposing, for instance, that the bible is right and there is such a thing as an afterlife… An eternal life in Heaven would not be what I consider “living”. Webster defines eternity as “infinite, or unending time”. Regardless of the amount of time you spend in an eternity, there will always be an eternity left in your future. When faced with the infinite, even a trillion years is but the blink of an eye.

To infinity, and beyond!

There is a theory in statistics which states that: Given an infinite amount of time, a monkey at a typewriter will eventually wind up writing Hamlet. The premise of the theory is that any finite string of characters (such as the works of Shakespeare) must eventually occur as a substring of an infinite string. This principal doesn’t just apply to monkeys at typewriters, however; it can be scaled up. Therefore, eternal life in Heaven would, at some point, cease to offer rewards to its members.

After praising god in every way conceivable, after partaking in an eternity of happiness and pleasure, and after walking the streets of gold forever, what then? When does the eternal life become eternal and pointless existence? In this way, I feel that an eternity in Heaven would offer very little difference to an eternity in Hell. The torture and agony of the souls in Hell would eventually fade just as the happiness and bliss of those in Heaven. After which time, you’re left with nothing more than a bunch of pitiful souls existing in a state of misery for the rest of eternity.

I refuse to simply exist. I will live.

The end of an era

Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it.


Last night I quit my job.

Well, technically I put in notice a while ago, but last night was my last night on the job. Without going into specifics as to the original reasons behind the transition, I’d like to make an important point: I was angry… Angry at my employer. This is important because regardless of my disdain for my boss, I still felt an incredible sense of loss and longing the moment I stepped out the door for the last time.

Everyone knows that quitting a job is akin to breaking up with a long-time partner. However, this was far more severe. Last night I walked out on a career; not just a job or an employer, but an entire profession. So as I turned in my company property, I was effectively handing over my identity. While it’s true that I’ve moonlighted as a freelance developer since ~2008, it’s always taken a backseat to my career field: Transportation & Logistics. And last night I walked away from that industry to follow a dream.

Some backstory…

To be honest, I had been looking for reasons to leave the field. I just didn’t expect things to happen quite as fast as they did. After my heart attack last year, I no longer felt comfortable driving an 80,000lb missile down the road. Granted, I had learned firsthand through the miracles of modern medicine and technology, that you can survive a heart attack. However, my confidence in my ability to survive a heart attack (should another occur) whilst driving a semi-truck at 70mph was a bit lacking. This led to me taking a very substantial pay cut in order to move to an office position.

Now that I had more free time, as I had now gone from working nearly 80hrs/wk to working just 40hrs/wk, I started to rekindle my love for coding. As time passed, and I became confident with my skills again, an old contact of mine reached out to me with a few small freelance jobs. With these small odd jobs behind me, we started to talk seriously about the possibility of him needing a full time developer at some point in the hypothetical future.

Chasing dreams…

Honestly, I didn’t really put too much stock in anything happening in the foreseeable future. However, after venting to him about the plight of my situation at work one day, he made me an offer I couldn’t refuse. And now, here I am. One foot leading the other, down a path I’ve never wandered. Leaving all that was secure and comfortable behind me in search of a dream.

Addendum

I rarely make new friends. It’s an unfortunate side effect of being anti-social and having a general dislike of people. However, the handful of people with which I had formed friendships at my past employer are going to be deeply missed. I certainly hope that they don’t become strangers.

How to write clever code

First, you start with something simple…

In order to start writing code as cleverly as we can, we first need a basic concept to work from. In the case of this example, we’ll be writing a simple function which evaluates a parameter and returns a value based on that parameter (with a default return value option). Short and to the point.

function doStuff($data) {  
  if ($data == 'val1') {
    $result = 'Value One';
  } elseif ($data == 'val2') {
    $result = 'Value Two';
  } else {
    $result = 'Unknown Value';
  }
  return $result;
}

…and you make it better

Obviously, this just won’t do… If we’re going to establish our credibility as a programmer, we are duty-bound to find some clever trick to make our code stand out among the crowd… Luckily, we know one such trick!

function convoluteStuff($data) {
  switch(true) {
    case $data == 'val1':
      $result = 'Value One';
    break;
    case $data == 'val2':
      $result = 'Value Two';
    break;
    default:
      $result = 'Unknown Value';
    break;  
  }  
  return $result;
}

MOAR CLEVERER!!!

While the above example does, indeed, show off our innate ability to add unnecessary complexity to even the simplest tasks (I mean, who likes “if” statements, anyway?), it doesn’t go far enough. It lacks a certain elegance, so to speak.

We need to really tout our abilities, here… Our code needs to be so clever, that we can puff out our chests and elevate our noses at those who don’t immediately grasp its function.

function cleverStuff($data) { 
  return $data == 'val1' ? 'Value One' : ($data == 'val2' ? 'Value Two' : 'Unknown Value');
}

Now this… THIS is clever code! Notice how we abandoned the structural breakup of indentations altogether and went straight to using convoluted ternary combinations? This is the work of a genius! The fact that you can't simply glance at it to understand what it's doing is the key. After all, the idea of coding is to make your code so obnoxious that anyone who has to maintain it after you curses you with plague and pestilence, right?

Hello World!

Current Usage

Despite the myth that “Hello World!” is the first thing to be output by all computers, its prevalence in nearly all facets of technology is undeniable; as anyone who has used WordPress can attest. A “hello world” program is often used as a simplistic introduction to programming languages, as it’s generally quite self-explanatory, and simple enough that even those with little or no programming experience can understand its function. However, do not mistake its simplicity for a lack of utility. The program needs a functioning language compiler and run-time in order to accomplish its task. This makes it ideal for a quick and easy sanity test for new systems.

A Brief History

Early on in the history of computing, it was necessary (as it is now) to run sample programs to test the viability of newly developed systems and technologies. The key difference, however, was that in technological antiquity, the emphasis was placed on persuading a target audience that computers were the way of the future. This is evident in the first run programs used in early systems pre-1970’s. John Presper Eckert and John Mauchly first used their ENIAC for ballistics calculations, while Alan Turing used the Manchester Mark 1 to compute Mersenne primes, and John von Neumann used the EDVAC to run a custom merge-sort algorithm.

After the adoption of digital computers by the United States government and large corporations, their usefulness was self-evident. This eventually led to first-run programs being less about enticing adoption, and more about quick and easy testing of system architecture. The first known case of “Hello World” being used to serve this purpose was in Brian Kernighan’s A Tutorial Introduction to the Language B, in which it’s found as an example of using external variables.

main() {  
  extrn a,b,c;
  putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';

Kernighan later (1974) wrote a similar function in the budding new language “C”, which he included in an internal memo at Bell Labs called Programming in C: A Tutorial. This example, however, is more widely referred to as the “first” usage of a hello world program, and used as the basis for other language variations today.

main() {
  printf("hello world");
}

Conclusion

While it may seem almost trivial, the “Hello World!” program represents a paradigm shift in society’s day-to-day operations. We as a society have accepted our technological future, and (for better or worse) embraced it with open arms. So the next time you’re shopping for a computer, consider the lengths that people like John von Neumann would’ve gone to in 1945 to prove to you that digital computers would soon replace tabulating machines.