Basically, I set up an automatic twitter every half hour, Monday to
Friday between 9am and 5pm. These tweets are from a linux/unix program written by
many people over the years called Fortune.
Fortune is a simple program which pulls random entries from a database
of quotes, sayings, or anything else of trivial importance. I believe the
original intent of the program was to provide a fortune cookie for
users who logged into a computer or other similar activity. Over the
years I have seen it used more as being a generator for tag lines in emails
than anything else. Each time an email is sent, a new fortune is
used as the tag line at the bottom of emails. There are many tutorials
available to get this working on many email clients.
I was looking into the programmer's interface that is supplied by the
folks at Twitter and wanted to set up an automatic twitter. I am using
fortune mainly because it's readily available. I decided to write a
simple PHP script that would call fortune, and use the returned text as
the source of a posted tweet. Here is the code:
// Auto Twitter feed
$message = shell_exec('fortune -s -n 140'); // Get a fortune that is less than 140 characters long
$message = urlencode($message); // encode the message to pass to Twitter
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, 'http://twitter.com/statuses /update.xml');
// Set to use the XML interface
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1); // POST instead of GET
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, \"source=$source&status=$message\" ) ;
curl_setopt($curl_handle, CURLOPT_USERPWD, $USER_NAME . ':' . $PASSWORD);
$buffer = curl_exec($curl_handle); // Send the tweet
curl_close($curl_handle); // Clean up
The next step is to add a cron job which would run the PHP script every half hour. Cron is a program which runs every minute and looks at a table of entries to determine if there are any applications, scripts or processes that should be run. Using Cron, you can make programs run automatically at different times, daily, weekly, monthly or every other day even. For this, I want it to run every half hour only durning business hours. Here is the cron entry:
Having a discussion the other day with a good friend we came across the word manipulate. This is a word which in the context of getting other people to do what we want - has a negative connotation attached. Don't get me wrong here - I don't want to loose the bad press that word has received - but I also don't want to avoid it.
If we intend to try to convince someone of doing something they normally won't do or intended to do - that is manipulation. What our intentions are - that is where malice can lie. (More)
Michelle and I have been discussing what we have to do to winterize our house.
We have four old windows and I'd say 2 1/2 doors that have to be
replaced. The half door is actually an interior door that goes to the
mud room out front - which isn't very well insulated, so I think it
should be a proper outside door.
With the tax break, we've decided to do the most important ones - the
boy's windows. So this year we are getting two new windows.
I - for the first time in my life - went window shopping!
That's it. That's all I wanted to blog about - all that for that dumb punchline. Aren't you glad you waste your time here?
This morning, I wanted to get some photos of Nate on his birthday, but he wasn't awake as I was leaving for work.
I decided to torture him on his birthday by shoving a camera in his face to wake him up. I wouldn't worry too much - he will seek retaliation before too long (it's not like I don't deserve it anyway). To make sure things are all equal between brothers, I woke Cameron up as well.
Cameron is getting to the age that he has figured out he can make decisions about what he wants to do - not just figuring out that he CAN do something.
The other day we came home and I told him to take off his shoes and we will sit for dinner. (More)
I became disillusioned with birthdays somewhere in my teens. It was a
harsh discovery to find out that birthdays don't mean much to people
outside of your immediate family and friends. You don't get the day
off school - you don't get special treatment from those around you -
rent is still due and you don't get gifts from strangers.
(More)
For the past three years I have been saying that I will replace the old light fixture in my office. I finally got around to it and can now see the crap in my office. That is a little bit good and a little bad.
The old light was a bare lightbulb hanging on a cord from the ceiling with a pullchain. I had a compact flourescent in the fixture - but that didn't give a lot of light - not to mention that it gave an eerie horror movie feel to my office when first turned on. It would sway back and forth for a good ten minutes casting eerie shadows all around.
I must admit - that did give my office a sense of forboding which I will remember fondly.
Now I have an actual light switch!!! Oh my!!! Welcome to the 1920's!!! I also have an insane amount of light now - I put up the old kitchen flourescent fixture that was replaced five years ago. It has four tubes in it - each four feet long and gives off enough light to blind the dust mites.
The only bad thing about this upgrade is - now I have no excuse not to see the unpaid bills lying around. Oh well. Take the good with the bad, I guess.