Bracing against the wind  
www.documentroot.com  

Tuesday, April 06, 2010

Will Work for Praise

I'm involved in several open source projects and free services that people seem to use. The SMX web development language, a couple CPAN modules, some tools at google code, a captcha generator, etc.

Most of them I built because I needed them, and open sources because of shameless self-promotion. I've noticed that, after releasing code, I completely ignore it unless either a) someone (usually me) needs new feature/fix or b) someone emails me and says they like it.

Praise is, apparently, the bigger motivator. After someone emails me to ask for a patch/fix... I fix it, sure. But after I get praise... I find myself, usually within a few weeks, adding things like testing suites, transaction support, plugins.... or some other major overhaul. Not sure *why* I do that. But after 10 years, I've noticed a pattern.

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Saturday, March 06, 2010

How to Fix Blogger's FTP Bug

Google is canceling support for FTP in blogger. Fortunately, there's an easy fix and you get to keep your domain, and keep everything working the way it was.

1. Switch to hosting your blog on blahblah.blogspot.com ... but don't finish the migration (read step 2).

2. DONT LET GOOGLE FILL YOUR OLD BLOG WITH REDIRECTS. This will ruin your site's ranking and be, in general, a bad user experience.

3. Use a script to synchronize the blogspot domain pages with your real custom domain blog. Here's the script I'm using, it works well and uses ETags so is remarkably efficient. I'm running 12 blogs from a cron job now, 5 of my own.

4. Turn OFF any indexing services for the new blogspot domain (Allow search engines to find this site? NO). You don't want two sets of content out there. Many search engines, not just Google, will punish your site's ranking for having multiple versions.

5. (Rant: I don't believe, for a minute, that the engineers at Google couldn't figure out how to run FTP affordably. I do over a terabyte of FTP crap every month for free at memebot.com ... and I never even look at it.... paid for twice over with cheap ads. They're either liars or they are incompetent.)

6. ADD this script to the HEAD section of your template... so people won't use your blogspot domain:
<SCRIPT language="JavaScript">
<!--
var str=location.href;
if (str.indexOf('blogspot.com') > 0) {
var newStr = str.replace('http://YOURBLOGSPOTNAME.blogspot.com','').replace('http://www.blogger.com/blog-preview.g','');
window.location='http://www.YOURDOMAINHERE'+newStr;
}
//-->
</SCRIPT>


7. I made a form so people could sign up to have their blog sync'ed if they don't know what a cron job is. If you use rsync, I don't need your password. (Why didn't Google use rsync?). I have a bunch of dedicated servers for other reasons, so it's no problem for me for now (not too many people so far):

New Blogspot Site:
FTP Host (aka custom domain):
FTP Path (for example /blog/):
FTP Username:
FTP Pass (optional):
Use Rsync*:

* NOTE: To use rsync, you'll need click here and put this public key in your authority file (~/.ssh/authorized_keys). This way your password doesn't have to be entered anywhere.



Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, February 25, 2010

Google Code Scripted Upload

When you want to upload a file to google code in a script there are several options. IMO, send2goog is the best one. In addition to command-line args, it has an interactive mode that auto-saves your config info in ~/.send2goof.conf on both a global-default level and per-file-name level... so you don't have to remember pesky labels, retype usernames, etc. Much nicer than using google's web UI.

Reminder to self as much as anyone else.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Monday, February 22, 2010

Gnu Programs on Win32

Because I keep forgetting, I'm posting this as a reminder to myself that you can get nearly all the best GNU tools running on Windows. I use MinGW, G++, and gdb as my compiler suite of choice... but there's also programs like "calc", which I go rooting around looking for on Windows.

But this list is more than comprehensive, continins full binaries and works on every old, wonky and new, fancy version of Windows out there.

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Friday, January 15, 2010

List all perl modules that can be yum installed

I have to do this from time to time. Handy way to list all the perl modules needed to install. Useful when upgrading perl or building a new box.

List all modules needed by all code in the current directory:


grep "^use [A-Z]" * | perl -pe 's/\r//g; s/.*?:use //; s/ .+//; s/;[ \t]*$//;' | sort | uniq


Same as above, but massaged and piped to yum provides:


grep "^use [A-Z]" * | perl -pe 's/\r//g; s/.*?:use //; s/ .+//; s/;[ \t]*$//;' | \
sort | uniq | perl -pe 's/(.*)/perl($1)/' | \
xargs yum provides | grep -E '^([1-9]:)?perl' | perl -pe 's/^[1-9]://; s/ :.*//; s/-[0-9].*?$//' | \
grep -v perl$ | sort | uniq


Suitable for piping to xargs yum install....

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Friday, November 06, 2009

Try SMX, a true 5GL

I keep trying to like PHP, but, honestly, it's completely awful. Please, world, try SMX for some website stuff.

If you need a huge community, or a facebook api ... use the %perl module.

After about a week of using it, you won't look back. Built-in image creation support, sqlite support, odbc, all the good stuff you need for decent interactive websites.

I just debugged an old blog program I wrote. In only 779 lines... it's way better than Blogger, IMO. Support for templates, multipart blogs, image uploading, multi-user, RSS, everything... in a terse 779 line program. I bet Blogger's like 100K lines or something.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Tuesday, November 03, 2009

Postgres Replication

There's a lot of talk about the lack of built-in replication for postgres. I have been using the "pg_comparator" method for slave updates.

This is essentially similar to an "rsync" for database tables. It works extremely well and has a low configuration overhead. You can use it to scale a single table out to dozens of servers, even choosing which fields to replicate.

It's also easy to install, configure and maintain - even code for.

Personally, I like it better than the builtin solution that they are discussing on postgres's lists. I wish a diff-patch shipping solution was in the running. For a lot of us, that's exactly what we need.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, February 12, 2009

mod_perl and file-scoped lexicals don't work

After months of debugging, and rewriting my code and not understanding what was going on, I discovered a horrible, sneaky bug in mod_perl.

File-scoped lexicals, when used in subroutines, are bound to the first-occurrence of the variable. Because of the way mod_perl works, this means that the first time you run a CGI program *within a given Apache process* it will work as expected.

The second time and thereafter, those file-scoped lexicals will be bound to previous instances, and will contain previous values.

OUCH! So code like this won't work:


my $var = CGI::param('var');

sub x {
print $var;
}


Note to self: NEVER use file-scoped lexicals in mod_perl unless you want to risk suicide and sleepless nights.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Saturday, July 05, 2008

ASP for Linux

Whew! I wanted a version of ASP for linux.

Chili!soft's version was the "expensive brand name" - it's incredibly profitable product line was bought out by Sun and is apparently "no longer for sale" directly. You have to use Sun's even more incredibly expensive "development platform" instead of just licensing an Apache ASP plugin from them.

Halcyon's version had better reviews, but the company was apparently gone. I found out it was bought out by Stryon. Researching Stryon, I found that it went out of business in a fraud investigation. The CEO had apparently suicided, his assets seized by the government. They even sold off his wine collection. Researching this has been weirder than a television drama, with rumors of links to the Chinese government, and more. But who bought the code?

After all that craziness I found a beta version of a product called arrowhead asp.

Is it possible that owning a solution to "getting off Microsoft" is somehow inherently dangerous? I wonder if I should warn the developer about what he's getting into. Or maybe he's safe, since he's using Java as the source base, tying him to Sun's protection base.

Well, at least my blog article will help aimless people (such as myself) searching for Stryon, Chilisoft and Halcyon find the available Arrow ASP solution.

The thing is ... I could write a better parser and apache module - in nice portable ANSI-C - with 90% compatiblity for ASP in about 3 weeks. Should I? Dare I? Although I like coding, and it seems fun.... it actually seems scary to me after reading all that.

ADDENDUM: I found that mono-project provides real support for ASP under linux, or at least VB.NET web apps running under apache, which is close enough.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Wednesday, May 21, 2008

Image Cannot Be Displayed

Ever get "This image cannot be displayed because it contains errors." when viewing an image? The reason is, 99% of the time, that the image uses CMYK as its encoding. Here's a fixcmyk perl program, that resolves this issue for all the files in a given directory.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, May 08, 2008

Perl Round Function

Yes, you can't find this easily on the web. What you get is people telling you to import posix, or do some wacky one-off thing that works half the time. This is the only solution you'll ever need... it should be a builtin.

# round to any decimal place
sub round {
my ($n,$d) = @_;
return int($n/(10**$d) + .5 * ($n <=> 0)) * (10**$d);
}

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Useful Line for Quoting Shell Arguments

Safely pass "@*" to ssh without having to worry about the remote shell re-expanding variables.

qa=`perl -e 'for (@ARGV) {s/(["\\$])/\\\\$1/g; $_="\"$_\"";} print join(" ", @ARGV)' "$@"`
ssh remote-server "cd /some/where; do something; $qa"

Single quote version is safer, but is harder for me to read.

qa=`perl -e "for (@ARGV) {s/'/'\\\\\''/g; \\\$_=\"'\\\$_'\";} print join(' ', @ARGV);" "$@"`

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Monday, February 25, 2008

Logo Maker

MkLogo allows you to generate an image of some text in any font chosen (or uploaded). The "effects" are essentially parameterized shell scripts of ImageMagick examples. I used CoolText for a lot of quick site logos, but I got tired of the "glitzy" styles. Fonts aren't all categorized yet. Maybe I should make them editable, see how that plays out. Don't ask me why I seem to need to get a new domain name every time I write a small program. Habit borne of dotcom days.

Labels: , ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Monday, February 18, 2008

FormLite instead of FormMail

Created a simple FormLite program for saving an HTML form to a database file in a generic way that should be portable to most systems. IE: Anyone can paste it into the cgi-bin dir of nearly any hosting provider. It allows data to be exported to excel or to an html table. This was a frequent request of friends, etc. There are probably other things out there like this, but it was fun to write.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Tuesday, November 20, 2007

SMX, MySQL and ODBC

It took me a little while to figure out why SMX wasn't working with MySQL when under apache, but worked fine from the shell. MySQL's odbc connector, by default, is installed with the "not thread safe" libraries. This also breaks PHP, and Python and any other Apache module that tries to call SQLExecDirect on a MySQL connection. The result is a "Segmentation Fault" for the program using that ODBC driver - not nice. To fix, simply edit the /etc/odbcinst.ini file and replace libmyodbc3.so with libmyodbc3_r.so.

While searching for the solution to this problem, I found dozens of bug reports, and unanswered threads littering the internet. So I hope this page gets indexed well enough to be useful, since I nearly wound up patching the odbc-connector drivers to fix it.

Installing a "thread-unsafe" driver by default seems to be in the best interests of nobody, and MySQL should probably stop doing that. Safe settings should be the default, and "overclock" settings should be something advanced users do.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Friday, May 11, 2007

Postgres synchronizer

Database replication has a lot of overhead. Sometimes I just want to copy a half-dozen rows that change every once in a while. pg_comparator seemed like it would be helpful. It's analogous rsync for Postgres, albeit less efficient. But the version that was out there had a very ambitious version number. I wrote a patch to fix the program, and add the feature of actually performing the update/delete/insert as needed. Hopefully someone finds this useful.

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, December 14, 2006

Running Perl Programs as Services

Taking spur of the moment notes, responses to phone calls, ideas, things to do, etc. is something I prefer to do very rapidly. I never seem to manage to have "task software" installed on a given machine, nor do I regularly have web access. Nor would I want to wait, while in the middle of a thought, for a program to open, or a web page to load. Some people use a pen, but that requires me to lift my hands from the keyboard (slows me down). Plus I can type faster than I can write.

My solution is to create a shortcut to a text file on the Desktop assign a key sequence to it. I press Control-Shift-T and a text file pops open. Then I add some dashes at the top as a "new entry" marker. I jot some notes down and Alt-F-S, Alt-F4. I rarely remember to time/datestamp my entries, so I'd wrote a program to do it for me.

If it looks complicated, that's because I decided to copy and paste some skeleton code from Win32::Daemon. It's terribly easy now to create Windows services out of Perl programs.

The program monitors my two text "note files" and updates them with timestamps within 1 second after being modified. It uses negligible CPU time. Archiving could be done automatically as well, moving 6 month old entries to a backup, but for now, I like to do that by hand.

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, December 08, 2005

Server Macro Expansion for Apache

This site is now hosted on memebot instead of on an old windows box in my office, and is running linux with SMX-enabled apache.

SMX stands for Server Macro Expansion, and is a simplified macro-language for rapidly building content and database-interactive websites. It's the language I wrote ZoneEdit in, as well as the language that powers Memebot.

Labels:


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Friday, September 23, 2005

AIM:Chat with ErgoEst

Created a chatterbot based on Eliza. It's dumb and annoying, but it taught me a bit about Net::OSCAR - which was my real interest. For the evangelists out there, Jabber just seems rediculous. Run a whole server? DBM/DBI like drivers for ever-changing chat protocols are what's really needed.

Anyway. If you use Trillian (love love), GAIM, or any other AIM client, say hello to ErgoEst.

Labels: , ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Thursday, December 23, 2004

Minimize.exe

Have you ever written a Windoze console program and wished that it would minimize itself? I have. I have a zillion console programs that run at various times of day. I like to have them run as desktop apps - to view progress, but I don't like logging in to my server to a screen cluttered with console programs.

To solve this problem, I wrote 2 line, 5 k program called "minimize.exe". So now, at the start of my console apps, I just type "minimize". Probably someone will tell me that there's already a visual basic script active-x object that comes with XP that will do the job. So be it.

Source code is here.

Labels: ,


[View/Post Comments] [Digg] [Del.icio.us] [Stumble]

Home | Email me when this weblog updates: | View Archive

(C) 2002 Erik Aronesty/DocumentRoot.Com. Right to copy, without attribution, is given freely to anyone for any reason.


Listed on BlogShares | Bloghop: the best pretty good | Blogarama | Technorati | Blogwise