Tuesday, February 9, 2010

Starting The Great Hunt

Reactions so far to The Great Hunt:

I'm enjoying Rand's resistance to his calling. Almost every genuine spiritual calling is met by horror and resistance. Oh, you need examples to prove the point? Moses, St. Augustine, Jesus (if you like Kazantsakis' deeply-felt interpretation) ... um, I'll think of some more. A "spiritual transformation" is a destruction of the ego. It's a "lose yourself to find yourself" thing. It's the meaning of death. Yeah, I don't think most of us are ready to die, we're way too full of self-love.

No, I think Siddhartha is a different story, Buddhism isn't about "spiritual calling", a Buddhist should laugh or snort about "spirituality", they wouldn't have patience with it. Most of what goes by the name of "spirituality" these days is new-age wishful thinking, quest for warm-fuzzies, yearning to feel connected or important.

I do like the Aes Sedai envisioned as spiritual practitioners.

The Eye of the World

OK, signed up for the Wheel of Time big read-in on Book Love Affair blog.

Just happenstance that I started reading WoT. I really liked George R. R. Martin's Song of Ice and Fire (so far) and wanted to indulge my LoTR-inclination, did some research, and picked up The Eye of the World.

What I enjoyed in this book:
  • Large, detailed world with (typical fantasy-lit) medieval-style political/economic/technology/cultural setting
  • Plot-driven, suspenseful writing
  • Sense of an epic, unfolding narrative
  • evocative villages/towns/cities, buildings, clothing, and landscape descriptions
  • Likable characters
  • Tolkienesque equivalents are enjoyable homage: Aragorn/Strider, hobbits, wizards, Sauron.

What I didn't enjoy in this book:
  • simplistic, unexplained good vs. evil scenario
  • uncomplicated (dare I say shallow, one-dimensional) characters
  • some continuity/context errors

Tuesday, January 12, 2010

Count number of files of certain size


find ./ -size 0k | grep "sess_" -c

This finds the files and directories matching a path and matching a size.
Can use -size +[number]k (above a certain size) or -size -[number]k (below a certain size), or a size match.
Then it pipes that to a grep for the word "sess_" and returns a count.
Helps us count the enormous number of blank sessions that our app is generating on OSX.

Friday, January 8, 2010

Selecting non-distinct rows in MySQL

Got this here.

SELECT *, COUNT(*) AS count FROM tablename GROUP BY fieldname HAVING count > 1

Wednesday, December 23, 2009

To count the number of session files in a directory

count number of session files in a directory:

ls -l | grep "sess_" -c

Saturday, December 5, 2009

PHPMyAdmin: Setting up the MAMP environment

Continuing notes to self. Followed the PHPMyAdmin macports installation instructions here.

I couldn't get logged in to PHPMyAdmin. When I tried to log in I got the message "#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)"

I googled the error and found this helpful thread in the MySQL forums. Amusingly, I found that I had previously had the same problem and thanked the poster almost exactly a year ago for the solution. Memory is short and technology is a long bizarre road.

yes- this works for me. You just have to go into the config.inc.php file and change:
$cfg['Servers'][$i]['host'] = 'localhost';

to this

$cfg['Servers'][$i]['host'] = '127.0.0.1';

Configuring my new MacBook Pro for development

I'm setting up my new —well, used, thanks JB!— MacBook Pro with Snow Leopard for development. I'm using MacPorts for simplicity, but of course, one always runs into something that baffles and confounds.

For future reference and benefit as I struggle through this:

Setting up the MAMP environment for Apache


  1. Don't forget to install XCode before installing MacPorts.
  2. This MacPorts guide is a good starting point.
  3. My first struggle was to get the right Apache launching, NOT the built-in Mac version.
  4. Make sure that the "web sharing" is off in System Preferences. This should be done before installing the apache2 macport.
  5. To check if you're running the right httpd (Apache daemon process) in terminal:
    ps -ax | grep httpd
    you want to see /opt/local/apache2/bin/httpd

    you don't want to see /private/etc/apache2
  6. To get apachectl commands working in terminal, I couldn't get the alias working, I had to add the path to .profile like this:
    export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:$PATH
    That includes the paths that MacPorts wrote.
  7. To see if you're going to execute the right apachectl, use this command in terminal:
    which apachectl
    and you'll see which one is first in line to execute. Very handy little command.
  8. I couldn't get my virtual hosts working until I edited /private/etc/hosts to assign them to 127.0.0.1 as described here. It wasn't enough to configure vhosts or my username.conf file and include it in httpd.conf.

Tuesday, October 13, 2009

Temporarily locking submit button

Suggested by this example.
I need a temporarily locking submit button because if there's a validation error on the page, the user needs to resubmit. But I need to stop the clickers (slow response sometimes on this server) and give them some feedback.

$(document).ready(function() {
$(':submit').click(function() {
$original = $(this).val();
$(this).val('Saving, please wait...')
.attr("disabled","disabled")
.fadeIn('slow')
.animate({opacity: 0.4}, 4000)
.fadeIn('slow', function() {
$(this).val($original).removeAttr("disabled")
.animate({opacity: 1}, 2000)
});
});
});

My only problem is that it conflicts with the jquery validation plugin we're using: it prevents the error bubbles from displaying when submit is clicked.
If I can reference a validation value then I can check whether this function needs to execute or not.

Monday, July 20, 2009

Brief display of unformatted text while jquery-ui or yui loads

On our new site I was seeing ugly unformatted text for a second while the jquery or yui widget loads. I didn't find anything about how to deal with that, but Michael of Amptools showed me the light.

1. Add style="display: none" to the element. Not in the stylesheet.

2. In the js for the dom event watcher, after the element loads, make it visible, like so:

(function () {
var carousel = null;
setTimeout(function() {

YAHOO.util.Event.onDOMReady(function (ev) {
var carousel =
new YAHOO.widget.Carousel("carousel-element",{
animation: { speed: 1 }
});

carousel.set("numVisible", 4); // override the default
carousel.set("revealAmount", 0);

carousel.render(); // get ready for rendering the widget
carousel.show(); // display the widget
jQuery("#carousel-element").slideDown();
});
},25);
// timeout is necessary for Safari and Chrome.
// Can be increased.
})();

Eclipse crashing when typing $

Eclipse 3.5 has been hanging almost every time I type a "$" character... and that's quite often. Every time this happened I had to force-quite on my Mac. At least PDT fixed that ridiculous "Selection Job Titile" error with this release.

Michael of Amptools kindly posted this bug to the Eclipse project, too. In the meantime I reverted to writing code in TextMate, no hardship there, but no "intellisense" treats either.

After uninstalling, reinstalling, and much gnashing of teeth, I did some more searching and pondering about this error.

This post gave me the clue I needed to deal with this problem.

The problem is solved by changing the Auto Activation code assist to a longer delay.

Preferences->PHP->Editor->Code Assist->Auto Activation

I'm finding that increasing the auto activation from 200 to 1000 is solving the hangs.

Yay!