Tuesday, March 20, 2012

PDF Displaying Blank Page In Javascript Popup window

The company I work for uses Adobe Livecycle for workflow management.  We also have a web front-end that acts as a proxy for user interaction with these workflows.  The web front-end will call the Livecycle APIs to generate a PDF and display it to a user.

Recently I was asked to display one of these PDFs in a separate window.  Pretty simple task right?  I wrote a little bit of Javascript with some window.open goodness and tested it out in IE7 (our standard).  Blank page.  Crap.

Turns out with a little bit of searching, IE7 and Adobe Reader don't play nice together when opening up a PDF in a new window created by Javascript.  Many people had the issue with the most common resolution to just create a link with a blank target.  That didn't quite suit my needs.  So here's my resolution.

The window.open command can take in an optional URL.  Instead of putting the URL of the PDF in the original window.open command I did something similar to the following:

var childWin = window.open('', 'windowname', 'other options');
childWin.location.replace('url of PDF');


By opening up the window with a blank page and then immediately doing a location.replace on the child window I was able to successfully bring up the PDF.

Hope that helps!

Wednesday, March 14, 2012

Bad Interpreter - No such file or directory

I ran into an issue with a shell script not functioning, getting the following error:

bad interpreter: no such file or directory

I verified that the shell was located at /bin/sh.  I then remembered that a colleague of mine made some changes to the script a few days earlier...on Windows...then moved it back.  Hmm.  Linebreaks ended up being the issue.

I ran

dos2unix filename

and the scripts ran just fine.

Hope that helps someone.

Friday, December 23, 2011

Incorrect $HOME using Git Bash on Windows

I had installed Git Bash and was trying to push a set of commits back to github.  This was failing because git was looking for my ssh keys in the wrong location.  It should have been looking in /c/Users/myusername/.ssh but instead was looking in /c/Windows/SysWOW64/config/systemprofile/.ssh.  I found out it was due to the $HOME environment variable.

I looked in my environment variables and saw %HOME% was set to %USERPROFILE% in the system properties.  In git bash, $USERPROFILE was set to /c/Users/myusername but $HOME was set to /c/Windows/SysWOW64/config/systemprofile.  Strange.  I then decided to try setting a %HOME% environment variable in the user variable on Windows.  I went back into git bash and $HOME was set correctly.

Hope this helps someone.

Friday, April 29, 2011

Changing non-US keyboard layout in Virtualboxes.org images

I wanted a quick Ubuntu server installation and installed the 10.04 server installation from virtualboxes.org.  Unfortunately for me, the keyboard layout wasn't correct and I wanted to change it.  Not being very well versed in Linux and all it's ins and outs, I wasn't sure how to do this.  I found out that you can change your keyboard configuration by using the following command:

dpkg-reconfigure console-setup

I ran through a few steps and now have a nice and easy to use US keyboard again.

Thursday, March 24, 2011

XDebug issue: Unexpected termination of script, debugging ended

I spent the better part of a day trying to figure out why I could debug a PHP script in Eclipse one minute and the next not at all. Hopefully this will help someone else out too.

My setup is Eclipse Helios PDT and WAMPServer 2.1 with PHP 5.3.5 and XDebug 2.1. I had no problem debugging scripts and then one day, poof! I started getting "Unexpected termination of script, debugging ended" messages and could not step through code at all.

As it turns out there appears to be a bug in the PDT (I can recreate this with multiple XDebug versions) with using XDebug and the Watches panel if you have some watches defined. To get around the error (I don't know if there's a fix) just remove all your watches before debugging by right-clicking on the watches view in the PHP debug perspective and choose "Remove All Watches".

This fixed it for me and I hope it will for you too.

Dummy Coder

Wednesday, March 23, 2011

How to find Oracle database block size

I had a need to find the database block size in Oracle (which is different from the OS block size).  Here's the query for finding that information:

SELECT tablespace_name, block_size FROM dba_tablespaces;

Dummy Coder

Thursday, July 15, 2010

XSLT output and using  

I did it again. I wrote some cool little XSLT that spit out an HTML document only to find out that all of my   turn into ? or Ă. Of course I should realize that the computer is only doing exactly what I told it to do.  Here's what I told it:

<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>

And the computer turned that into Ă exactly as I told it to or in the case of IE6, a ?. Here's a simple fix for it:

<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>">]>

It will turn all in your XSLT into &nbsp; which will in turn display correctly on your browser.

Dummy coder.