An Overly Complicated and Extensively Useless Guide
This morning I was working on my new website, kayvontabrizi.com (shameless plug), which features my resume (I'm on a roll), and inside, links to contact me (alright that was the last one).
Since the HTML version's beauty far exceeded that of MS Word's overused styles, I was inclined to simply print the resume as a PDF (a built-in Chrome feature). So there I am, viewing my fresh-off-the-digital-press PDF, when I run into a dysfunctional link. For reasons beyond me, Chrome did not allow the generation of a hashed link (/something/with-a#hash), but only if the hash exists as the id attribute of an element on the page, and the URL was a same-origin request.
This left me with two options:
- Rename the hash to some non-existent hash, and change it later, or…
- Change the domain to anything other than "kayvontabrizi.com" and change it later.
Please note that both methods require changing it later.
Being the logical & semantic developer I am, I chose to change my domain to "kayvonltabrizi.com" (l is not the first initial of my middle name…).
This would later prove to be a mistake.
I open the PDF in my trusty text editor, Sublime Text 3, and to my surprise, I see minimal gibberish. I quickly identify the URL in question, and remove the l.
And then, like any professional and experienced developer, I do a mental happy dance.
And then I check my work. Expletive.
Surprise, surprise, the file wouldn't open. It must have something to do with that infernal encoding thing…
Instead of trusting my gut-feeling, I do a quick search about PDF document structure, which reveals that there is a reference table tracking the byte-positions of certain objects. Despite a severe lack of knowledge and experience pertaining to PDFs, I attempt to manually adjust this table.
Let's ignore the section where I pointlessly waste lots of time, and skip to where I realize that instead of inserting a letter into my URL, I could just modifying an existing one.
Thus, kayvoltabrizi.com was born. Semantic. I know.
Alright, now all I have to do is change the letter manually in my Chrome-generated PDF, and I'm done!
Of course, encoding came back to byte me in the expletive. To little surprise, the PDF would not open after having been edited in Sublime, so I switched the encoding to hexadecimal, saved it as a new PDF, and tried opening it.
Now all I had to do was edit hexadecimal values… Great.
A quick search confirmed my crude knowledge of computer architecture; each character was encrypted as 8 bits (a byte), and a single hexadecimal character (0-F) represented 4 bits (and since Sublime displays hexadecimal as blocks of four characters, each block was 16 bits). So once again, I opened up my PDF in Sublime, select all the text up to the URL I wished to edit, and examined the status bar, which revealed to character position of the l in "kayvoltabrizi". Then I multiplied by 8, and divided by 16 (not really, I divided by two, I passed 2nd grade okay? 3rd was hard doe).
I finally located the block, changed "6c" (l) to "6e" (n), and saved.
Viola. Voila. Whatever, I took French, check my resume (that one was subtle, wasn't it).
Then I submitted my resume to HopHacks
And then I wrote this.