SPWD

Web 2.0

A Year In Reflection

by Billy on Dec.31, 2008, under Blogging, Casual Blogging, Off-Topic, PHP, Social Media, Uncategorized, Web 2.0, Web Design

Well, today marks the end of 2008 here in my part of the world, and looking back I re-read a post from January 1, 2008 - quoted below with inserts as to how I did.

As I sit here, having just stepped outside to see the revelry around my neighborhood of the ringing (or exploding) in of the New Year, I find myself seeking several things this year:

1. Write More Blog Posts, More Frequently - I did post more frequently, but still not enough
2. Expand My Knowledge in Ajax, PHP and Web2.0 Design - This is on-going, but I gained much in the PHP area, a bit in Ajax and sharpened some of my visual design skills as well
3. Enhance My Blog with a custom layout - This one did not happen, still using free themes
4. Generate more readership - This one did happen, though not as much as I would have liked, but that’s related to number 1
5. Become more active in the blogosphere - I started to do this late in the year and am experiencing some benefits to it now, but still growing.

While not lofty goals, they are all things I had wished to do in 2007, but unforseen complications mandated a different direction - thus is the blogger life (okay, the casual blogger life). It is funny, I keep up on several blogs, many of which are operated full time, and I think to myself how can I create more space in my alloted time each day/week/month to blog more.

The first item is to create a schedule for my time and try to stick to it, albeit allowing for variances as necessary. Reading these blogs also prompts me to think of a new section, one devoted to the “Casual Blogger” rather than the full-time blogger. There are several items I would like to examine in this area, of course time permitting as I have several half-finished tutorials to get posted straight away this year.

Well, anyways - Happy New Year if you celebrate it at this time of year, and good wishes on successful blogging, successful web design and stressful life in general this year.

Having a post like this was helpful, but I did not refer back to it near enough to truly succeed at the few goals I had listed, though in all but one there was growth. The growth was not as expected, but I know the factors that made it so, and I know how to control those factors now. You see in any given situation we either let the situation control us, or we control it. Yes, yes I know there are those situations that we cannot exert control over, and with life there will always be exceptions.

This year has seen many changes in my life, some good and some not so good. In April I was fortunate enough to buy my first Harley-Davidson motorcycle, in July we bought my wife her first horse and in August we closed on our first house. In that time I learned I can ride a motorcycle better than a horse, mainly because the motorcycle doesn’t have an attitude like the horse does. I also learned that once you let the horse know who is boss, they will still try to control the situation. I also learned that buying a house is a long and grueling process, especially when you are trying to find one that will fit 2 adults, 5 children, 3 cats, 2 dogs, 2 fish and a horse that is within your budget.

I was also reminded, several times, of just how it is in the world I live in. People will lie through their teeth and make you look like a complete moron. They will lie through their teeth just to protect their own self, no matter the cost to you. People will lie through their teeth just to make sure they are the ones, at the end of the day, that are smiling, not you. These people are people that sometimes you consider friends, yet what kind of friends are they in the end? They are not. I also was reminded that even though you try to do the right thing, sometimes you will fail and it never fails that those failures will be thrown at you in your face every chance someone else gets, just to make the feel better when they look at themselves in the mirror every morning.

I also found out what it is like to lose two jobs within months of each other, neither of them my fault. Two weeks after closing on our house, I found myself walking out of one my ex-employer’s building having been cursed at and told rather nasty things. Some people thrive off treating others like dirt, another lesson I was reminded of. The countless hours I lost with my family, getting kicked out of school because I did not have the time to attend class due to long working hours made me realize that sometimes some people just aren’t happy, no matter what sacrifices you make for them, and in the end they treat you like dirt, spit in your face and expect you to suck-it up, work harder and still smile while you are there. The funny thing with that is, even when they break the law, they expect that from you and expect you to follow the rules and threaten you with your job if you falter one step.

The next job was ended due to the funny thing that every top government official wanted to say was not happening for the longest time, the “recession”. It’s funny that they can keep denying things so long, until the markets of the world are trashed, and then finally say it has happened, and will only get worse before it gets better. To that I have to ask, just like I have to ask the CEO’s of the “bailout” companies that take home more in a month than the majority of Americans will in a lifetime: What makes you so special to vote yourself a raise when congress starts up again each year? To the CEO’s I have this to ask: In what world can your company lose millions, sometimes billions, you layoff 25% of your workforce and yet you still expect well over $10,000,000 a year salary, benefits and perks of private jets, limousines and personal assistants?

I say 2009 should be earmarked the year the worker takes back what is his/hers. Why should we be put into dangerous situations, be put down, be cursed and yelled at, and be paid nothing what the market rate is for our time, our services and value we bring to your company? That is what I learned this year, is the value of an employee is nothing, as all employees are expendable, replaceable or weren’t needed in the first place.

Late in the year I started networking more, with some larger names in the industry. Once again I was reminded how doing things sometimes just doesn’t work out. Case in point, I wrote a decent review for a well known blog, operated by an even more well known blogger. Suffice it to say, other persons that provided such reviews, or articles were at least credited for their work, and many times linked to. My work was not credited in any way shape or form, and I didn’t think to ask for it to be credited until after I read the post and I guess that was too late. I expected this upstanding, well-favored person to, I dunno, automatically attribute properly work that was not his, and in the end it just didn’t work out. So no extra exposure for yet another little guy in the blogosphere, and yet again someone using what was not theirs to enhance their life. Sometimes you just don’t know about people, but all you can do is hope for the best, which is what I did, and still do.

I also found out what it is like to experience the grace and goodness of people. After losing the second job, we had the support of many family and friends, some friends that we don’t even know about. They helped my family have an enjoyable Christmas, as well as helped us keep our house. To these blessed souls, they make me realize that none of the rest of it matters, because as long as there is one person out there that cares enough to do the right thing, the light will always be on, and someone will always be home to welcome you in. Without people like this in the world, it would truly be a nightmare to try and survive, it would be the epitome of the worst horror fiction novel ever wrote, but would be our daily life. There are some that I have no clue who they are, how they know myself or my family, but they helped in anyway they could - and it has made a world of difference in our lives.

This year has seen a lot of changes here on this blog as well, with intermittent errors starting just after the new year started back in January. After 11 1/2 months of fighting with the server, which was old and needing replaced, I finally got my new server up and online. It has been runny steady for several weeks, and in that time I have been able to post quite a bit and enjoy having physical access to the server when I need it, since it is no longer a 4 hour drive to the co-lo facility. I have a new theme this past month, some more items on the back-end and have been striving to post more frequently, since obviously I have time to while I still look for employment.

I hope your year has been good to you, and if not I hope you can find the good in it, and in the people around you. Don’t hold a grudge, as that does nothing but drag you down - trust me from experience on that one. While I vent about what happened to me with the jobs, article and all of that, remember these are experiences that make us stronger, they make us wiser and in the end may make us just the person we need to be to succeed at our next task.

Reblog this post [with Zemanta]
Leave a Comment :, , , , , , more...

PHP 5, Twitter & XMLReader

by Billy on Oct.22, 2008, under Blogging, Internet Tools, PHP, Web 2.0

I was interested in using and experimenting with the XMLReader class that is part of PHP 5, and thought why not test it out using my Twitter feed. Turns out, the feed contained more information than I really wanted, so I had to find a way to extract only what I needed. To that, I present the following, simple and basic script to extract just the text of the latest update on Twitter.

A basic Twitter feed might appear like mine below:

Quick Code


<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Twitter / southplatte</title>
    <link>http://twitter.com/southplatte</link>
 
    <description>Twitter updates from southplatte / southplatte.</description>
    <language>en-us</language>
    <ttl>40</ttl>
  <item>
    <title>southplatte: working on database stuff with MySQL</title>
    <description>southplatte: working on database stuff with MySQL</description>
 
    <pubDate>Tue, 21 Oct 2008 05:35:21 +0000</pubDate>
    <guid>http://twitter.com/southplatte/statuses/968543230</guid>
    <link>http://twitter.com/southplatte/statuses/968543230</link>
  </item>
  </channel>
</rss>

As you can see we get a channel name with related information, and then the items, or Tweets. In this case, Twitter has used some duplicate XML tags, namely title, description and link in both the channel element and item elements, so our script should pull only the item information, unless we wanted to publish the channel information, which for this we will not.

Quick Code


1.   <?php
2.   $reader = new XMLReader();
3.   $reader->open('http://twitter.com/statuses/user_timeline/twitterusernamehere.rss?count=1/');
4.  
5.   while ($reader->read())
6.   {
7.      if ($reader->nodeType == XMLREADER::ELEMENT)
8.      {
9.         $name = $reader->name;
10.  
11.        if($name == "item")
12.      {
13.        while($reader->read())
14.      {
15.       if($reader->nodeType == XMLREADER::ELEMENT)
16.        {
17.          $noName = $reader->name;
18.          if($noName == "description" || $noName == "pubDate" || $noName == "link")
19.          {
20.            $reader->read();
21.            $result .= $reader->value."<br>";
22.          }
23.  
24.        }
25.      }
26.      
27.      }
28.      
29.     }
30.  
31.  }
32.  
33.  
34.  $reader->close();
35.  
36.  ?>
 

What the script does:
Line 2 creates a new instance of an XMLReader object
Line 3 opens the RSS feed from Twitter - the username will be your Twitter user name (or what ever Twitter user name you want to get updates for) and the count URL parameter tells it to only retrieve the latest Tweet. You can ommit the count and get all, or specify another number here.
Line 5 starts a while loop that will loop through the entire contents of the XML file returned from our open command.
Line 7 checks for the node type and if it is equal to an ELEMENT, takes action.
Line 9 sets the value of the Element.
Line 11 Validates the element to be equal to item, item being the element that contains our tweet.
Line 13 begins a new while loops (almost a recursive action here) and moves through the file again, to get the actual Tweet text from within the Item element.
Line 15 again checks that we are working with elements
Line 17 assigns each element to the variable
Line 18 checks the variable to be equal to the elements that we want, description, pubDate and link.
Line 20 tells the object to read the XML/RSS stream
Line 21 appends the $result variable with the values from our selected elements.
Line 34 closes our XMLReader stream.

Now all we need to do is include this into a PHP page, echo or print the $result variable and we will get an output like the following:

Quick Code


southplatte: working on database stuff with MySQL
Tue, 21 Oct 2008 05:35:21 +0000
http://twitter.com/southplatte/statuses/968543230
southplatte: Another interview setup for Wednesday, still waiting on the one from last week to decide, it is between myself and one other person!
Sat, 18 Oct 2008 15:28:30 +0000
http://twitter.com/southplatte/statuses/965216528

As you can see, we have some formatting issues to deal with, such as double spacing between Tweets, maybe formatting the date string, and encasulating the entire tweet with the link so it could be clicked and take the visitor to the individual Tweet on the Twitter web site.

The final page I have it in on my testing server is:

Quick Code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: .8em;
  color: #666666;
  background-color: #FFFFFF;
}
-->
</style>
</head>
<?php
$reader = new XMLReader();
$reader->open('http://twitter.com/statuses/user_timeline/southplatte.rss?count=1/');
 
while ($reader->read())
{
   if ($reader->nodeType == XMLREADER::ELEMENT)
   {
       $name = $reader->name;
 
      if($name == "item")
    {
      while($reader->read())
    {
      if($reader->nodeType == XMLREADER::ELEMENT)
      {
        $noName = $reader->name;
        if($noName == "description" || $noName == "pubDate" || $noName == "link")
        {
          $reader->read();
          $result .= $reader->value."<br>";
          //break;
        }
 
      }
    }
    
    }
    
   }

}
 
$reader->close();
 
?>
<body>
<span class="style1"><?php echo $result;?></span>
</body>
</html>
 

This could definitely not be used for much, but you could also set up a very similar and though not quite as simplistic page to read any RSS feed, thus creating your own PHP RSS/XML reader. It could definitely be extended and enhanced to perform some very advanced functionality as well.

Leave a Comment :, , , , more...

Available for Freelance and other work

by Billy on Oct.06, 2008, under E-Commerce, Graphic Design, Internet Tools, Off-Topic, PHP, Search Engines, Servers, Uncategorized, Web 2.0, Web Design

I am currently accepting new projects, either on a freelance basis or on an employment basis. The employment basis may be either a temporary, temp-to-hire, contract-to-hire or direct hire situation. At this time I am not available for relocation, so local opportunities (those that are not available via telecommuting/offsite work) must be within the Front Range to Southern Colorado area.

Use my contact page if you are interesting in discussing any potential opportunities.

Leave a Comment :, , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...