martin5211 37 Posting Whiz in Training

I found some errors in your code:

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
		The Main class creates the GUI for the Dorm and 
		Meal charges.
 */
public class Main extends JFrame
{
	private JPanel dormPanel;
	private JComboBox dormBox;
	private JPanel mealPanel;
	private JComboBox mealBox;
	private JPanel totalChargesPanel;
	private JPanel selectedMealPanel;
	private JPanel buttonPanel;
	private JButton calcButton;
	private JLabel label1;
	private JTextField totalCharges;

	private String[] dorm = { "Allen Hall: $1,500 per semester", 
			"Pike Hall: $1,600 per semester", 
			"Farthing Hall: $1,200 per semester", 
	"University Suites: $1,800 per semester"};

	private String[] meal = { "7 meals per week: $650 per semester", 
			"14 meals per week: $1,095 per semester", 
	"Unlimited meals: $1,500 per semester"};

	/**
   		Constructor
	 */
	public Main()
	{
		super("Dormitory and Meal Plan");

		// Specify an action for the close button.
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Create a BorderLayout manager.
		setLayout(new BorderLayout());

		// Create the dorm and meal panel.      
		buildDormPanel();
		buildMealPanel();
		buildSelectedTotalChargesPanel();
		buildButtonPanel();

		// Add the components to the content pane.   
		add(dormPanel, BorderLayout.WEST);
		add(mealPanel, BorderLayout.EAST);
		add(totalChargesPanel, BorderLayout.SOUTH);
		add(buttonPanel, BorderLayout.NORTH);

		// Pack the contents of the window and display it.    
		pack();
		setVisible(true);
	}

	// The buildDormPanel method builds the dorm panel.	
	private void buildDormPanel()
	{
		// Create the dorm panel.      
		dormPanel = new JPanel();
		dormBox = new JComboBox(dorm);

		// Register the action listener.      
		dormBox.addActionListener(new ComboBoxListener());

		// Add the dorm panel to the panel.
		dormPanel.add(dormBox);
	}

	// The buildMealPanel method builds the meal panel.	
	private void buildMealPanel()
	{
		// Create the meal panel. …
martin5211 37 Posting Whiz in Training

Your external IP is not accessible from intranet, it is a common issue. If you did the right steps, try to access to your wan address from an outside location.

martin5211 37 Posting Whiz in Training

This example will show an alert after the end.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>    
<div id="ytapiplayer">
  You need Flash player 8+ and JavaScript enabled to view this video.
</div>

<script type="text/javascript">
 
    var params = { allowScriptAccess: "always" };
    var atts = { id: "myytplayer" };
    swfobject.embedSWF("http://www.youtube.com/v/App5FjQMpdA?enablejsapi=1&playerapiid=ytplayer", 
                       "ytapiplayer", "425", "356", "8", null, null, params, atts);

function onYouTubePlayerReady(playerId) {
  ytplayer = document.getElementById("myytplayer");
  ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}

function onytplayerStateChange(newState) {
	if(newState == 0){
   		alert("Player is stopped");
	}
}

</script>
martin5211 37 Posting Whiz in Training

The result will be displayed into an array:

preg_match_all("/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i", $syntax, $matches);

echo "<pre>";
print_r($matches);
martin5211 37 Posting Whiz in Training

I think Zend Framework wins using LiveDocx component: http://www.phplivedocx.org/downloads/

Antiword would be an alternative, it's a UNIX app, can be executed from PHP using exec()

<?php
exec('/usr/local/bin/antiword /opt/lampp/htdocs/example.doc', $output);
?>
martin5211 37 Posting Whiz in Training

The same marketing text found at:

http://www.tekla.com/international/solutions/building-construction/construction-companies/site-management/Pages/Default.aspx

This is a construction company. Websites are managed differently. To maintain a site, first of all, programming tasks differs substantially from design tasks. Programming tools could be mainly editors, IDEs and debuggers. Design tools: image editors like Gimp, Photoshop; multimedia authoring packages like Flash; vector drawing tools like Illustrator. Word for copywriting (or OmegaT for multilingual). Finally, browsers to review and test websites.

Project management and CRM software can make the process 'staged' and organized. ProjectPier (based on activeCollab) is an example of a good website management tool.

peter_budo commented: Thank you for notification on copy rights +17
martin5211 37 Posting Whiz in Training

I'm looking at your code, the method used in your form and mysql variables is ok, but into the form code, the survey code is commented into <!-- ... --> tags, remove it.

Add value="<?php echo $_GET['center']?>" into the input tags, should be something like:

<input type="text" maxlength="2" size="3" name="center" value="<?php echo $_GET['center']?>" />-<input type="text" name="custID" maxlength="5" size="10" value="<?php echo $_GET['custID']?>" />

Now, you can use /pre_venture.php?center=10&custID=1 in your link

If you want to hide that input elements, use this instead of above code:

<input type="hidden" name="center" value="<?php echo $_GET['center']?>" />
<input type="hidden" name="custID" value="<?php echo $_GET['custID']?>" />

On the PHP submission code, you use only $_POST instead of $_POST['center'] on the first value. Is that ok?

JRSofty commented: Good post. You could have also mentioned the use of the $_REQUEST since she is mixing both $_POST and $_GET usage in her page. +2
martin5211 37 Posting Whiz in Training

Facebook and another community sites achieves this optimal capacities performing an image scale reduction and using lossless formats like JPEG for every photo uploaded. Data storage can be a concern on higher web sites, I think CPU usage should be another factor to be considered. You can make a heavy amount of CPU load killing the server resources trying to recompress files that already uses a compression on their data. Also, Lempel-Ziv (.gz .zip) compression will give bigger files as a result (if you're using JPEG images).

The GD library would give the essential functions to do image processing like format conversion and reducing images to the maximum visible dimensions into the website template.

digital-ether commented: great answer +6
martin5211 37 Posting Whiz in Training

To generate a PDF into PHP, there are two techniques: PDFLib or FPDF. PDFLib has some restrictions on licencing (commercial applications), I encourage to use FPDF because is free and Open Source, although PDFLib is rough and more complete (use your criterion). At http://fpdf.org there are a place to download the class and good tutorials. Use $_GET or $_POST variables to get the form data depending the form method.

To send the email, mail() function or PHPMailer are commons methods to perform these assignments. Please take care to encode the attachment and the headers, set multipart content type first, then the proper content type and encoding in each part, we could send plain or html text and multiple attachments too.

In this example I've used FPDF and mail() techniques. I don't know if it is better move this code to snippets section.

<?php
// download fpdf class (http://fpdf.org)
require("fpdf153/fpdf.php");

// fpdf object
$pdf=new FPDF();

// generate a simple PDF (for more info, see http://fpdf.org/en/tutorial/)
$pdf->AddPage();
$pdf->SetFont("Arial","B",14);
$pdf->Cell(40,10, "this is a pdf example");

// email stuff
$to = "target@domain.com"; 
$from = "me@domain.com"; 
$subject = "send email with pdf attachment"; 
$message = "Please see the attachment.";

// a random hash will be necessary to send mixed content
$separator = md5(time());

// carriage return type (we use PHP end of line constant)
$eol = PHP_EOL;

// attachment name
$filename = "example.pdf";

// encode data (put attachment in proper format)
$pdfdoc = $pdf->Output("", "S");
$attachment = …
nav33n commented: good post! +8
Roebuc commented: FPDF is perfect, thanks! +1
martin5211 37 Posting Whiz in Training

It is possible to use fopen() in PHP5 to send a POST request and obtain the content in a variable, check this tutorial:
http://netevil.org/blog/2006/nov/http-post-from-php-without-curl

According to the amount of data, sometimes is more fast and useful to use only string functions, with a combination of strpos() and substr(); other method is using regular expressions.
http://www.webcheatsheet.com/php/regular_expressions.php
http://www.snipwiki.com/snips/show/38_find-a-substring-between-two-other-substrings

With larger files or complex patterns is recommended to use SimpleXML functions (PHP5), like is described in the first tutorial suggested by Ezzaral. Xpath would be a good improvement to locate elements easily.

Some sites have clean XML results and search API easily obtainable by public, with some limitations, like the Kayak API to search flights in tourism sites. Really, I don’t know if there is a such solution for your industry, some sites contain manuals and examples to implement search and get results on their sites.

Ezzaral commented: good info +3
martin5211 37 Posting Whiz in Training

You can pass the image id as parameter in functions:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="date" content="2003-12-02T09:54:03+08:00" />
<meta http-equiv="imagetoolbar" content="no" />

<title>Dynamically enlarge image on mouseover and mouseout</title>

<style type="text/css">
body {margin:64px;}
#apDiv1 {
position:absolute;
left:361px;
top:161px;
width:186px;
height:144px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:306px;
top:127px;
width:300px;
height:164px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:188px;
top:116px;
width:100px;
height:75px;
z-index:1;
}
#apDiv4 {
position:absolute;
left:387px;
top:113px;
width:100px;
height:75px;
z-index:2;
}
</style>


<script type="text/javascript">
// <![CDATA[
var glbInc, glbDec;

function decreaseSizeImage(image) // will get back to its normal default size
{
var id = image;
if(glbInc != null) {clearTimeout(glbInc); glbInc = null;};
if (document.getElementById(id).height > 100)
{
document.getElementById(id).height -= 30;
document.getElementById(id).width -= 40;
glbDec = setTimeout("decreaseSizeImage('"+id+"')", 32);
};
}

function increaseSizeImage(image)
{
var id = image;
if(glbDec != null) {clearTimeout(glbDec); glbDec = null;};
if (document.getElementById(id).height < 216)
{
document.getElementById(id).height += 30;
document.getElementById(id).width += 40;
glbInc = setTimeout("increaseSizeImage('"+id+"')", 32);
};
}
// ]]>
</script>

</head>

<body>
<div id="apDiv3"><a href="#" onmouseover="increaseSizeImage('image2');"
onmouseout="decreaseSizeImage('image2');"><img id="image2"
src="avatar196367_1.gif" width="100" height="75" alt="color" id="image2" /></a></div>
<p>&nbsp;</p>
<div id="apDiv4"><a href="#" onmouseover="increaseSizeImage('image1');"
onmouseout="decreaseSizeImage('image1');"><img id="image1"
src="avatar196367_1.gif"
width="100" height="75" alt="Krusty is helpless" /></a></div>
<p>&nbsp;</p>

<p id="validation">&nbsp;</p>

</body></html>
martin5211 37 Posting Whiz in Training

yes, it's true, but you can use a condition like this to deal with compatibility issues:

<? if (isset($_SERVER['HTTP_USER_AGENT']) && 				(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == true)) { ?>

I'm using z-index and I haven't see strange issues http://agec.ath.cx/lead maybe you could see a solution there

Web developer toolbar in firefox is a great tool to see CSS properties and change values on the fly.