Monday, September 2, 2019
[Media] Useful Firefox Plugins
As an avid user of Firefox, there are many plugins which are absolutely essential to upgrade your browsing experience. Here are a few I always use.
FireShot
https://addons.mozilla.org/en-US/firefox/addon/fireshot
This is my favorite plugin to make web page screenshots which can be saved as images or pdfs with links!
uBlock Origin
https://addons.mozilla.org/en-US/firefox/addon/ublock-origin
Nowadays, ads are everywhere which unfortunately includes YouTube and other popular video streaming sites. To avoid them ever showing up, I use this efficient blocker. It runs so smoothly I never notice it's even there.
DownThemAll!
https://addons.mozilla.org/en-US/firefox/addon/downthemall/
This is the downloader for links on a page. Download images, pdfs, links, etc. all in one easily customizable plugin.
Image Picka
https://addons.mozilla.org/en-US/firefox/addon/image-picka
I use this app if I specifically want to just download images on a page. Not nearly as functionality heavy or customizable as DownThemAll! but it's perfect for downloading pictures.
In My Pocket
https://addons.mozilla.org/en-US/firefox/addon/in-my-pocket
For those of us using Pocket to bookmark and store interesting articles, the old official plugin no longer works with the latest version of Firefox. Have no fear for a guy by the name of Pierre-Adrien Buisson created an unofficial version which is just fine. With one click, save any article you want to Pocket for later perusal.
Thursday, July 4, 2019
[IT] Display Chinese in Command Prompt
chcp 936
In the Windows shell, the "code page" determines how bytes are converted to characters on the screen. Using the CHCP command changes the shell's code page. Please note that before the CHCP command can be used, the nlsfunc must be loaded and country.sys must be loaded into the config.sys.
Automation
To remove the need to do this every time, you can create a simple batch file to change the code to whatever you wish. Here, it's changed to 65001 which is Unicode. This will not be able to display East Asian characters but you will be able to type other characters.
@ECHO OFF
REM change CHCP to UTF-8
CHCP 65001
CLS
You can save this in the folder C:\Windows\System32 as a bat file such as switch.bat.
Then, create a shortcut to cmd.exe on Desktop and change the shortcut's properties to C:\Windows\System32\cmd.exe /k switch
Now whenever you need to type in a different script, you can use this shorcut.
Monday, April 18, 2011
[IT] Advantages of Hexadecimal
If you work with computers on some level beyond Microsoft Office or browsing the net, at some point, you will run across hexadecimals. What are they and why do people bother using them when they seem something better left for assembly programmers?
Hexadecimal is just a base-16 number system. We humans because we grew up in a society where most of us has 10 fingers, use the decimal system for the most part. In hex, in addition to the numerals 0-9 to represent values zero through nine, we also have letters A-F to represent values ten through fifteen.
Consider the number 10995. In decimal system, we have
(1 x 10^4) + (0 x 10^3) + (9 x 10^2) + (9 x 10^1) + (5 x 10^0) = 10995
In hexadecimal system, we have 2AF3:
(2 × 16^3) + (10 × 16^2) + (15 × 16^1) + (3 × 16^0) = 2AF3
What's important is to realize that numbers are abstract counting notions which can have infinite ways of displaying in reality. Actually, base 10 really offers no advantage to us except that we humans are born with 10 fingers and toes which make it easier for us to count. We could use base-23 or base-159 for no good reason.
However, there are distinct advantages to using hexadecimal in computer science:
1. You can store more information in the same space. In a hex code with two digits you can express the numbers 0 through 255. In a decimal code with two digits you can count from 0 to 99.
2. Hexadecimal (base 16) converts easily to binary (base 2), which is used by computers at the fundamental level. A two digit hexadecimal number can range from 0 to 255, which can be expressed in eight digits of binary code.
Programmers sometimes like to throw around dorky jokes that ordinary people won't get. The following is a good test to see how dorky you are:
3x12=36
2x12=24
1x12=12
0x12=18
Programmers typically put 0x in front of a number that's in hex base. This way, people don't get confused. So here, the first three lines are interpreted as multiplication while the last is considered the hex interpretation of 12, which is (1 x 16^1) + (2 x 16^0) or 18.
Here's a better one:
Q: Let’s say only you and dead people can read hex. If you teach your buddy how to read hex also, what do you all have in common?
A: You are all deaf.
If you need an explanation, you're still not quite a dork. Work on it though! Still, for completeness, explanation: "dead" refers to a hexadecimal number DEAD (57005 base 10), as opposed to the state of not being alive. With you and your friend, that's two more to the group, so add 2 to D to get F. Hence, DEAD + 2 = DEAF.
Sunday, April 17, 2011
[IT] Short Discourse on Encoding (ASCII, UTF-8, etc.)
A -> 0100 0001
In Unicode, a letter maps to something called a code point which is still just a theoretical concept. How that code point is represented in memory or on disk is another story.
The earliest idea for Unicode encoding, which led to the myth about the two bytes, was, hey, let's just store those numbers in two bytes each. So Hello becomes
00 48 00 65 00 6C 00 6C 00 6F
Couldn't it also be:
48 00 65 00 6C 00 6C 00 6F 00 ?
the people were forced to come up with the bizarre convention of storing a FE FF at the beginning of every Unicode string; this is called a Unicode Byte Order Mark and if you are swapping your high and low bytes it will look like a FF FE.
For an email message, you are expected to have a string in the header of the form
Content-Type: text/plain; charset="UTF-8"
For a web page, the original idea was that the web server would return a similar Content-Type http header along with the web page itself -- not in the HTML itself, but as one of the response headers that are sent before the HTML page.
It would be convenient if you could put the Content-Type of the HTML file right in the HTML file itself, using some kind of special tag. Of course this seems to be a Catch-22: "how can you read the HTML file until you know what encoding it's in?!" Luckily, almost every encoding in common use does the same thing with characters between 32 and 127, so you can always get this far on the HTML page without starting to use funny letters:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
But that meta tag really has to be the very first thing in the section because as soon as the web browser sees this tag it's going to stop parsing the page and start over after reinterpreting the whole page using the encoding you specified.
What if a poorly informed web designer doesn't put this tag though? Apparently, every browser does something different to try to guess the character set. Sometimes, they get it right. Sometimes wrong which you the web browser will have to try to figure out what encoding the web designer actually meant for you to use. Is it Chinese? Hindi? Arabic? Good luck!
Thus comes the central point that for every web document you code up, be sure to include the encoding type!
