Jeremy Scharlack's Blog
(not | yet) another blog
Tech
Computers, Gadgets and Other Nerdy Things

February 04, 2004

Changing URLs in comment body

I also changed the urls posted in comments to prevent spammers from increasing their google ranking. Now all urls posted of the form <a href=”http://www.wherever.com”> will be changed to <a href=”http://blog.scharlack.com/go.cgi?link=www.wherever.com”>, using the perl script I described previously.

The change is simple enough for anyone who knows perl. This regular expression will do it:


s/http:\/\//http:\/\/blog.scharlack.com\/go.cgi?link=/g

Not too bad for a regex, but still weird looking. It simply substitutes all instances of “http://” with “http://blog.scharlack.com/go.cgi?link=”. It does it globally hence the /g. The backslashes are placed before any slashes to “escape” them since / means something to a perl regex.

Now to put regex ability into movable type. For that I got Brad Choate’s plugin mt-regex.

There are manyways to use mt-regex, but I just needed to do a simple substitution in the comment body. To do that i just changed the MTCommentBody tag to:

<$MTCommentBody regex="s/http:\/\//http:\/\/blog.scharlack.com\/go.cgi?link=/g" $>

Posted by Jeremy at 02:26 AM | Link | Comments (0) | TrackBack (0)


New Comments

Due to the Comment Spam I had been getting I decided to edit my comment templates again.

It seems comment spammerrs aren’t spamming me to get my attention, but to increase their google ranking with a link. So I am changing all commenter’s urls to redirection links using a little perl script I wrote located at go.cgi:

#!/usr/bin/perl
use CGI ':standard';
$link = param('link');
if ( !$link ) {
        $referer = referer();
        if (!$referer) { $referer = "javascript:history.go(-1)"; }
        print "Content-Type:text/html\n\n";
        print "No URL given for this user<br>";
        print qq|<a href="$referer"*gt;<-- Go Back|;
}
else {

        if ( $link =~ m/http/ || $link =~ m/mailto/ ) {}
        else { $link = "http://" . $link; }

        print "Location:$link\n\n";
}

The script is called as go.cgi?link=www.wherever.com. The very last line redirects someone $link, in this case www.wherever.com. The other stuff includes checking if there is an http:// in the name and adding one if there isn’t. It also checks for a mailto and it uses that if it is present. It also will print up a page saying there is no link if none is specified.

I modified the comment parts of my individual archive template to:

<span class="comments-post">
 Posted by: <$MTCommentAuthorLink spam_protect="1" show_url="0" $>
 from <a href="http://blog.scharlack.com/go.cgi?link=<$MTCommentURL$>">here</a>
 at <$MTCommentDate$> | 
 <a href="<$MTEntryPermalink$>#<$MTCommentID pad="1"$>">link</a>
</span>

This creates two links, one for the e-mail and the other for the url. I couldn’t find a better way to do it since the <$MTCommentAuthorLink$> tag creates a whole link with both tags and a name.

This also resolves another issue of mine: it stops the url links in my comments from opening another window. Just a little thing I never liked.

Posted by Jeremy at 01:47 AM | Link | Comments (1) | TrackBack (0)


January 13, 2004

E-mail Obsfucation

See that e-mail link on the top right, it should look the same, but it has in fact changed. Spam bots shouldn’t able to harvest that address now. Hopefully that should cut back on spam.

My e-mail isn’t written anywhere in the source code. It is written using javascript. One could just simply have javascript write out the code like this:

<script LANGUAGE="JavaScript">
  user = "jeremy";
  site = "scharlack.com";
  document.write('<a href=\"mailto:' + user + '@' + site + '\">');
  document.write('jeremy &lt;at&gt; scharlack &lt;dot&gt; com<a>');
</script>

But that wouldn’t be paranoid enough. So I found this site which will generate my e-mail address from an encrypted cypher:
<script type="text/javascript" language="javascript">
<!--
// eMail Obfuscator Script 2.1 by Tim Williams - freeware
{
 	coded = "to3owd@5mrk3vkmu.myw"
		cipher = "aZbYcXdWeVfUgThSiRjQkPlOmNnMoLpKqJrIsHtGuFvEwDxCyBzA1234567890"
		shift=coded.length
		link=""
		for (i=0; i<coded.length; i++){
			if (cipher.indexOf(coded.charAt(i))==-1){
				ltr=coded.charAt(i)
				link+=(ltr)
			}
			else {     
				ltr = (cipher.indexOf(coded.charAt(i))-shift+cipher.length) % cipher.length
				link+=(cipher.charAt(ltr))
			}				
    }
			document.write("<a href='mailto:"+link+"'>jeremy &lt;at&gt; scharlack &lt;dot&gt; com</a>")
    }
//-->
</script>
Posted by Jeremy at 11:06 AM | Link | Comments (0) | TrackBack (0)


January 12, 2004

Creation on a Mac

After remarking that Appleseems determinedly intent on fucking itself over” explaining

I’ve never edited a movie in my life, never mastered a video DVD, and never even considered making a multi-track music recording. Neither have you, if I might be permitted to play the odds here. By aiming its media tools at creators instead of consumers, Apple is either confusing Jobs’ Pixar coworkers and celebrity friends for normal people, or deciding that its long-time 5% market-share is too big.

Mike Koslowski was then criticized by Patrick Nielsen Hayden and Ginger Stampley saying basically that they do in fact want to create, and so do plenty of people they know.

Mike then responds:

Apple knew this was coming. In 2001, they announced their vision of the PC as “digital hub”, and I gaped: Yes, exactly, that was it. This integration and convergence was the next great challenge facing the industry, and if Apple focused on it, they could create the future.

But they didn’t. They got sidetracked with their vision of content creation, which is fine for those who are going to use those apps, but leaves the rest of us waiting for the future to arrive. And, as a side effect, cuts Apple out of the picture when the future does get here. None of those devices that are being introduced at CES have Apple logos. Many of them won’t even work with a Mac. Meanwhile, Microsoft is rapidly developing and expanding its Media Center software (currently at its second version; and we know what that folklorically means for the next version), and working with oodles of consumer electronic manufacturers to release devices that work well with their software.

Well Apple has hardly been slacking with itunes, has just announced several (much needed) improvements to iphoto, and expanded its hightly successful ipod line (not that I really like the new mini ipods), all of which Mike had previously praised. These have also been far more successful than, for example, Microsoft Media Center.

It is also worth noting that all of the creation apps he criticizes are based on professional apps: iMovie comes from Final Cut Pro, iDVD comes from DVD Studio Pro, and GarageBand comes from Soundtrack. These professional apps have all been highly successful with real content cretors. Apple had to put considerably less effort into making these apps than if they had to start from scratch (the way a company like Microsoft would). It should be noted though that Apple didn’t start from scratch even on the pro apps: they brought applications from other companies and developed them further (they did the same with iTunes).

No matter how much I might use them, I am simply glad to see these apps on my computer. I have only used iMovie a few times, but I am glad it’s there and is simple enough that I don’t have to use it all the time to learn it. I have also used Final Cut Pro, at least until it crashed my computer (it was an older version, acquired totally legitimately), and I use Photoshop daily, so I may not be typical, but even I, who have never made anything musical in my life, am very interested in GarageBand. I remember using a similar program, FruityLoops, as while back on a PC, and although I never got anywhere with it, it was fun.

Apple also includes an extra CD, Developer Tools, with its OS. I have done a little programming, and I am generally geeky, but I certainly don’t ever plan on developing my own Mac apps. I installed it anyway (mostly to get the compiler), and I poked around a bit. There’s some cool stuff there. I am glad I installed it and I am glad Apple provides it.

Via Jim Henley, who has discussed this before without coming down on either side.

Posted by Jeremy at 01:11 PM | Link | Comments (0) | TrackBack (0)


January 10, 2004

WiFi Everywhere

Interesting proposal for a way to get WiFi even more places from Cringely via Slashdot.

He basically proposes to give people free wireless routers and cards which can then be programmed to let others on for a fee. This would allow wireless access to spread widely without a lot of investment or negotiation.

A good idea but I see a couple problems with this:

  1. Broadband providers probably won’t be thrilled with customers sharing their bandwidth
  2. These would most likely increase WiFi coverage in residential areas, but customers probably want it more in commercial areas, near their offices and hotels

The first issue is fairly easy to solve. Cringely mentions Speakeasy as an ISP which does allow bandwidth sharing. He thinks others will follow, but I suggest going right to the ISPs. They could provide wireless routers for free to customers provided they help build the WiFi network. However, I believe some ISPs rely on the fact that most people don’t use their connection most of the time, which is why they are weary of others using it as well.

The second issue is a little hard to resolve. You could give free equipment to business as well or course, but the equipment is more complex and expensive. Business also probably use more of the bandwidth they pay for at least during working hours. It might work with small offices, but not with even medium sized ones, not to mention stores and hotels.

Not a bad idea though. I do hope we get a comprehensive wireless network soon, and I predict we will.

Posted by Jeremy at 08:37 PM | Link | Comments (0) | TrackBack (0)


November 28, 2003

Blogging from Kinkos

Just because I can. I am in a Kinkos in Pasadena, CA right now, visiting LA for thanksgiving. It turns out Kinko’s will let you use their internet for free if you use your own laptop.

I am here checking my email and downloading (and using) a program, PodWorks which allows one to extract songs their iPod back to their computer. I needed it because I needed to burn a CD from songs on my iPod (my rental car only has a CD player), but the songs were on my external hard drive at home in New Jersey. The CD just finished burning.

I am such a geek.

Posted by Jeremy at 06:26 PM | Link | Comments (0) | TrackBack (0)


November 16, 2003

Comment Spam

…and on my little updated, unread blog. I think they spammed every entry, and several were spammed with up to 4 comments. I know lots of people have been having these problems; I just can’t believe it filtered down to me.

It would have been a huge PITA to remove all those comments without MT-Blacklist plugin. I had heard of it before, but found it on the Movable Type main page. It wasn’t too difficult to install, just download, unpack, upload and change permissions. I could imagine it being complicated for someone who doesn’t know UNIX though. I expect to get an email from Sam pretty soon.

It worked great. Its default list got most of my spam. I added a custom field (fda.gov – someone was posting with that fake address) that got rid of the rest.

Really, what is the point of all that spam? Am I or my nonexistent readers really going to buy viagra from you? Assholes.

Posted by Jeremy at 01:42 AM | Link | Comments (1) | TrackBack (0)


November 02, 2003

Photoshop File Browser

File BrowserJust got through processing a bunch of digital photos I took this halloween. I was starting to use iPhoto but, I was quite frustrated with its slowness, especially on my large photo library. So I started opening the images with Photoshop’s file browser. It was much faster, of course. The images were also smaller, but they took about as long to load in photoshop as they did to preview in iPhoto. Photoshop also recognized the automatic rotation that my camera embeds in each file, meaning that all the verticals were vertical in the right orientation. That saved a surprising amount of time. Most importantly I could do a batch action on any group of files I selected, saving lots of time, letting me alter each image, and letting me edit. Very useful when I had a bunch of shots I wanted to e-mail people: I could select the images and the go do something else while photoshop resized them, preformed some basic tonal correction and saved the jpegs in a different spot. I could even automatically create a web gallery based on the images I selected.

Posted by Jeremy at 04:43 PM | Link | Comments (2) | TrackBack (0)


 

Archives

Recent Entries

Links

Powered by
Movable Type 2.63