PHP + MySQL + CSS Striped Tables

January 27, 2012 · Posted in Web Development · Comment 

This is how i stripe table rows using PHP when querying MySQL.

<style>

tr{

background:white;

}

tr.stripe{

backgground:#acf;

}

<?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></tr>”;

$rc = 0;

while($d = mysql_fetch_array(mysql_query(“SELECT * 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;

?>

Share

Simple PHP Mail Script

April 16, 2011 · Posted in Web Development · Comment 

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>”;
}

?>

Share

Website Layouts Now Available

April 16, 2011 · Posted in Web Development · Comment 

I am creating templates for web sites in standard html and css. You can browse the directory at http://dev.mjwired.net/templates and feel free to use them. My goal is to have a good range of templates that I can quickly use for building customer sites.

There is nothing fancy there yet, just a one column and a two column centered layout

Share

How to root your Droid X Android 2.2

January 13, 2011 · Posted in Android · Comment 

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

Share

VMware ESX ESXi vSphere vCenter vCloud

December 28, 2010 · Posted in Server Technologies, VMware, Web Development · Comment 

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.

Share

Inception (the Movie) 2010

December 21, 2010 · Posted in Entertainment · Comment 

I don’t normally post on movies, but after watching this movie, I’d thought I would share a quick thought.

Movies that have a lot going on and are difficult to follow interest me. I love suspense and thrills. I want to sit on my couch and wonder what is going to happen next. I want a movie to make my mind wander for hours.

This movie gave me all of that.

Inception is about taking lucid dreaming to the next level and sharing dreams with other people, creating and managing the surroundings, activities, and overall controlling the dream. They take this to an extremely deep level. Inception has gun fights and kidnappings, explosions and car chases, amazing visual and sound effects, and the plot really keeps you going.  This is a great movie that doen’t stop surprising you.

Check it out

Share

iNag Iphone Nagios Viewer

December 2, 2010 · Posted in iPhone, Network Monitoring, Server Technologies · Comment 

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.

Share

Ubuntu 10.04 LTS Dell Lattitude E6510 nVidia 3100m Nouveau Graphics Issue

November 22, 2010 · Posted in Ubuntu Desktop · 2 Comments 

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!

Share

Google Webmaster Tools Verification

November 9, 2010 · Posted in Web Development · Comment 

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.

Share

iPhone 4 Temperature Warning : iPhone needs to cool down before you can use it

October 15, 2010 · Posted in iPhone · Comment 
iPhone Temperature Warning

iPhone Temperature Warning

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.

Share

Next Page »