Posted in General, JavaScript, Snippets, Web Development

How To Flip Text upside down and then backwards

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>FlipText</title>
<script type=”text/javascript”>
function flip() {
var result = flipString(document.f.original.value.toLowerCase());
document.getElementById(“results”).innerHTML = result;
}

function flipString(aString) {
var last = aString.length – 1;
var result = new Array(aString.length)
for (var i = last; i >= 0; –i) {
var c = aString.charAt(i)
var r = flipTable[c]
result[last – i] = r ? r : c
}
return result.join(”)
}

var flipTable = {
a : ‘\u0250’,
b : ‘q’,
c : ‘\u0254’,
d : ‘p’,
e : ‘\u01DD’,
f : ‘\u025F’,
g : ‘\u0183’,
h : ‘\u0265’,
i : ‘\u0131’,
j : ‘\u027E’,
k : ‘\u029E’,
//l : ‘\u0283’,
m : ‘\u026F’,
n : ‘u’,
r : ‘\u0279’,
t : ‘\u0287’,
v : ‘\u028C’,
w : ‘\u028D’,
y : ‘\u028E’,
‘.’ : ‘\u02D9’,
‘[‘ : ‘]’,
‘(‘ : ‘)’,
‘{‘ : ‘}’,
‘?’ : ‘\u00BF’,
‘!’ : ‘\u00A1’,
“\'” : ‘,’,
‘<‘ : ‘>’,
‘_’ : ‘\u203E’,
‘\u203F’ : ‘\u2040’,
‘\u2045’ : ‘\u2046’,
‘\u2234’ : ‘\u2235’,
‘\r’ : ‘\n’
}

for (i in flipTable) {
flipTable[flipTable[i]] = i
}
</script>
</head>

<body>

<form name=”f”>
<h3>Type Below</h3>
<textarea id=”clickcode” rows=”5″ cols=”50″ name=”original” onkeyup=”flip()”>Write your text in here!</textarea>
<div id=”results”></div>
</form>

</body>
</html>

Posted in Coldfusion, Web Development

ColdFusion Vs Everyone?

This morning I was shocked to hear that ColdFusion is dead. Oh no wait again? So here’s the deal. I heard from two completely unrelated sources “this morning” that CF was dead. Hey folks….It’s still not dead, so why not just cut the crap accept that it’s alive and well.

ColdFusion is primarily used behind firewalls. For example a majority of the larger companies have instances of ColdFusion running their intranet applications.

ColdFusion’s many strengths including:

  • data transformation applications
  • rapid development
  • data aggregation
  • report building
  • systems integration
  • translation layer between multiple platforms and languages
  • And SOOOO many more

ColdFusion shows up as having low usage on external reporting services because it’s tucked away behind firewalls where external reporting services can’t see it. Also the analysis of external ColdFusion instances should include all CFML engines including Blue Dragon, Railo and Adobe ColdFusion. Railo is rapidly becoming the chosen solution for ColdFusion developers due to it open source roots and Adobe’s neglect to market ColdFusion.

Keep in mind that if we removed WordPress, Drupal and Joomla from the statistics, php would most likely be down by 75%, to less than the number of .NET sites.

Everyone jabbers about Groovy, Grails, Ruby on Rails etc, but they are all a smaller market than ColdFusion.

I’m not afraid to learn other languages, but I always laugh at people who baulk at CF. They just can’t afford the hosting, so they learn what they can afford or what they were taught in college. With the introduction of Railo I am hoping for a resurgence of ColdFusion development.

I really like this article written by Ray Camden CF extraordinaire.

http://www.raymondcamden.com/index.cfm/2011/3/21/Quick-advice-for-handling-the-ColdFusion-haters

Keep in mind folks there are currently at least 211,947 active sites using Adobe ColdFusion. Not including Intranet’s and custom internal applications, which is most likely the majority. Does that sound dead to you?

If you love CF get out there and tell people. Let you managers know why. Show them the product, the results and the cost analysis of something done using CF verses something done in another language.

Find a creative way to show people that you love ColdFusion. Post your ideas here (even though I get very little traffic). Scream to the world “I LOVE COLDFUSION!!!!!”

Posted in Soccer

Fernando Torres!

Yes, we will gladly take him! Fernando has had a rough spell at Chelsea, but that by no means defines his career. I can’t believe that we may actually snag him. He’ll be great for us!

Posted in JavaScript, JavaScript - native, Mobile Development, Snippets, Web Development

View Leadboltads.net source code on an Android device.

Leadbolt does everything humanly possible to hide their code from you. But not today my friends. I made it my mission to hack it so that I could enforce my own styles against the content.

If you are developing an android HTML5 app, simply place the JavaScript code I am about to give you below as the last thing before the closing body tag, and the Leadbolt ad code will be expose.

<script>
    alert(document.getElementsByTagName('html')[0].innerHTML);
</script>

Run your code directly in any android browser. This will launch a JavaScript popup within your android application that reveals the rendered HTML tag source code.

Have fun, I’m sure this might work with all types of JavaScript based ad services for android devices.

Posted in Coldfusion, JavaScript, JavaScript - native, Snippets, Web Development

Escape an iFrame after a session logs out

Here is an example of how I escape an iFrame when my log in page is loaded.

So let me set the stage first.

I have an app that uses iFrames (very old app that I didn’t build). In my ColdFusion Application.cfc I tell the app to force the log in screen once a session has expired. So to avoid the iFrame from loading the log in screen my task is to tell the log in screen to check if it’s within an iFrame. If the page is within an iFrame I want the parent page to reload. By default my iFrames will be gone and the parent page will fail the session check. Hence forcing the parent page to display the log in as anticipated.

Place the following code on your log in screen or whatever screen you wish to have escape the iFrame.

<script>
    var iFramed= (window.location != window.parent.location) ? true : false;
    if(iFramed == true){
        alert('Your Session has expired. Please log in again.');
        window.parent.location.href = "index.cfm";
    }
 </script>

The target file to load into the parent window is in my case index.cfm. Your can of course point to any target you wish. Perhaps login.cfm or what ever suits.

Posted in General

Email vs. In person

Today I found myself writing an email to a co-worker and realized that my email could have been improperly interpreted. At times trying to help someone can come across as putting your nose where it doesn’t belong. No one knows this better than me. I hate when people inject their opinions into my work, but that’s a character flaw in me (a topic better saved for a therapist). Anyway. I immediately got out of my chair and walked over to talk to my co-worker. My co-worker turned to me and I could sense the negative vibe instantly, but guess what! By walking over and explaining myself and assuring them that I meant only to help, they reevaluated the scenario and thanked me.

So there is a lesson to learn here. Email is dangerous!

If you need to offer criticism, advise or talk out a fact checking or debugging scenario, then it really is better done in person. People are sensitive and emails definitely don’t cater to the sensitive people of the world, and it certainly doesn’t assist those who are not sensitive in their delivery techniques.

The other solution is to put an emoticon after every word, so that there is no misinterpretation…Probably not the best idea or is it? Maybe emails should have an emoticon attached as a primary overtone to a subject. That way when you get an email you can send the ones labeled with a frown as spam and the ones with an angry face as trash.

Today we are witness to the birth of emotomail!!! Who’s in?

Posted in Coldfusion, Snippets, Web Development

Prevent brute force attacks

Check to see if the login was successful. you can apply your own variable here. Obviously all variable names

<cfif [login successful...]>
	Do something since you've successfully logged in.
<cfelse>
	<cfparam name="session.FailedLogin" default="0" >
	<cfset session.FailedLogin = session.FailedLogin+1>
	<cfif session.FailedLogin gt 10>
		<cfabort>
	</cfif>
	<cfset createObject("java", "java.lang.Thread").sleep(JavaCast("int", session.FailedLogin*500))>
</cfif>