Fixing bootloaders when dual booting OS X and Ubuntu

Posted by Quinn Madson | Posted in | Posted on 9:03 PM

0

I ran into a problem the last time Ubuntu upgraded either the kernel or grub (not sure which); Either way, it blew away my Chameleon bootloader and replaced it with Grub. Here's how to fix it:


  • Reboot from the iATKOS v7 CD
  • Deselect all checkboxes except the one for Install Chameleon
  • Install
Now you should be able to boot into OS X but, Ubuntu will be unavailable.

  • Boot from the Ubuntu Live CD
  • Open the Terminal from Applications >> Accessories
sudo -s
mkdir /mnt/r
mount /dev/sda4 /mnt/r
mount --bind /dev /mnt/r/dev
mount --bind /proc /mnt/r/proc
chroot /mnt/r
update-grub
grub-install --force /dev/sda4

Adding CFWheels Applications as "Custom Script" elements in the CommonSpot CMS

Posted by Quinn Madson | Posted in | Posted on 1:43 PM

0

It appears that CommonSpot (version 5, at least) ignores Application.cfc files when using a custom script in the same directory. In CF Wheels, Application.cfc is used to setup the entire framework.

Here is what I did to get it working:

  • Put your CF Wheels application in the customcf/ subdirectory
  • Rename Application.cfc to application.cfc (This is done to prevent the application from being initialized twice if accessed outside the CMS.)
  • Edit the index.cfm at the root of the application directory:
<!--- Manually instantiate the application.cfc --->
<cfset server.railo = structNew()>
<cfset server.railo.version = "fake version">

<!--- If this is the first time the application has run, call the onApplicationStart method --->
<cfset app = CreateObject("component","application")>

<!--- Call the onRequestStart method and pass the current page as a parameter --->
<cfif not structKeyExists(application, "wheels")>
<cfset app.onApplicationStart()>
</cfif>

<!--- Call the onRequestStart method and pass the current page as a parameter --->
<cfset app.onRequestStart(cgi.script_name)>


<!--- This is the only original line in the file --->
<cfinclude template="wheels/index.cfm">

Gnome Screensaver Missing Lock Screen Prompt in Ubuntu Lucid 10.04

Posted by Quinn Madson | Posted in | Posted on 12:43 PM

4

For some reason, the unlock dialog box for Gnome Screensaver suddenly stopped appearing. Screensaver works fine but, move the mouse and no unlock prompt, just back to the screen saver. The only work-around was to press Ctrl-Alt-F1, login, and type the command:

killall gnome-screensaver
Although, after a while this gets annoying so, I looked for a better long term solution. Here it is:
sudo chmod a+r /etc/pam.d/*
That's it. I assume that the permissions may have been messed up during an update. Posted here for posterity.

CFEclipse Dictionary for CF on Wheels

Posted by Quinn Madson | Posted in | Posted on 9:56 PM

3

As far as I could tell, there was no CFEclipse dictionary available for CF on Wheels so I created one.


To get it, download the XML at: http://su.pr/6s1VUi

To use it:
  • Open your Eclipse plugins/ directory
  • Open the directory: org.cfeclipse.cfml_X/ (where X is your CFEclipse version number)
  • Open the directory: dictionary
  • Copy cfwheels.xml to this location
  • Close Eclipse if it is running
  • Open up: dictionaryconfig.xml
Change:
<version key="cf8" label="Coldfusion 8">
<grammar location="cf8.xml" />
<grammar location="user.xml" />
</version>
To:
<version key="cf8" label="Coldfusion 8">
<grammar location="cf8.xml" />
<grammar location="user.xml" />
<grammar location="cfwheels.xml" />
</version>
I am not sure if it is an Ubuntu bug but, any thing that is not in the first grammar file is not loaded in Eclipse. If you run into problems, just copy and paste the functions listed in cfwheels.xml to cf8.xml or whatever dialect you use. The other option is to create a separate CFWheels dictionary entry but, it doesn't work very well switching back and forth between dictionary sets.

In the likely event that I am struck by a bus, a very confused sperm whale, or bowl of petunias, I created a script that scrapes the CF on Wheels documentation and creates the dictionary XML. If more functions are added and the structure of the docs pages don't change immensely, rerun the script to refresh the dictionary XML.

Here's the code:

<cfparam name="url.page" default="0">
<cfparam name="url.start" default="0">
<cfparam name="url.end" default="0">

<!---
Strips all table and table content tags and extra whitespace from a string.

@param string String to format. (Required)
@return Returns a string.
@author Jared Rypka-Hauer (jared@web-relevant.com)
@version 1, August 25, 2005
--->
<cffunction name="detableize">
<cfargument name="string" type="string" required="true" />
<cfset var outputString = arguments["string"]>
<cfset outputString = reReplaceNoCase(outputString , "</*table>", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "</*td>", "ø", "all")>
<cfset outputString = reReplaceNoCase(outputString , "</*t[rhd](\s*\w*=*""*\w*""*)*>", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "(?m)^\s*", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "\n{2,}", "#chr(10)#", "all")>
<cfreturn outputString />
</cffunction>

<!--- based on function above; removes garbage from api page --->
<cffunction name="detagify">
<cfargument name="string" type="string" required="true" />
<cfset var outputString = arguments["string"]>
<cfset outputString = reReplaceNoCase(outputString , "</*li>", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "<code>[a-z\(\)]*</code>", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "<a href=""", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , """></a>", ",", "all")>
<cfset outputString = reReplaceNoCase(outputString , "(?m)^\s*", "", "all")>
<cfset outputString = reReplaceNoCase(outputString , "\n{2,}", "#chr(10)#", "all")>
<cfreturn outputString />
</cffunction>

<cfscript>
/**
* Returns the content enclosed in a tag pair.
*
* @param tag The tag to look for. Should be passed without < or > and without attributes. (Required)
* @param string The string to search. (Required)
* @return Returns a string.
* @author Johan Steenkamp (johan@orbital.co.nz)
* @version 1, September 16, 2002
*/
function getTagContent(tag,str) {
var matchStruct = structNew();
var startTag = "<#tag#[^>]*>";
var endTag = "</#tag#>";
var endTagStart = 0;
matchStruct = REFindNoCase(startTag,str,1,"true");
if(matchStruct.len[1] eq 0 ) return "";
endTagStart = REFindNoCase(endTag,str,matchStruct.pos[1],"false");
return Mid(str,matchStruct.pos[1]+matchStruct.len[1],endTagStart-matchStruct.pos[1]-matchStruct.len[1]);
}
</cfscript>

<!--- get urls --->
<cfhttp url="http://cfwheels.org/docs/function/"></cfhttp>
<cfscript>
urlsFilecontent = cfhttp.filecontent;
urlsStartPoint = find("<h1>Wheels <abbr title=""Application Programming Interface"">API</abbr></h1>", urlsFilecontent);
urlsEndPoint = len(urlsFilecontent) - urlsStartPoint;
urlsChopped = mid(urlsFilecontent, urlsStartPoint, urlsEndPoint);
urlsChopped = getTagContent("ul", urlsChopped);
urlsChopped = detagify(urlsChopped);
urlsChopped = listToArray(urlsChopped);
dictionary = "";
itemsPerPage = 25;
urlsPages = ceiling(arrayLen(urlsChopped) / itemsPerPage);
</cfscript>

<cfoutput>
<h1>CFWheels API to CFEclipse Dictionary Conversion</h1>
<p>#arrayLen(urlsChopped)# functions listed in documentation. Function conversions are broken up into batches to prevent timeouts.
Click below to convert a batch.</p>
<ul>
<cfloop from="1" to="#urlsPages#" index="i">
<cfscript>
if (i neq 1) {
start = (i - 1) * itemsPerPage;
end = start + itemsPerPage - 1;
} else {
start = 1;
end = itemsPerPage - 1;
}

if (end gt arrayLen(urlsChopped)) {
end = arrayLen(urlsChopped);
}
</cfscript>
<li><a href="?page=#i#&start=#start#&end=#end#">#i#: #start# - #end#</a></li>
</cfloop>
</ul>
</cfoutput>

<cfif url.page>
<cfloop from="#url.start#" to="#url.end#" index="i">

<!--- convert html to cfeclipse dictionary xml --->
<cfhttp url="http://cfwheels.org#urlsChopped[i]#"></cfhttp>
<cfset functionFilecontent = cfhttp.filecontent>

<cfscript>
functionStartPoint = findnocase("contentWrapper", functionFilecontent);
functionEndPoint = len(functionFilecontent) - functionStartPoint;
functionChopped = mid(functionFilecontent, functionStartPoint, functionEndPoint);
functionName = getTagContent("code", functionChopped);
functionChopped = replacenocase(functionChopped, "<code>", "", "all");
functionChopped = replacenocase(functionChopped, "</code>", "", "all");
functionDescription = getTagContent("p", functionChopped);
functionParameters = getTagContent("tbody", functionChopped);
functionParameters = detableize(functionParameters);
functionParameters = listToArray(functionParameters, "ø", true);
</cfscript>

<cfoutput>
<cfsavecontent variable="functionOutput">
<function xmlns="http://www.cfeclipse.org/version1/dictionary" name="#xmlFormat(functionName)#" returns="">

<help><![CDATA[
#xmlFormat(trim(functionDescription))#
]]></help>
<cfloop from="1" to="#arrayLen(functionParameters)-1#" index="i" step="5"><cfif functionParameters[i+2] eq "No"><cfset required="false"><cfelse><cfset required="true"></cfif>
<parameter name="#xmlFormat(trim(functionParameters[i]))#" type="#xmlFormat(trim(functionParameters[i+1]))#" required="#xmlFormat(trim(required))#">
<help><![CDATA[
#xmlFormat(trim(functionParameters[i+4]))#
]]></help>
</parameter>
</cfloop>
</function>
</cfsavecontent>
</cfoutput>

<cfset dictionary = dictionary & functionOutput>

</cfloop>
<cfoutput>
<textarea cols="150" rows="50">
#dictionary#
</textarea>
</cfoutput>
</cfif>
Hopes this helps some other CFEclipse & CF on Wheels developers out there.