Tuesday, December 22, 2015

Convert .a png to .icns for Mac App Bundle

Here is a bash script to convert a .png to .icns for Mac App Bundle. Usage:

pngtoicns.sh image.png AppImage

and it will generate AppImage.icns

#!/bin/bash

INFILE=$1
OUTFILE=$2

mkdir $OUTFILE.iconset
sips -z 16 16     $INFILE --out $OUTFILE.iconset/icon_16x16.png
sips -z 32 32     $INFILE --out $OUTFILE.iconset/icon_16x16@2x.png
sips -z 32 32     $INFILE --out $OUTFILE.iconset/icon_32x32.png
sips -z 64 64     $INFILE --out $OUTFILE.iconset/icon_32x32@2x.png
sips -z 128 128   $INFILE --out $OUTFILE.iconset/icon_128x128.png
sips -z 256 256   $INFILE --out $OUTFILE.iconset/icon_128x128@2x.png
sips -z 256 256   $INFILE --out $OUTFILE.iconset/icon_256x256.png
sips -z 512 512   $INFILE --out $OUTFILE.iconset/icon_256x256@2x.png
sips -z 512 512   $INFILE --out $OUTFILE.iconset/icon_512x512.png
cp $INFILE $OUTFILE.iconset/icon_512x512@2x.png
iconutil -c icns $OUTFILE.iconset
rm -R $OUTFILE.iconset

Thursday, December 17, 2015

3D Printers

I've been doing a fair bit of 3D printing lately which has kept me busy and is why this blog hasn't been updated in some time. But I'm now at a point where I'm going to start talking a bit about 3D printers and my experience. It's a big industry and growing rapidly so it takes a bit to get your head wrapped around it.

Most of my experience comes from using friend's printers, but nothing comes even close to being thrown into the deep end and having to use one all by yourself. I originally wrote this post going over my decision making process, but I actually purchased a printer and it was defective so I went back and rewrite this post including my new decision making process for my second 3D printer including some of my hands on experience with that printer. At work we also have a few different machines. So I researched just about everything else out there but mostly the Ultimaker 2, Zortrax M200, Lulzbot Taz 5, Type A Machine Series 1 and Fusion3 F306 as well as a few dozen others. My budget was no more than $3000. I wanted to get a good printer and not one that I'd want to replace in a year.

Every 3D printer design has tradeoffs, and reviews are only half the equation. So here's what I've found and what I decided to go with. The things I decided to look for are:

1. The ability to level the build plate.
2. Heated plate.
3. Simplicity of the extruder. Some are very complex and not easy to clean if filament gets stuck (and it will get stuck).
4. Print speed (this is extremely tricky and has many tradeoffs including resonance).
5. 3mm filament instead of the more popular 1.75mm (this is a new requirement since my returning of the printer I originally purchased).

I decided against the PrinterBot because it's just too small and the quality of prints I've seen come off it aren't up to what the other printers produce. But I do like the design and price! It is a very solid printer. You really can't go wrong with this printer if the size is big enough for what you want to print.

The Zortrax M200 seems to be the world's best kept secret it seems. It's half Ultimaker 2 and half Type A Machines Series 1. The stepper motor for the filament lives on the print head so technically it's a little slower to print but as I wrote earlier about the Ultimaker 2 I prefer this design given the tradeoffs. The problem with the Zortrax is I just don't know enough about it because it is the world's best kept secret.

The Ultimaker 2, which is what I have the most experience with, while a good printer it has some serious flaws that only show up after using it for some time. No review will find these. The print head moves in X and Y while the build plate moves down Z as the print is assembled. To increase print speed the Ultimaker 2 reduces the weight of the print head by moving the stepper motor that moves the filament off the print head and onto the frame by using a Bowden tube and using the filament from the roll to the print head. The Bowden tube is made of teflon which is slippery and has a higher melting temperature than the filament which is good because when the filament gets stuck you can simply get a blowtorch, stick some new filament in the tube melt the stuck piece and pull it out. Don't cut the tube like others have done because you'll just have to buy a new $30 Bowden tube. So while this is a slick way to make the print head go faster (less mass means easier to throw the print head around at faster speeds), it has the side effect of requiring 3mm filament which I used to not like but now I prefer. But there is another side effect. The print bed is cantilevered and isn't super solid so when it goes down fast it oscillates making the print not come out so good.  The only way to counteract this is to print slower. So what's the point of the print head being able to go faster? Well there are a couple reasons, balance of the print head is key. Without an a stepper on the print head the center of mass is easy to get accurate and right over the extruder tip. The Ultimaker 2 has a screen and an SD card but no wireless printing or USB to be connected to a computer. The SD card is nice because I'd prefer not to be tied to having a computer drive it, but requires a screen so originally I didn't care about the screen and thought it'd be good to have wireless printing but I've now found that you need to have a computer right next to the printer if you don't have the ability to start prints from the printer itself. Actually mainly for diagnosing problems and to extrude small bits of filament when swapping filament or cleaning the print head. The build platform is 8in x 8in x 8in which is fairly big but not huge but pretty standard. The Ultimaker 2 is a bit difficult to work on, but it is a pretty good printer overall.

The Lulzbot Taz 5 was actually my runner up choice but was not my first choice. The sales rep at a Santa Clara 3D printer show was right. He said "sure, you can go with a different brand, but you'll eventually be back looking at the Taz". He was right. The build plate moves in the Y direction while the print head moves in the X and Z. But the build plate is heavy and as the print gets larger it gets heavier. Common sense says this large amount of mass takes a lot of work to move and if it isn't quite dry the print can move. Just a slight move will cause an uneven print. The only way to counteract this is to print slower. Other than that I think the Taz 5 is a great machine and like I said was my runner up. I like that it's open source and has a huge community around it. It's print volume is a little bigger than the Ultimaker 2 at 11.7in x 10.8in x 9.8in. Very odd size. A friend of mine was in the market for a 3D printer so I shared my thoughts and he decided to go with a Taz 5 and has been printing right out of the box without any problems. There is a slight issue with the weight of the print head and when the print head is at X = MaxX / 2, the print head moves about 100 microns about (1 layer or half a layer depending on layer resolution). It isn't a huge problem, but I think it's the biggest issue I have with the Taz 5 at this point. There are a few solutions, wait until the Taz 6, they are putting larger rods on the X axis, and there are a few solutions users have published (http://www.thingiverse.com/thing:866604). One thing I really like about the Taz 5 is it uses a 24volt power supply. That means the print head heats up fast! They also use very high gauge wires to the print head which is important.

Type A Machine Series 1 Pro is what I decided to get, and unfortunately had to returned it. It prints the biggest of all these at 12in x 12in x 12in, and all the specs look great. At first I thought the cantilevered print bed would be a problem but it's super solid. The printer has wifi and a web server instead of an SD card and display. However, my experience of actually using the printer for two weeks changed my opinion and I would only buy a printer for my needs if it has a display, SD card and controls on the printer. I'll elaborate more on this later. I visited their facility since it's near Oakland and only an hours drive away. First off, they are super nice, but I will tell my store exactly how it happened. I spoke with Type A Machines and they had a two or more month waiting list. Alternatively they had a refurbished unit that I could get right away. I really wanted it sooner than later because of my daughter's Maker's Club and a few projects I'm working on so I went against my better judgement and got it. I never buy refurbished and I never will again. The $500 savings tipped my decision from the Taz 5, brought the price under my budget, and the larger build volume was important for one thing I wanted to print and I really didn't like at the time how the Taz bed moves. It's all engineering compromises but now after working with the Type A I prefer the Taz design. So, the printer shows up, I open it up and there are no directions besides this way up sign and don't grab here. At this point there should be directions right on top for what to do and I think they'll fix this but I had no directions, so I cut the box and slid the printer out. It was well packaged but wasn't difficult to get it out of the foam protection armor. I set it up, opened up the box on the side with the build plate but had no instructions, power cord or wifi antenna. I looked around on the website for instructions but couldn't find any. The wifi antenna and power cord were in another box but under the print bed wedged in. I finally figured out that I had to manually twist a knob on the back to raise the print bed to get the box out. After opening this new box and finding no directions I dug around and finally found them. The instructions turned out where shoved down the size of the box. I skimmed through the instructions to figure out how to connect to the printer since I had already set it up. And here's where things went really south but I'll just point out the highlights so this isn't a 10 page post. I had no filament. The filament I ordered from Type A didn't ship. They did a next day air but it arrived 2 days after the print. A friend however had some 1.75mm ABS, so I did a quick level of the bed and went to print. My workflow is to have my computer inside the house and the 3D printer in the garage. I could bring my laptop out to the garage but that's less than ideal. I ended up using my iPad, but the web browser interface is extremely clunky with the iPad. In order to use this printer you need a computer right next to it. This is why I prefer the SD card design. Having to require a computer is either handy if you want the printer sitting on your desk but if you want it in the garage or somewhere the order from the melted plastic won't bother everyone in the house then you need another computer adding to the expense of the device. So the prints were turning out really odd. The print head would never go to X = 0. I'd have to restart the printer, physically move the print head and turn it back on. About a 10 minute procedure. Also the loading of the model on the iPad took forever, but I couldn't start a print from my computer because you need to be right next to the printer and even more so for me since all the problems I had. I also found out that that the filament would get tangled up. To make a long story short, there was a Bowden tube in the box but because of my problems with the directions I never noticed it. I saw it but thought it was a small piece of sample filament. Also, all the photos of the printer on the website or manual do not have this Bowden tube attached. There's one little sentence in the directions buried in a long paragraph that describes it. I ended up getting my own Bowden tube to avoid the tanglement but it still has major problems because of the range of motion of the print head, 12" in both X and Y and it can move fast! I ended up giving up on the ABS since it stinks! So in addition to the print head not returning to X = 0, turned out there was dust and hair in all the fans that started blowing out on my earlier prints, one of the belts was worn, the two rail slides were rusted and the L bracket holding the fan was bent. Not so refurbished like new up to the most recent spec of the Series 1 2015 model as they claimed. Turned out the rusted rail slides had been replaced in newer units with a stainless steel version but mine didn't get that fix. I also ran into some sort of head clog after very little printing that I could never figure out and Type A Machines tried but after 20 minutes gave up and blamed it on the fact that I ran about 12" of ABS through the printer which apparently isn't supported contrary to all the specs supporting it and verbal approval from multiple people on my visit saying it can print ABS. I guess it isn't in their "supported" filament list and "voids the warranty". It extruded fine for 2 days after the use of ABS so I don't think that was the problem. To finish up the story, I personally delivered the printer to Type A, returned it, and spent over an hour going over all the problems that I had. Eventually 6 days later of going back and forth I got a refund since that is their policy (good policy and good to know they honor it), but since it wasn't my fault but a faulty unit I requested a refund of the unused filament and the shipping that I paid to get the printer. It was a bit of a hassle to be honest but they did honor everything. Last thought is I know the Type A uses a 24volt power supply, but the print head doesn't heat up as fast as the Taz 5. I think this is due to the ribbon cable they use to supply power and data to the print head stepper. I don't see how the tiny wires in the ribbon cable can support enough amps to heat the print head up. There'd be a lot of waste in the ribbon cable at any rate.

So, I prefer 3mm filament because it has more pressure and doesn't tangle as easily. I prefer the print bed to move in the Y direction rather than the Z so the movement of the print head is simpler. I prefer the open model of the Taz because if something doesn't work you can modify it. I'm ordering a Taz 5 and plan to upgrade or modify the X axis to the Taz 6 version or some other modification at some point. I also plan to build a housing for the printer so it doesn't smell.

Last thought, the Type A Series 1 has a very small footprint but is very tall. The Taz 5 isn't as tall but has a much larger footprint because the bed moves.

Wednesday, December 16, 2015

How to Stop Your Cursor from Getting Bigger in OS X El Capitan

Ever since installing El Capitan I've noticed the mouse cursor getting bigger once in a while. It thought it was a bug at first but, it isn't. This article will show you how to turn it off:

http://www.tekrevue.com/tip/cursor-bigger-shake-to-locate-el-capitan/

Thursday, November 5, 2015

How to Move Your iTunes library to an External Drive

iTunes can take a lot of hard drive space, especially for a laptop with an SSD. But if you get an external drive, you can move your iTunes library to the external drive.

1. Copy the entire iTunes folder (~/Music/iTunes) (and all its subfolders and files) to the other drive.
2. Open iTunes while hold down the Option (alt) key (shift on Windows).
3. A dialog will show up, click "Choose Library..." and selected the iTunes folder you copied to the other drive.

Wednesday, October 21, 2015

Great Scott!

Back to the Future day is finally here!

Monday, August 31, 2015

iOS 8.4.1


I mentioned a while back that iOS 8.4 had a few bugs in it in this post. Those issues have not been solved and in fact, there appears to be a few on the iPhone having to do with Location Services and geofences which drain the battery. After the update, no app has a geofence according to Location Services, but if I turn off "Location-Based Alerts" (Privacy | Location Services | scroll down to System Services, and turn off "Location-Based Alerts") then the icon next to the battery goes away and it's all good.

Monday, July 27, 2015

OSX Web Server Folders

Something that I always forget because I don't run a web server on my Mac very often is when I go to localhost I see something different than what I expect. localhost is located here:

/Library/WebServer/Documents

While if you are editing ~/Sites then you want:

http://localhost/~yourusername

Wednesday, July 22, 2015

iOS 8.4 iPad Air 2 rotational & wake delay issue work-arounds

There are two iPad Air 2 issues with iOS 8.4 that I personally find pretty annoying and apparently so do others as you can see from this discussion on the Apple message boards.

1. Screen rotation does not work
When running on the iPad, if I rotate the screen before unlocking then screen rotation does not work. The best work around is to disable Reduce Motion:

Settings | General | Accessibility | turn off Reduce Motion.

The screen will now rotate correctly. I really don't like Reduced Motion but not rotating is even worse. Unfortunately battery life suffers.

2. Long wake delay
The only current work-around for the wake delay is to use a Smart Cover/ Smart Case (magnetic wake). I don't use a smart cover so I hope Apple fixes this soon.


There is some additional information in the message on the Apple message boards.



Monday, July 20, 2015

Small Changes in Windows 10 not for the better

There are quite a few changes in Windows 10 and I have hardly uncovered half of them. Many are for the better and many are well less than idea which is cause the majority of the people a bit of a difficult time. I thought Microsoft would have learned from their mistakes before.

Here is the right click menu on the Recycle Bin.


Notice that the "Empty Recycle Bin" is the third item down, when in all previous versions of Windows (I'm not counting Windows 8 because I don't think many people count that as a version) it was the second item.

Many years back Microsoft tested a great idea to reorganize menu items based off use. And by great I mean it was a really bad idea. Research ended up finding that people tend to remember location more than reading the words. Think of it as muscle memory.

There are many other such subtle menu items that have changed location for no apparent reason other than a new feature. A few of them I'm find with, but if Microsoft hopes to get everyone on board with Windows 10, and I think they have a really good chance of success, they need to not change the user interface very much between iterations of Windows.

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.