Welcome to BrownPHP

Welcome to BrownPHP! If this is the first time you have been visiting the site, please make yourself welcome. I made a quick video to go through some of the features of the site like the BrownPHP code repository and the book review section. Check the video out and let me know what you think.

This is the first screencast that I did and it was done in a very short amount of time. I’m just playing with the idea of making more screencasts in the future to possibly run through code an other things like that.

Like I said, this screencast is the first I tried. I’ll most likely redo this in the future so that it is a little more professional, and possibly without all that uh – um, haha. Let me know if there is anything that you would like to see a screencast about in the future.


Remove Characters from String except ASCII

Recently while developing I came across the need to remove all special characters and numbers from a string. Actually, if it wasn’t an ASCII character, I wanted to get rid of it! I needed this for a method I was working on to use for my Auction Alerts site that I have been working on.

I think the best way to go about handling this would be to use a regular expression. To be more specific, I chose to use ereg_replace. I know that this function has been depreciated in PHP v5.3, meh, it still works like a charm. J

Anyway, an example of the code I used was this:

$cleansed_string = ereg_replace("[^A-Za-z ]", "", $string );

Oops, I forgot to mention that I wanted to leave spaces in it for reasons I’ll leave to your imagination. Glorious right? One line of code to filter all that other junk out. Well, I wasn’t done there.

I also needed this method to take out a number of commonly used words. The goal was to really leave in the words that are truly unique to the string. I don’t care about the words like “the, we, am, I, etc…”

$filter_words = array("the","and","it","we") //there are a lot more words in this array than shown
$filtered_string = str_ireplace($filter_words, " ", $cleansed_string);

It’s really as simple as that. You’ll notice that I used str_ireplace. This is a case-insensitive string replace. “The” is the same to me as “the” so I wanted the function to replace all occurrences found for those.

When all is said and done, $filtered_string is the variable that I returned from the method. It doesn’t have any numbers or special characters in it. Not only that, but it doesn’t have the useless crap words in like “I”.

Remove All Numbers from a String

I didn’t need this, but I thought I would add how to do that from this post. It isn’t much different than removing all characters other than the ASCIIs. All you need to really do is change the regular expression a bit.

$cleansed_string = ereg_replace("[^0-9]", "", $string );

BAMM! Done! Now $cleansed_string contains only numbers from the string.

I hope this little post was helpful you some of you. Let me know if you have any better methods for filtering strings like this.


Crush It! By Gary Vaynerchuk – Reviewed

Crush It!: Why NOW Is the Time to Cash In on Your Passion

I finished reading Crush It: Why NOW Is the Time to Cash In on Your Passion about a week ago. Although I wasn’t overly impressed, it did inspire and re-ignite my passion. The book did certainly have the potential to be better though.

The book primarily focuses on going after your passion so that your job no longer is considered work. It only touches on the strategy to do this with a soft bristled brush however.

Throughout the book, Gary explains that if you follow his methods taught in the book and work hard, you can achieve what he has. What he has is wealth and a job that he enjoys waking up to. He explains how he took his father’s small liquor store and transformed it into a multi-million dollar business. However he never really goes into the methods in detail other than using social networks to assist in branding himself.

I am not by any means a millionaire or consider myself an internet entrepreneurial success as Gary is, but I think that the angle he took in the wine market had more to do with his success than his social networking. If my passion were rodents, I don’t feel I could gather a large following as Mr. Vaynerchuk can reach with a “wine for middle class” approach.

Gary’s points in the book come across arrogant in most cases, but he makes it a point to mention that is just how he is and by trying to fake another personality would be portrayed just as that, fake. Knowing that, I didn’t really mind the name dropping and “I don’t care what anyone thinks” comments. Even though these statements and others like are proudly exclaimed, overall I felt he was sincere and trustworthy throughout the read.

Conclusion:

All in all, the book did inspire me. A couple times throughout my reading, I put the book down and grabbed my laptop to put some work into a few of my sites. Crush it! helped me take a step back and look at the big picture. One could say, I stepped out of the now and into the future. If you feel you are in a rut right now and need something to get you going again this could be the book you need. If you are already all inspired, you may just want to save this book for a rainy day.

I’m be happy to give 3 out of 5 PHP elephants to this book for its ability to inspire creative thinking and emphasis on branding yourself with social media.

Visit Gary Vaynerchuk’s Website to learn more about this author.


Reading PHP Books Never Hurt Anyone, but…

Reading PHP Books

As a functioning member of society, I feel it is important to make yourself a well rounded human being. Being able to see and understand the other side of an argument is an important quality in anyone.

To help yourself better yourself you need to intrigue your mental palate. Reading has always been a great way to inspire creative thinking. Speaking from an engineering stand point, my creative thinking could use some inspiration.

What’s on your bookshelf? Do you have a bookshelf? If you would take a look at my bookshelf you would find a number of PHP books. PHP books cover all sorts of topics; frameworks, database design and PHP integration, PHP design patterns, etc…

I don’t have any books cover really anything else! Looking back on all of this, I’m a bit disappointed in myself. I don’t have any great novels. Why? They bore the hell out of me. Not joking. Big popular books I was instructed to read throughout high school and college only taught me to dread the thought of reading books like that.

What is my point of all this? There has got to be more things that grab my interest rather than just PHP. Well, I have never thought to reach out and look for other topics until now.

I’m redoing the Books section of the site to start a “book club” I suppose you could call it for us PHP developers that want to better ourselves and reach passed reading only PHP books. Don’t worry though; I plan on reading some PHP books as well. Some books that have caught my eye are ones that have strong ties to internet topics. So if you are a geek with a blog or know one, you are going to want to keep up with these books.

So when I’m done with a book, I’ll give my personal review in a blog post from which you can comment your own thoughts on the book.

If any of you have any ideas on some good books to read/review just let me know and I’ll add it to my personal list if I find it fascinating.


Twitter PHP Class Added to Repository

Well I spent a few hours condensing the PHP code that I developed for BrownPHP into a Twitter class that can be downloaded. You can get it PHP class in my code repository.

Take a look at the class and let me know if there are any methods that you would like to have added to the class. Currently there are two main methods.

  1. sendTweet – This method is a popular one that is seems like everyone want to use. It’s a simple method that can be called to tweet something to your Twitter account. This method is very simple and shouldn’t be complicated at all to implement into your own code at all.
  2. getTagCloud – This is another easily implemented method. By providing any Twitter username, this method will generate a Twitter Tag Cloud. If you have never used a Twitter Tag Cloud, it basically can provide a bird’s eye view of the topics that a Twitter user tweets out more regularly.

I won’t get into how integrating your own sites and projects into Twitter can make them more social and viral inducing, but I will say that if you aren’t using Twitter right now you are losing out on a great way to help your brand.

There are so many insightful people on Twitter (granted a lot of trolls too unfortunately) and a lot of great ideas that can culminate by socializing with this community. I myself am going through a re-branding phase. Instead of using my dlbrown06 Twitter account, I will be using the BrownPHP Twitter account to be tweeting about BrownPHP and other PHP interests.

If you are involved in the PHP community, wanting to learn PHP, or are a PHP guru yourself follow BrownPHP. I’ll be sure to follow you as well to continue discussing PHP projects and development.


  • BrownPHP Tag Cloud

  • Copyright © 1996-2010 Brown PHP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress

    Powered by Yahoo! Answers