Removing duplicate rows in Open Office (calc)

I needed to de-dupe a spreadsheet the other day and found a great how-to from google. Thought I’d post it here for my own future purposes:


There is no automatic function to remove duplicate rows. Follow these steps to delete all rows that have duplicate values in column A:

  1. Select all cells of the current data range.
    On most systems, you can click any cell inside the data range, then press Ctrl+Multiplication key on the numeric keypad.
  2. Sort the data range by column A.
    Choose Data – Sort.
  3. Click an empty cell in the first row. Let’s assume it is cell C1. Enter the formula:

    =IF(A1=A2;1;0)

    This will display 1 if the current row has the same value in column A as the next row. It will display 0 if the values are different.

  4. Copy the formula down for all rows of the data range.
    Drag the lower right edge of the cell C1 down to the last row.
  5. Now the formulas must be replaced by their values to freeze the contents.
    While the column C is still highlighted, press Ctrl+C to copy all selected cells to the clipboard.
  6. Press Shift+Ctrl+V to open the Paste Special dialog box.
    In the Selection area, enable only the Numbers command; disable the other Selection commands. Click OK.
  7. Select the whole data range including the new column C and sort the range by column C.
    Choose Data – Sort.
  8. Select all rows which have a value 1 in column C, then press Del key.
  9. Optional steps: Delete column C. Select the remaining rows and sort them again by column A.
No Comments

IE and underscores in domain names

Ok, a short warning to those who use underscores in their domain names. Underscores you say? Aren’t they illegal characters in domain names? Why yes they are (but I think they’re valid in sub-domains…not sure), but you may find yourself using them in development environments, particularly if you’re doing a re-design. Think something like http://mysite_v2.local/ etc

Now, this works of course and everything is fine and dandy because your using your own hosts file to make it “legal”…except that Internet Explorer has this little quirk where it doesn’t persist your session (cookie) information. So your app sets some session variables, refresh the page and they’re gone. Sigh…

Why would IE even bother to do this? Who knows. But keep this in mind next time your pulling your hair out trying to figure out why session management isn’t working for you in IE.

Rule:

Don’t ever use underscores in domain names

1 Comment

Support Details – tech support management

Ever dealt with a client where you wanted to know their operating environment? Thinks like what operating system they are running (and version), which browser type and version, whether they have JavaScript enabled etc? Sounds easy but for some clients this is like being asked to provide a detailed analysis of early 7th century rock formations around Stone Henge…in Latin. :(

Here’s a super simple solution that anyone could use :)

http://supportdetails.com/

Basically you send your client the URL above which they open. The web page will automatically detect their environment, all they have to do is enter your email address in a text box and click a button and in seconds you’ll receive an email detailing the system they are using. Nice!

If you want to make it even easier you can provide the URL to them with your email already attached:

E.g. http://supportdetails.com/?recipient=developer@mycompany.com

1 Comment

Detecting https across Railo and ColdFusion Server

Previously I had a way of detecting whether page requests were being made via ssl but today I came across a scenario where this doesn’t work. Let me explain…

Right now we’re looking at developing across different ColdFusion engines, “ColdFusion” of course but also “Railo”. One of the applications we had detected whether a request was being made securely (https) and if it wasn’t we turned off session management for security reasons. The basic code looked like the following snippet:

oRequest = getPageContext().getRequest();
if (oRequest.isSecure())
{
	this.sessionManagement = true;
	this.sessionTimeout = createTimeSpan(0,0,20,0);
	this.setClientCookies = true;
}
else
{
	this.sessionManagement = false;
	this.setClientCookies = false;
}

This was working all fine and dandy for ColdFusion Server, but was failing when we went to Railo (at least in the way we configure Railo). The reason was that we proxy page requests on Railo through Apache to Tomcat. This proxy is done over http regardless of the actual client request to the server. I guess the reason for this is that Apache to Tomcat is considered part of your secure (server) network. What was happening was that isSecure() was coming back false, because of this proxy request.

Mark came up with a cool solution for this. We simply add a custom header in the Apache conf file.

RequestHeader set https on

All this does is set a value into the header which we can pickup via the CGI scope, i.e. CGI.https

Now this key (https) already exists on ColdFusion server and will be blank for http requests and “on” for https requests. This is the reason we set the custom header value to “on” in the Railo vhost, so our application code is easily compatible across the two ColdFusion engines.

So now we just have a simple function to detect ssl requests:

<cffunction name="isRequestSecure" access="public" output="false" returnType="boolean">

	<cfset var secure = false>

	<cfif cgi.https EQ "on">
		<cfset secure = true>
	</cfif>

	<cfreturn secure>
</cffunction>

Now we can easily call isRequestSecure() which will be either true or false. Nice :)

Don’t forget that the CGI scope is kind of “magic”, in that we won’t ever need to param a key in that struct (like CGI.https).

No Comments

cfhttp issues using “.local” on Max OSX

Ran into an interesting problem today doing something quite simple. Basically all I was doing was posting xml data to a URL, but I kept getting a 408 request timeout and I didn’t know why.

We happen to use the “.local” domain name structure for local development. I was posting data from one local site to another e.g.

http://mysite1.local -> http://mysite2.local

When I dumped cfhttp on the posting page I got the following error:

cfhttp

Now I hadn’t come across this error before with cfhttp and nothing I did fixed the issue, I even got that message using a “GET” method. It wasn’t till I tried “GET” from a public domain (http://www.google.com, which worked) that I thought to try a local domain which didn’t use “.local”.

Success!

Mark mentioned that it could be a problem with Bonjour (as I’m on a Mac) which uses .local.

This is kinda timely as we’re moving away from the “.local” convention in favour of “.cf7″, “.cf9″, “.railo” etc as we’re using multiple cfmx engines for different projects and that provides a way to easily test codebases against different engines easily.

No Comments