Posts Tagged ‘PHP’

Do You Create Value?

Monday, January 19th, 2009

Do you create value? Do you even know what value I speak of?

It seems that there are many voices in the social media/network arena, just as there are in the web development and PHP programming arenas, some claim to be “experts” while others do nothing but “bash” the experts. Human nature to be competitive I guess. But the basic idea is this, everything we do creates value. So to answer the question for you, yes you create value!

So the true question is what type of value do you create? Positive or Negative?

Want to build your followers, interact with the big dogs or sell more product? You had best hope you are out there, daily, generating positive value. Negative value will do nothing more than move you in the wrong direction.

Reblog this post [with Zemanta]

A Year In Reflection

Wednesday, December 31st, 2008

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]

Get My Tweets WP Plugin Released

Monday, December 22nd, 2008

getmytweets_logo2I have officially created my first Wordpress plugin and widget, Get My Tweets.

While there are other plugins that do similar things, display your recent tweets on your Wordpress powered blog, this one makes special use of PHP 5 and the XMLReader extension. So in other words if your hosting provider does not meet those requirements, you will not be able to use the plugin.

There are only two options for the plugin, Twitter user name and numer of tweets to retrieve. The user name supplied must be set to have the time line be public in order for the plugin to parse the xml file from Twitter.

DOWNLOAD THE CURRENT VERSION

If you have any comments, suggestions or trouble, leave a comment.

If you are feeling really generous, why not donate –


Reblog this post [with Zemanta]

PHP File Listing Script

Tuesday, October 28th, 2008

I had a need for a script to read directories for users, listing only files and not sub-directories, so this is the script that ended up being what worked. One of the features was to exclude a few system files on the Linux file system that are present in directories and to list the last modified time so that the users uploading and downloading files could see the different timestamps to differentiate more recent files.

This script handled the uploading of files, after a user was logged into the system. Proper validation and security measures need to be taken before using a script such as this. This may include user logins, ip-restrictions or other measures.

The code explanation follows the code below:

Quick Code


<?php

//define the path
//using the "." sets it to the current path
//any relative or absolute path that the web
//server use can read with will work

$path = "."; 

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open files.");

echo "<h3>List of items.</h3><p>";

//running the while loop

echo "<ul>";
while ($file = readdir($dir_handle)) 
{
//remove . and .. from the list
   if($file!="." && $file!=".." && $file!=".htaccess")
   {  
       $modified = date("F d Y H:i:s", filectime($path."/".$file));
      echo "<li><a href='$path/$file'>$file</a>&nbsp;&nbsp;Last Modified: $modified</li>";
  }

}
echo "</ul>";
//closing the directory
closedir($dir_handle);
echo "</p>"
?> 
</div>

The script first sets up the directory path that we want to open, in this case I wanted to open the current path, so I used a period to signify the current working directory. Next, we open the directory using the opendir command passing in the $path variable. We have to loop through the entire directory to get all the files. **Note this script does not take in to account sub-directories.**

At this point, the script tests for the directories . and .. and also to not list the .htaccess file if it is present. Within the file check, we get the last modified date of the file, this is done by doing a date format on the filectime function, which accepts the path/filename combination. The script then simply adds each file to an unordered list, and makes each file name (represented by the $file variable) a link so that they can be clicked on to be viewed or downloaded.

The last important line of code closes the directory handle resource by calling the closedir function.

While simple, this script accomplished reading a directory of files and making a linked list of them. As I mentioned I had this was only presented to users who had successfully logged into the system, presenting them with a list of files they could easily download. It was created as a direct replace for an FTP system that was not working well for users – the entire package was a login control, the file listing control (presented here), a way for the user to upload files back and the automatic deletion of files that were older than a set time frame.

I will post about the other parts of the system in the future, and in the end, wrap it up with a complete user managed file transfer system.