Tim's Blog

Author: TimothyRHuertas (page 1 of 6)

Beanstalk + Rails Passenger + Rails 4 + AWS == evil

I was super excited to learn about AWS and beanstalk. I created my rails 4 project and used beanstalk to push it. When I went to the url I was greeted by my old friend the nginx error screen. “502 bad gateway”. WTF! I ssh’d in to the box and in the logs I find “You must set config.secret_key_base in your app’s config”. I added config.secret_key_base = ‘dfsdsfsd’ to my application.rb and Bam! Error solved.

Fuck x-webkit-speech

Today when experimenting with chrome’s speech recognition I noticed that it censored swear (curse) words.  I could not find a property to enable me to talk like a sailor.  So I came up with a hack.  I intercept the  onwebkitspeechchange event and convert censored words to uncensored words.  So b**** become bitch, f*** becomes fuck, ect.  Here is a demo.

Get the source at http://www.timothyhuertas.com/demo.html

**note this works in chrome only
Happy uncensored searching!

RIP Macho Man Randy Savage

“… he says I can’t sing, I cant dance, but I can make romance, yea!”

Google Animation for Martha Graham

Today I went to Google and noticed that their logo was a pretty elaborate animation.  I asked myself, “how did they do that?”  After thinking about it I considered frame by frame animation.  So I pulled up firebug and bam!  An image that had each frame in the animation was being sent to the client. Interesting.

http://www.google.com/logos/2011/graham11-hp-sprite.png

new shirt

I just made this shirt on cafe press.

InetAddress.getLocalHost().getHostAddress() 127.0.0.1

Today I wasted about 4 hours on this.  I was running in to an issue because InetAddress.getLocalHost().getHostAddress() was returning “127.0.0.1” aka the loop back address and not the “real” IP address I expected.  It sounds silly, but after hours of Google-ing and head banging it turns out the cause of this was a corrupt hosts file (which I had been looking at all day trying to figure out what I needed to do to it to make stuff work).  The moral of the story is if you run in to this problem back up your current host file then replace it with a default one.

FABridge.js play nice with Chrome

Today at work I got an email that said, “The site text editor is broken in Google Chrome. Remember about 3 years ago when you thought FABridge.js was a good idea?” In hindsight I would not have used FABridge. I think the levels of indirection out weigh the ease of use (especially if you need tons of control). Nonetheless I had to fix it. Once I found the bug it was pretty easy to fix. I narrowed the error down to FABridge__bridgeInitialized in FABridge.js. FABridge__bridgeInitialized looks for either an embed or object tag based on the browser type. A check for Chrome did the trick.

In FABridge.js if you change:
if (/Explorer/.test(navigator.appName) || /Konqueror|Safari|KHTML/.test(navigator.appVersion))
to:
if((!(/Chrome/.test(navigator.appVersion))) && ((/Explorer/.test(navigator.appName) || /Konqueror|Safari|KHTML/.test(navigator.appVersion))))

you should be in good shape.

So if you hear FABridge.js does not work in Chrome. Or your JavaScript wrapper to the Flash widget is broken this may solve your challenge.

THERE IS A BETTER WAY TO DO THIS. HERE IT GOES
/**This function searches for the flash dom object that has the flex movie in it.
*In some browsers this is an object tag. In other browsers this is an embed tag.
*We know we have the right thing when we find a dom object with the function getRoot.
**/
function FABridge__bridgeInitialized(bridgeName)
{
var searchStr = “bridgeName=”+ bridgeName;
var flashInstanceWithBridge = null;

var flashInstances = document.getElementsByTagName(“object”);

//search object tag
if (flashInstances.length == 1)
{
flashInstanceWithBridge = flashInstances[0];
}
else
{
for(var i = 0; i < flashInstances.length; i++) { var inst = flashInstances[i]; var params = inst.childNodes; var flash_found = false; for (var j = 0; j < params.length; j++) { var param = params[j]; if (param.nodeType == 1 && param.tagName.toLowerCase() == "param") { if (param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0)
{
flashInstanceWithBridge = inst;
flash_found = true;
break;
}
}
}

if (flash_found) {
break;
}
}
}

if(!flashInstanceWithBridge|| !flashInstanceWithBridge[“getRoot”] || !(typeof(flashInstanceWithBridge.getRoot) == “function”) ) //search embed tag if the object tag does not have the needed methods
{
flashInstanceWithBridge = null;

flashInstances = document.getElementsByTagName(“embed”);
if (flashInstances.length == 1)
{
flashInstanceWithBridge = flashInstances[0];
}
else
{
for(var i = 0; i < flashInstances.length; i++) { var inst = flashInstances[i]; var flashVars = inst.attributes.getNamedItem("flashVars").nodeValue; if (flashVars.indexOf(searchStr) >= 0)
{
flashInstanceWithBridge = inst;
}

}
}
}

if(flashInstanceWithBridge)
{
FABridge.attachBridge(flashInstanceWithBridge, bridgeName);
}

return true;
}

I can’t wait to watch this.

Here is a clip about the spiderman show that is going to open on Broadway. I have to go see this.

It’s your job to know

Imagine the time that went in to planing and producing this shot.  So serious…

Olderposts

Copyright © 2018 Tim’s Blog

Theme by Anders NorenUp ↑