Link

home – LOLCODE “HAI! This site provides community documentation of the emergent LOLCODE language. It is our hope that the examples can grow in a way that is both internally consistent and suggest a real, feasible computing language.” 

AJAX Bible now with Word Search and Link In capabilities

Here is a list of the new features:

  • Word Search: excluding a small list of very common words, you can now find references by search for key words. There is no implimentation for quotes or key words such as AND and OR. You can assume all words will use AND functionality. Much thanks go to Jeremy Wall for building the expat parser in perl to parse the bible and build the indexes I use for the word searches. I could have done it without him, but it would have been much more miserable for me, and my parser would have taken hours, not minutes like his.
  • Link In: You can now link into the AJAX Bible using <a href=’http://www.walljm.com/bible/?ref=John%203:16-17′>John 3:16</a>. Demonstrated here: John 3:16-17.
  • New UI: You will notice things look much prettier. Many thanks to Daniel Bergey for doing the redesign.

 

You can download the AJAX Bible and use it on your desktop if you like. Just unzip the files and run index.asp.

AJAX Bible: Now with Robinsons Morphological Analysis Codes

I have add greek morphology to the AJAX Bible. Thanks again to the Zephania Bible Project for providing source xml files. The Morphology is derived from Robinson’s Morphological Analysis Codes, and is linked to strongs numbers.

Next up: Greek NT based on the Textus Receptus source text, and Word Search! 

Javascript: Find the Shared Values of Any Two Sets

I’ve been working on adding word search capabilities to the AJAX Bible, and in the process I had to come up with a way to find the shared values between two sets, or in my case with Javascript, two arrays. There aren’t many algorithms published online that I could find, so here is the most efficient method I found.

(You can view an example of the set compare algorithm here. View source to see the javascript.)


/// <summary>
/// Takes two javascript arrays and returns an array
/// containing a set of values shared by arrays.
/// </summary>
/// <param name="x" type="array" />
/// <param name="y" type="array" />


function ReturnSharedSet(x, y) {
// declare iterator
var i = 0;

// declare terminator
var t = (x.length < y.length) ? x.length : y.length

// sort the arrays
x.sort();
y.sort();

// in this loop, we remove from the arrays, the
// values that aren't shared between them.

while ( i < t) {
if (x[i] == y[i]) {
i++;
}
if (x[i] < y[i]) {
x.splice(i, 1);
}
if (x[i] > y[i]) {
y.splice(i, 1);
}
t = (x.length < y.length) ? x.length : y.length;

// we have to make sure to remove any extra values
// at the end of an array when we reach the end of
// the other.

if (t == i && t < x.length) { x.splice(i);}
if (t == i && t < y.length) { y.splice(i);}
}
// we could return y, because at this time, both arrays
// are identical.

return x;
}

The basic idea is to take two arrays and remove any values that aren’t shared by the other. I sort the arrays first, then iterate through them. If x > y, then I remove that value from y. If y > x, then I remove that value from x. When I get to the bottom of the shortes array, I chop the rest of the values from the longer array, and return one of the arrays as my result (it doesn’t matter which, because at this point, they are both the same).

Note: It works with strings and numbers. The javascript sort function can be customized, and javascript comparison operators work with both strings and numbers. If you impliment it in another language, make sure to be aware of how the comparison operators work, i.e. "a" may not be < "b" in every language.
 

AJAX Bible Update

A few weeks back I made some updates the the Ajax Bible (beta), fixing the bug that would break the strongs concordance when a word had more than one number attatched to it. Yesterday, I also added Prev and Next Chapter links, as well as Prev and Next book links for easier navigation.

Enjoy! 

Link

Jacascript Tabs
Fixes the tab behavior in textfields, so that the tab key doesn’t move you to the next form element, but creats 5 spaces instead. 

Manipulexity and Whipituptitude

As Adam Turoff explained once, Perl has two subtle advantages: manipulexity and whipituptitude. It’s very important to be able to solve the problem at hand simply and easily without languages and tools and syntax getting in your way. That’s whipituptitude. Manipulexity is the ability to use simple tools and build a sufficiently complex solution to a complex problem.

What is Perl 6? by chromatic 

Perl DBI 1.50 bug in Weaken Support Check

A friends Ikonboard failed recently with an error saying:


Ikonboard has exited with the following error:

Modification of a read-only value attempted

The problem ended up being caused by a change in the DBI.pm module from 1.49 to 1.50.

The offending code is below:


275 # check for weaken support, used by ChildHandles
276 my $HAS_WEAKEN = eval {
277 require Scalar::Util;
278 # this will croak() if this Scalar::Util doesn't
have a working weaken().
279 Scalar::Util::weaken(my $test = "foo");
280 1;
281 };

The error is on line 279. The negates the " and instead of passing a reference to a scalar value to the weaken function, if returns something else, something that I assume can’t be modified by the weaken function, thus the error.

The code can be fixed by replacing the above code block with this one:


275 # check for weaken support, used by ChildHandles
276 my $HAS_WEAKEN = eval {
277 require Scalar::Util;
278 # this will croak() if this Scalar::Util doesn't
have a working weaken().
279 my $foo = "foo";
280 my $test = $foo;
281 Scalar::Util::weaken($test);
282 1;
283 };