cf.Objective 2014 - Getting Started with Responsive Web Design

I tweeted this out a while back, but I have been selected to speak at cfObjective() 2014! I blogged in early November about my proposal and the people have spoken! I hope to see all of you at the conference!

Responsive Web Design has been a buzzword since the term was first coined in May 2010. Come find out what this emerging technology is all about as you are introduced to the basics of Responsive Web Design. We'll cover your current options when it comes to designing your own website and we'll also discuss emerging best practices and a few examples from industry leaders. We will also take a look at how you can test your responsive design without owning one of each device out there.

Target audience

Anyone interested in creating one website for every device

Assumed Knowledge

Basic CSS and HTML experience

What the audience will learn

  • What is responsive Web Design and how does it work
  • When is responsive Web Design appropriate?
  • Pro/Cons of using a framework
  • Fixed vs Fluid layout
  • Best Practices for developing a site
  • Common Misconceptions
  • Who is using responsive web design?

If you're interested in attending head on over to cfobjective.com and register before March 1st to get an early bird discount.

Connecting MS SQL database to Railo datasource

Tonight was the 2nd time I've struggled getting Microsoft SQL Server set up to communicate with Railo (and really anything at all), so I thought I'd write up some quick tips on what I had to do. Once you think you have everything set up there are 2 steps that are left.

Go to Microsoft SQL Server 20XX > Configuration Tools > SQL Server Configuration Manager

From there open up TCP/IP and make sure Listen All is set to No

After that go to the IP Addresses tab and make sure Active and Enabled are yes (enabled defaults to no) and make sure you're using the IP and correct TCP Port when configuring your datasource.

Thanks to this MSDN post for getting me on the right track.

What tab is playing that sound?

One of internet users biggest annoyances has been resolved in Chrome 33. When a tab starts playing audio Google Chrome version 33 adds a speaker icon to the tab.

From all the testing I did, the speaker icon is the last thing to disappear when you have a bunch of tabs and it works whether you have multiple tabs with audio, if the audio is paused and isn't dependent on your system sound being turned on.

cf.Objective() Proposal - Getting started with Responsive Web Design

Interested in learning about responsive web design? Head on over to the cf.Objective() Trello board and vote for my talk on Responsive Web Design and any others that you would like to attend.

Here's a brief description of what my talk will be about

Target Audience: Anyone interested in creating one website for all devices

Assumed Knowledge: Basic CSS and HTML experience

Objective: Introduce responsive web design and why it's important

Why I'm Qualified: Part of a team that created a mobile website for a large insurance company.

What the audience will learn: What is responsive Web Design When is responsive Web Design appropriate Pro/Cons of using a framework Fixed vs Fluid layout Concept of columns and grids

Anything else you'd like to learn? Feel free to comment here and/or on the Trello board and if my talk is selected I'll try to work a few suggestions in as well.

Checking an HTML page for duplicate IDs using jQuery

At work our testers make use of the ID elements on HTML tags quite frequently and when they're not unique, it usually causes them issues with testing. To avoid the manual parsing of trying to find duplicate IDs in the page source. I found/updated a JavaScript function that loops through each ID found on the page and outputs any duplicates into your console.

This code does require that jQuery is defined on the page you are testing.

view plain print about
1javascript:(function () {
2    var ids = {};
3    var found = false;
4    $('[id]').each(function() {
5        if (this.id && ids[this.id]) {
6            found = true;
7            console.warn('Duplicate ID #'+this.id);
8        }
9        ids[this.id] = 1;
10    });
11    if (!found) console.log('No duplicate IDs found');
12})();

You can copy and paste the entire JavaScript function into a bookmark for quick access.

view plain print about
1javascript:(function () { var ids = {}; var found = false; $('[id]').each(function() { if (this.id && ids[this.id]) { found = true; console.warn('Duplicate ID #'+this.id); } ids[this.id] = 1; }); if (!found) console.log('No duplicate IDs found'); })();

Using ColdFusion to parse a list with empty values

I was parsing through a csv file today and having issues with empty values. The data I'm receiving is in a format the 3rd party cannot update, so my data looked something like this

1,,abc,32,,gef

Dumping the list provides the expected list, but looping through the list it skips over values

view plain print about
1<cfoutput>
2    <cfloop list="#list1#" index="i">
3        #i#<br>
4    </cfloop>
5</cfoutput>

produces

view plain print about
11
2abc
332
4gef

After googling this for a bit I gave up and asked my brother. He told me to use the 'includeemptyfields' attribute in listtoarray(). I knew I could turn a list into an array, but I wasn't aware of the third attribute until today, the default is obviously false, so blank values were never included.

The code below produces the desired output. Notice I am now looping through an array instead of a list.

view plain print about
1<cfset newlist = listToArray(list1,',',true) />
2<cfoutput>
3    <cfloop array="#newlist#" index="i">
4        #i#<br>
5    </cfloop>
6</cfoutput>
7
81
9
10abc
1132
12
13gef

get US Bank Holidays UDF

I was looking for an existing UDF on cflib.org for current bank holidays but the only one I could find was for German holidays only. With this function you can pass in a year otherwise it will assume the current year is to be used.

The following holidays are calculated using this UDF.

HolidayOfficial Date
New Year's DayJanuary 1
Independence DayJuly 4
Veterans DayNovember 11
Christmas DayDecember 25
Inauguration DayJanuary 20th (Year after election year - multiple of 4)
MLK's BirthdayThird Monday in January
George Washington's BirthdayThird Monday in February
Memorial DayLast Monday in May
Labor DayFirst Monday in September
Columbus DaySecond Monday in October
Thanksgiving DayFourth Thursday in November

view plain print about
1<cffunction name="getUSBankHolidays" access="public" output="false" returntype="struct" hint="general bank holidays for US">
2 <cfargument name="iYear" default="#Year(now())#" />
3
4 <cfset var currentYear = arguments.iYear />
5
6 <cfset var strResult =
7 { NewYears = createDate(currentYear,1,1),
8 Independence = createDate(currentYear,7,4),
9 Veterans = createDate(currentYear,11,11),
10 Christmas = createDate(currentYear,12,25)
11 } /
>

12
13 <cfif NOT (currentYear - 1) MOD 4>
14 <cfset strResult.Inauguration = createDate(currentYear,1,20) />
15 </cfif>
16
17 <cfset strResult.MLKBirthday = createDate(currentYear,1,GetNthOccOfDayInMonth(3,2,1,currentYear)) />
18 <cfset strResult.WashingtonsBirthday = createDate(currentYear,2,GetNthOccOfDayInMonth(3,2,2,currentYear)) />
19 <cfset strResult.MemorialDay = createDate(currentYear,5,DaysInMonthh(createDate(2012,5,1))) - DayOfWeekk(createDate(2012,5,DaysInMonth(createDate(2012,5,1)))) - 2)) />
20 <cfset strResult.LaborDay = createDate(currentYear,9,GetNthOccOfDayInMonth(1,2,9,currentYear)) />
21 <cfset strResult.ColumbusDay = createDate(currentYear,10,GetNthOccOfDayInMonth(2,2,10,currentYear)) />
22 <cfset strResult.Thanksgiving = createDate(currentYear,11,GetNthOccOfDayInMonth(4,6,11,currentYear)) />
23
24 <cfreturn strResult />
25</cffunction>
26<cfdump var="#getUSBankHolidays()#">

This function is long overdue for me as monitors that run on week days run on Holidays and result in a lot of false positive 'down' notifications. If the array returned is empty then the scheduled task should run. If the array has records then it's a holiday

This UDF requires the getNthOccOfDayInMonth function from cflib.org

Using PS Tools' pslist and pskill to remotely kill computer processes

At work we have a lot of computers/servers that need to be remotely managed. If a computer has frozen for some reason, PS Tools is a great program to help determine what the issue is and if necessary remotely reboot the computer. There are 12 different programs that come with PS Tools, but pslist and pskill are the two used most frequently.

All PS Tools programs are ran via the command line. I unzipped all the programs to c:\pstools, so I can use

view plain print about
1cd c:\pstools
in the command prompt to get to my directory from there you can type pslist to get a list of all running processes on a computer.

view plain print about
1pslist \\mattbusche
is the command to find all running processes on my computer

Normally if a rogue process is the problem with the computer it will have an extremely high CPU time. Idle and system will always have high times, so those can always be ignored. To kill a process you need the pid from the pslist command. You will need to reference the computer in this command as well

view plain print about
1pskill \\mattbusche -t 344
That command would terminate pid 344 smss. If the offending process isn't something you've heard of, you probably shouldn't just go and kill it. We have a ton of VB programs, so those are fairly easy to identify (i.e. pre-trip approval, email reader, etc)

If for some reason the process cannot be killed then you will need to use psshutdown which I will cover in a later post.