PHP + MySQL + CSS Striped Tables
To create a clean looking table, we sometimes want the table rows to be striped. To do this, create a css class for alternate table rows, such as “tr.stripe”. Using PHP, invoke a loop that reads the table rows, and increments a count on each read. Using the modulus formula
if($rc % 2 == 0)
you will always reach a 0 for an even number, so our alternating rows now have a stripe class.
The example below is very generic, but should get the point across.
<style>
tr{background:white;}
tr.stripe{background:#ACF;}
</style>
<?php
mysql_select_db(mysql_connect("db_host","db_user","db_paswd"),"database_name");
$table = "<table><tr><th>Field 1</th><th>Field 2</th>";
$rc = 0;
while($d = mysql_fetch_array(mysql_query("SELECT field1,field2 FROM table"))){
$table .= "<tr ";
if($rc % 2 == 0){$table .= "class='stripe'";}
$table .= " ><td>$a[0]</td><td>$a[1]</td></tr>";
$rc ++;}
$table .= "</table>";
echo $table;
?>
Simple PHP Mail Script
This php script will take your input and generate a mail message, then forward it to the SMTP server that php.ini is configured for.
<?php
if (isset($_REQUEST['email']))
//if “email” is filled out, send email
{
//send email $email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$from = $_REQUEST['from'] ;
mail( “$email”, “Subject: $subject”, $message, “From: $from” );
echo “Thank you for using our mail form”;
}
else
//if “email” is not filled out, display the form
{
echo “<form method=’post’ action=’mail.php’> Send To Email: <input name=’email’ type=’text’ /><br /> From Email : <input name=’from’ type=’text’ /><br /> Subject: <input name=’subject’ type=’text’ /><br /> Message:<br /> <textarea name=’message’ rows=’15′ cols=’40′> </textarea><br /> <input type=’submit’ /> </form>”;
}
?>
How to root your Droid X Android 2.2
This root exploit will allow you to install applications that require “Super User” permissions on your android device.
1. Make sure you select the following options :
Settings -> Applications -> Unknown Sources (Select Checkbox)
Settings -> Applications -> Development -> USB Debugging (Select Checkbox)
2. Connect your phone to your computer and use as USB Mass Storage. Copy the z4root.1.3.0.apk onto the sd card ( download using the link at the bottom of this post )
3. On phone go to “Files” application -> Phone Files -> Launch z4root.1.3.0.apk
4. Launch the “z4root” application. Select your Temporary or Permanent root option …
the phone will restart and you have now rooted your phone.
You can now install applications that require Super User access. You will notice the Super User application is installed, which allows you to manage applications that require the special Super User permissions.
http://www.mjwired.com/files/android/root/kit/z4root.1.3.0.apk
VMware ESX ESXi vSphere vCenter vCloud
Wow. Just looking at that title is confusing. That is why I am writing the post.
When I first started looking into virtualizing my servers using VMware, I was overwhelmed by the amount of different software titles VMware offers for virtualizing. I honestly pushed off virtualizing for a few months because I knew it was going to require extensive research. My goal is to break down the different titles VMware sells, and basically put together a quick and easy strategy guide for small, simple VMware deployments. This will be useful for those who are looking to test VMware server virtualization, or do a quick deployment to get their feet wet.
Why VMware?
You have a server (or maybe a wanna-be server in your basement), and you want to run multiple virtual machines on the same box. VMware is not the only solution out there. I chose to use VMware for several reasons, the top reason being that a lot of people are using VMware for virtualizing. I can expect good research, write ups, documentation, and hopefully assistance when needed. Also, if I were to ever get serious with my virtualized environment, I would feel comfortable using VMware because the company’s reputation. With all that aside, I used Citrix XEN Server for a while and it was just lacking too many features. VMware Server on linux does not work very well… I’ve tried a couple different choices.
A quick description, in my terms
ESX – Legacy hypervisor
ESXI – Current hypervisor
vSphere – The entire virtualized environment, as a collective whole.
vCenter (Server) – Management system
vCloud – Your private could.
ESX/ ESXi – The Hypervisor
ESX/ESXI is installed as the hypervisor on the physical servers. A hypervisor can be looked at as the system software that runs on the computer (host) that manages the system’s resources and distributes the utilization of such resources amongst guest ( virtual machine) systems.
ESX vs ESXi is an entire topic in itself. Basically, ESX is legacy, and ESXi is the new standard.
vSphere & vCenter
vSphere is the entire system as a collective whole. You manage the system using the vSphere client. The vSphere client is downloaded from the ESXi server after the ESXi hypervisor is installed, by navigating to the server’s ip/ host name using a web browser. The software is for Windows only. It works on XP/ Vista/ 7 32 or 64 bit. There are several alternative solutions for MAC OS X and Linux users, none are useful in my opinion. If you don’t use Windows, like myself, you can run a Windows virtual machine on your computer to manage your vSphere environment. Otherwise, you can run a Windows on a standalone box. The vCenter box/vm talks to the ESXi hosts in a proprietary language, unfortunately, this is the only method of utilizing the extended features. vCenter is installed off the vCenter ISO that you download from VMware. This will install Apache, Tomcat, and the VMware components.
vCenter adds a boat load of features that are not available using the standard ESXi / vSphere setup. Fault tolerance, high availability, clustering, distributed networking, etc. are some of the extended features. Clustering works very well and is very easy to set up. You start my adding a cluster, then adding resources (hosts).
My VMware system is still a work in progress, I have set up several different environments, using Fiber Channel Storage, multiple hosts, and clustering. I enjoy using VMware. My favorite feature is snapshots.
iNag Iphone Nagios Viewer
So there is a very useful application for the iPhone / iOS devices called iNag. iNag connects to your Nagios server and renders your Nagios Site for the iOS devices.
The price is $15. It is a little pricy, but what you get out of it is worth it if you actually use it. iNag also allows you to send custom commands for hosts, and interact with hosts and services on the fly. It is fast. Over 3g, iNag downloads my setup with 800 devices in just a few seconds. you can also set up multiple servers and multiple nagios instances. You have to setup your server to work with the application by running a script for the iNag data feed. More information can be found here http://idevelop.fullnet.com/iapps/modules/apps/inag.php.
Views:
- Tactical Overview
- Hosts
- Services
- Event Log
Host / Service Detail Provides:
- Host Status with Uptime
- Status Information
- Performance Data
- Current Attempt
- Last Check Time
- Check Type
- Check Latency / Duratiuon
- Next scheduled Active Check
- Last State Change
- Last Notification
- Is Flapping?
- Isn Scheduled Downtime?
- Last Update
Host / Service Commands Available:
- Disable Active Checks
- Re-schedule Next Check
- Submit Passive Check
- Disable Passive Checks
- Stop Obsessing
- Disable Notifications
- Send Custom Notification
- Schedule Downtime
- Disable Ecent Handler
- Disable Flap Detection
- Disable all notifications
- Enable all notifications
- Schedule a check of all
- Disable all checks
- Enable all checks
I have loved having quick and easy access to my Nagios server, in a easy to use format. If there is a problem, I am able to get into Nagios and do what I need to do no mater where I am or what I am doing.
Ubuntu 10.04 LTS Dell Lattitude E6510 nVidia 3100m Nouveau Graphics Issue
This post is a recap of the steps I was able to take to successfully install Ubuntu 10.04 LTS (64 Bit) on a Dell Lattitude E6510 with an nVidia 3100m graphics adapter.
The Nouveau project was developed to provide better graphics drivers for nVidia cards. Unfortunately, with the nVidia 3100m adapter, the Nouveau drivers crash. The fix is quite simple, but requires a few steps.
1. Boot into O/S
2. Disable Nouveau drivers
3. Install nVidia drivers using third party drivers
When attempting to install from a live disc, you will find that you can not run X to boot the live environment. On this laptop, the screen would display colored lines vertically and horizontally, and go blank. Others have reported different symptoms, but the fix is global. If you have attempted to use an Ubuntu alternative installer disc, then you are half way there. Weather or not you have installed Ubuntu or not, you have to start x in VESA mode, and disable the Nouveau drivers. This can be accomplished by changing your boot parameters for the live disc, or changing the Grub paramaters if Ubuntu is already installed.
1. Live Disc – Change boot parameters
Boot to the live media, press the ‘Esc’ key on the keyboard after you pass your system’s splash screen. Press ‘F6′ for extended options, press the ‘Esc’ key to remove the options menu. You are now prompted with the boot parameters for the live media. Type
nouveau.modeset=0
at the end of the boot line. Press the enter key. You will now boot into Ubuntu 10.04 from the live media and have a working operating system/ installer. This is just a workaround, as we have not saved any parameters.
1b. Post Install
If you installed Ubuntu 10.04 LTS using an alternative installer or the method above, we will be using the same boot parameters to start X, but we will be using the Grub boot menu. After you pass the system’s splash screen, hold down the ‘Shift’ key to start the Grub bootloader menu. Select your installation and press the ‘e’ key. This will allow us to modify boot parameters. At the end of the kernel line, type
nouveau.modeset=0
which disables the Nouveau drivers in the kernel.
2. Disable Nouveau drivers in grub configuration
Modify /boot/grub/grub.conf to include
nouveau.modeset=0
in the kernel commandline.
2b. Disable the Nouveau drivers permanently
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
This command will simply append the following code to the file ‘/etc/modprobe.d/nouveau-kms.conf’.
3. Install the nVidia drivers
Ubuntu Menu Bar -> System -> Hardware Drivers
Select the nVidia drivers, install them and you are done!
Google Webmaster Tools Verification
Apparently Google Webmaster Tools checks for site verification on a regular basis. I was with the understanding that the site verification was a one time deal. I’d rather prefer to not have meta tags or added dns that sits there forever. I used the Google Analytics Verification, since my sites using Google tracking code. This method will have less clutter and meta tags.
iPhone 4 Temperature Warning : iPhone needs to cool down before you can use it
I have never seen this warning before. Ever since iOS 3, I have seen lots of warnings for This Accessory Does Not Support Charging, etc, but this is new to me. My iPhone 4 has been sitting on the desk, I sent / received under 10 SMS messages, other than that the iPhone 4 has been idle. This worries me a little bit. I performed a hard reset on the phone by holding in the Home + Sleep buttons. the iPhone 4 came right back up and was all better. Has anyone seen this before? Does the iPhone 4 have a temperature sensor? This is strange.
Audio Installation Log
New site, Install Log is now up and running. This site details installations for mobile audio video and electronics.
HTML 5 Video
I had a little free time and decided to see what all this HTML 5 jazz is about. I was very impressed and excited. There is a great guide at http://diveintohtml5.org . I will warn you, it is alot of information, but it is very detailed and provides history and usage.
So HTML 5 Video is simple. I have tested on as many platforms / browsers I could get my hands on at the time (at work behind firewalls with all types of security software), and here are my findings:
Google Chrome LOVES HTML 5 Video.
It renders nearly any format with no issues. Chrome also accepts new HTML 5 tags such as <article> <header> <hgroup><footer>. Which is more than any other browser that I have used. I tested on Windows XP, Windows 7 and Ubuntu 10.04.
Internet Explorer 6
Why would I even try? No HTML 5 support, stuck with this version at work. But IE 7 and 8 have no support as well. Microsoft … IE9 is supposed to have partial HTML 5 support. When developing HTML 5 pages, we have to add all types of extra crap for IE users. The great thing about the HTML 5 <video>tag is that all nested tags except <source> are ignored. This means we can put all types of alternate data in this tag such as flash video and captions stating your browser does not support HTML 5, and HTML 5 compatible browsers will completly ignore all of this!
Firefox
Firefox 3.7 will only render OGG video files using the HTML 5 <video>tag. Firefox claims near full HTML 5 support in 3.7 but alot of tags are not rendered, such as <article><header><hgroup><footer>but 4.o should resolve these issues. The website listed above has a good write up on converting your video files to OGG files using FireOGG, which is a browser extension. It is very easy and quick, but a pain to have to convert all your video files.
I know that Google Chrome has its issues, but the HTML 5 support makes me smile. It’s a big step for the developer, and it actually makes a different for the end user.
I forgot to mention the iPhone Safari browser. HTML 5 Video works like a charm.
Sample HTML 5 Video, sorry too lazy to make an OGG video file.
This video is from Shred The Bay (http://www.shredthebay.com), a wakeboarding blog.
Your browser does not support this HTML5 Video | Download in Quicktime format

