Pages

Friday, September 23, 2011

Laptop Running Hot and Slow

Is your laptop running really hot?
Does your laptop's performance seem non-existent?
Is your fan running really loud, but not much air is coming out?

It might be time to remove the dust bunny.



Monday, September 19, 2011

Javascript: Recursively Fetch All Documents Associated With Frames

A recursive Javascript function to get all objects of type HTMLDocument from all iframes in a document and all their children.  It might need some refinement.  For example, there is an HTMLDocument associated with iframe, when all you might want are the documents associated with the frames.


//Returns array including current document and all documents in all frames
function getAllDocuments()
{
documents = [document];
childDocuments = getAllChildDocuments(documents);
return documents.concat(childDocuments);
}

//Recursive function drills down into all iframe and frame documents
// docs: array of HTMLDocument types
function getAllChildDocuments(docs)
{
childDocuments = []
var docsLength = docs.length;
for (var docIndex = 0; docIndex < docsLength; docIndex++)
{
var iframes = docs[docIndex].getElementsByTagName("iframe")
var iframesLength = iframes.length;
if (iframesLength > 0)
{
for (var iframeIndex = 0; iframeIndex < iframesLength; iframeIndex++)
{
var iframeDocument = iframes[iframeIndex].contentDocument;
if (iframeDocument)
{
childDocuments.push(iframeDocument);
var frames = iframeDocument.getElementsByTagName("frame");
var framesLength = frames.length;
if (framesLength > 0)
{
for (frameIndex = 0; frameIndex < framesLength; frameIndex++)
{
var frameDocument = frames[frameIndex].contentDocument;
if(frameDocument)
{
childDocuments.push(frameDocument);
}
}
}
}
}
}
}
if(childDocuments.length > 0)
{
return childDocuments.concat(getAllChildDocuments(childDocuments));
}
return childDocuments;
}

Wednesday, September 14, 2011

Unable to Install Aptana Studio 3 Plugin for Eclipse

Problems:
Installation of Aptana Studio 3 Plugin for Eclipse (Indigo) stuck at 49%.
Difficulty installing Eclipse plugins, with error message "Comparison method violates its general contract!".

Solution:
Uninstall Java 7
Install Java 6 Update 27

Additional Notes:
There is mention in the references below of entering the following in eclipse.ini:
-Djava.util.Arrays.useLegacyMergeSort=true

Unfortunately, I was not able to get this particular solution to work. It would allow you to keep Java 7 installed, and is worth further investigation if uninstalling Java 7 is not an option.

References:



Thursday, September 8, 2011

How to Set Up Eclipse C++ with Cygwin

UPDATE:  This is most likely overkill except for custom configurations.  Eclipse should work without all these configuration steps, compilers are included in the plugin. 


1. Install eclipse along with CDT Eclipse plugin

2. Install MinGW.  During install, make sure to go into the development section and select gcc: g++, make, and GDB. This will cause their prerequisites to be installed, too.

3. Add “C:\cygwin\bin” to system path (for g++, make, GDB)

4. Create a new C++ project in eclipse

5. In the project properties, set the toolchain to "MinGW GCC":
a) Open Project Properties
b) go to C/C++ Build->Tool chain
c) Select MinGW GCC

References:
  1. http://www.ibm.com/developerworks/opensource/library/os-eclipse-stlcdt/#resources
  2. http://www.eclipse.org/forums/index.php/mv/tree/200049/#page_top
  3. http://www.eclipse.org/forums/index.php/mv/tree/167048/#page_top