Metacrap
Archived Posts from this Category
Archived Posts from this Category
I’m lucky I have four computers at my disposal, otherwise I’d be screwed. Yesterday two of them broke. The Sawtooth mac was upgrading its OS when it crashed. Now it kernel panics whenever it boots up. It wouldn’t be a big deal, but I can’t find my 10.3 CDs at the moment.
Then, my old PC (the music server), died again. It had a hard drive failure on its system drive a few months ago, and Berg kindly gave me a brand new drive to replace it. Unfortunately, that new drive has now failed. Curses! The drive is still under warranty, but I have to pack it up, ship it in, and wait for a replacement, all pains in my ass.
Fortunately my other Mac and my media PC are both functioning. For the moment.
In the world of improved computer stuff, I have a small announcement. I bit the bullet and upgraded this blog to MovableType 3.12. This is the version with more restrictive licensing, which is frustrating. However, it also has some major enhancements, particularly in the realm of spam-blocking. In the last week, I’ve been hit with over 3000 spam comments. The existing system for blacklisting and removing spam was functioning, but the overwhelming deluge of spam was beginning to expose the software’s weaknesses. It was time for an upgrade.
Now, comments to posts older than three weeks will be moderated, meaning I must approve them before they appear. If this happens to you, don’t worry, I’ll approve your comment as long as you aren’t selling penis pills. Also, comments with more than two URLs in them will be moderated. If you have to post a lot of links, go ahead and do so, but know that your comment won’t appear on the website right away, I’ll have to approve it (which, again, I’ll do as long as you aren’t selling penis pills). The amount of spam actually appearing on the website should decrease drastically from this point on, though one may occasionally slip through my ever-tightening nets.
If you feel like you have been blocked or needlessly moderated, or I seem to have forgotten to approve your legit comment, please contact me.
6 comments Tuesday 07 Dec 2004 | Sam | Metacrap
Two tiny updates:
On the About page, there is now a tiny bit of additional info, namely, the total number of posts, total number of comments, and overall comments per entry (currently 1.9), in addition to the month-to-month data. You don’t care, but I do! It is like a running log of how interesting I am.
Second, there is a little Towers of Hanoi solver running. Thanks to Amit Singh’s Hanoimania I have been tweaking some PHP code to solve the classic puzzle. His code is great, and deserves all the credit, however, I’ve made a few tweaks to improve the interface, and add additional information such as the number of moves required to solve the puzzle.
For anyone who isn’t familiar, the Towers of Hanoi is a classic puzzle consisting of three posts with a tower of disks placed on one of the posts. The disks are stacked according to size, with the smallest disk on top, descending to the largest disk on the bottom. To solve the puzzle you must move the entire tower from the starting post to a different post. You can only move one disk at a time, and no disk may be placed upon a disk smaller than itself, IE, disks can only move to empty posts, or on top of larger disks. It turns out that the puzzle has a very simple algorithmic solution, which Amit implements in 108 different programming languages, a truly heroic effort. I’m playing with the PHP one for the heck of it.
There is a little legend associated with the puzzle, whereupon a monastery deep under the mountains contains a version of this puzzle with diamond posts and golden disks. There are monks there who are solving the puzzle. The puzzle began with 64 disks, and they started solving the puzzle, one movement per second, at the beginning of the universe. When they finish the puzzle, the universe will end. Solving a 5 disk puzzle is fairly easy, and once you figure out the system, the movements come quickly. However, with a little calculation you can see that the number of moves needed to solve the puzzle goes up very quickly. It turns out that it will take the monks somewhere around 580 billion years to finish the puzzle with only 64 disks.
Bonus points to anyone who can figure out the equation to calculate the optimal number of moves required to solve the puzzle with a given number of disks (N). Hint, check out the solution for 1 disk, 2 disks, 3 disks, and 4 disks. Seeing a pattern yet? Try to predict the number of moves required for 5 disks, and see if you can formulate an equation based on that pattern.
0 comments Thursday 18 Dec 2003 | Sam | Misc. Technical, Metacrap
I hate having a downed server. In this case, my host’s name server went down, and stayed down for several days, which is why you couldn’t read this site, or send me (or any other cowboy) mail. Now you can! So go nuts.
There are a lot of interesting things that happened over the week, but I’m afraid that you won’t be hearing about them, because I’m no longer in the mood to write about them. Maybe I’ll get in the mood, but maybe not. I suppose we’ll just count this as a week lost to the void. Bye bye, week.
Anyway, I’ve got some correspondence to catch up with, now that I have email again. More interesting posts will follow, I promise.
9 comments Tuesday 09 Dec 2003 | Sam | Metacrap
After playing with many different wiki engines until far too late at night, I’ve decided to try out WikkiTikkiTavi. TWiki is far too complicated, and PHPWiki does not seem to be under good development at the moment, and has been fairly buggy for me (which is in fact, why I’m switching), and MoinMoinWiki, which seems to require a really silly amount of installation and confusion for a python script.
WikkiTikkiTavi is in early stages of development, but has a simple templating system, and seems to be fairly powerful, without being overly complex. In fact, it is quite simple.
If you don’t know much about Wiki, let me just tell you that it is a website that anyone can edit. Yes, even you. Each page has a link at the bottom that says “Edit this page”. You can click there, and edit the page, using simple markup instead of full HTML. New pages are produced anytime you put two words together and capitalize them, LikeSo. As soon as you do that, the page is produced, and you can begin editing the new page. Wiki’s live on soft security, and evolve as a function of their user base.
One thing a wiki does as part of ‘soft security’ is remember all changes made to itself. Say someone comes along and trashes something (which is actually very rare in the wiki world), some other kind soul can just come along and restore from the change log. Its a very unique thing.
Anyway, please give what may become the new CowboyWiki a try, and let me know how you like it. If you aren’t used to wiki, I suggest reading a bit more about it, and them come play around. If you ARE used to wiki (Andrew, Will, Dustin I’m looking in your direction), please let me know how you think of things. There are some nice features, for instance, just click Preferences to identify yourself, and your name now becomes a WikiWord. The sidebar is actually its own wiki page as well, so is editable. You can double click on the page to instantly open the Edit window, if you don’t want to click the link at the bottom. Many interesting features, but still deliciously simple. I want to hear your feedback!
2 comments Thursday 30 Oct 2003 | Sam | Metacrap
Made a few more small changes to the site. Firstly, the search page is now wrapped comfortably within a PHP script. Handy, because it lets me control more of its appearance and behavior with PHP, which I couldn’t do before, when it was just a lowly perl CGI script. Namely, use includes to put in standard header and footer elements. It also gave me the ability to finally generate truly compliant code on the search system. Not too shabby.
The other change utilizes the nice MT plugin MTRelativeDate. Its a very simple plugin that works exactly like the normal date template tags, but gives the option of using “Today” and “Yesterday” to describe the date on entries where it is appropriate. Look for its use! Clever huh? It also affects the comment date/time information. Very nice. At least, I think so.
More little tweaks coming soon. Why? Because I enjoy it! Huzzah!
Oh, and some real entries containing stuff you actually give a crap about are coming soon too!
Update: MTRelativeDate, while an elegant solution, isn’t working properly for me. It only updates the date when I post a new entry, so things get out of date (pun unintentional) pretty fast. So, I reverted to a more verbose, but ultimately more effective solution, which is a snippet of PHP code. The code gets today’s date, yesterday’s date, and the date the post was made. Then it compares them and decides whether it should print “Today”, “Yesterday” or the day of the week, such as “Wednesday”.
";if ($entrydate==$today) {
echo "Today,";
}
elseif ($entrydate==$yesterday) {
echo "Yesterday,";
}
else {
echo(",");
}
?>
4 comments Thursday 16 Oct 2003 | Sam | Metacrap
Many blogs have been hit with a new type of spam. Comment spam. This site has gotten a few, but you probably haven’t noticed because I’ve removed them in short order. However, some automated bots are in action, and some sites have been hit with hundreds of spam comments in short order. A few tools are being looked into to supplement the basic IP banning concept. Some are rather unique, such as attempting to steal pagerank from spammers (which I don’t feel will be effective (Andrew agrees), but at least it is thinking ‘outside the box’), to more traditional solutions like blacklisting, whitelisting, distributed blacklisting, bayesian filtration (which he set up in response to concerns about accessibilty stemming from his previous solution, discussed below), and more.
One interesting method, and something I’ve been thinking about recently, and has was implemented by James Seng (who also wrote the Bayesian plugin noted above) is a ‘captcha’ that provides a very basic turing test. In order to make a comment, you have to look at an image, and then type the numbers seen in the image into a form field. You may have seen these in some places where you are making online orders and they wish to verify that a human is reading, not a machine.
One problem with this, that is noted heavily in his comments for the entry, is accessibility. If you can’t see, you can’t complete the test. Now, I admit that there aren’t many blind people reading the web, but they are out there, and they use browsers that are basically a text-only browser with the addition of special navigation tools, and a text-to-speech engine. Accessibility is a big deal now, and tools like this that hamper accessibility should be avoided in my opinion. Some may argue that sometimes you have to make a sacrifice in order to block the scourge of automated comment spam, but I’m inclined to believe that there is a better way. Until other solutions have been exhausted, I’m going to avoid this route.
Some people have suggested text based turing tests. For instance, you might have to answer a question like, “What is the third letter of the word ‘Banana’?” However, the basic problem is that even if this question is randomly generated, pulling from a set of predefined questions and answers, or even pulling random words and random numbers (third, fifth, seventh, etc.), it will ineveitably be parsable by a computer. If a script can create it, a script can parse it and get the answer. The benefit of images is that it is largely one-way. You can create an image with a script, but it is very hard to get text back out of that image. If only there was a way to do it without an image, but still retaining a level of unparsability.
If you have any great ideas, let me know! Until then, I’ll be using some basic tools, bayesian filtration primarily, to control comment spam. If it gets out of hand, I’ll put more thought into these other interesting possibilities. It may turn out that basic methods are sufficient, but the concept of developing a proper turing test is very interesting to me, and is worth considering, if only as a mental exercise. Its obvious the human brain is different from our computers, but it is difficult to pinpoint exactly how, and to produce tests that a computer can use, but that can only be answered correctly by a human.
Also, as a side note, this post sends more trackback pings than any other post I’ve made. Link-tastic!
4 comments Wednesday 15 Oct 2003 | Sam | Metacrap
In case you are interested, there is a new format for the archive URLs. Instead of looking like http://www.flexistentialist.org/archives/000325.shtml, which gives you no information whatsoever, they now look something like this: http://www.flexistentialist.org/archives/2003/10/12/new_archive_urls.shtml (which is the link to this entry). This includes the date, and the first 16 characters of the entry title, which makes much more sense.
If you’ve linked to entries before, using the old style, please change the links to the new style. However, if you don’t change it, its not the end of the world, because there is a redirect set up to move you to the correct entry.
For information on how to do this sort of thing, check out the following links:
2 comments Sunday 12 Oct 2003 | Sam | Metacrap
I’ve got a few quotes that randomly appear beneath the navigation bar at the top of the page. Instead of choosing from the regular fare of inspiring quotes, I’ve chosen to focus specifically on quotes from interesting hip-hop songs. Some of them are funny, others quite serious. I see much hip hop as a sort of poetry, and most of it quotes quite nicely. Here is a little list of the quotes you might see on the top of the page, and where they are from.
Finally, the title of this post is also a quote from a hip hop song. Bonus points to whoever can name the song and artist! Also, any suggestions for quote additions would be welcome, or even just songs that you think have a great message are welcome.
5 comments Sunday 05 Oct 2003 | Sam | Personal, Metacrap
I stayed up later than I should enabling the random photo that you see on the main page now. Refresh the page to see another one. Go ahead, refresh again. And again. Then one more time. Each time you refresh, a new image appears! Crazy!! You can just click that silly little refresh button all damn day, and you’ll see nothing but random images. Of course, there are only about 148 images in the pot right now, so you’d get repeats soon enough.
As usual, contact me if you want to know more about how I did that.
2 comments Tuesday 30 Sep 2003 | Sam | Metacrap
This is a note to all those using RSS feeds to view this site. There is now an RSS 2.0 feed with comments included, if you desire it. The url for the feed is http://www.flexistentialist.org/index-comments.xml if you would like to subscribe. Using this feed, your aggregator will show an entry as new if it has a comment posted. You can then read the entry to see the comment listed at the bottom. Its handy for keeping up with the discussion that often ensues from my entries.
Of course, if you think the comments are nothing more than mindless blabbery, and you don’t want to have entries you’ve already read show up as new just so you can read the comment, then stick with the regular RSS feeds.
If you don’t know what RSS is, then read this handy article titled All About RSS. In short, RSS is a method by which the content of this website is sent out in a generic news format that programs called aggregators can read. The aggregator downloads the RSS file on a set interval (once an hour, once a day, etc.), and checks to see if there is a new entry. If so, it highlights the entry, and makes it easy for you to browse. I have about 30 websites in my aggregator, and whenever any of them make an update, I am informed within the hour. It makes keeping up with a lot of blogs and news sites very easy.
2 comments Thursday 25 Sep 2003 | Sam | Metacrap
Today celebrates over 100,000 words of nonsense written on Flexistentialist. The current stats for the site, including this post:
Here is to another 100,000 words of drivel, coming at you from Flexistentialist.
4 comments Wednesday 24 Sep 2003 | Sam | Metacrap
As any Movable Type weblog software user knows, finishing a post only to realize when viewing the page that there is an error, and having to navigate back through the MT menus to edit the entry, is a hassle. One solution is to put an “Edit this Entry” link next to each post. Clicking the link opens the MT edit window for that entry, and you can fix the entry right there. However, this requires you to put an unsightly link by each post, something that your users will never use. If they try, they just get prompted for your username and password. Some hide the link, make it tiny, etc., trying to minimize this problem.
But what about a more elegant solution? Girlie has a solution that involves making a custom PHP file that sets a cookie, then having some PHP code in your index template that checks for the cookie, and then presents the link if it finds the cookie. This works fine, but still isn’t very elegant. You need to visit this special little page to set the cookie, and anyone could find said page and set the cookie, or you could lose the cookie and forget where the special page is, etc.
What would be best, is if the snippet of PHP could detect the cookie that MT uses when you have it remember your login settings. A quick modification to Girlie’s code lets it check the cookie that MT places, and compares the author name of the post to the author name in the cookie. If they match, it presents the link. This even works for multiple author blogs, because the cookie will only match for that author’s entries, hence the link will only appear on those entries.
Now, this is all very elegant sounding except for one horrible dirty little secret. You have to make a small modification to the MT code. I hate to do it, but I couldn’t figure out any other solution. The problem is that when MT sets the cookie, it sets the path of the cookie to be the relative location of mt.cgi, ie, ’/cgi-bin/mt/’. This means that the browser will only return the cookie to pages that are underneath that directory. If we try to access the cookie from flexistentialist.org/ the browser won’t send the cookie data, and it is though the cookie doesn’t exist. What we need to do is change it so that instead of setting the ‘path’ value of the cookie to ‘cgi-bin/mt/’, or whatever the install location of MT is, it sets the path location to ’/’ which means the cookie will be sent to any file or directory at your domain. It still won’t send the cookie data to other domains (which would be a security risk) because we aren’t changing the ‘domain’ parameter of the cookie.
So down to the nitty gritty practical stuff. Keep in mind that you are making a change to software you don’t understand, and that it is possible to break something in a way I can’t predict. This is a simple change, but still, back up your installation, and export your entries before doing this, because its just good policy. The following mod is being done to version 2.64 of MovableType. Other versions probably have similar lines, but they may appear in different areas of App.pm. The bake_cookie subroutine is pretty streamlined, so it is unlikely to change in future versions, but I’m not Ben, nor Mena, so I don’t know for sure.
First, lets make the small modification to one of the MT files. Navigate to the MT install directory, the one mt.cgi is in, and then navigate to lib/MT/ and open App.pm. Scroll down to about line 164, which will put you around the beginning of the bake_cookie subroutine, which looks something like this:
sub bake_cookie {
my $app = shift;
my %param = @_;
unless ($param{-path}) {
$param<del>path} = $app</del>>path;
}
See the bottom three lines of code, beginning with the ‘unless’ statement? These three lines are what set the path parameter to $app>path; which is your installation directory, /cgi-bin/mt in my case. What we want to do is comment these two lines out, and add one that just sets the path to ’/’. Change the above section of code to look like this:
sub bake_cookie {
my $app = shift;
my %param = @_;
- Add the line below this comment. The line simply sets the
- -path parameter to '/' in all cases. This lets the cookie be
- accessed from any file on your domain, instead of just files
- beneath the MT installation directory.
$param{-path} = '/';
- Comment out the three lines below this as shown. These
- lines are what set the -path parameter to 'cgi-bin/mt/' or
- whatever your install directory is. We don't need them
- anymore, but its bad policy to delete stuff, in case you
- want to undo this, so we just comment it out.
- unless ($param{-path}) {
- $param<del>path} = $app</del>>path;
- }
Now that we have told MT to always set cookies with a path of ’/’, we are done with the dirty work, and can simply insert a snippet of PHP into our templates where ever we want an “edit this entry” link to appear!
Here is the snippet. This snippet assumes your files are parsed as PHP files, look elsewhere if you need to find out how to do that, it isn’t hard. The snippet must be placed inside an MTEntries container tag to work.
, // its just there for display purposes. $edit_link = '<a>mt.cgi?__mode=view&_type=entry&id= &blog_id=" target="_new">[edit]</a>';// This checks to see if the cookie variable begins with the author name.
if (eregi ("^", $HTTP_COOKIE_VARS['user'])) { echo $edit_link;
}
?>
The first part of the code just defines the ‘edit’ link. You can have it say anything you want as the link text. It is also set with target=”_new” to have it open a new window, remove this if you don’t like that behavior. The details of the URL, such as the blog ID, the entry ID and the MT URL should all be filled in automagically.
The second part of the code just checks to see if the contents of the ‘user’ cookie, which is the one MT leaves, which will look something like this, “Sam::ajel23jfaU3::1”, begins with the name of the author who wrote the post. The first :: and everything after it isn’t important for our purposes, so we ignore it. If the author name and the cookie match, then the edit link is displayed. Since that cookie is only in place on computers where you have logged into MT, and specified “remember my login details”, then it only appears for you!
Ta Da! Put this snippet on your main index template, in your archive template, or anywhere you want an ‘edit this entry’ link! I put the link right after the title of the entry, but maybe you’d like to put it somewhere else, or even change the [edit] text to the MTEntryAuthor tag, and put it at the bottom of the post where it says, “Posted by soandso” so that the name becomes the edit link (but only for you!). The world is your oyster, go wild.
What are some potential problems associated with this? Well, one potential problem might be a naming conflict with other web software on your domain that is trying to leave a cookie called ‘user’. Part of the purpose of setting the path of the cookie to be the install directory of MT is that no other applications, such as bulletin boards, will see the cookie and potentially be confused by it. By having the cookie be displayed to all files on your domain, if you had another piece of software that left a ‘user’ cookie, they could confuse each other. Theoretically, it would have been wise for the cookie to be called ‘mtuser’ or something less generic than just ‘user’, to avoid possible conflicts. For instance, the cookies left when someone chooses to remember details when leaving a comment are called ‘mtcmtemail’, ‘mtcmtname’ and ‘mtcmturl’, which are good names. If you are using any other software on your domain that leaves cookies, I recommend viewing your cookies to see if they leave anything called ‘user’ before making this modification, to avoid conflict, and promote harmony between web-apps.
Security concerns? This mod only allows other files on your domain access to the cookie, no other domains, so that keeps it ‘in the family’. If there are multiple people running things on the same domain, then potentially they could access the cookie when you browsed to their site. If you think that they are very clever and malicious, then you might not want to make this mod. However, if you think that the people you share a domain with are clever and malicious, you might not want to be sharing a domain with them. Beyond that, this should be a safe change to make, but still, do it at your own risk.
Finally, if anyone has any trouble getting it to work, better ideas on how to do something I did, or security concerns or if you just want to say ‘thanks’, please post a comment, or email me about it. Enjoy!
Update: Edited the code to use eregi() instead of ereg() as per Mark’s suggestions. This makes the login search case insensitive, to match the login of MT. For instance, your author name could be ‘Sam’ but you could login as ‘sam’ or ‘saM’, which could set a cookie that doesn’t match the author name, unless you use a case insensitive comparison. So now it does.
9 comments Friday 12 Sep 2003 | Sam | Metacrap
No no, you silly, I didn’t clean my real house, I mean to say that this website has been cleaned. I removed the Daily Sam picture, because it was horribly out of date, and I don’t feel like setting my webcam back up for now. I might replace it with a random image from my image archive, but we’ll see.
I modified how comments are displayed, in the hopes that it will be a little easier to read. I tweaked the CSS here and there a bit too, but you probably won’t notice, unless you are me, which you aren’t.
I also got the On My Playlist feature working again! The old one was based on spyAMP (see my programs section for more details on that), which required Winamp3. I’ve reverted to Winamp 2.91 because on my system it is faster and more stable than Winamp3. However, I lost the ability to update that part of the website. I wanted to remedy it, so I started using a new plugin called Currently Hearing that uploads your currently playing information to an ftp server. Now, this isn’t ideal, because my last set of scripts were built around the idea that the plugin would send an http POST query to the script, which would log everything in a mySQL database, and then a second script was called to display the data. Now, I have to parse a file that has been uploaded, which is a bit of a pain, and I have to do some funky logic to get it to understand whether or not Winamp is still playing.
So basically, the On My Playlist looks basically the same to all of you, but its totally different on the back end. I don’t feel like posting my script for that right now, because it is horribly hacked up, the logic is backwards, and the formatting is embedded in the script. However, if you know PHP and want a head-start on a script of your own, I recommend first checking out the example PHP scripts on the Currently Hearing page, and if you want to see how I’ve modified it, email me and I’ll hook you up with the script ‘as is’.
0 comments Thursday 11 Sep 2003 | Sam | Metacrap
Where, oh, where has this site gone? Well, unfortunately a rocky server migration combined with some odd DNS problems has rendered this site and Cowboys of Justice largely inoperable for the past few days. This includes email, so if you’ve sent me something either here or via cowboy-mail, or are concerned about your cowboymail account, then be sure to resent any correspondence.
Cowboymail is mostly operational right now. In the very least, it is receiving mail, though sending mail may or may not work at the moment. I’m on the prowl though, and it should be fixed soon.
This website lost its last few posts, which is why the last post in the archives is about a week and a half old. I have no rememberance of what I had posted after that date, so its just lost to the void. If anyone remembers, or better yet, has some sort of copy of the post (maybe a cached RSS feed or something?) I would be eternally grateful for the reminder and/or data!
Anyway, normal operation will be resuming shortly, thanks for bearing with me.
In a fit of late night creativity, I decided to compile all the brewing data I’ve generated thus far, and make a webpage out of it. If you’d like to see what we have brewed, how it turned out, and the recipe we used, check out the Brew Log! It is also a link on the top navigation bar now.
Also, I’ve added a nav-bar link to the Gallery which has been up for some time now, but in an experimental state. We are now actually using it, so feel free to check it out. There probably isn’t much in there of interest, unless you were one of the people hanging out with us recently while we were taking pictures.
0 comments Tuesday 24 Jun 2003 | Sam | Metacrap