Wednesday, February 21, 2018

My second time getting LASIK

I first had Lasik eye surgery in March of 2003.  I was nearsighted in both eyes, both being -5.25 strength.  I had the procedure done at the Lasik Vision Institute in Chicago and was very happy with the results.

About 3 years ago, the vision in my right (dominant) eye started to weaken.  An eye exam showed it at -0.75 while my left eye has stayed at the same 20/20 strength.  So, I decided to fund my FSA and get Lasik again in just my right eye.

Technically I need PRK because the original Lasik procedure involved cutting a flap in my cornea that is peeled back for the laser and then closed again to heal.  Recovery is very quick, I remember seeing ok by the next day.

PRK involves wiping away of the cornea to use the laser, using a protective contact lens to cover the opening, and then allowing it to grow back over the next few days.  Recovery is much slower this way and that's what this blog is going to highlight.

Day 1 (surgery day)

I'm dropped off in the morning and after some clerical stuff and drops I'm taken to a prep room to talk to the eye surgeon and take anti-anxiety medication.  Shortly after I'm taken to the surgery room which is cold and dark.  I lay flat and more drops are applied.

The dr. starts lightly pressing on my eye with what seems like a little metal hook tool, similar to what a dentist would use.  He asks if I can feel any pain, I reply no.  He then proceeds to wipe the tool back and forth along my eye, effectively wiping away my cornea.  This is a hard sensation to describe, it's no painful but it is a little uncomfortable.  I had to remind myself that I've done this before and it's no big deal.  After about 20 seconds of that, he stops and starts to use the laser.  Again, no pain but there is a burning smell that is unmistakeable.

Finally a protective contact lens is placed on my eye (the dr. was great about explaining what he was doing during each step) and I was done.  I head out to the waiting room to wait for my ride.  Since my eye is so dilated, anything with light is really fuzzy to look at but I don't have a hard time keeping my eyes open.  It is suggested to go home and fall asleep immediately, which I do.

Day 2

For the most part, it doesn't seem like my vision was any better or worse yet.  Keeping my eyes open is still not a problem, especially when using the blu-blocker sunglasses provided.

Day 3

Post-op follow up appointment.  Things are looking good according to the dr.  She mentions that the dilation should be gone in the next 3 days.

I attempt to go to work, which actually turned out to be a mistake.  The light is hard for my right eye to handle while on the road so I keep it closed while using only my left.

Once I'm at the office, the ceiling lights are too much to bare, even with sunglasses on, so I finish up the day in a dark office room with monitor brightness turned all the way down.  My pupil is still largely dilated so the fuzzy halo effect around lights now seems worse.  I have to close my eyes every now and then and tears fill up my eye often when the light gets overwhelming.

Day 4

Did I mention that the dr. said Days 3, 4, and 5 would be the hardest?  This is definitely proving to be true.  I decide it'd be best to work from home these next few days.  My vision actually seems worse this day, not sure if it's because of buildup on the contact lens or the dilation.

Day 5

Things seem to be exactly the same as Day 4.

Day 6

Today is the day the protective lens comes out.  According to my eye exam, I can read letters off the 20/30 line.  Numbing drops were put in before the lens was removed, but even with those, there was still some very brief discomfort as the dr. used tweezers to remove the lens.

Dilation is taking longer than I'd like to go down.  At least the office lights no longer hurt my eyes.

Day 10

Dilation has finally gone down to almost normal.  The sharpness of vision in my right eye is at least as good as my left now.

Day 14

Dilation is completely gone and the sharpness has surpassed my left eye.  I'm able to see highway signs from really far away with my right.  In fact, it now feels like my left eye is the weak one in need of surgery.  I still get occasional headaches as my body is getting used to my right eye being the sharper, dominant one.

I'm extremely happy with my result and now I'm thinking of getting my left eye redone.

Sunday, August 9, 2015

Using ES6 / ES2015 with Meteor 1.1.0.3

Mission

Meteor 1.2 is set to ship later this summer.  It will have built-in support for ES2015 (along with support for Angular and React).  I'm really looking forward to this release but I want to start using ES2015 today.  These are my tips on how to get things (mostly) working.

Meteor packages

Most documentation will tell you to add the ecmascript package but it doesn't seem to install just yet.  The following error message appears on both Windows and OSX:


Instead we'll add the Babel package:

meteor add grigio:babel

With Babel (pronounced bay•bull) we can now use ES2015 syntax in our project with the caveat that we have to suffix our files correctly.  The babel package is going to look for files that end in either .es6, es6.js or .jsx).

Using classes

Normally when you declare a class in ES2015 the syntax looks like this:
class Gamer {
   ...
}
Due to the way Meteor bundles files and how variables are scoped you have to this:
Gamer = class Gamer {
   ...
}
Then you'll be able to new up a Gamer object in other files.

Some gotchas

I haven't tested out all ES2015 features but one of the features I couldn't get to work is getters and setters.  At this point, I've just accepted that it's not supported until Meteor 1.2 is released.
class Gamer {
   get name() { return this.name; }
}

Testing with Velocity

Velocity is the defacto test runner to use with Meteor. Depending on which 'reporting' package you install for it, you'll see the results of your tests either in the console or in the browser.  Read more about Velocity here.

There are 2 packages we'll want to install
meteor add sanjo:jasmine
meteor add velocity:html-reporter

I write my tests using Jasmine.  When you use Velocity with Jasmine you need to group your tests under the correct folder structure (under the root of your app):
  1. tests/jasmine/client/unit
  2. tests/jasmine/client/integration
  3. tests/jasmine/server/unit
  4. tests/jasmine/server/integration
It seems that only tests found in 1 and 2 above have support for Babel.  Server tests will not work with it.


Hopefully this will help some of you folks that are hoping to use ES2015 features within Meteor and have hit a wall recently.  I know I did.




Wednesday, July 8, 2015

Getting Angular's $http.post method working with Web API

By default, when you deploy a .Net Web API project, you are not allowed to make cross site requests to it from, say, an angular application.  The browser will prevent the call from happening because your api needs to send the proper response header to allow the call to be made.

In order to enable it, you need to make a modification to your web.config file.  Enter the following somewhere between your system.webServer tags:
<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
    <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
  </customHeaders>
</httpProtocol>
Also, in your ApiController, add an empty Options method (some browsers issue this command to check the validity of a cross origin request):
    public class DataController : ApiController
    {
        public void Options() { }
    }


Friday, January 30, 2015

Getting Docker working on Windows 8.1

1. Installation

Download and run the latest installer:  https://github.com/boot2docker/windows-installer/releases

Pick all 3 items to install unless you know that you already have them on your machine.




2. Enable virtualization

Reboot your computer and go into the BIOS settings.  Find and enable Virtualization which should look something like the image below:




3. Make sure VirtualBox can launch the VM

Launch Oracle VM VirtualBox and select the boot2docker-vm image.
Click Settings -> System.
Make sure the RAM is set to 4096 MB (or 2048 if you can't give it that much).
Click the Start button to start the VM and see if you get any errors.




4. Launch Boot2Docker

If everything went well you should be prompted to enter the password for docker@localhost.  The password is 'tcuser'
For some reason, I was prompted repeatedly until I reached the linux console.


Eventually you should reach the console prompt, then you're ready to start using Docker!




For further reading go here (by maximheckel) for details on running docker and sharing folders (scroll down to Running Docker containers):

http://blog.tutum.co/2014/11/05/how-to-use-docker-on-windows/


Tuesday, November 11, 2014

Thoughts on Meteor - Part 1: Documentation

Just a few months ago I told myself that I was going to start looking into React.  It's been gaining a lot of popularity and boasted a new architecture and philosophy on binding data to views.

Right around the same time I started reading that Meteor was nearing its 1.0 release.  I had watched the video on Meteor and tried out their demo for what seemed like a year ago, so it was interesting that they were approaching this major milestone.

As I read more about the features via the Discover Meteor and MeteorHacks newsletters I really got sucked back into it.  I bought the Discover Meteor book and am working my way through it.  Between meteor.com and atmospherejs.com there is a good amount of reading that you can do before you get started using it.  I'm still working my way through the docs seeing if I can get a better handle on the underlying technology and patterns used so that I can better explain to my fellow developers what's going on under the hood.

I definitely recommend you do the following for your first foray into Meteor:

1. Go to meteor.com and create an account
2. Run through the Tutorial on meteor.com (only works for OSX and Linux, I'll cover an alternative to this in the next blog post)
3. Read the Subprojects page on meteor.com to learn more about the components that make up the Meteor project.  Some of these links will point to atmospherejs for the project's readme.
4. Check out DiscoverMeteor.com and determine for yourself if you want to buy the book.  It was worth it to me so far.

Wednesday, August 20, 2014

Creating Visual Studio item templates to increase productivity

Goal

In this post we'll look at extending Visual Studio by creating an Item Template to help with code generation.  In the past I've relied heavily upon code snippets for generating chunks of code but item templates help more so when I need to generate an entire code file or several code files at once.  Also, parts of the file will need to be dynamic in that I want to give the file a custom class name.

These instructions are for use with Visual Studio 2013.


Prerequisites

Make sure you have VS 2013 SDK installed.
Install the SideWaffle template pack extension.


Steps

1. Create a new VSIX project.

2. Open the Package Manager Console in Visual Studio

3. Execute Install-Package TemplateBuilder –pre

4. Create a folder named ItemTemplates at the root of the project

5. Under that folder create a folder with the name you want to show up in the Add Item dialog box (a good choice would be your company name).

6. Right-click the new Company folder (or whatever you named it) and click Add -> New Item.  Select the SideWaffle Item Template and give it an appropriate name.

7. Add the actual file that you want to be created by your template into this new template folder (same level as the readme.txt file that was added).  Optionally, if you want more than 1 file to be added just add those also.  If you want them to be added to subfolders then create those subfolders here to match.

8. Inside the Definitions folder that it creates will be 4 files with a .vstemplat- extension.  Rename all applicable files for your template to have a .vstemplate extension.

9. Edit the .vstemplate file(s) and set DefaultName to the actual filename that you want shown in the dialog window when it asks for a filename to save to.  Also, change the Name and Description fields accordingly.

10. In the same file edit the ProjectItem element by removing readme.txt from it's contents.  Replace it with the name of the file you added in step 7.  If you're adding more than 1 file then just copy and paste this line for every file needed.  If the file is in a subfolder then make sure to put the folder name first in the content like this:

<ProjectItem ReplaceParameters="true">css\site.css</ProjectItem>

(For info on replacing parameters, skip down to the last section)

11. Edit the source.extension.vsixmanifest file at the project root.  Make sure to edit the Install Targets to the correct version(s) of Visual Studio that you want.  For me I edited the version range to be [11.0, 12.0].

12. Edit the Metadata and put values for Product Name, Author, and Description.

13. Now build your project and go to the Debug folder in File Explorer and you should see a .vsix file there that you can deploy.  If you just want to test the extension then run it in Debug mode and it will launch a 2nd VS instance that will have the Item Template available.


Replacing parameters in template files

Let's say that you're adding a new CSharp class from this template and you need to know the name that the user entered.  You can put tokens in your source file that will get substituted.  FYI, the documentation that I found on MSDN didn't work for me for some reason.

I ended up using these two tokens:  $fileinputname$  and  $rootnamespace$

Intellisense will complain but you should still be able to build the solution.  Here is what my sourcefile.cs looks like:
namespace $rootnamespace$
{
    public class $fileinputname$
    {
        public $fileinputname$()
        {
        }
    }
}

Wednesday, August 6, 2014

Addressing the problem with npm install jest-cli on Windows 8

This post is specifically about trying to get Facebook's Jest testing library working on a machine running Windows 8 (or 8.1).  I also happen to have Visual Studio 2013 installed (and just this version).


Install Python

I will assume that node and npm are already up and running on your machine.  You need to have Python 2.7.x installed.  Version 3 is out already but we need 2.7.  During the install you have to manually enable the option that puts Python in your Path environment variable.


Install jest-cli

Open a command prompt in your project root and type:
npm install jest-cli --save-dev --msvs-version=2013

The reason you need the --msvs-version option is that the contextify node package will need to be built using VS build tools and it will look for 2010 by default.  Be sure to specify the correct version on your machine.  Credit goes to Kevin Griffin for his article on this.


If all goes well you should see no errors.  Here is what my package.json file looks like afterwards:

{
  "name": "reapcast",
  "version": "1.0.0",
  "description": "smart podcasting",
  "devDependencies": {
    "jest-cli": "^0.1.18"
  },
  "scripts": {
    "test": "jest"
  }
}