Category Archives: Code

Tutorial: A Character Count Tool Using Bootstrap and JavaScript

This week I want to document how I created a simple web application that allows users to input a message, and in return display the number of characters in it. Not only was it simple to make, but useful in the real world too! Final Character Count Page: For this project, we will be using Bootstrap for the user interface, and basic JavaScript for the character counting functionality. To get started, download the compiled and minified version of Bootstrap from the official website. Getting Started To kickstart our project, we will be using the “Starter template” from Bootstrap as it is easy to configure and readily available. According to Bootstrap, the template contains “nothing but …

Continue reading

Posted in Code, Web Development.

AppleScript: Back Page Function in Browsers

This week at work, I realized how pre-2010 my Mac’s Mighty Mouse was. There is a set of buttons on the side of the mouse, but it doesn’t even serve any functions! Namely, it doesn’t allow me to go back a back (aka a “back page” operation, if that’s what it’s called) on the browser. At home, I use the Logitech Performance MX mouse, and on Windows at least, the side buttons are preconfigured to do exactly that, and more (go forward a page), when pressed. Being a OS X newbie, I decided to create a simple AppleScript macro to perform just this function.  It probably isn’t the best solution by far, but at …

Continue reading

Posted in Code.

Replacing Spaces with “%20” in a String (C++, Ex: 1.4)

string space to %20 cracking

There are multiple ways to replace spaces in a string with “%20”, but one way I did it without starting from the back is through string concatenations and substrings (substr). In C++: Output: Substr takes in two inputs and returns a string that starts from position index and spans for length characters. In our above example, str.substr(0, i) when i = 5 ([5] == ‘ ‘) will return “hello” (starting from position 0 and spanning 5 chars). My reasoning in this example was that I would take substrings of everything before and after the space, and then concatenate them together with a “%20” in between. Corner cases weren’t checked, but it works well in normal cases. …

Continue reading

Posted in C++, Code.