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:

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