Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.

Archive for April, 2007

PHP Tertiary Statement – Using Tertiaries in PHP

Posted by chris on April 21st, 2007 Comments (4)

So Wednesday I started my new job as a php developer. It’s been way awesome so far. One of the neat things I learned is the tertiary statement/operator which looks something like this ((condition_to_test)?if_true_do_this:if_false_do_this);. Here’s an example:

1
((isset($_POST[something]))?yes:no);

If the the above statement is true then it returns a yes, otherwise it returns a no. Can’t really think of a good example for it, but it works kind of like an IF statement, especially when you just need to test something boolean-like style.

In Programming (, )

Xp Firewall Not Opening from Control Panel

Posted by chris on April 11th, 2007 Comments(0)

This is a common problem which leads to a lot of side-effects. I’ve noticed that in some cases the firewall is still somehow running even though you cannot access settings from the control panel or start the service from services.msc. You instead get an error, unfortunately I forgot what the error says. This problem prevents Windows IM, OpenVPN, and other processes that need to access the network from functioning properly since these processes cannot bypass the firewall. Luckily there is an easy solution.

Start > Run > and type netsh winsock restart

You will have to reboot the computer. Once rebooted go into the control panel and turn the firewall OFF.

In Software ()

probing for service and os types, other nmap related

Posted by chris on April 2nd, 2007 Comments(0)

I often forget how to get the OS type and service type’s of remote servers. Here are a few commands that are quick, easy, and effective.

If curl is installed you can execute curl –head http://www.example.com to return web server and OS information. Note there are two dashes in front of head.

If nmap is installed nmap -p 80 -sV http://www.example.com will return the same information as above. The added benefit of using nmap is that you can change the port number parameter in front of -p to anything (25 for smtp, 21 for ftp, etc).

In Linux ()

getting rss feeds with php’s simplexml_load_file() function

Posted by chris on April 2nd, 2007 Comments(0)

I’ve been reading this object oriented php book and here’s one of the cool things I’ve learned from it. Using php you can easily get rss feeds and parse the xml files output to your page with the simplexml_load_file() function. There are so many things you can do with this. You can keep your sites content fresh with a news section using this or you could even create a web-based feed manager, like feedme.com or something like that. Click here for the quick, dirty, and inelegant code.

The other thing you can do is set the $feed variable to a post. Then create an array of several different rss feeds, populate that array in a drop down box, and allow the user to select whatever feed. Pretty slick.

In Programming ()