It's Brent

My Bias Lighting Setup

Posted on September 22, 2014

As a programmer I’m always searching for things to make my computing experience better, both in terms of health and productivity. Few things I’ve done have made as much of an impact as my bias lighting setup on my 27” iMac in the picture below. The benefits from the bias lighting extended far from the office as I never realized how bad the computer screen was to my eyes. Little did I know I was suffering from issues with Computer Vision Syndrome.

Bias Lighting on 27" iMac

For the longest I suffered from headaches, eye strain, and dizziness. I just assumed this was part of me, or I always tried to equate it to drinking too much caffeine the day before. There wasn’t a week that would go by that I didn’t have to take Excedrin or motion sickness tablets. Over a couple of months went by before I realized I wasn’t downing pills anymore and how much better I felt.

Bias lighting can help with the reduction of glare and reflection on your screen by moving the light to behind your screen. Especially with the lack of matte options on Apple displays. Which resulted in my not having any lights on because I couldn’t see my screen. Even things you wouldn’t expect like “colors and black levels appear richer than they would in a totally black environment”.

After over a year of using bias lighting I have far fewer headaches. My eyes feel less tired at the end of the day. Light doesn’t hurt my eyes as much anymore, even the bright Louisiana sun. It’s easier to work longer periods of times when my office is dark, whether at night or when it’s overcast outside.

My Setup

While I prefer the multicolor Dioder setup as the white is much cooler, you can find the plain white set which is much warmer at Amazon / Ikea. Antec offers quite a few solutions as well that are strictly for bias lighting. Like this larger set for use on a TV, or a USB powered set.

Note: Typically I work mostly during the day, this picture was taken at night to give a better illustration. The window in front of my computer is a little misleading as it’s behind a small tree, and there is never any direct sunlight coming through it.

Fixing Raspberry Pi Wifi from Dropping

Posted on May 22, 2014

I noticed some issues with my Raspberry Pi dropping the Wifi and not reconnecting. After some tinkering I was able to get it fixed. I am using the Edimax EW-7811Un network adapter, which works awesome for it’s size and price. I originally created a script that checked network status and tried to bring the network back up that ran on a cron job, but it never worked properly. Here is the following solution that I got working.

First thing is to go into the /etc/ifplugd/action.d/ directory and move the ifupdown to a backup file (ie ifupdown.original). Then use the following command to copy the ifupdown from wpa_supplicant.

cp /etc/wpa_supplicant/ifupdown.sh ./ifupdown

The next thing is to disable power management on the Edimax wifi adapter. Power management will cause the device to sleep if it is not in use, but sometimes not wake up. To check if it is on, run the following command. If you see a 1 printed, then power management is turned on.

cat /sys/module/8192cu/parameters/rtw_power_mgnt

If you that command returned a 1, then either create or modify the file /etc/modprobe.d/8192cu.conf using vim or whichever editor you are familiar with. In that file, add the following text.

# Disable power saving
options 8192cu rtw_power_mgnt=0

After you have done all this, reboot your Pi. Once rebooted and run the command to check your power management, you should get a 0. This has solved most of my issues with the Wifi not working. My only remaining issue is a baby monitor that interferes on the same frequency.

Update to iOS Html to Pdf Conversion

Posted on April 01, 2013

My previous post on how to convert or print UIWebView / html / url to pdf has generated a ton of traffic to my site. Lots of Google searches hit my site. I have always wanted to update this code, possibly make it easier to use. Even package it up into a single easy to use class.

Today I’m happy to say that I finally did that. I released BNHtmlPdfKit on GitHub just a little bit ago. BNHtmlPdfKit easily turns HTML data from an HTML string or URL into a PDF file on iOS.

One of the things that always bothered me about my previous solution was the generated PDF files looked absolutely horrible because they were rendered at 72 dpi. I also knew that somehow there must have been a way to get the PDF file to generate using the UIPrintFormatter.

Turns out the solution was a tiny hack. Create a custom UIPrintPageRenderer and override paperRect and printableRect. This will cause the UIPrintFormatter to return a pageCount as well as render the document.

Check out the Readme and feel free to fork the project!

In use by:

Hacking My Garage With A Raspberry Pi

Posted on March 29, 2013

Several months ago our Craftsman garage door openers stopped responding to our remotes. I tried everything I could think of to fix this problem, short of buying anything new. Garage door opener parts are expensive, to the point buying new openers is a better option.

After much research I found out that RF interference was the issue. No new remote or logic board was going to solve the issue, even getting new openers wouldn’t solve the issue.

By knowing the wall switches work by simply closing the circuit I set out for a wireless solution that we could control from our iPhones. I wanted to try my hand at an Arduino, but getting WiFi to one isn’t cheap. I then discovered the Raspberry Pi had programmable pins. Getting wireless to the Pi was nearly $80 cheaper, plus it allowed me to leverage languages I already knew. I soon placed an order on Amazon for all my parts.

Don’t forget (assuming you don’t have these lying around):

After getting the parts in I wrote a quick node.js app that serves a single page and also has a 2 backend requests to open each garage. I also quickly wrote an iOS app as well. I’m using Forever to make sure the app stays up. To install node.js and forever from your command line on the Raspberry Pi enter these commands.

$ sudo apt-get install node
...
$ sudo npm install forever -g

The only issue I came across was that the relay I bought turned on when firing low, and off when high. The Raspberry Pi has a default state of low, but the GPIO pins are set to input mode so the relay doesn’t immediately fire until the pin is set for output.

As far as wiring goes, I have 2 sets of door switches. The regular wall switches that came with the openers which are right next to each other, then a separate set of switches wired in another part of the garage. I went to Lowes and got some Alarm Wire (it has 4 wires inside of it), this made me only have to make one run from the Pi. I just connected my wires to the back of each wall switch using the COM and NO ports from the relays. It doesn’t matter how these are connected as you are just completing the circuit. I used this guide in my plans for this project.

Raspberry Pi With SainSmart Relay Wiring

I have open sourced the node.js app at brentnycum/garage-node. I have also open sourced the iOS app at brentnycum/garage-ios, in order to put this on your device you need an iOS Developer Account from Apple. I ended up creating my own fork of pi-gpio to handle using the additional GPIO pins on the Raspberry Pi Model B Rev 2.0 that I used, as I soldered the relay to the board instead of using the pins. The wiring above matches my node app.

To get the node.js app from Github you can either choose to download the zip file, or you can use the simple command.

$ git clone https://github.com/brentnycum/garage-node.git

Once you have the code on your Raspberry Pi, move into the app’s directory and run the npm install command to install the dependencies. npm is the node package manager.

$ cd garage-node
$ npm install

After all the dependencies are installed you can run the app. Once it’s running you will be able to point your browser to your Raspberry Pi at port 3000 (ie http://192.168.1.105:3000).

$ node app.js
or
$ forever start app.js

Be sure to change the config.js file if you are using any different pins.

Additional Reading:

How I Grew As A Programmer in 2012

Posted on December 30, 2012

Learning to be a better, faster, and more efficient programmer is difficult when you act like you already are. To become a better programmer I had to look from the outside at myself and pick apart my flaws that I didn’t see in front of my face. Even after programming for over 13 years there is still plenty of room to grow.

Early Bird Gets The Worm

Since I started working from home with my current job 3 years ago I’ve been a little lazy with my mornings. The morning is my absolute most productive time of the day. At my previous office job I would be one of the first to arrive, after waking up to cook an awesome breakfast. Before this year I was barely able to get to the other side of the house by 8. While I’m still not getting up as early as I’d like, I’m working on it. I’ve gained more of my mornings back, and as a result gained a lot more productivity.

Getting Things Done

I was not a full follower of the whole GTD thing. In fact I’m not an Scrum / Agile type person either. Most of my projects for my job are me working alone, which probably lead to this. In the past my list of things to do has been kept in my head as I have a pretty good memory. Keeping this list in my head has gotten harder as I’ve gotten older and had a kid. The best solution I have found has been Trello. Working as a consultant with many clients and even more projects, it’s difficult to find project management software that doesn’t charge an arm and a leg for a high amount of projects. Trello is currently still free for an unlimited number of projects.

Reading Later

There have been several read it later apps pop up, I immediately skipped these. Earlier in the year Read it Later became Pocket, and went free. I gave it a shot. By pushing all the articles I found during the day while waiting on compiles to reading at night, it felt as if I gained an extra hour a day.

No Amount of Help Is Too Small

Not committing to open source projects has been a weakness of mine. It took me a while to realize that I don’t have to implement full blown features to help out on an open source project, fixing trivial bugs is helpful. There is no patch too small.

Changing of Text Editors

As a programmer changing text editors is a big deal, so for the first time since 2005 I have changed text editors. I switched from TextMate to Sublime Text. I used TextMate to get me through my Bachelors and Masters, then continued to use TextMate into my professional career. So even thinking of switching was a big deal. I tried out Sublime and never looked back, it’s speed and customizability won me over.

Skipping Frameworks

There are tons of frameworks out there that make our jobs much simpler. In the past I’ve been quick to jump to use some frameworks, now I have apps that are fully relient upon code that isn’t maintained anymore. I built several iOS apps using Three20 in years past, now Three20 has pretty much gone of the way of the Dodo. When I originally started using Three20, development was full speed ahead and not slowing down plus Facebook was behind it. Three20 breaks, and breaks a lot these days. I’ve patched things locally, but they are mere bandaids on a large wound. Stripping out Three20 from these apps would take more time than it’s worth. Now I weigh my decisions on using any framework.

Just Buy the $2.99 App

I have a bad habit of anytime that I see an app that I like, I feel I need to build it myself instead of paying for it. Cutting out the features I don’t need and shoving in my own. Now, unless it’s something I can complete in 5 minutes, it’s worth more to spend $2.99 and go about my day.

Side Projects

I have always kept a ton of side projects going, mainly to myself. Most never see the light of day, and most I never use again. I’m now starting a rule that if I can’t open source it or make money off of it, then I will not work on it. I have wasted too many hours of my life that I will never get back on these projects. While every project has been enjoying, there never has been much gain for me or for anyone else.

My Daughter

Having my daughter last September has made me think a lot about the future. I no longer have just myself, or my wife to worry about. I have someone who is dependent upon me to provide everything they need. She has a long ways to go. I want to make sure she has every chance in life, and gets as much education as she can.

To provide these things for her, I can’t help but always be a better programmer than I was the day before.

Switching to Jekyll

Posted on August 15, 2012

After over 5 years of running Wordpress for my blog I’ve decided to hang it up. Wordpress is nothing short of great, but it is overkill for what I need. If you look at my archives it’s not like I have written to the lengths of a novel. It’s taxing to run a database for that. Using Wordpress for client’s sites has been great and offered an easy way for them to be able to change information themselves, and I will probably continue to use it in that regard. So long and farewall my good friend. Welcome to my new friend, Jekyll.

Hopefully this will finally push me to start writing again. I have a few posts that I’d love to write.

Ember Nycum

Posted on September 11, 2011

Ember Nycum

Our daughter, Ember Nycum, was born on September 8th. Check out http://embernycum.com for more pictures and information. Yes, I'm a proud geek dad.

Bouncer on GitHub

Posted on June 11, 2011

Created my first jQuery plugin and put it on GitHub tonight. It’s called Bouncer. Bouncer is a plugin that is designed to enforce rules on your input fields in much the same way a bouncer would serve at a club. With Bouncer you can set which and which type of characters are allowed or disallowed, as well as imposing a max limit of characters.

github.com/brentnycum/bouncer

I have been wanting to learn jQuery a little bit more and thought this was something I could easily see myself using a lot. I seem to only use ready made plugins in my projects and never touch it more than binding events to simple actions. Fork it and improve it if you want, willing to accept Pull Requests.

ABOUT BRENT

I am a software developer living in Shreveport, LA with my wife, daughter, and 2 dogs. Most of my time is spent developing for the web using Rails, on mobile for iOS, and sometimes for the Mac. When I'm not programming I follow the Texas Rangers through the ups and downs of all 162 games.

You can find me on Twitter and Github.

Follow @BrentNycum