Google analytics code

Friday, January 25, 2013

jQuery / Javascript: Detecting orientation and updating for it

I'm getting started on a new mobile project at work. The first step is playing with the orientation of the device and updating the layout so it takes advantage of the available space.

The javascript event you're looking for is orientationchange. You can watch for this with the jQuery on method.

$(window).on('orientationchange',updateDisplay);

The handler method will look at the window.orientation to figure out if it's portrait or landscape.


if(Math.abs(window.orientation) === 90){
// landscape: do stuff
}
else{
// portrait: do stuff
}

You can see an example here.




Saturday, December 1, 2012

iOS : A short list of PDF viewers I've tried

I've spent quite a bit of time thinking about how I can transition to ebooks for programming reference. I've had a e-paper Kindle for three years and haven't purchased a single physical book since. Typically with technical books I end up writing a lot of comments in the margins, adding page markers with notes on them and highlighting everything.

I tried reading PDFs on a e-paper Kindle and it doesn't work well at all. You can't adjust the font size, page drawing is painfully slow and the device isn't built well for my workflow. Kindles are perfect for relaxation reading, but not that great for much else.

I started looking for an iPad PDF reader and there are no shortage of those. I tried quite a few readers and read about a lot of others.

Adobe Reader (app link)
I used this for about a week. The page flipping speed was ok. It had trouble with large PDFs. Note taking wasn't that great and highlighting wasn't much better. For a free app it will get the job done, but I was looking for something better.

PDF Reader Pro (app link)
This started off as a promising app. Highlighting was ok and it the app was responsive. The problem I had was page turning wasn't that smooth. It had trouble zooming in a page and the interface wasn't that great.

iBooks (app link)
You can read PDFs with this and thats about all. No fancy features here.

Kindle for iPad (app link)
Limited note taking and highlighting. Not that great.

PDF Expert (app link)
This is by far the best PDF reader I have ever used. The interface is really clean and well laid out. It supports book syncing with dropbox so all of your comments and highlights are backed up to the cloud.  It also supports syncing with a Webdav Page turning is incredibly fast and supports border tapping and swiping. It will zoom in on a page so you don't see borders and it doesn't clip any of the text. It supports a page grid view so it's easy to find a page if you've lost your place. It supports tabs at the bottom of the app so you can have more than one book open at a time.

I really can't say enough good things about PDF Expert. I was hesitant paying $10 for an iPad app, but it's true that you get what you pay for. Anyone looking for a PDF reader should give this app a try. 


Javascript : Updating the search parameters with window.location

I ran into an issue with Firefox not navigating to a new address I set via windows.location. Here's an example of a url I was trying to set.


window.location = "?page=account&this=that&foo=bar";

There's a property on the location object called search. When updating a partial url this should be used.

window.location.search = "?page=account&this=that&foo=bar";

Friday, August 3, 2012

Flex / ActionScript 3 : Problem with ExternalInterface.addCallback

I'm adding some functionality to an existing Flex project that requires cross talk between ActionScript and Javascript. Reaching from ActionScript to Javascript is pretty easy. This can be done with the ExternalInterface.call. Calling from Javascript to ActionScript was a little tricker. Especially with local development.

You can use ExternalInterface.addCallback to create a bridge for Javascript to talk with ActionScript. There are a few more steps to make sure this is set up properly.

1) Make sure the id and name are the same in each AC_FL_RunContent function. Just changing one won't work. This way document.getElementById should always find the object on the page.
2) Make sure allowScriptAccess is set to always in each AC_FL_RunContent function. This updates the security setting so Javascript can access the Flash object.
3) If you're doing local development make sure to check Always allow in Global Security Settings Panel.

I found step 3 after wasting an entire morning looking around the internet. Without this I kept getting this warning.


*** Security Sandbox Violation ***
SecurityDomain 'null' tried to access incompatible context 'file:///foo/bar/project.swf'

Once you're project is finished you might want to change this back. Not sure what thing on the web wants to break your computer.

Thursday, July 12, 2012

I heard you like popples


Here's something cool my wife is currently working on. She's working from a pattern but decided to make some changes along the way. It's coming along nicely.


If you're into plush toys you should check out her tumblr account.


She also has an etsy account where she posts things from time to time.




Saturday, February 4, 2012

OSX : The tale of too many git clients

I'm starting a project that uses GIT for source control. I have a little experience using git but it has been mostly with github and their client for OSX. It took a little while to wrap my head around the way git works but I finally figured it out.

The only issue with github's client is that it only works with their site. I tried searching google for a few git clients and ran into far too many. I found two really good stack overflow pages that ranked different git clients.


Buried in there is a link to a review site that talks about a lot of the clients and gives good feedback on them.

Mac OS X Git Clients Roundup - shiningthrough

Tuesday, February 8, 2011

Flex / ActionScript : Eclipse autocomplete stopped working

At some point if you're working with Eclipse autocomplete is going to stop working. I've tried hunting on google for a few hours and finally found a solution that worked from the comments in a blog.

You might have either a path to a SWC folder or have multiple SWC files in your project. Remove either all the SWC files from the folder and add them back one at a time, or remove the SWC files from the project and add them back one at a time. They might be causing a conflict that will result in autocomplete not functioning anymore.

Thursday, February 3, 2011

Things my wife made: valentines day cthulhu (shameless promotion)

My wife is a very creative person. She's recently started making stuffed cthulhu dolls. She's making a special type just in time for valentines day. Clicking on the picture will take you to her etsy store for more pictures and details :)

Friday, December 3, 2010

Resize An Existing .vdi Virtualbox Image – EASILY! By Gregory Milby

After installing Virtual Box and getting windows set up I realized the drive was way to small. I tried looking for an easy way to resize the drive but many of them required booting into linux and using a boot manager to copy the contents from one drive to the other.

I finally found a tutorial that uses a command line tool that comes with Virtual Box. Worked like a charm. Hope this saves you some time.

Resize An Existing .vdi Virtualbox Image – EASILY! By Gregory Milby

Tuesday, October 19, 2010

PHP: bCalendar - Free PHP calendar with international support

I've been working on a calendar class for awhile now and I've decided to release it to the public. I've refactored the class quite a bit so the names and methods make since. It's PHP5 compatible, very skinable, supports multiple languages and comes with documentation. You can download the project here.

Here is a quick example of how to set it up. You can view a running copy here.
// Update the language by using setLocal
//setlocale(LC_ALL, 'Japanese');

// Include the calendar class
include_once "classes/class.bCalendar.php";

// Create the class. The first option is the URL the navigation will use. The second is the path to the css file. The third is the date for the calendar to start on. The last determines which day the calendar will start on.
$obj_cal = new bCalendar("index.php","css/calStyle.css", null, 1);

####################
# Optional methods
####################
// Set the range of the date picker combobox
$obj_cal->setComboboxYearRange(2000,2010);

// Add a date to the calendar
$obj_cal->addEvent("10/19/2010", "This is a test event");

// Link a date on the calendar to a url
$obj_cal->linkDate("10/15/2010", "http://google.com");

// Change the behavior of the date picker to not snap to the current date
$obj_cal->setComboBoxToCurrentDate(false);

// Change the order of the calendar header
$obj_cal->setCalendarHeader(array(bCalendar::CAL_PREVIOUS_MONTH,
                                     bCalendar::CAL_MONTH_YEAR,
                                     bCalendar::CAL_SELECTOR,
                                     bCalendar::CAL_NEXT_MONTH));
####################
# Optional methods
####################

// Draw the calendar
$obj_cal->drawCalendar();

There are other properties that control the formatting of the month, year and day on the display. Those are outlined in the documentation under Variable Summary. If you have any questions of feedback please let me know in the comments. Also if you use it in a project let me know. It would be cool to see how people use it.