Wednesday, June 24, 2015

Disable Skype Auto Start

Skype starts automatically and it is pretty trivial how to disable it but you have to know how and that's the key which is why I'm writing this. It doesn't show up in the Registry under Software | Windows | CurrentVersion | RunOnce.

So here is how to disable it:

Launch Skype and login. This is the key step because if you don't login the options are different. Go to the Tools menu and choose Options, under General Settings you'll see the checkbox for start Skype when I start Windows. Uncheck that and you're good!

If you don't have a Skype account, then I think you're out of luck because I've used ProcessMonitor to monitor the registry access and haven't been able to find a manual way to disable this.

Monday, June 22, 2015

Enums in Bash

I find that I use a lot of bash scripts. Using cygwin on Windows, Mac and Linux they are cross platform (for the most part). One feature lacking in bash is enums, but you can simulate them. I ran across this StackOverflow post and there is a nice comment about enums in bash, but it isn't complete.

#!/bin/bash

STATES=(INITIAL DEFAULT_CS_SETUP CREATED_CS CHECKED_OUT_DIR MKELEMENT_FILE CREATED_BRANCH CHECKED_IN_DIR COMPLETE)
tam=${#STATES[@]}
for ((i=0; i < $tam; i++)); do
    name=${STATES[i]}
    declare -r ${name}=$i
done

echo get the INITIAL state
echo ${STATES[$INITIAL]}

echo get the next state from CREATED_CS
echo ${STATES[$CREATED_CS+1]}

echo list elements from CREATED_CS to the end
for ((i=$CREATED_CS; i < $tam; i++)); do
    echo ${STATES[$i]}
done

echo list elements from CREATED_CS to CREATED_BRANCH
for ((i=$CREATED_CS; i <= $CREATED_BRANCH; i++)); do
    echo ${STATES[$i]}
done

Often times I want to create an empty enum and add items to it. So here is my example of creating an enum type, OPTION_STATES, defining the enum values and adding an item to it and checking for it later.

#!/bin/bash

# Define enum type.
OPTION_STATES=(OPTION_ONE OPTION_TWO OPTION_THREE)

count=${#OPTION_STATES[@]}
for ((i=0; $i < $count; i++)); do
    name=${OPTION_STATES[$i]}
    declare -r ${name}=$i
    
    if [[ $DEBUG == true ]]; then
      echo $name $i
    fi
done

# Create instance of enum type, yes this is a hash table.
OPTIONS=()

# Put an element into the instance.
OPTIONS[$OPTION_ONE]=$OPTION_ONE

# Check if that element is in the instance.
if [[ ${OPTIONS[$OPTION_ONE]} == $OPTION_ONE ]]; then
  echo "woo hoo"
fi

Tuesday, June 16, 2015

Desk Ergonomics - Every Diagram on the internet is wrong!

I ran across the following image recently from the article here.


The image is courtesy of Ergotron but I never found it on their website or I would have provided a link other than that one. On a side note, I have tried to use an Ergotron, but it didn't work for me. I'm too tall for one, two it didn't stay clamped to the desk, three the springs were too weak for my monitor, four it bounced when I typed. For someone else it might work out though. I know other people that like them. I think they are shorter and use a smaller monitor.

Anyway, back to my point. I honestly can't stand diagrams like this that have been floating around as long as I've used a computer for the correct ergonomic positioning. There are so many things wrong with this from a movement and ergonomic perspective it isn't even funny. Anyway, I'm going to start writing about this in future articles, but I wanted to point out a couple major issues with this diagram for "ergonomic perfection".

1. The legs are parallel to the floor. Not good. You want your thighs slightly sloped toward the knee. Same goes for the elbow. However sloped forearms makes using a mouse difficult, but I have a solution for this that I will post about in the future. The correct angle for legs and arms is 120 degrees. This isn't always achievable but that is as close to neutral as one can get without standing with their arms at their side and palms facing their legs.

2. The height of the monitor is incorrect. Monitor placement is an extremely complicated subject. It depends on your size and the size of the monitor, and most importantly, where on the monitor you look the most. Like I said, it's complicated. Your eye muscles are very strong in holding your eye up so you can look down, but are much weaker when looking up, so you certainly don't want to be looking up too much. I will write a future post about monitor placement because this is so important.

Monday, June 15, 2015

Rasperry Pi - How can I fix broken sudo - sudo: parse error in /etc/sudoers near line 29?

I recently got a Rasperry Pi and I've googled for many little oddities so I figured I'd write them up here on this blog to save anyone else out there some time.

I decided to create a new account it administrative privileges. So I create a new account for myself and enable sudo for it.

sudo adduser chris

Then add a line to the /etc/sudoers like so.

sudo visudo

This will open the /etc/sudoers file in nano, add a line just like the one already there for the pi user.

chris ALL=(ALL) NOPASSWD: ALL

However, I spelled PASSWD correctly. And consequently get:

sudo: parse error in /etc/sudoers near line 29
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Can't shutdown, can't edit /etc/sudoers. So I thought I was stuck. Looking online if you have Linux you can put the SD card in your card reader, and mount the file that is rasparian image and edit to your hearts content. On Mac you can sorta do it with Fuse-ext2. Here is the best set of directions for that http://pi.gbaman.info/?p=328. But, I decided to try something I hadn't seen before:

logout

Then I logged in with "root"! Now I could edit /etc/sudoers all I wanted.

Friday, June 12, 2015

Windows 10

I just installed the Windows 10 preview in a VM on my Mac. So far so good! I think this is going to be a pretty good release of Windows.


Thursday, June 11, 2015

iOS Privacy Settings

Here are a couple privacy settings that I like to make changes to and I'm documenting here so I can point friends and family to this post.

1. Settings, Privacy, scroll down to Advertising, turn "Limit Ad Tracking"

2. Settings, Privacy, Location Services, scroll down to System Services, Frequent Locations, turn it off.