It’s that crazy guy: Spock!
June 30, 2006
Ahah! I found it, Tom.
Just for you….

(Warning – Sound and video)
VOTE NIMOY
FOR THE
UN!!!!!
A blast from the past…(so to speak)
June 30, 2006
I’m not posting because I’ve been thrown into a bit of a panic. I’ll post the reason later tonight.
But I was looking through the humor folder at work for something a friend asked me to find for him, and I stumbled across this…
I don’t know whether this falls under a joke, a time capsule, irony, satire, political commentary, proof against revisionists, or what…
-
The President is meeting with Saddam Hussein regarding the recent
crisis. They are meeting in Hussein’s Baghdad capital, and halfway
through the meeting Hussein hits a button on his armrest. A fake arm
flies out and hits Clinton in the face.
A little while later he hits another button and Clinton ducks, only to
be kicked in the butt. A while later, this happens again. Clinton is
angry, calls a break, and they decide to meet again later, in
Washington.
When Hussein comes to DC, they sit in Clinton’s office. A few minutes
into the discussions, Clinton hits a button, Hussein ducks, but
nothing happens. A few minutes later, Clinton hits another button, Hussein
ducks again, but still nothing happens. This happens a third time, and
Hussein, by this point, is angry and paranoid.
He gets up and shouts “Enough of this! I’m going back to Baghdad!”
Clinton looks up and displays a funny-looking smirk to the Iraqi
leader. Then quite calmly replies, “What Baghdad?”
–
Please include your work to support the answer…
June 28, 2006
Cindy’s comment on my last post reminded me that I did not show any of the routines I tried while trying to figure out how to get the full raw email from the built in PHP imap_ routines.
So, here it is… It is obviously scrap work, but some one might find it useful to have all in one place. Just save this as a php file on your server (some place not shared since you’ll have your email password in it in raw text) and then change the mail server, username and password references (3 of them) to your own. As is, this routine will display a VERY simple webmail reader. It displays a list of messages in your box and the contents of 1 message.
It should give you the groundworks for building something more complex.
However, what it does not include is any part of the TRUE header which is what I pointed out here that I really need.
BTW this routine is OBVIOUSLY NOT safe html. If you display an email that has an embedded code that does nasty stuff, this testing routine will not protect you from it. It is JUST test code. Use it wisely.
-
<?php
-
print(‘Therefore it is not fully documented or clean. <br/>It contains code fragments of my own making and those found on the web, who knows where. <br/><br/>’);
-
print(‘There are THREE places where you must put in your email server, email username and email password. <br/>’);
-
-
function list_emails(){
-
$MAILSERVER=“{imap.1and1.com:143}”;
-
// or $MAILSERVER="{pop.1and1.com:110}";
-
// or $MAILSERVER="{localhost:143}";
-
$PHP_AUTH_USER = “YourAddrHere@thecodecave.com”;
-
$PHP_AUTH_PW = “YOUR_PW_HERE”;
-
-
$mbox=imap_open($MAILSERVER,
-
$PHP_AUTH_USER,
-
$PHP_AUTH_PW);
-
-
-
echo “Number of Total Emails: “
-
.imap_num_msg($mbox);
-
echo “ Number of Recent Emails: “
-
.imap_num_recent($mbox).“<BR><BR>”;
-
$headers=imap_headers($mbox);
-
for($x=0; $x <count($headers); $x++) {
-
$idx=($x+1);
-
$headers[$x]
-
</a><br>”;
-
}
-
imap_close($mbox);
-
}
-
-
function view_message_num($num){
-
$MAILSERVER=“{imap.1and1.com:143}”;
-
// or $MAILSERVER="{pop.1and1.com:110}";
-
// or $MAILSERVER="{localhost:143}";
-
$PHP_AUTH_USER = “YourAddrHere@thecodecave.com”;
-
$PHP_AUTH_PW = “YOUR_PW_HERE”;
-
-
$mbox=imap_open($MAILSERVER,
-
$PHP_AUTH_USER,
-
$PHP_AUTH_PW);
-
$header=imap_headerinfo($mbox,
-
$num,
-
180, 180);
-
print(‘<br/><strong>This is a print_r of only the header->from contents.<br/>I wanted to ensure the print_r contained all the info from the subarrays. This text should also be found above.</strong><br/><br/>’);
-
$from = $header->from;
-
$udate=$header->udate;
-
$subject= $header->fetchsubject;
-
echo “From Address: “;
-
$from[0]->mailbox,
-
$from[0]->host).
-
“<BR>”;
-
echo “Personal : “.
-
$from[0]->personal.
-
“<br>”;
-
echo “Adl : “.
-
$from[0]->adl.
-
“<br>”;
-
echo “Mailbox : “.
-
$from[0]->mailbox.
-
“<br>”;
-
echo “Host : “.
-
$from[0]->host.
-
“<br>”;
-
echo “Subject : “.
-
$subject.
-
“<br>”;
-
echo “Date : “.
-
$date.
-
“<br>”;
-
echo “To Address : “.
-
$header->toaddress.
-
“<br><BR><BR>”;
-
}
-
}
-
-
$mid = $num;
-
$struct = imap_fetchstructure($mbox, $mid);
-
$parts = $struct->parts;
-
$i = 0;
-
-
if (!$parts)
-
{
-
/* Simple message, only 1 piece */
-
$content = imap_body($mbox, $mid);
-
}
-
else
-
{
-
/* Complicated message, multiple parts */
-
-
$endwhile = false;
-
-
$content = “”; /* Content of message */
-
-
while (!$endwhile)
-
{
-
if (!$parts[$i])
-
{
-
{
-
}
-
else
-
{
-
$endwhile = true;
-
}
-
}
-
-
if (!$endwhile)
-
{
-
/* Create message part first (example ‘1.2.3′) */
-
$partstring = “”;
-
foreach ($stack as $s)
-
{
-
$partstring .= ($s[“i”]+1) . “.”;
-
}
-
$partstring .= ($i+1);
-
-
“filedata” => imap_fetchbody($mbox, $mid, $partstring));
-
}
-
{ /* Message */
-
$content .= imap_fetchbody($mbox, $mid, $partstring);
-
}
-
}
-
-
if ($parts[$i]->parts)
-
{
-
$parts = $parts[$i]->parts;
-
$i = 0;
-
}
-
else
-
{
-
$i++;
-
}
-
} /* while */
-
} /* complicated message */
-
-
print(‘<br/><strong>This is a print_r of the results of the entire content of the email turned into an array as offered by RJ<br/>NOTE: THIS MIGHT NOT BE SAFE HTML</strong><br/><br/>’);
-
-
-
print(‘<br/><strong>This is a print_r of the body in text format. This in theory should be included above, but this is quote protected.</strong><br/><br/>’);
-
-
imap_close($mbox);
-
}
-
-
/*********************************************************************************/
-
/* Calling routines */
-
/*********************************************************************************/
-
list_emails();
-
$num =1;
-
}
-
view_message_num($num);
-
?>
-
<hr/>
-
<br/>
-
<hr/>
-
-
-
<?php
-
function parsepart($p,$i){
-
//where to write file attachments to:
-
$filestore = ‘.’;
-
-
//fetch part
-
$part=imap_fetchbody($link,$msgid,$i);
-
//if type is not text
-
if ($p->type!=0){
-
//DECODE PART
-
//decode if base64
-
//decode if quoted printable
-
//no need to decode binary or 8bit!
-
-
//get filename of attachment if present
-
$filename=”;
-
// if there are any dparameters present in this part
-
foreach ($p->dparameters as $dparam){
-
if ((strtoupper($dparam->attribute)==‘NAME’) ||(strtoupper($dparam->attribute)==‘FILENAME’)) $filename=$dparam->value;
-
}
-
}
-
//if no filename found
-
if ($filename==”){
-
// if there are any parameters present in this part
-
foreach ($p->parameters as $param){
-
if ((strtoupper($param->attribute)==‘NAME’) ||(strtoupper($param->attribute)==‘FILENAME’)) $filename=$param->value;
-
}
-
}
-
}
-
//write to disk and set partsarray variable
-
if ($filename!=”){
-
}
-
//end if type!=0
-
}
-
-
//if part is text
-
else if($p->type==0){
-
//decode text
-
//if QUOTED-PRINTABLE
-
//if base 64
-
-
//OPTIONAL PROCESSING e.g. nl2br for plain text
-
//if plain text
-
-
//if HTML
-
}
-
-
//if subparts… recurse into function and parse them too!
-
foreach ($p->parts as $pno=>$parr){
-
parsepart($parr,($i.‘.’.($pno+1)));
-
}
-
}
-
return;
-
}
-
-
//open resource
-
$MAILSERVER=“{imap.1and1.com:143}”;
-
// or $MAILSERVER="{pop.1and1.com:110}";
-
// or $MAILSERVER="{localhost:143}";
-
$PHP_AUTH_USER = “YourAddrHere@thecodecave.com”;
-
$PHP_AUTH_PW = “YOUR_PW_HERE”;
-
-
$link=imap_open($MAILSERVER,
-
$PHP_AUTH_USER,
-
$PHP_AUTH_PW);
-
-
$msgid = 2;
-
//fetch structure of message
-
$s=imap_fetchstructure($link, $msgid);
-
//see if there are any parts
-
foreach ($s->parts as $partno=>$partarr){
-
//parse parts of email
-
parsepart($partarr,$partno + 1);
-
}
-
}
-
-
//for not multipart messages
-
else{
-
//get body of message
-
$text=imap_body($link,$msgid);
-
//decode if quoted-printable
-
//OPTIONAL PROCESSING
-
-
}
-
print(‘<br/><strong>This is a print_r of another method of getting the complete parts of the email. This is the parts array.</strong><br/><br/>’);
-
?>
I’m still here and working on new plugins…
June 28, 2006
It’s been nutso at work since I got back and I’ve been researching a new idea too. So, I’ve not had time for posting. But I will share with you some of what’s caught my attention.
I have two plug-ins I am working on. One is in the EARLY testing phase. It’s called No-More-404. It allows all of the permalink structures you used before to be handled and not present 404 errors. I would like it to present 301 (moved/redirect) messages and point you to the correct structure, but right now I haven’t found an elegant way of doing that. The plugin is toooo top heavy if I build in all of the routines I would need to use using the method I have right now. So, it looks like version 1 of the plugin will simply allow multiple permalink structures for the initial link to your site. Google frowns on that, but it is better than everyone getting 404 errors. After they click (or crawl)on another link, the new structure will be used. But it would be better if I could force it to the official structure.
I am also working on a DNSBL routine that may become a WP plugin or maybe a VB plugin as well. Basically it will block spams based up on the IP address used to send the message. It would be strange to have WP manage your spam, but as long as both VBulletin and WordPress have Cron ablities, it will work for someone that does not have shell access to their host.
But I ran across a technical problem yesterday and it vexed me. I think I have it solved though. Some of you may find this interesting so, I’ll provide part of the conversation I’ve had over at http://www.codingforums.com/showthread.php?t=89994. Besites I am soooo light on words lately…
PHP Imap_blah function to retrieve full Internet header
I’ll switch over to the pear library if need be, but I CANNOT believe the built in php functions don’t do what I want them to do.I can use imap_header to get the basic "to" and "from" stuff in emails. They give the "typical end user" level of info about the origin of the email. However, what I want retrieve is the ip address of the smtp server that processed the email. That information is included in EVERY email and is available from IMAP servers (at least it is available to Outlook because you can right click on an email and choose options to see it).
I cannot find an IMAP_BLAHBLAHBLAH function that either returns this info or returns the full raw text of the message. I need the email’s Internet headers. This stuff:
Quote:
Return-Path: <tkuhnel@alushiptechnology.com>
Delivery-Date: Mon, 26 Jun 2006 23:53:47 -0400
Received-SPF: none (mxus6: 74.139.17.40 is neither permitted nor denied by domain of alushiptechnology.com) client-ip=74.139.17.40; envelope-from=tkuhnel@alushiptechnology.com; helo=Laskowski6;
Received: from [74.139.17.40] (helo=Laskowski6)
by mx.perfora.net (node=mxus6) with ESMTP (Nemesis),
id 0MKvMg-1Fv4dv28vt-0006m9 for *@thecodecave.com; Mon, 26 Jun 2006 23:53:47 -0400
From: "Adam Field" <tkuhnel@alushiptechnology.com>
To: <*@thecodecave.com>
Subject: RICARDO examined BENJAMIN of a please
Date: Tue, 27 Jun 2006 03:53:44 +0480
MIME-Version: 1.0
Content-Type: multipart/related;
type="multipart/alternative";
boundary="—-=_NextPart_000_006A_01C69962.9CE1DB50"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Message-ID: <0MKvMg-1Fv4dv28vt-0006m9@mx.perfora.net>
Envelope-To: *@thecodecave.comBut all I get from imap_headerinfo is this stuff :
$header=imap_headerinfo($mbox,
$num,
180, 180);
print_r($header);Quote:
stdClass Object ( [date] => Tue, 27 Jun 2006 03:53:44 +0480 [Date] => Tue, 27 Jun 2006 03:53:44 +0480 [subject] => RICARDO examined BENJAMIN of a please [Subject] => RICARDO examined BENJAMIN of a please [message_id] => <0MKvMg-1Fv4dv28vt-0006m9@mx.perfora.net> [toaddress] => [to] => Array ( [0] => stdClass Object ( [personal] => [mailbox] => brian [host] => thecodecave.com ) ) [fromaddress] => "\"Adam Field\"" [from] => Array ( [0] => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [reply_toaddress] => "\"Adam Field\"" [reply_to] => Array ( [0] => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [senderaddress] => "\"Adam Field\"" [sender] => Array ( [0] => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [Recent] => [Unseen] => [Flagged] => [Answered] => [Deleted] => D [Draft] => [Msgno] => 1 [MailDate] => 27-Jun-2006 03:53:47 +0000 [Size] => 12651 [udate] => 1151380427 [fetchfrom] => "Adam Field" [fetchsubject] => RICARDO examined BENJAMIN of a please )
The imap_body requests provide no more info with the default parameters.
I suspect the quotes I’ve provided here are more info than is needed for anyone that knows the answer, but I wanted to be clear about what I was asking.
So, how do I get that Received-SPF or Recieved info?
If this is not possible, is PEAR my best bet or do I have to go old school on this thing and communicate with it via FTP or telnet?
Input is appreciated!
A reply:
to find the SMTP address, would it not be as easy as extracting the hostname from the sender’s email address, and converting it to an IP address if necessary with gethostbyname() (http://us2.php.net/manual/en/function.gethostbyname.php)?
My Response:
Unfortunately, it is rarely that simple.
Take for example that address on the spam I quoted earlier. tkuhnel@alushiptechnology.com was used as the sender. However, that address is probably some innocent business man that had their email address plastered into several thousand spam emails.
Alushiptechnology.com evaluates to 62.233.142.37. That is very different from the address of the SMTP server that we see in the email 74.139.17.40. Additionally, since shared servers have become more common, it is not at all unusual for the SMTP server to be a common server – say smtp.lunarpages.com and the website url/email address to be on a totally different server like Support@codingforums.com.
So, unfurtunately, all things being equal, gethostbyname() is a good idea that won’t work in this situation. However, if we were to check on the IP address of the SMTP server, we can tell that it is blocked. Here is one of the places I would check: http://www.spamcop.net/w3m?action=ch…=74.139.17.40+
I’ll see if PEAR has a solution for me. But I still find it hard to believe that this info is not available from the built in functions that otherwise seem so robust!
If any of my readers have any other suggestions, your input would be much appreciated too!!!
Tags allowed in WordPress Comments & Posts
June 23, 2006
There have been some comments on the WP support forum asking what tags are allowed in WP comments.
If you are a user of the editor or author security levels with unfiltered HTML rights, you are technicially allowed to enter any HTML tags.
Otherwise, these are comment tags that are allowed by the filtering engine used by WordPress (KSES):
- address
- a
- href
- title
- rel
- rev
- name
- abbr
- title
- acronym
- title
- b
- big
- blockquote
- cite
- br
- button
- disabled
- name
- type
- value
- caption
- align
- code
- col
- align
- char
- charoff
- span
- valign
- width
- del
- datetime
- dd
- div
- align
- dl
- dt
- em
- fieldset
- font
- color
- face
- size
- form
- action
- accept
- accept-charset
- enctype
- method
- name
- target
- h1
- align
- h2
- align
- h3
- align
- h4
- align
- h5
- align
- h6
- align
- hr
- align
- noshade
- size
- width
- i
- img
- alt
- align
- border
- height
- hspace
- longdesc
- vspace
- src
- width
- ins
- datetime
- cite
- kbd
- label
- for
- legend
- align
- li
- p
- align
- pre
- width
- q
- cite
- s
- strike
- strong
- sub
- sup
- table
- align
- bgcolor
- border
- cellpadding
- cellspacing
- rules
- summary
- width
- tbody
- align
- char
- charoff
- valign
- td
- abbr
- align
- axis
- bgcolor
- char
- charoff
- colspan
- headers
- height
- nowrap
- rowspan
- scope
- valign
- width
- textarea
- cols
- rows
- disabled
- name
- readonly
- tfoot
- align
- char
- charoff
- valign
- th
- abbr
- align
- axis
- bgcolor
- char
- charoff
- colspan
- headers
- height
- nowrap
- rowspan
- scope
- valign
- width
- thead
- align
- char
- charoff
- valign
- title
- tr
- align
- bgcolor
- char
- charoff
- valign
- tt
- u
- ul
- ol
- var
How to fix error C00D11DA: an error occurred while verifying the license
June 22, 2006
So, this HUGE thunderstorm rolled through last night and took out the power a bunch of times. The first time the power went out, I had the computer on and was playing a licensed media file.
Upon rebooting the computer, I found that NONE of my licensed media would play. That REALLY stunk. I listen to unabbridged audio books all the time. I have several libary accounts with branches that offer LibaryReserve borrowing through Overdrive Media, the Ohio eBook Project website (http://ohdbks.lib.overdrive.com) and Net Library accounts. Each branch offers different lists of audio books, so I probably have free access to 3000 or so audio books.
So it was a ROYAL pain when none media player could play none of these files. Media Player wouldn’t even do the OverDrive Media Player’s security update task.
When I tried to do anything related to Media Player’s Digital Rights management, I got the error “Windows Media Player cannot play, synchronize, or burn a protected file because an error occurred while verifying the license.” That’s error C00D11DA if you must know… It means that one or more of your license files are corrupt. In my case, it seems all of them were. I could neither do a restore nor a backup of the licenses. Here’s how to fix that…
ATTEMPT 1: Surgical Assualt
The first choice you have, if the problem is with one song or story or whatever, is to delete that wma file, download a new unlicensed one and aquire a new license. That’s the easy fix. But my problem was with ALL licensed media. The Windows Media Player would not even attempt to get a new license for any file.
ATTEMPT 2: Send in the Ground Forces
You might be able to do a license restore and save your self a lot of pain. So try this first.
1. Run media player
2. Choose Tools-> Manage Licenses
3. Click “Restore now”
Hopefully that works. Of course that depends upon you having backed them up before, and who does that? Who even knows that menu entry is there???
Anyway, it didn’t work for me. So, I searched my hard drive and registry for anything related to the licensing. Google revealed nothing until I found a post by a guy that had just paid $35 to MS Support for the fix. (HAH! This morning I can’t find the link, but the very first result is a more detailed blog entry by Cris Lanier describing what I was about to tell you in this post. Oh well, I’ll tell you anyway and turn it into a three step process. If you want to do this process manually, or have some OS other than XP, I recommend that you use the link I provided to Chris’s blog.)
ATTEMPT 3: Throw out the baby with the bath water it’s time for Global Thermonuclear War
Well, that’s it. Now, it is time to quit playing games get serious. Now, to fix your Digital Rights Management problem, we are going to erase everything your computer knows about the DRM licenses you have and tell it to start over. Since this process will delete all licenses you have, after we’re done, you’ll have to redownload the WMA (or whatever they are) and reaquire a new license. Hopefully, that’s not a problem for you, but if it is, there’s really not much else that can be done at this point, as far as I know. A call to MS and a few hundred dollars in support fees might get them to rebuild the license database, but I wouldn’t count on it. In the meantime, the rest of us are gonna give DRM a brain transplant. Or at least we’ll remove the old brain and see if a new one grows back…
SUMMARY:
Delete the C:\Documents and Settings\All Users\DRM directory
Delete these two registry branches:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DRM
HKEY_CURRENT_USER\Software\Microsoft\Windows Media\WMSDK
WindowsXP three step process: (Close all media players first)
1. Click Start->Run paste in the following line, press enter and hit Y if you are sure you did it correctly:
rd /s “C:\Documents and Settings\All Users\DRM”
2. Click Start->Run paste in the following line, press enter and hit Y if you are sure you did it correctly:
reg delete “HKLM\SOFTWARE\Microsoft\DRM”
3. Click Start->Run paste in the following line, press enter and hit Y if you are sure you did it correctly:
reg delete “HKCU\Software\Microsoft\Windows Media\WMSDK”
That’s it. You’re done. Now re-download the files and re-aquire your licenses. You should be in business.
Using Delphi and TWebBrowser to process Wordpress’s HTML Source code
June 21, 2006
I don’t have a lot of time since I am heading off to my brother-in-law’s highschool graduation in upstate NY tomorrow. I might be able to post date a few articles for the Verizon Phone tips category, but this will be the last meaty post for a little while. So, today you get a program that I wrote at the beginning of the month when I wanted to let people know I’d written an article about the release of WordPress 2.03: TrackbackGrabber.
This little routine will go to a WordPress post, grab the source code and isolate all of the track backs for you. It turns them in to seperate lines of <255 characters each that you can paste into your ping back line on your post. Then when you publish an article, you will let everyone on that list know about it. This is somethign I used to do manually and it took forever!
IMPORTANT: Don’t abuse this or it will back fire and you’ll quickly be labeled a spammer and will be reported to Akismet, Spam Karma and other spam filtering tools. If that happens none of your comments, trackbacks or manually typed entries, will get through anywhere!
Concepts Demonstrated:
- Surfing the web using Delphi
- Using a TWebBrowser Active X control to navigate the DOM structure of a website
- Retreiving the source code of a webpage
- The fundamentals of creating a web bot in Delphi
- Filtering contents of a TMemo
- How to tell when a page has loaded in the TWebBrowser
That last one was the tricky part. If you access WebBrowser1.Document too soon, you will get an access violation. Sleeps and process messages, no matter how many you use or how long you wait, do NOT consistently work. Pressing the button (calling WebBrowser1.Navitate twice) always worked but I found WebBrowser1.ReadyState in the documentation and checking that seems to be the right way to do it.
Exe: http://www.thecodecave.com/downloads/delphi/TrackbackGrabber.exe
Source Code: http://www.thecodecave.com/downloads/delphi/TrackbackGrabber.zip
Main unit:
-
// ****************************************************************************
-
// TrackBackGrabber_Main 06/Jun/2006
-
// Written by Brian Layman (AKA Capt. Queeg AKA SilverPaladin)
-
// Visit him at http://www.TheCodeCave.com
-
//
-
// Wordpress’s Trackback system is a way to connect articles about the same
-
// topic. If you post something related to a popular article, this tool allows
-
// you to tell other bloggers that have posted related articles that you have
-
// additional information on the subject.
-
//
-
// Warning: I can’t think of any way that this routine could cause harm to
-
// your computer, but it could spell the end of your blog if you abuse it.
-
// Abuse this tool and it WILL back fire. You’ll quickly be labeled a
-
// spammer and will be reported to Akismet, Spam Karma and other spam
-
// filtering tools. If that happens, none of your comments, trackbacks or
-
// manually typed entries, will get through anywhere! It would really stink
-
// to have every comment you leave on any Wordpress blog automaticly
-
// deleted.
-
//
-
// As always, I’ll say it is a good best practice to understand every line
-
// of new code before you run it. Who knows what could be lurking? Better
-
// yet, do not run this example at all. You should stop right now and erase
-
// the files. For if it causes blue smoke to be emitted from your network
-
// card, if it erases all users from your computer, or if it makes your
-
// sister break up with her lawyer boyfriend and start dating a caver, it
-
// is not my fault. (Actually that last one might be an improvement, but
-
// it is still not my fault.) But the fact of the matter is, computers
-
// have a mind of their own and we programmers live on the wild side.
-
//
-
// Usage: TrackBackGrabber.exe
-
// Supply an URL to a WordPress post and it will grab all of the track
-
// back links and then consolidate those to lines 255 characters long.
-
// Then all you need to do is paste each line into your WordPress post’s
-
// track back field and hit save. Each site will only be updated once.
-
//
-
// Licensing – You can use this source as you will. It’s free for
-
// commercial, shareware and gpl use as you like. I hope it helps.
-
// If this program & source really helps you out, please visit
-
// http://www.thecodecave.com/did-that-help/ and read more.
-
//
-
// History:
-
// 06/Jun/2006 – BL – Created
-
//
-
// ****************************************************************************
-
unit TrackbackGrabber_Main;
-
-
interface
-
-
uses
-
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
-
StdCtrls, OleCtrls, SHDocVw, mshtml;
-
-
type
-
TfrmTrackback = class(TForm)
-
memoResults: TMemo;
-
btnGather: TButton;
-
editAddress: TEdit;
-
WebBrowser1: TWebBrowser;
-
procedure btnGatherClick(Sender: TObject);
-
private
-
{ Private declarations }
-
procedure ProcessPage;
-
public
-
{ Public declarations }
-
end;
-
-
var
-
frmTrackback: TfrmTrackback;
-
-
const
-
// This defines what to look for.
-
// In this case it is TrackBacks.
-
// Deliberate references to this article for.
-
SEARCH_STR = ‘Trackback from <A href’;
-
-
// Alternatives…
-
// SEARCH_STR = ‘Pingback from <a href’;
-
// SEARCH_STR = ‘<cite>’;
-
-
implementation
-
-
{$R *.DFM}
-
-
{******************************************************************************
-
btnGatherClick
-
Visit a website, get the source and process it.
-
******************************************************************************}
-
procedure TfrmTrackback.btnGatherClick(Sender: TObject);
-
var
-
Flags: OLEVariant;
-
iElement : IHTMLElement;
-
begin // btnGatherClick
-
// Set the flags so that there is no history kept of this visit.
-
Flags := navNoHistory;
-
-
// Go to the specified website
-
WebBrowser1.Navigate(WideString(editAddress.Text), Flags);
-
-
-
// Now twiddle our thumbs until the page loads.
-
repeat
-
Application.ProcessMessages;
-
until (WebBrowser1.ReadyState>= READYSTATE_COMPLETE);
-
-
-
// Now check to see if it was a valid link and if so go to work
-
if (Assigned(WebBrowser1.Document))
-
then begin
-
// Get the body of the document
-
iElement := (WebBrowser1.Document AS IHTMLDocument2).Body;
-
-
try
-
// Now Bubble all the way up to the top of the web page
-
while (iElement.ParentElement <> NIL)
-
do iElement := iElement.ParentElement;
-
-
// Grab the Outer HTML
-
// Note that another implementation could iterate the DOM structure
-
// for the particular type of element desired. For instance, we could
-
// search for all of the scripts and grab the innerhtml.
-
// In this case, we’ll do the work in Delphi rather than using COM&DOM
-
Memo1.Text := iElement.OuterHTML;
-
// Process the source code.
-
ProcessPage;
-
except
-
raise Exception.Create(‘An exception was raised. Probably the LOAD_DELAY constant is too low for this machine. Try clicking the button again and it should work.’);
-
end;
-
end;
-
end; // btnGatherClick
-
-
{******************************************************************************
-
ProcessPage
-
In this demo, the contents of Memo1 are iterated and every thing that is not
-
a trackback is stripped out.
-
This example could be changed to gather ping backs, normal links, images,
-
google keys, script loctions.
-
With relatively little work you could turn this into a bot that grabs the
-
source code for a web page, saves it locally replacing any absolute links
-
with relative ones and then interates through all links pointing to the
-
same site. Of course, you’d also need to obey Robots.txt, somehow prevent
-
yourself from getting lost in links you’ve already visited and probably vary
-
the time you spend at each page so that you don’t LOOK like a robot to
-
smart firewalls.
-
******************************************************************************}
-
procedure TfrmTrackback.ProcessPage;
-
var
-
Loop: Integer;
-
P: Integer;
-
S: String;
-
begin // ProcessPage
-
// Iterate all of the source code lines and delete the ones that don’t
-
// match what I am looking for. Edit down the ones that do match.
-
for Loop := Memo1.Lines.Count – 1 downto 0
-
do begin
-
if (pos(SEARCH_STR, Memo1.Lines[Loop]) <> 0)
-
then begin
-
S := copy(Memo1.Lines[Loop],pos(‘"’, Memo1.Lines[Loop]) + 1,255);
-
P := Pos(‘"’, S);
-
S := copy(S, 1, P – 1);
-
if (copy(S, Length(S), 1) <> ‘/’)
-
then S := S + ‘/’;
-
Memo1.Lines[Loop] := S + ‘trackback/’;
-
end
-
else Memo1.Lines.Delete(Loop);
-
end; // for Loop
-
-
// At this point, I have a long list of links. 1 per line.
-
// What I want to do is past these in to the track back field in my post.
-
-
// So, I will now combine all of the lines as much as I can.
-
// There’s a max length of 255 characters to the trackback field.
-
// So, I will roll all of the links up into lines that are <255 characters
-
Memo1.Lines.Insert(0, ”);
-
Loop := 1;
-
while (Loop <> Memo1.Lines.Count)
-
do begin
-
S := Memo1.Lines[0] + ‘ ‘ + Memo1.Lines[Loop];
-
if (Length(S) <255)
-
then Memo1.Lines[0] := S
-
else begin
-
Memo1.Lines.Insert(0, Memo1.Lines[Loop]);
-
inc(Loop);
-
end;
-
Memo1.Lines.Delete(Loop);
-
end;
-
end; // ProcessPage
-
-
end.
Matt Mullenweg on WordPress & OpenSource Development
June 20, 2006
Matt had a very eloquent monolog on WP-Hackers at the beginning of this month.
It’s something that is worth reading over several times and I’m putting it here so that you and I both have an oportunity to do just that. If you are involved in any type of open source development, this is worth reading.
Go ahead, it’s really not that long…
Original Source
I can’t speak for everyone, but all of my work on WP from the beginning
has been with the knowledge that someone would rip/sell/steal/etc any
and all of it. Just like giving people freedom to say whatever they want
means that they might say things that you disagree with, in the end I
think the inherent freedom is more important than control. In my
experience I’ve found the good far outweighs the bad. I’ve applied the
principles of “give as much away as possible” to other parts of my life
and it has been nothing but rewarding.Even *if* there were some sort of awful license violation, in 99.9% of
cases it’s not worth pursuing. The time and cost of a legal battle (in
another country, to top it off) would be energy far better spent on
bugs, support, features, etc. Besides, if the features are that great
it’d be better just to clean-room implement them as GPL rather than
extracting them forcibly from someone who doesn’t want to share. (Not to
mention it would probably be 3-5x faster.)I think supporting a platform you’re building on is a no-brainer
business decision though, natural selection will do far more than legal
action in the long-run for these types of cases.I have always recommended people doing development around WordPress
license their work as GPL, as I think that provides the most long-term
benefit for both the individual and the community. (It’s a virtuous
cycle.) We’ve socially encouraged that with GPL requirements on
wp-plugins and in the theme competitions, and I think the flourishing of
those areas is a testament to the power of the GPL and open source.
(Thousands of examples are available outside of the WP ecosystem, too.)When I see or hear about people who want to work for themselves or make
a living off of WordPress-related things but having trouble the problem
has never been with the license. If you want a Real Job with a Big
Company, don’t you think organizations like New York Times and CNET that
are putting huge investments into using WordPress aren’t crazy for
people who know the system really well? Watch Craigslist, Monster, etc
for listing with “WordPress” in them, they’re popping up pretty commonly
now.For people just looking for some extra beer/server money from their
work, the biggest mistake I see is simply not asking. Make it *really
easy* for people to find your Paypal or Amazon wishlist. I won’t say how
many times I’ve tried to buy a book or something as a thank you for
people on this list and couldn’t for love or money find something on
their site that enabled me to. (As an aside, if you’re overseas try to
have a donation mechanism that’s easy for US folks too.) Have a mailing
list for release announcements. If you’d work on something more if you
got more money, then tell people. Provide amazing free support and put a
“if you found this useful” link at the end of every email. If you’re
open to people sponsoring features, or paid customizations, make that
obvious. Also consider publishing how much you get in donations, as most
people VASTLY overestimate donations, or they assume someone else is
doing it so they don’t need to. Outright charging is usually not the
most successful model.Finally, I think striking out on your own can be incredibly rewarding
and is a great lifestyle and challenge, though I know it’s not for
everybody. Biggest mistake I see in this group is forgetting it’s a
business, just like anything else. Buy or check out as many books about
small businesses, finances, entrepreneurship, etc as you can. At the
same time, don’t forget to budget time for community. Before I left
CNET and started Automattic I knew about a dozen people doing
full-time WP consulting and work, names you mostly don’t know because
they were so caught up in their own work they weren’t improving the core
platform they were building their livelihood on. I swore I wouldn’t let
that happen, and luckily have found a model that allows 95+ percent of
work to be completely Open, but it’s something you have to plan ahead of
time because it’s very easy to get caught up. There are business models
around consulting, support, services, training, development,
advertising, and dozens of other things that can include and encourage
supporting Open Source. I will happily phone chat for 30 minutes with
anyone in the WP community who is fleshing out a sustainable business
idea to strike it out on your own. I’m happy to share what I’ve found
worked and what didn’t. If you need help, just ask!
Performing a reset on your Verizon LG phones isn’t hard e.g. LG vx5200 and LG vx8100
June 19, 2006
[CLOSED TO COMMENTS]
So you changed some setting on your phone and now you don’t know how to fix it? Have no fear, there is a simple process that can restore your phone to the default settings:
- Click OK/Menu
- Click right twice to get to the Settings and Tools Menu
- Click down until you get to the System (this is 5 on a 5200)
- Click down until you get to the Security (this is also 5 on a 5200)
- Enter your lock code. If you have not customized it, this is the last for digits of your phone number.
- Click Reset Default
- You’ll see a message that says “Reset Default: Preference settings will be set to factory defaults. Press OK to continue.” You know what to do here…
I’ve not done this on my phone. I like my settings. But I’m told that this will NOT remove the custom rings you have uploaded on your phone AND there is a seperate menu item for deleting contacts. So, I don’t think it will remove your contact information either BUT I cannot guarantee this. Choosing this option MIGHT remove all of those settings.
If someone reading this follows these instructions, please let me know, in a comment, what is cleared and what is not.
Make your Verizon cell phone safe! Set the Emergency numbers!
June 18, 2006
Your cell phone can be configured with up to three emergency numbers that work for your area. 911 is now pretty common in the US but it was not always so. There still may be areas that don’t use 911 but use a different number. In anycase, you set three numbers that ALWAYS work wether the phone is locked or not. One should be your equivelent to 911. The second number in your phone is, by default, 611. 611 is the universal phone company repair service. It is also used on many colleges as the campus police number. So, some people will be used to calling it. The third number *611 will get you directly to verizon’s customer service. So, if you lock your phone you can call them and ask them how to unlock it
plus someone should always be there eventually…
Anyway, wouldn’t it be MUCH more useful for you to have the local fire department number as one that you or your kids can dial even if the phone is locked? Or maybe your spouse’s phone?
Anyway, changing these number is probably a pretty good idea and here’s how to do it:
- Click OK/Menu
- Click right twice to get to the Settings and Tools Menu
- Click down until you get to the System (this is 5 on a lg vx5200)
- Click down until you get to the Security (this is also 5 on a lg vx5200)
- Enter your lock code. If you have not customized it, this is the last for digits of your phone number.
- Click Emergency #s
- You’ll see a message that says “Reset Default: Preference settings will be set to factory defaults. Press OK to continue.” You know what to do here…

