Friday, August 14, 2015

Inserting a Unicode Character into MS Word or TextEdit on Mac OS Yosemite

If you write articles for science journals you probably frequently need to insert special characters in your text. Often it is much easier to find a Unicode representation of the character you need rather than hunt through the many fonts installed on your Mac system or the character you need might not be included in an available font.

The answer is to enable typing Unicode directly into documents on Mac. I found some other blog posts and forum entries explaining how to type unicode characters on Mac. However, they were for older versions of Mac OS so I am making a version with plenty of screenshots to show you how to do it on Mac OS Yosemite.

First you have to enable Unicode Hex Input on your system:

Step 1: open system preferences:




Step 2: open keyboard preferences:


Step 3: select the Input Sources Tab:


Step 4: click the + button:




Step 5: select Others from the languages (scroll to the very bottom):



Step 6: select Unicode Hex Input (it will probably be the only choice):




Step 7: click the Add button:




You should now see a little language flag on your menu bar at the very top right of your screen:




While in TextEdit (or almost any other application you can click on the flag and select Unicode Hex Input (Sorry, I can't make a screen capture of actually doing it.)

You will then see the flag replaced with the Unicode Hex symbol:




To add a unicode symbol to your TextEdit document just hold down the option key and type the 4 digit unicode hex, then release the option key. The unicode symbol should appear. In this example I typed 2119 which is a Blackboard Bold uppercase P:










Sunday, June 14, 2015

Why the Iraqi Army is Losing to ISIL in Two Pictures!

The top image is a U.S. soldier training an Iraqi soldier the correct technique for firing over a berm. If you have ever fired a rifle then you will immediately see this is a very stable position and a decent shot can regularly hit a person sized target at 300m away or more this way. Also, if a mortar shell or grenade lands on his side of the berm, the Iraqi would have a good chance to escape being hit by shrapnel.



A U.S. soldier training an Iraqi soldier to fire over a berm (Washington Times)


The image below is of Iraqi soldier actually firing over a berm at ISIL. A standing position is much less stable and even a good shot will have problems hitting a person sized target 200m away. Even more telling is that the guy on the far right can't even see over the berm. He is using "spray and pray" and can only hit anything by luck.

Iraqi soldiers firing over a berm at ISIL (AP)


Of course, there could be a good reason to do what the Iraqi soldiers are doing such as they might need to be able to move quickly etc. However, from the photo it looks like they should be doing it the "book" way.

Firing a rifle over a berm is something that every U.S. soldier learns in Basic Training. Basic Training is just that, the minimum basics of being a soldier. In the U.S. Army it lasts about 8 weeks. The Iraqi Army has had over 10 years of training by the U.S. military.




Tuesday, February 17, 2015

Net Neutrality

I am not a lawyer, I am a computer scientist.  Therefore, I'm going to cut straight through all the BS regarding Net Neutrality. Unless you own a large amount of stock or are an executive in AT&T, Verizon, Cox, Charter, Comcast or other large Internet provider, then you benefit greatly from Net Neutrality.

On one side of the argument are large telecoms (such as Cox, Verizon, AT&T, Charter, etc) and on the other are content providers (Netflix, Google, HBO, CBS, Fox etc) and the public.

What the large telecoms are attempting to do is the equivalent of this:

The power company sends you a letter announcing that even though you are paying full price for electricity, some brands of appliance will be favored over others. So, if you use a GE or Whirlpool microwave you can have any power you want up to 1500 watts.  All other brands of microwave will be limited to 500 watts.

This is exactly what the telecoms are doing.  You are paying for the bandwidth, but they want to establish a bureaucracy that will require content providers to negotiate with the telecoms over how much access you will have to their content.  Youtube, Netflix, HBO, CBS, FOX and many more giant content providers will be forced to make deals with each telecom separately in order for their customers to be able to get full access to their content.  Small providers, without an army of lawyers already on the payroll will be left out and you won't have access to their content or have access at speeds equivalent to dial up.

Remember, that the telecom customers are paying for the bandwidth but the telecoms are deciding how it is used.

Now, there is a ton of legalize out there explaining why this is a good idea. Terms like "encouraging innovation" and "free market" are tossed about.  This is just nonsense.  There is no way that allowing giant corporations to decide what content people have access to is going to encourage anything except for the profits of giant corporations.

Also, I've heard that Net Neutrality must be bad because it will create a huge "government bureaucracy." This is nonsense.  The FCC already exists and the rules for Net Neutrality are simple: you are not allowed to favor one content provider with more bandwidth than any other. On the other hand, what the telecoms are proposing creates a large, confusing corporate bureaucracy. Each content provider would have to negotiate a maze of deals with every Internet provider in order to reach customers. This could be overcome by Netflix and other large providers, but what about a small startup with a killer idea? They would just be trying to reach out and create a customer base and would have no chance to get started.

Thursday, September 25, 2014

Fix for Bash ShellShock Vulnerability on Mac OS X

ShellShock is a serious security vulnerability on all Mac and Linux machines that you should fix even if you have no idea why.

This post will tell you how to install the latest version of Bash on Mac OS X to get rid of the ShellShock vulnerability.  You must have admin privileges on your computer to complete this. If you use MacPorts or Homebrew you need to do an update of whichever you use as well.  MacPorts and Homebrew have a separate version of Bash besides the one built into your system.

This explains the ShellShock vulnerability:

http://www.bbc.com/news/technology-29361794

Steps to repair:

Step 1:
Install XCode if not already installed from the app store:

https://itunes.apple.com/us/app/xcode/id497799835


Step 2:
Open a terminal window:

https://www.youtube.com/watch?v=zw7Nd67_aFw


Step 3:
sudo env x='() { :;}; echo vulnerable' bash -c 'echo hello' 

You will be prompted for an admin password. If you see this you have the vulnerability:

vulnerable
hello

If you see this someone has fixed it for you.  No need to proceed:


warning: x: ignoring function definition attempt

error importing function definition for `x'

hello

Step 4:

Copy and paste everything below in courier font into the terminal then hit enter.    If you have a problem try to copy and paste one line at a time:


mkdir bash-fix
cd bash-fix
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz -k| tar zxf -
cd bash-92/bash-3.2
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 -k| patch -p0    
# Note: The bash23-053 patch does not apply cleanly on OSX because
# of a missing y.tab.c file. This can be ignored or the alblue
# one used instead. Upstream commits the y.tab.c file so doesn't
# have that problem.
# Not-yet-released-patch - replace alblue.bandlem.com line with:
# curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0  
curl http://alblue.bandlem.com/bash32-053.patch -k| patch -p0
cd ..
sudo xcodebuild
sudo cp /bin/bash /bin/bash.old
sudo cp /bin/sh /bin/sh.old
build/Release/bash --version # GNU bash, version 3.2.53(1)-release
build/Release/sh --version   # GNU bash, version 3.2.53(1)-release
sudo cp build/Release/bash /bin
sudo cp build/Release/sh /bin

rm -f echo

env X='() { (a)=>\' sh -c "echo date"; cat echo



Step 5:

Update HomeBrew or MacPorts:

HomeBrew:

Copy and paste the courier font one line at a time into the terminal window:

brew update

brew upgrade bash

MacPorts:

Copy and paste the courier font one line at a time into the terminal window:

sudo port selfupdate

sudo port upgrade bash

Step 6:

Be happy this kind of thing rarely happens to Linux and Mac OS.

I got most of the script from the link below but there were a couple of bugs that needed to be fixed:

http://apple.stackexchange.com/questions/146849/how-do-i-recompile-bash-to-avoid-shellshock-the-remote-exploit-cve-2014-6271-an/146851#146851