martin5211 37 Posting Whiz in Training

One thing you may need is a dynamic DNS provider.

After registering one of these services, would be necessary to install an updater software to modify the DNS record automatically when the dynamic IP changes. If you have a router, check on the configuration page if there are a DDNS section to set up your dynamic DNS configuration and make the update automatically from there.

There are several free dynamic DNS providers and updater clients for any OS, only lack free support for CNAME option (that is fully available through commercial packages, this is required if you want to use virtual hosts, a.k.a. site1.mydomain.ath.cx).

So, this is a common issue when you want host a website or setup a development/testing server from home.

martin5211 37 Posting Whiz in Training

i've exaggerated a bit with the pinyin tool :) chinese is always a pain.

i'd like more office management... maybe like a mini-m.y.o.b. package, taking it from a very simple perspective.

martin5211 37 Posting Whiz in Training

Revise your mysql database properties is set to utf8 and utf8_bin collation, then take a look at the table structure if it is utf8 and utf8_general_ci collation is selected too.

Finally, inside the html layout, the meta 'content-type' must be stand as utf-8 charset to handle these characters.

martin5211 37 Posting Whiz in Training

I suggest to validate the page for (X)HTML and CSS to make clear that there is not any syntax error. These displaying errors in IE6 is commonly due to an incorrect closed tag or sometimes due to a conflicting javascript function.

Anyway, good luck.

martin5211 37 Posting Whiz in Training

A mandarin script class to convert Pinyin or romanized characters to chinese writing and visualize it using GD, all-in-one package, would be very useful.

martin5211 37 Posting Whiz in Training

There is some little mistakes, like missing type on id_client field, a UNIX timestamp normally takes ten positions and lunch_time have one space inside (table names can't have any space). I recommend make the first field (id) as primary key usually.
The resultant SQL would be:

CREATE TABLE food_journal(
id INT( 11 ) NOT NULL AUTO_INCREMENT ,
id_client INT( 11 ) NOT NULL ,
TIMESTAMP INT( 11 ) NOT NULL ,
water VARCHAR( 8 ) NOT NULL ,
breakfast VARCHAR( 8 ) NOT NULL ,
breakfast_calories INT( 8 ) NOT NULL ,
breakfast_time VARCHAR( 8 ) NOT NULL ,
snack_1 VARCHAR( 8 ) NOT NULL ,
snack_1_calories VARCHAR( 8 ) NOT NULL ,
snack_1_time VARCHAR( 8 ) NOT NULL ,
lunch VARCHAR( 8 ) NOT NULL ,
lunch_calories VARCHAR( 8 ) NOT NULL ,
lunch_time VARCHAR( 8 ) NOT NULL ,
snack_2 VARCHAR( 8 ) NOT NULL ,
snack_2_calories VARCHAR( 8 ) NOT NULL ,
snack_2_time VARCHAR( 8 ) NOT NULL ,
dinner VARCHAR( 8 ) NOT NULL ,
dinner_calories VARCHAR( 8 ) NOT NULL ,
dinner_time VARCHAR( 8 ) NOT NULL ,
snack_3 VARCHAR( 8 ) NOT NULL ,
snack_3_calories VARCHAR( 8 ) NOT NULL ,
snack_3_time VARCHAR( 8 ) NOT NULL ,
PRIMARY KEY ( id )
)
martin5211 37 Posting Whiz in Training

Yes, more difficult is to put xml data to db. Depending on your PHP version, if it is 5 you can use built-in SimpleXML functions, or in case if it is PHP4 you will need a class to parse xml to an array. Both cases will provide to you access to element attributes in a variable to put afterwards in db.

martin5211 37 Posting Whiz in Training

UNIQUE and KEY id_2 isn't necessary, let alone primary key (id), indexes are meant to use a basic field for lookups, you could use more fields like fname and lname to perform special full-text lookups using MATCH().

And yes, you could avoid spaces or make carriage returns between commas to make the code more readable.

martin5211 37 Posting Whiz in Training

Use concatenate . and escaping \ operators like:

echo "<job id=\"". $result['id'] ."\" title=\"". $result['title'] ."\" company=\"". $result['company'] ."\" location=\"". $result['location'] ."\" />";

In this way we have the result in xml syntax.

martin5211 37 Posting Whiz in Training

xml post using fputs() and SimpleXML functions or XML to array class is another good and simpler method for great amount of data like rss, news, etc.

martin5211 37 Posting Whiz in Training

For clients I recommend to start with id, fname (first name), lname, username, email

For journal, id, id_client, title, body, date

You could use text type for any field except id (I suggest int, 11 chars length for this)

martin5211 37 Posting Whiz in Training

I recommend every-time as possible the guideline use mentioned by digital-ether. I will try to make a more deep review.

Create one table for clients, first field called id_(table name), type Int, as primary key and with auto-increment extra feature. Then, when you add a record, a new auto-incremented unique id number will be generated for each client. That's the normal usage for tables.

You can translate the client id to another tables to maintain the relationships between tables (e.g. for posts table, I suggest to create the first field id_post, the second as id_client and then the additional ones - title, body, etc.).

When you add a new client the question is how to insert the resultant client id in another table? Well, you could do a lookup by client name to get the client id before, using a input field or a dropdown list with client names and id values, or use

SELECT id FROM clients ORDER BY id_client DESC LIMIT 1

same as mentioned by digital-ether again, in this case to get the latest inserted id from clients. When you make a insertion in another table do not forget to insert the client id.

You could make a lookup by logon name, e.g.

SELECT id FROM clients WHERE username = $logon_name

To make a single query through several tables with a same field in common (e.g. client id) you could perform a query like this:

SELECT *
FROM clients
INNER JOIN posts ON …
martin5211 37 Posting Whiz in Training

Other suggestion:

CREATE TABLE IF NOT EXISTS `session_id`
martin5211 37 Posting Whiz in Training

Which language are you using in your text-based game? and what do you mean with a training function? If you're talking about a character the procedure is very simple... add points to each variable and store in a database. You could make simple formulas (sum points) to adjust some variables according to an event... and let the character's experience to growth. Maybe you will need to partition it in several tables for different profiles/characters.

martin5211 37 Posting Whiz in Training

why don't you use GD library? that provides the same functionality.
I've attached two links as guidance:

http://www.sitepoint.com/article/image-resizing-php

http://www.tizag.com/phpT/fileupload.php

Also there is various threads on this forum talking about this topic and in addition, i think code snippets too...

martin5211 37 Posting Whiz in Training

"Computer-based diagnosis of hearth diseases using x-ray imaging techniques and neural networks" sounds cool for me

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

A solution is to store the variable value in a hidden element inside form. For example:
document.getElementById('id').value = id_var;

Then, when the form is submitted the idea it's to create another hidden element using $_POST or $_GET. In javascript, then will be possible to use:
var id_var = document.getElementById('id').value;

martin5211 37 Posting Whiz in Training

mmm I see... Please, in the future use code tags when you post code to get more clear.
The problem is in the conditions. If you use OR, when one is true, returns ever true value. If you use AND, the two values should be true to execute the intrinsical methods.
Use complete headers with doctype, then use W3C validator. Note the use of getElementById, it is another method.
Also, you could split the ff1() in two functions, and call each condition in accordance with the id element if there are problems later.

<html>
<head>
<script>
function ff1()
{
if(document.getElementById('FirstName').value==""){
alert("Please enter your First Name");
document.getElementById('FirstName').focus();
}

if(document.getElementById('MotherTongue').value==""){
alert("Please enter your Mother Tongue");
document.getElementById('MotherTongue').focus()
}


} 
</script>
</head>
<form method="post" action="validation.php">
Name :
<input name="FirstName" type="text" class="dropmenu" id="FirstName" value="First Name" size="15" maxlength="30" onblur="ff1()" />
<input name="LastName" type="text" class="dropmenu" id="LastName" value="Last Name" size="20" maxlength="30"/><br />
Mother Tongue :
<input name="MotherTongue" type="text" class="dropmenu" id="MotherTongue" value="Mother Tongue" size="20" maxlength="30" onblur="ff1()" />

<input name="submit" type="submit" class="button" value="submit" />
</form>
</html>
martin5211 37 Posting Whiz in Training

You could try to replace a element div with another, replace an image wih another, using a link and onclick event, calling a function with the methods mentioned above.
Then you could learn to use ajax to replace a complete avatar set.

martin5211 37 Posting Whiz in Training

Ajax would be mandatory because you will don't like to reload the whole page at the hair changing or changing a specific attribute of the avatar. With Javascript you could remove specific DOM elements, like a layer and create another set.
In Code Snippets there is a good example using Ajax and in w3schools.com you will find reference of the following Javascript methods: getElementById(), createElement(), setAttribute(), appendChild() and removeChild()
The first stage is create an avatar and try to change only one attribute, then you could create a complete options menu and a complete avatar.

martin5211 37 Posting Whiz in Training

That's true, the pro is that you will get more faster validation with js or ajax :)

martin5211 37 Posting Whiz in Training

Wow, but it needs a lot of art. You could use inner divs and ajax to update the avatar directly without reloading the page. You will need custom CSS classes for each character to situate correctly the elements. The rest it's very simple.

martin5211 37 Posting Whiz in Training

Use WHERE clause to filter occurrences in Mysql results and $_GET or $_POST variables to get url parameters (according to form method). For example, add including the quotes:

WHERE id = '". $_GET['id'] . "'
martin5211 37 Posting Whiz in Training

I recommend to use OOP to make a particular functionality, like a class to query the database or send different type of e-mails. The rest of the site, like views or presentation, it's usual to use structured programming.

The most valuable in a CMS it's the database design IMO. Table for posts, a table for sections or categories, etc.

You could get a lot of tutorials from Google talking about this subject - building a CMS.

martin5211 37 Posting Whiz in Training

I agree, that's why I returned to Windows now :) The question is, it is good to be good at one thing at least.

martin5211 37 Posting Whiz in Training

2839... could be an anti-stress therapy

martin5211 37 Posting Whiz in Training

2837

martin5211 37 Posting Whiz in Training

Content superb and updated is very important as well as presence in search engines with right keywords. With minimum knowledge you could start with SEO on your site.

martin5211 37 Posting Whiz in Training

Another solution is changing z-index on divs, with z-index you could locate an image over another and build a custom header layout too. Higher values put the image on the top.
This is the trick:

getElementById(--id--).style.zIndex += 1

I've enclosed the source code again with new modifications

martin5211 37 Posting Whiz in Training

Suggestions (maybe one will be enough)

- <div> with more width
- getElementById(id).height with lower value in the condition
- <div> with auto margins or without width property in CSS.

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

There are several methods... If you want to setup your linux box as router it is necessary to edit iptables file located commonly in /etc/init.d. Also, add or edit in /etc/sysctl.conf the following line to this:
net.ipv4.ip_forward = 1

Now, if you want to configure your linux box to connect a router, you have to go to System Tools > Network Device Control or Internet Configuration.

martin5211 37 Posting Whiz in Training

And another method, I've created a mini function:

function big_num() {
	
	for ($i = 1; $i <= rand(60,80); $i++) {
		$a .= rand(1, 32768);
	}
	
	return $a;
}

echo big_num();
martin5211 37 Posting Whiz in Training

I don't know if it possible, because there are a limit in rand() and the processor, but if you really want only large numbers you could concatenate them with dots and min and max parameters, like:

$big_num = rand(32765, 32768). rand(32763, 32765). rand(10000, 32768). rand(32763, 32767). rand(15000, 32768). rand(18000, 32768);

echo $big_num;
martin5211 37 Posting Whiz in Training

The link calls a javascript function that hide the content with GeSHi and show the next div with a textarea and plain text as value (trimming the bbcodes). For example add the following ID properties to that <div> elements: "geshi" and "plaintext". Then add a JS function like this:

function plainText () {
var geshi = document.getElementById('geshi');
var plaintext = document.getElementById('plaintext');

geshi.style.display = "none";
plaintext.style.display = "block";
}

By this way, we're changing CSS properties of some elements (geshi and plaintext) when you call this function.
Add the plainText () call on onload property of your link to toggle text.

These modifications has to be done in the view of vb board.

martin5211 37 Posting Whiz in Training

Yes, you can accomplish this task with imagegrabwindow(), from GD library. This function will capture the complete window, after this operation it's necessary to crop the image, using GD functions too.

martin5211 37 Posting Whiz in Training

Maybe you could start renting a dedicated server with centos, cpanel and webhost manager, and a billing script.

martin5211 37 Posting Whiz in Training

Have you hear about GeSHi? It is a good syntax colorizer and very unobtrusive. This is the code to put on:

include_once('geshi.php');

$geshi =& new GeSHi($source, "php");

echo $geshi->parse_code();

There are a bbcode tutorial at phpit.net. You can use preg_replace to get the content of code tags and use it as source.

martin5211 37 Posting Whiz in Training

First, very important, to upload the image you will need enctype="multipart/form-data" inside the html form tag to set the suitable encode type to send files.

Then you use fread to get the file content in a variable (use fopen before with the given url parameter), then we can insert the mime type and the content.

To get the data, you can do this like another data type, but taking care regarding to when you output the MIME header.

If you are inserting images in the middle of the document, for example (not covered in the tutorial), you will need something like this snippet:

function output_handler($image) {
   header('Content-type: '. $data["mimeType"]);
   header('Content-Length: ' . strlen($data["fileContents"]));
   return $image;
}

ob_start('output_handler');
echo $data["fileContents"];
ob_end_clean();
martin5211 37 Posting Whiz in Training

By general, I insert only the name of an image. I save the images in a folder.

Anyway, sure that you can do so. There are some tutorials talking about that. You will have to do output buffering to display the mime content stored in the mysql record with header function or ob_start (depending if the headers are already sent).

Look at the ONLamp tutorial.

martin5211 37 Posting Whiz in Training

The most important thing it's the array concept, if you learn to manipulate arrays, you will be able to put almost any data or given result. I like very much devshed.com, phpbuilder.com and phpit.net, very good articles about everything.

martin5211 37 Posting Whiz in Training

This is the last corrected version, tested the results with Mathematica from Wolfram Research. The first version is like unkempt - very ugly.

First, if you have to deal with an algorithm, build one, you will have to separate the business logic (like functions to do math operations in this occasion) from the user interface. We have two problems. I recommend start with the business logic always.

We use variables or arrays to contain the values. Both are the same, array can be defined as a variable conjunct, each one with an index to make more easy the location. I'm using the symbol equal to assign the result of the operation (with variables) to unique array index, separating the terms.

Given the parameters by the function, I use conditions to define an action in accordance with an event. In this case, we know that I can't apply the same formula with any given value.

In the square function of a number, I'm using a controlled loop to make a repetitive task of multiply a parameter by itself given the number of times by another parameter too (in this case, parameter can be omitted, have a default value, two times).

I don't know how to put simpler, but in almost every language you can do math operations easily like with a calculator. The problem growth when you don't have built-in functions in the language to make operations, you have the possibility to use more specialized libraries …

martin5211 37 Posting Whiz in Training

This is the last corrected version, tested the results with Mathematica from Wolfram Research.

martin5211 37 Posting Whiz in Training

I love PHP, now it's time to take a large breath before submerge myself in Java struts/spring. I like more open platforms and code with long long life and not much microsoft.

martin5211 37 Posting Whiz in Training

why not c# acting as cgi? I appreciate a tool that works and deal with really ugly code, a perfect one :)

martin5211 37 Posting Whiz in Training

Pseudo language reminds me to learn another language :) The code have some errors, like the absence of the square root and another condition to put: (sqr(b) - (4ac)) have negative value (nan if I do the square root). Basically, there three functions, one to calculate the square because I haven't a built-in function in PHP to do this, and two functions with the same resemblance to calculate with the quadratic formula ((-b ± sqrt( sqr(b) - (4ac) )) / (2a)).

I use parenthesis to make the order of precedence of the operations and yes, the logic will be more complex dealing with complex numbers.
Each function return the values in a array. An array is a container of data. So, in this way, I can save the two terms of the imaginary result and display then.

The part below the functions there are to display the results. First, to get the parameters sended by the form and store in variables. Then, execute the functions with the parameters obtained. Now then, a condition to show imaginary or real results and finally, the form to input the data. I'm assigning strings to a variable and concatening another strings, then I show the variable with all strings using HTML code.

I have enclosed the new source code, maybe it is more clear.

martin5211 37 Posting Whiz in Training

I would like to see and grasp hot sand, a place like Tunisia.

martin5211 37 Posting Whiz in Training

^ you can't kill your soul :)

martin5211 37 Posting Whiz in Training

Personally, I don't like very much Dreamweaver 8 because now I have my own style, but I've to admit that in the first two weeks I started to build a social networking site, you don't have to worry very much, and you can focus to learn the most basics things: array manipulation, iterate arrays to display content, conditions to show, hide sections of the website and send parameters by url in forms.

PHP.net is a great resource, almost all examples are very easy, you can copy&paste and see the results, then modify it and apply your idea. For example, the foreach example to read an array and the subsequent examples to deal with multidimensional arrays (arrays like excel spreadsheets). The foundations of PHP are very basic, you have to learn not to see all like very complex.

phpDesigner is more cheaper and lighter than Dreamweaver, it have a great potential but have confussing behaviors: automated hiding of php or html code, and the instantaneous bug reporter, both very annoying for beginners.