PHP Find Variable in String

Anyone code in PHP out there. Well if so, here is a helpful hint. Ever need to find a string in an another string? Uh, or maybe find a variable in a string? If you don’t, someone sure does, well take me for instance, I do this often. Its quite simple. You use the strstr() function like so:

$string_to_find = “Patrick”;
$string_to_look_in = “Hello Patrick, what is your name?”;

if(strstr($string_to_look_in,$string_to_find)) {

echo “AHA, found it.”;

} else {

echo “hmmm… yeah, just doesn’t seem to be here right now.”;

}

Hope this was helpful to someone.

Comments (0)



Vista Tips Everyone Should Know

So I just started using Windows Vista about 2 weeks ago, and I must say, its got a few differences from XP but not much.  I do like it better than XP and I haven’t had any problems at all (or none I can think of).  For the average windows user, Vista may seem much different and a little overwhelming, but all of your old features are there, and some new.  If you’re thinking about upgrading I would recommend it, but only if you have a new computer.  If you don’t you won’t get all of the goodies like aero which is the new interface which looks like glass.  If you use a mac and you are thinking about switching over, shame on you.

Anyways, my friend posted some Vista tips over on his blog which really helped me out.  You can view them by clicking here: Vista Tips.

Well, there is my 2 cents on Vista, more to come as I continue to use Vista more.

Comments (0)



Mac OSX - Clean Desktop

So, your a neat freak and you want a clean desktop on your mac. Well, there are two ways you can do this. Since I’m a neat freak (only on my computer), I used the first method I’m going to mention of hiding all my drives on my desktop.

Method 1The first method is to hide all of your drives on your desktop. The way you do this is by going to your desktop or the finder, then clicking going to Finder>Preferences located in the context menu at the top right of your screen. In the General tab, uncheck the first 3 items - Hard Disks; CDs, DVDs, and iPods; and Connected servers. Now you might ask yourself, How do I go about accessing these items if they aren’t on my desktop. Well, 2 simple ways. 1) Go to your finder and they will show up in the left pane, or 2) use Quicksilver (my preferred method).

Method 2

 

 

The second method is to download a little program called desktopple by FoggyNoggin Software. It is donationware so if you like, be sure to donate to the programmers who work hard on this excellent little software. This software will install a little icon in your system tray located at the top right of your screen. Just click the icon and choose Hide Desktop from the drop-down, its that simple.

Like I said, I prefer the first method, but if you want a simpler, more controllable approach, use method two.

Technorati Tags: , ,

Comments (0)



Quicksilver Easy Searching

I’ve been messing around with searching using Quicksilver, and man am I amazed. Any site you can search (google, yahoo, newzbin, etc…) you can setup a quick search using Quicksilver and your default browser. My default browser is Firefox and the search I’ll show you is for my site since google is already searchable by default with Quicksilver.

First off, make sure you have the Web Search Module plugin installed. This is what allows you to do these quick easy searches.

Step 1

Next, go to your browser and navigate to a search engine or the site you would like to search. I’m going to PHATO Productions Blog (hey, thats mine).

Step 2

Now do a search in the search field and submit that search.

Step 3

Notice the url after you submit the search. Your gonna want to copy that url.

Step 4

Now create a bookmark. In my case the bookmark url is going to be http://www.phatoproductions.com/blog/index.php?s=mac&sbutt=Go. I’m not going to keep the whole url though, I’m going to replace the search query (mac) with three stars (***). When we use Quicksilver the 3 stars will allow us to put our search query in there.

Step 5

After you have created your bookmark, goto Quicksilver preferences and refresh your bookmarks for your default browser, just in case Quicksilver hasn’t done that yet.

Step 6

Now invoke Quicksilver and type in the name of your bookmark.

Step 7

Tab over twice and type in a search and then hit enter.

Step 8

The search should open up your browser with the site you are searching with the search query, notice the url.

Step 9

Thats it. Quick, easy, simple… And now your searches will be the same way once you have them all setup. I hope this helps you out, and if it is redundant, I’m sorry, but this tip would have helped me yesterday, hehe.

Technorati Tags: , , , ,

Comments (0)



Smart Mailboxes and Rules for Mail.app

Merlin Mann posted some useful smart mailboxes in Mac’s Mail.app, and I thought these were very interesting, especially the one where he separates his emails by location. I have some of my own smart mailboxes setup and he covers a few of them such as recently viewed and recently sent. I also have address book groups setup for friends, business, etc… and I have smart folders setup for these different groups. I also have rules setup and one of these rules keeps my inbox clean. I like a not so clutter inbox so I setup a rule to archive emails that are 1 day old.

Archive Rule

Rules and smart mailboxes are an excellent way to keep your emails organized. So be sure to check out Merlin Mann’s post and try setting up your own smart mailboxes and rules.

Technorati Tags: , ,

Comments (0)



Start Xampp with Automator when Mac Boots

AutomatorI’m not sure if anyone else knew this, but I couldn’t find anywhere on how to do this. I use xampp as my local web server and to start apache and mysql you have to go into terminal, login as the super user an then type the command to start it. Well this started to get tedious and I wanted to run 1 command to start xampp. This is how I did it.
I used automator to accomplish my task. Open automator, on the left click automator under applications an then in the list that shows up to the right, drag Run Applescript in the pane to the right. Once you have your applescript box up, type this in there:

do shell script “/Applications/xampp/xamppfiles/mampp start” password “password” with administrator privileges

Make sure you tupe it all on one line, if it word wraps for you, that is ok, just don’t manually hit return. Once you have this in the input box, change “password” to whatever your super user password is. After you do this click compile. Now you can click the run button above and this should start up apache and mysql. I then went ahead and saved this as an application in my Applications folder and whenever I need to start it up, I just do it using Quicksilver.
This is a simple process but now I just have to do 1 step instead of 3 or 4. A simple time saver. You could also have this application run at boot so you don’t even have to do anything.

Technorati Tags: , , , ,

Comments (0)



Computer Hardware 101

Computer HardwareMany people just go out and buy a computer, hook it up and get to working or playing on it. I’m sure the average Joe never really understands what goes into getting this computer to function correctly. Is this important, certainly not if you have money to have the geek squad drive their little bug down to your place to get you back up and running. But what about those that don’t have money and they need to troubleshoot what is wrong with their computer. Well, this, believe it or not, is actually not that difficult. You just need to know a few things and you could be on your way to actually knowing a little bit about the machine you trust with your life’s work.
There are just a few components that I’m going to cover, and I’m gonna try not to drag on about things, just tell you enough to understand why your computer needs these components. Lets start with the obvious shall we.

The monitor (or the screen you look at with those eye balls of yours)
This component is amongst the three you use the most. All the visuals of the computer are viewed on the monitor. This is an LCD (Liquid Crystal Display) if you have a newer computer, or a CRT (don’t know what that stands for) if you have an older computer. The CRT is a big clunky thing, where the LCD is a thin, sleek piece of hardware. The computer supplies the monitor with images that are transmitted from the video card (we’ll cover this in a second). If your computer is on and you aren’t getting a picture to your monitor than it is either not plugged in, there is a problem with the monitor, or a problem with the video card.

The Mouse and Keyboard
These two components are the tools you use to navigate around on your computer. The keyboard is obviously for typing, hotkeys, or other types of simple or complex input. The mouse is a simple tool used to drag, drop, click, double-click, and just navigate your computer in a simple manner. if your mouse cursor is not moving when you move your mouse, it may not be plugged in or if you have a wireless one the batteries may be dead, or not exist. Same goes for the keyboard. Now onto the more interesting stuff.

Technorati Tags: , , ,


(more…)

Comments (0)