[PHP] Optimizing PHP Relevancy Ranking Algorithm

2003-11-28 Thread Galen
I've developed some search result ranking code and it works extremely 
well in terms of relevancy but needs use some help with performance. 
I'm already using zend optimizer and I've done some basic things to 
clean up the code. This helps performance quite a bit by itself, but 
that's not enough, because I need to deal with ranking 20,000 search 
results.

From my limited benchmarking, it looks like the biggest problem is when 
I work with "$_SESSION. 
$_SESSION["search"]["results"][$key1]["relevancy"] = ($result_score * 
-1) / $num_fields_matched;" and "usort($_SESSION["search"]["results"], 
"cmp");" which use up about equal amounts of time each and account for 
80% of the loop time, but I don't know how to fix it. For the first 
piece of code, replacing $_SESSION with a blank array nets a huge 
performance increase (virtually eliminates time spent on that line of 
code). The second line of code, when commented out, causes an almost 
identical performance improvement as the first.

I wonder, is there some slowness when dealing $_SESSION as compared to 
a regular array? Or is the slowness related to handling large arrays? 
One of these two things probably explains the first line. I think the 
second troublesome line of code may be due to the same problem as the 
first or it may be related to using usort instead of another sorting 
option, but I'm not sure how I could use another sorting option to meet 
my sorting needs for this complex situation.

Anybody got a few ideas on how to speed up these two sluggish lines of 
code? I'm pretty much out of ideas. And if you have any other 
suggestions to speed things up, I would really appreciate them too.

Thanks,
-Galen P. Zink


The code:

function cmp($a, $b)
{
if($a["relevancy"]  < $b["relevancy"])
{
return 1;
}
elseif($a["relevancy"] > $b["relevancy"])
{
return -1;
}
else
{
return 0;
}
}
		foreach($_SESSION["search"]["results"] as $key1 => $value1)
		{
			$num_fields_matched = 0;
			$result_score = 0;
			$metaphone_ratio = 0;
			foreach($_SESSION["search"]["statements"] as $key => $value)
			{
if ($value != "")
{
	$value = strtolower(trim($value));
	$value1[$key] = strtolower(trim(($value1[$key])));
	$num_fields_matched++;
	$levenshtein = levenshtein($value, $value1[$key], "0.5", 1, 1);
	$value_metaphone = metaphone($value1[$key]);
	$search_metaphone = metaphone($value);
	$search_position = strpos($value1[$key], $value);
	$string_count = substr_count($value1[$key], $value);
	
	if ($search_metaphone == $value_metaphone AND $value_metaphone != 
"")
	{
		$metaphone_ratio = 1;
	}
	elseif ($search_metaphone != 0)
	{
		$metaphone_ratio = 0.6 * (1 / levenshtein($search_metaphone, 
$value_metaphone));
	}
	
	$result_score = 1; //basic math involving all above variables set 
in this foreach loop goes here - I'm not able to show it due to IP 
issues
}
			}
			if ($num_fields_matched == 0)
			{
$num_fields_matched = 1;
			}
			$_SESSION["search"]["results"][$key1]["relevancy"] = ($result_score 
* -1) / $num_fields_matched;
		}

		usort($_SESSION["search"]["results"], "cmp");
	}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Suggestions for optimization?

2003-11-29 Thread Galen
I'm working on some database search ranking code. It currently 
represents 95-98% of the time spent when doing fuzzy seaches. I have 
tried my best to optimize my code - algorithmic shortcuts, eliminating 
session variables, unsetting irrelevant results, etc and benchmarking 
to find the best techniques. That's given me over a 10x improvement. 
Unfortunately, because of the number of results it must process (up to 
20,000), it is still somewhat slow. I think it could use some code 
structure/formating tweaks to eek out that last bit of performance, but 
I don't know much about optimizing PHP code in that way. Does anybody 
have suggestions?

Also, might there be some tweaks for PHP itself to improve performance? 
I already know about the Zend Optimizer and have it installed, it does 
help.

Thanks!

Here's my code:

	if ($search_results[0]["relevancy"] == "")
	{	
		function cmp($a, $b)
		{
			if($a["relevancy"]  < $b["relevancy"])
			{
return 1;
			}
			elseif($a["relevancy"] > $b["relevancy"])
			{
return -1;
			}
			else
			{
return 0;
			}
		}
		
		$search_statements = $_SESSION["search"]["statements"];
		
		foreach($search_results as $key1 => $value1)
		{
			$num_fields_matched = 0;
			$result_score = 0;
			$metaphone_ratio = 0;
			foreach($search_statements as $key => $value)
			{
if ($value != "" AND $value1[$key] != $value)
{
	$value = strtolower(trim($value));
	$value1[$key] = strtolower(trim(($value1[$key])));
	$num_fields_matched++;
	$value_metaphone = metaphone($value1[$key]);
	$search_metaphone = metaphone($value);
	$search_position = strpos($value1[$key], $value);
	$string_count = substr_count($value1[$key], $value);
	$levenshtein = levenshtein($value, $value1[$key], "0.5", 1, 1);
	
	if ($search_metaphone == $value_metaphone AND $value_metaphone != 
"")
	{
		$metaphone_ratio = 1;
	}
	elseif ($search_metaphone != 0)
	{
		$metaphone_ratio = 0.6 * (1 / levenshtein($search_metaphone, 
$value_metaphone));
	}
	
	$result_score = $result_score + ($levenshtein + (8 * 
$search_position)) - (2 * ($string_count - 1)) - (1.1 * 
$metaphone_ratio * $levenshtein);
}
elseif ($value1[$key] == $value)
{
	$result_score = $result_score - 5;
}
			}
			if ($num_fields_matched == 0)
			{
$num_fields_matched = 1;
			}
			$search_results[$key1]["relevancy"] = ($result_score * -1) / 
$num_fields_matched;
			
			if ($fuzzy_search == true AND $search_results[$key1]["relevancy"] < 
-5)
			{
unset($search_results[$key1]);
			}
		}
		
		usort($search_results, "cmp");
	}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Fastest loop code/best way to get database results into array

2003-12-01 Thread Galen
I'm working on some code that deals with a LOT of results from a MySQL 
database and drops them into an array. It deals with about 17,200 
results on a very fast box in about 0.5 seconds, which is not too bad, 
until I realize I may need to call it on about that many results 
several times in a page.

Is there any way to speed things up? Change to a different loop type? 
Some other technique for pulling the data out of the database faster? 
My only requirement is that the array format remain unchanged (yes, 
associative values are important).

Here's the code, which seems awfully simple:

for($i=0; $i < $num_results; $i++)
{   
$search_results[$i] = mysql_fetch_array($result, MYSQL_ASSOC);
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Working as a PHP/database developer..

2003-12-02 Thread Galen
A few suggestions here, from my experience. I offer a variety of 
computer services freelance, and have been focusing on building my web 
development side of things.

Customers love flat rates, but you WILL eat the time WHEN, not if, you 
go over. I offer flat rates for mostly HTML web design services. The 
client gets x number of pages and y number hours photography and we 
meet in the beginning and in the end. The client approves the site and 
I'm done. Any changes, unless I personally feel I made a stupid 
mistake, are billed according to my update policy.

For PHP pages, I don't offer flat rates. I can give an estimate of the 
time it will take, but no more than that. My absolute minimum hourly 
rate is $35/hour and I'm located in Southwestern Washington State, USA. 
When I do work, it's a premium service. I don't claim to be the world's 
best PHP coder, but all my pages are reasonably written, execute 
quickly, and are quite secure. My big thing is that I make everything 
work, and work smoothly. I have a knack for building features that make 
everything easy to use, as simple as possible, yet extremely powerful. 
I write online catalogs that the owners can update and upload pictures 
and everything. I create online scheduling systems that are simple and 
straightforward. All this is perfectly integrated and easy to use.

So as far as code issues go, well, most of the code isn't reusable 
without modification. I don't usually write a lot of comments, so that 
makes it doubly hard to see what's going on. The part that really makes 
me feel better about misuse of my code is that my clients like and 
trust me. They wouldn't switch to another person or company, and they 
lack the skills to work on PHP themselves. For simplicity's sake, I 
just leave source code on their sites.

The only exception is a new area I'm working on: writing code that is 
licensed. I'm developing a church/club/organization database with PHP & 
MySQL. I'll license it to people for their use only and include 
limitations on how many people can be in the database through PHP. This 
code I will compile so it can't easily be changed or modified for 
reuse. I also have a few other projects like this in the works.

I'm still learning about the best ways to do all this, but I think you 
might find what I've learned so far helpful.

Galen P. Zink
Computer Consulting & Web Design
(360) 609-2617
http://zinkconsulting.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] getimagesize() & MySQL Image Storage (Running functions on contents of variables)

2003-12-07 Thread Galen
I'm using a MySQL database to store images as BLOBs. I know how to 
handle all the MySQL stuff, it's easy, and really makes keeping track 
of files nice an clean. No permissions, no risk of getting things out 
of sync, finding stuff is as easy as SQL.

My question is about handling stuff once you pull it out of the 
database. When I store images in the database, I currently stash the 
format and the resolution in the database, which works but is a bit 
messy. I can't find any easy way to run getimagesize on the contents of 
a variable, not a file. I could write the image to a file if I needed 
to, but that can be slow and rather inelegant, I'd rather store the 
values in the DB. Any ideas on how I could use getimagesize or similar 
function to determine the format and resolution of the image in a 
variable?

I have had a similar problem with ftp uploading. There was no way to 
upload the contents of a variable, so I had to write everything to the 
disk, kind of annoying when I have 1,000 files. The script wasn't a 
very heavily used script nor could the public execute it, but it bugged 
me to no end. I think there are some other functions that also only 
operate on files and I've fought with them too.

Is there any kind of generic solution for this? Some kind of wrapper I 
could use to make a variable act like a reference to a file but 
actually be in memory only?

If this seems totally pointless, please tell me. But it seems like 
there should be a way for almost any function that runs off a file to 
run off the contents of a variable, it's just binary data.

Thanks,
Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: getimagesize() & MySQL Image Storage (Running functions on contents of variables)

2003-12-07 Thread Galen
So you're saying there's no way to do what I want to do.

Anybody got any other ideas?

It seems so stupid to be unable to run functions that accept files on 
variables, with so many people using databases and whatnot these days.

-Galen

On Dec 7, 2003, at 1:46 AM, Justin Patrin wrote:

Galen wrote:

I'm using a MySQL database to store images as BLOBs. I know how to 
handle all the MySQL stuff, it's easy, and really makes keeping track 
of files nice an clean. No permissions, no risk of getting things out 
of sync, finding stuff is as easy as SQL.
My question is about handling stuff once you pull it out of the 
database. When I store images in the database, I currently stash the 
format and the resolution in the database, which works but is a bit 
messy. I can't find any easy way to run getimagesize on the contents 
of a variable, not a file. I could write the image to a file if I 
needed to, but that can be slow and rather inelegant, I'd rather 
store the values in the DB. Any ideas on how I could use getimagesize 
or similar function to determine the format and resolution of the 
image in a variable?
I have had a similar problem with ftp uploading. There was no way to 
upload the contents of a variable, so I had to write everything to 
the disk, kind of annoying when I have 1,000 files. The script wasn't 
a very heavily used script nor could the public execute it, but it 
bugged me to no end. I think there are some other functions that also 
only operate on files and I've fought with them too.
Is there any kind of generic solution for this? Some kind of wrapper 
I could use to make a variable act like a reference to a file but 
actually be in memory only?
If this seems totally pointless, please tell me. But it seems like 
there should be a way for almost any function that runs off a file to 
run off the contents of a variable, it's just binary data.
Thanks,
Galen
If the programs read from a file descriptor, you could open a pipe, 
write into it on your side, and have the command read from it. But 
that's really messy... and won't work for the image size function.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best practices for sharing members database between different portals

2003-12-09 Thread Galen
There is no good way to really handle this between domains and keep the 
user logged in.  I doubt there are any real "best practices" on this. 
If you're disparate, you might be able to use some tricks to make it 
work, but all in all, I don't think it's a very easy thing. Cookies & 
sessions just don't span multiple domains!

-Galen

On Dec 9, 2003, at 1:26 PM, Tariq Murtaza wrote:

Dear All,

Please comment on Best Practices for sharing members database between 
different portals.

Suppose we have 3 portals running on different networks.
Assignment is to make a single Login/Pass for all portals, means once 
LogedIn in one of the portal, could able to access the other portals 
without loging In.
Constraints are, every portal have different Database structure and 
also have different Global / Session variables.

Please share your experience and which approach is the best practice.

Regards,

TM
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Write on image in faint color

2003-12-10 Thread Galen
It's not that hard, no imagemagick functions required! Use imagecopy 
(part of image functions, built into PHP GD stuff) and a nice 32 bit 
PNG image with the opacity exactly the way you like. Browse the PHP 
manual for more docs on the exact code, there are lots of examples. I 
found it didn't like to work until I specifically saved my file as a 32 
bit PNG and specified opacity values for various elements I want to 
appear on top of the image. The opacity value (alpha channel) is fully 
respected by imagecopy under these circumstances, so it composites the 
two images just like it would in any good graphics app, leaving you 
with a single image.

Similarly, you can use imagecopyresampled, also part PHP, to create 
smaller files. Using imagejpeg you can output the resized jpegs. It's 
not terribly hard, either.

I use all this on my site. It works like a charm for watermarking my 
images on my photo website I'm developing. I do it on the fly and let 
registered users select their level of compression (jpeg low to high, 
even png) and compress images on the fly. I can even let certain users 
view my preview-sized (640x480) photos without a watermark, and I can 
do this because I add the watermark in real time. For a not terribly 
busy website and when not overused, it works great. Beware it can get a 
bit slow and/or memory intensive if you are working with it a lot or 
with large files in a real-world site environment. However, my host's 
lightly loaded, dual 3 GHz linux boxes with 1.5 GB of RAM make this 
almost a moot issue. :)

-Galen

On Dec 9, 2003, at 5:14 PM, Al wrote:

There's a command line, open-source utility called ImageMagick
(http://www.imagemagick.org/) available for all major platforms that 
allows
you to do lots of powerful image manipulation on one file, or one 
thousand.
You crop, scale, rotate, colour, draw on, place text over, compose,
transform and create montages of images using this program.

It has quite a steep learning curve, but the results are worth it!

You can run this using PHP shell_exec() function if you want to 
execute the
program from a web page, although be careful of the obvious security
consideration involved in doing this.

Hope it helps,

Al

"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi,
This was asked some time ago but cant find it in the archive, anybody
remember how it was solved please write and tell me.
Requirment:
Write domain name in faint color on picture (a kind of "watermark")
Reason:
I have 3 directories full of images that are original to our site and 
I
spent a crapload of time scanning them and putting them up, I dont 
want
others to just "borrow" the images and use them without giving us some
type
of credit...

I found a package on google after searching that you just throw all 
the
images in a folder and it generates the thumbs for you in a folder 
called
"thumbs", can i do the same for this too?
ie.
throw all the images in a folder, run the program and get 
www.sitename.com
written on all the images?

Any help and reminders appreciated.

Cheers,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Images in MySQL vs directory/file?

2003-12-10 Thread Galen
I tend to disagree. Images in the database, providing they actually 
associate with other bits of info, are great. I usually keep images in 
a separate table than the data, but it's really easy to keep track of 
everything. No file permissions, backup is as easy as standard SQL 
backups, etc. I my experience, it's a LOT easier to keep track of stuff 
in the database than the filesystem, especially when it comes to moving 
from box to box. There may also be some security advantages, too, as 
the data is not actually stored in the filesystem and couldn't possibly 
be executed or otherwise accessed by someone without database access 
privileges.

As far as it being slow, well, not terribly as long as your files don't 
balloon too large, especially considering all the stuff you might be 
doing with the disk. If you store images that are played with a lot on 
the disk, it'll likely be slower than MySQL due to MySQL having better 
caching. (I have actually shown this on some of my projects that work 
with a lot of images that are worked with quite a bit).

If your site is going to be high volume traffic, implement some sort of 
caching routine for your images. You'll get the convenience of database 
and the performance boost of caching, and as always, if the cache 
fails, just hit the database for the information.

For your needs, give it a try. I doubt you'll have performance 
problems, and you can always switch back to the filesystem if you do 
have troubles.

-Galen

If you are going to be passing images

On Dec 10, 2003, at 10:32 AM, Adam i Agnieszka Gasiorowski FNORD wrote:

Derrick Fogle wrote:

I've read that, given the choice, you should never store images in a
database because it makes the database dog slow. But I've got some
parameters and issues that might make a difference:
We (at hyperreal.info) are storing all the
 images attached to articles in the database and
 all the structural images (belonging to design)
 in files on filesystem (in CVS). There are no
 problems and backups are much easier...The server
 runs on LAMP.
--
Seks, seksiÄ, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne ksztaÅty... http://www.opera.com 007
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Images in MySQL vs directory/file?

2003-12-10 Thread Galen
On Dec 10, 2003, at 12:47 PM, [EMAIL PROTECTED] wrote:

Well, it seems to me that the confusion comes from the fact that we are
comparing apples and oranges.
I agree. Images in a database mean totally different things to 
different usage profiles.

But I would also like to question the extra layer.  Not that MySQL 
doesn't
have better caching, that is possible,  but it adds and extra layer to 
the
process because MySQL still stores the data on the drive.  Also, does 
the
web server cache images?  If so, then we are ahead of the game even 
more.
I think the extra layer is a mixed blessing. Yes, it can slow things 
down. But at the same time, it can use caching to make up for the 
slowdown in many cases, especially when writing. What the extra layer 
provides is structure and ease of use and (depending on your setup) 
security. For many applications, the benefits outweigh the costs. There 
are certainly many applications (high traffic sites come to mind) where 
file-based is the way to go, or at least an extensive caching system 
would be required.

From: Gerard Samuel [mailto:[EMAIL PROTECTED]
I disagree.
Depending on your setup, when a file based image is downloaded to
a user's computer, its cached there.
No need to fetch it again, till it expires.
I don't think thats possible via images from a database, but
I may be wrong.  Feel free to correct me...
Actually, the real problem these days with browsers is that you can't 
get them to STOP caching! At least in my experience, properly used 
headers don't even stop caching pages quite 100% of the time. If you 
retrieve an image from the database via url-encoded stuff (i.e. 
mysite.com/image.php?id=234) the browser will probably cache it no 
problem unless you send no-cache headers.

This is obviously a bit of a hot issue. I think that anybody seriously 
interested in this should try it with his or her setup and see how it 
works. I bet that for most people, it won't be a big deal at all. But 
for a few others, if implemented across their whole site, it could 
cause lots of CPU usage problems.

Give it a try. You might like it.

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP's MySQL Query Length Limit? (Long SQL failing!)

2003-12-11 Thread Galen
I've been doing PHP for a pretty good while now, and I've been able to 
solve most of my own problems. Before I spend hours troubleshooting 
this one, I think I should ask the list:

I have a script that accepts large files (images) and inserts them into 
a MySQL table. The images are manipulated and whatnot, no problems at 
all getting the image into a string and running addslashes() on it. 
Then I go and use it with a mysql query. This is something I've coded 
dozens of times, but now there's a twist. The files are bigger than 
I've ever worked with. In theory, I didn't think there would be a 
problem, but there is. When I try in insert a file of about 800K or 
larger (9-10 MB is as large as I ever try to insert) the insert fails. 
The query is written correctly AKAIK, but no data reaches the table I'm 
writing to.

The only difference between queries that work and those that do not 
work is the size of the file I'm trying to insert.

I'm running the same basic code a few times, once to save the original 
image (only lightly used), once to save a preview image, and once more 
to save a thumbnail image. I use the same SQL query and code to run all 
the queries. All the tables use mediumblobs except for the originals 
which uses longblobs, so there should be no problem in terms of size. 
I've upped my memory limit for php scripts and the file upload size but 
I'm not having any success getting the query to go through, even though 
I'm confident I have the correct data to insert (I can echo it back to 
the browser or write it to a file, no problem.) The problem is 
happening between mysql_query($query) and the mysql app. FYI, I'm 
running PHP 4.3.x (not sure which version, ATM), MySQL 4.0.14 and 
Apache 1.x under Mac OS X. I could dig out the exact versions, this is 
just a testing box that is quite reliable so I'm not real concerned 
with those kinds of things.

And before you guys tell me I should save my files in the filesystem, 
I'm very aware of how that works but I'd rather not do it for various 
reasons. I'm trying to solve this problem of long queries failing. If I 
can't solve it, I'll look into other options to do what I need to do.

Thanks!

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP's MySQL Query Length Limit? (Long SQL failing!)

2003-12-11 Thread Galen
Yes, it's the max_allowed_packet size!

I already saw that variable and assumed it was related to packet length 
- as in TCP/IP packet length - not query length.

It's all working now. Thanks!

-Galen

On Dec 11, 2003, at 2:36 AM, Rich Gray wrote:

I have a script that accepts large files (images) and inserts them 
into
a MySQL table. The images are manipulated and whatnot, no problems at
all getting the image into a string and running addslashes() on it.
Then I go and use it with a mysql query. This is something I've coded
dozens of times, but now there's a twist. The files are bigger than
I've ever worked with. In theory, I didn't think there would be a
problem, but there is. When I try in insert a file of about 800K or
larger (9-10 MB is as large as I ever try to insert) the insert fails.
The query is written correctly AKAIK, but no data reaches the table 
I'm
writing to.

[chop]

Hi Galen

I'd hazard a guess that it is probably your MySQL server settings that 
are
cause of the problem - in particular check the max_allowed_packet_size 
(?? -
you'll probably need to check this name as I haven't any docs to hand 
at the
moment) setting in your my.ini file...

HTH
Cheers
Rich



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Palm OS Processor

2003-12-11 Thread Galen
I would love one of these too! PHP programming in my pocket! And how 
about a mini database for Palm OS also? (SQLite?)

Anybody know anything more about this?

I'm not finding much with Google that seems relevant for PHP running on 
the Palm.

-Galen

On Dec 11, 2003, at 7:47 AM, Stephen Craton wrote:

Hello,

I was just wondering if there were such a program for Palm OS 4.1 that 
processes PHP code. Just wondering so that I can maybe make some 
complex calculator functions on it and use it for school work or 
whatever else may come my way. Thanks!

Stephen Craton
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Palm OS Processor

2003-12-11 Thread Galen
If I'm not mistaken, I would need to do a bunch of re-writing of PHP to 
get it to compile for the Palm, and I'd probably need to write a front 
end of some type. I'm not that kind of programmer, but I could deal 
with compiling from source myself if it were that simple. Thoughts? 
Comments? Anybody want to help start "palm-php" on sourceforge? (I'm 
half joking about the last thing, but I am also half serious - anybody 
interested?)

As far as the Sharp Zaurus, yes, I have looked into it. Linux in the 
pocket is pretty appealing. But the Palm is much more ubiquitous and 
available in more forms (many sizes of pdas, cell phones, even watches 
now), so php for the Palm would be more useful. Plus, they already have 
source and binaries of php, apache, etc for the Zaurus, but not for the 
Palm, at least that I can find.

Any other ideas?

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Lexical PHP stuff? (Thesaurus and similar)

2003-12-11 Thread Galen
I'm looking for information on lexical databases and PHP. Specifically, 
I want to be able to use a lexical database efficiently with PHP.

I've found this:
http://www.foxsurfer.com/wordnet/
It allows PHP to access WordNet. The biggest problem I see with it is 
that it requires GD functions not be enabled, which I use all over my 
site. Secondly, it only supports an older version of WordNet (as  far 
as I can tell). These two limitations, especially the first, tend to 
make this a poor choice for me.

Does anybody know anything about this?

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP & QuickBooks Integration

2004-01-20 Thread Galen
I am looking into the possibilities of exporting data from QuickBooks 
into PHP for use with a SQL database. Getting data back into QuickBooks 
would be even better, some kind of integration. Anybody ever done this? 
Anyone even got any experience working with QuickBooks data, back and 
fourth?

All suggestions are welcome, I hear this can be a tough topic.

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question about array limits & practicallity

2004-01-21 Thread Galen
Considering all this, a few ideas for you.

1) Store all questions in a MySQL table. Maybe add a column for "test 
number" or something so it can handle all the questions necessary for 
several tests. When generating the test, load everything into an array 
and create the test from that array. Be sure to be ready to stash that 
array in the next table I'm going to talk about.

2) Add another table and store student information. Store test number, 
identifying student data, and then use serialize to convert the array 
of questions into a string. Store that string in "text" or longer type 
field.

Using arrays will make your life easy here. serialize() and 
unserialize() are great functions. Work everything around arrays, that 
way it's easy to modify, sort, randomize, and generate data. MySQL is 
the best way to store data you are going to edit, but serialized arrays 
stored in MySQL are often many times easier (and sometimes faster) for 
lots of little, tiny settings or complex data sets.

I'm not the supreme expert on PHP here, but I've done a solid bit of 
coding with it and have learned a lot. I'm more into highly effective 
code than anything else - quick deployment, easy updating, flexible 
structure, reliable functionality.

Hope it helps.

On Jan 21, 2004, at 9:08 PM, Joe Harman wrote:

Thanks for your comments Chris and Rob... Chris you have great points 
to
make, my ears are wide open...

The reason I thought about storing the array in a blob is because every
test generated will be different. the 102 question test will be 
generate
randomly from a bank of 500 questions.. That means that the order of
questions will also be different... So I would like to find a way to
store that unique test for the student or administrator to review..

I do understand PHP & MySQL very well... But I am no master, that's why
I was asking... Any other ideas or recommendations for this... Words of
wisdom are also welcome :o)
So thanks for your input,
Joe
-Original Message-
From: Chris W [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 11:54 PM
To: Robert Cummings; PHP-General
Subject: Re: [PHP] Question about array limits & practicallity
Robert Cummings wrote:

Also can I store those arrays as a blob in MySQL?


You could, but you'd be better off storing them in normalized tables
IMHO.

In this cans I will have to strongly agree with Rob, but I also have to
add a few comments.
Why on earth would you store an array as a blob in a database!?  That's
like spending $10,000 on a new storage system to organize all the junk
in your garage, and then ripping out all the bins and shelves and
cabinet door and just dumping all your junk in there.  You might as 
well

just put it in some file on the hard drive.  If your using a database
and you don't know what normalization is or you don't know how to tell
if a database is normalized, STOP and drop everything till you learn 
the

basics or normalization.  I don't mean become an expert or anything, 
you

don't need to be able describe the intricacy of Boyc-Codd normal form
from memory, just learn enough to have a good grasp on everything up to
3rd normal form, which isn't all that hard.
Chris W

I'm waiting till tomorrow to respond on all the challenges to my last
post, so I can respond to all of them at once.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Threading & PHP

2004-01-24 Thread Galen
Hi,

This may be completely crazy, but let me tell you what I want to do: 
thread PHP.

My server is a dual-processor 2 GHz machine, and it's not very loaded. 
I have a few tasks that are huge and lengthy and would benefit from 
being placed in their own "thread" if you will. This would serve to 
either accelerate the process by splitting it among CPUs or allow the 
process to continue "in the background" for a few seconds after all 
pages have been loaded.

There are two areas where I'd use this:
1) To accelerate results in a relevancy ranking/fuzzy matching 
algorithm I have created, and although I've optimized the heck out of 
it, it can be slow when hundreds of thousands of items are thrown at 
it. It would be easy to split the array in half and run the algorithm 
on both halves, which would almost half processing time for returning 
results.

2) With image processing. When a user uploads an image to a few of my 
pages, the image is processed, re-compressed, and filed in the database 
or a file system. This can take several seconds, and I'd prefer that 
the user doesn't have to wait for the process to complete.

How might I be able to make some PHP code run as a "thread" that would 
serve these purposes?

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Threading & PHP

2004-01-25 Thread Galen
Interesting idea. I feel rather unintelligent for not thinking of that, 
but it would solve my second application for threading - big tasks I 
don't want the user to wait around to finish like image compression and 
storage. Excellent suggestion.

Unfortunately, my first application for threading won't work out very 
well here because a lot of data has to be handed back and fourth here, 
and it doesn't really improve response times when I am sorting or 
whatever. So now to look at the next replies

-Galen

On Jan 24, 2004, at 12:54 PM, Lucas Gonze wrote:

One possibility is to have the code which first receives the request 
split it up into subrequests and do HTTP requests for the subrequests. 
 Whether that makes sense depends on whether the overhead of an HTTP 
transaction is a big part of the execution time of the subrequests.

- Lucas

On Saturday, Jan 24, 2004, at 15:24 America/New_York, Galen wrote:

Hi,

This may be completely crazy, but let me tell you what I want to do: 
thread PHP.

My server is a dual-processor 2 GHz machine, and it's not very 
loaded. I have a few tasks that are huge and lengthy and would 
benefit from being placed in their own "thread" if you will. This 
would serve to either accelerate the process by splitting it among 
CPUs or allow the process to continue "in the background" for a few 
seconds after all pages have been loaded.

There are two areas where I'd use this:
1) To accelerate results in a relevancy ranking/fuzzy matching 
algorithm I have created, and although I've optimized the heck out of 
it, it can be slow when hundreds of thousands of items are thrown at 
it. It would be easy to split the array in half and run the algorithm 
on both halves, which would almost half processing time for returning 
results.

2) With image processing. When a user uploads an image to a few of my 
pages, the image is processed, re-compressed, and filed in the 
database or a file system. This can take several seconds, and I'd 
prefer that the user doesn't have to wait for the process to 
complete.

How might I be able to make some PHP code run as a "thread" that 
would serve these purposes?

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Threading & PHP

2004-01-25 Thread Galen
Looks great, except it's not setup on my remote host. I have SSH, FTP, 
etc access but I do not administrate the system nor can I request 
something like recompiling PHP just for me.

You can see for yourself:
http://zinkconsulting.com/phpinfo.php
Any other ideas?

-Galen

On Jan 24, 2004, at 12:19 PM, Evan Nemerson wrote:

php.net/pcntl
cvs.php.net/cvs.php/pecl/threads
On Saturday 24 January 2004 03:24 pm, Galen wrote:
Hi,

This may be completely crazy, but let me tell you what I want to do:
thread PHP.
My server is a dual-processor 2 GHz machine, and it's not very loaded.
I have a few tasks that are huge and lengthy and would benefit from
being placed in their own "thread" if you will. This would serve to
either accelerate the process by splitting it among CPUs or allow the
process to continue "in the background" for a few seconds after all
pages have been loaded.
There are two areas where I'd use this:
1) To accelerate results in a relevancy ranking/fuzzy matching
algorithm I have created, and although I've optimized the heck out of
it, it can be slow when hundreds of thousands of items are thrown at
it. It would be easy to split the array in half and run the algorithm
on both halves, which would almost half processing time for returning
results.
2) With image processing. When a user uploads an image to a few of my
pages, the image is processed, re-compressed, and filed in the 
database
or a file system. This can take several seconds, and I'd prefer that
the user doesn't have to wait for the process to complete.

How might I be able to make some PHP code run as a "thread" that would
serve these purposes?
-Galen
--
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Threading & PHP

2004-01-25 Thread Galen
Sorry, no-can-do. No root access - it's a lightly loaded shared 
machine. No Apache 2. Other ideas?

Full info at:
http://zinkconsulting.com/phpinfo.php
-Galen

On Jan 24, 2004, at 6:16 PM, Chris Shiflett wrote:

--- Galen <[EMAIL PROTECTED]> wrote:
This may be completely crazy, but let me tell you what I want to do:
thread PHP.
If you use PHP as an Apache module, you can use Apache 2, which has
threading. Just make sure any extension you use is thread-safe.
Chris

=
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Threading & PHP

2004-01-25 Thread Galen
I'm not 100% sure what you're talking about, to be honest. I think I'm 
in the second half of the people... :)

As far as I can tell, Apache runs as many processes (httpd) as needed 
on my local machine. As far as my server, I haven't seen this behavior, 
but I admit I don't sit there watching top all the time unless 
something is broken, and even then, I usually can't fix whatever is 
broken. I don't have root or other special access to the server - it's 
a shared machine, pretty lightly loaded most of the time. I do have SSH 
access.

I think you might be talking about scalability of PHP. What I'm looking 
for is the ability to take a single task that generates or is initiated 
by a single page - such as an extremely complex sort/ranking task or 
complex image resizing, thumbnail generation, compression, and storage.

If I'm way off base with my comments, please correct me. I am still 
seeking a solid way to get some sort of thread functionality working.

-Galen

On Jan 24, 2004, at 1:15 PM, Mark Charette wrote:

On Sat, 24 Jan 2004, Galen wrote:

Hi,

This may be completely crazy, but let me tell you what I want to do:
thread PHP.
Can you set processor affinity on your system? If so, you can "pseudo
thread" by assigning processes to different CPUs; e.g., run your main
Webserver on one processor and a slave Web server or helper processes
assigned to the other processor. This is a very common way of dividing
tasks on multi-processor systems where code-rewrites to make things
thread-safe are not cost effective.
 --
"Half the people know what they're talking about, and the
other half are writing code."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] What's faster? MySQL Queries or PHP Loops?

2004-09-08 Thread Galen
Almost all the time (unless the data being worked with is extremely, 
extremely large) PHP is much faster at manipulating data than MySQL. So 
if you already have the record set pulled out of MySQL, you probably 
want to go with PHP to manipulate it. Especially for repeating like 
this, there is zero reason to be querying MySQL excessively. Even if 
you have a huge chunk of data, I'd pull a big chunk of the records at a 
time and only query MySQL every 200 KB or something.

You still may want to check the performance (never a bad idea to find 
those slow parts of your code), so use a simple function like this to 
benchmark:


$time_start = microtime_float();
// Sleep for a while
usleep(100);
$time_end = microtime_float();
$time = $time_end - $time_start;
 echo "Did nothing in $time seconds\n";
?>
(from http://php.net/microtime )
-Galen
On Sep 8, 2004, at 8:22 AM, Robb Kerr wrote:
Here's the scenario...
First, my HTTP Server (Apache), PHP Server and MySQL Server are on the 
same
machine - an Apple Xserve.

Second, I've got a page with a long repeat region reflecting a 
recordset
queried out of a MySQL table. The region also displays information 
obtained
from fields in a related table.

Third, I use Dreamweaver to generate my MySQL recordsets and repeat
regions.
Here's the question...
I can either A) in the header or my page, generate a recordset of all 
of
the records in the related table and then loop through the recordset
creating an array of the fields I need and then later pull from it in 
the
repeat region... or B) take the six lines of code Dreamweaver 
generates to
create a recordset and move them into the repeat region itself. In 
other
words, I can create a recordset of all of the records in the related 
table,
loop through it generating a PHP array and pull from this array later 
OR I
can query the database every time through the loop while creating the
repeat region.

Since I haven't freed the table until the bottom of the page and 
because my
MySQL Sever and PHP Server reside on the same machine, will I really 
notice
a measurable difference in speed? If my MySQL Server were a different
machine, I'm sure that there would be a noticable difference because 
all of
the queries would be across a network (possibly the internet) and 
traffic
would become a factor.

Just wondering what other people have noticed.
--
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams

http://www.digitaliguana.com
http://www.cancerreallysucks.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Online Appointment Scheduler?

2004-10-23 Thread Galen
Hi PHP people,
I'm working on a web project involving a small medical office. One of 
the things that has been discussed is online appointment scheduling. 
Before I go out and gut myself on anything, is there any online 
appointment scheduling software that complies with HIPAA privacy 
requirements? (This is a U.S. thing)

I did some googling, but now that google searches the URL as well as 
the content of the page for your query, searches including "php" have 
become dramatically less useful. (.php, ?phpsessid, etc)

Thoughts or products/projects anybody?
-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Online Appointment Scheduler?

2004-10-23 Thread Galen
Hi PHP people,
I'm working on a web project involving a small medical office. One of 
the things that has been discussed is online appointment scheduling. 
Before I go out and gut myself on anything, is there any online 
appointment scheduling software that complies with HIPAA privacy 
requirements? (This is a U.S. thing)

I did some googling, but now that google searches the URL as well as 
the content of the page for your query, searches including "php" have 
become dramatically less useful. (.php, ?phpsessid, etc)

Thoughts or products/projects anybody?
-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Web-Chat Software

2004-04-13 Thread Galen
Hi PHP people,

I'm looking for PHP-based chat software. This is more of casual thing, 
otherwise I'd go out and write my own that works exactly the way I 
want, but I just don't have the time.

I've tried several packages, and every single one has very significant 
browser problems. The problems go on and on and on... which chat 
programs (don't forget to mention the version you're using) have 
"robust" web-based chatting interfaces? I'd rather not try all of the 
hundreds of packages out there on several different browsers to find 
out!

Also, this has gotta be PHP/MySQL only - no daemons please! The 
requirements are simple, so I don't need loads of complex stuff, 
simpler (interface-wise) is better here, but I most need something that 
plain works!

Thanks,
Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Web-Chat Software

2004-04-13 Thread Galen
Elfyn,

I've seen stuff like that. The problem comes in with the refreshing:

1) many browsers flicker when a refresh happens
2) refreshes must occur very frequently to make chat window feel 
"responsive"
3) frequent refreshes make window "flicker" annoyingly often on some 
browsers

I'm poking around looking for something with a little more advanced 
approach if possible. Anyone else got suggestions?

-Galen

On Apr 13, 2004, at 1:28 AM, Elfyn McBratney wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Galen,

On Tuesday 13 Apr 2004 07:12, Galen wrote:
Hi PHP people,

I'm looking for PHP-based chat software. This is more of casual thing,
otherwise I'd go out and write my own that works exactly the way I
want, but I just don't have the time.
I've tried several packages, and every single one has very significant
browser problems. The problems go on and on and on... which chat
programs (don't forget to mention the version you're using) have
"robust" web-based chatting interfaces? I'd rather not try all of the
hundreds of packages out there on several different browsers to find
out!
Also, this has gotta be PHP/MySQL only - no daemons please! The
requirements are simple, so I don't need loads of complex stuff,
simpler (interface-wise) is better here, but I most need something 
that
plain works!
I don't know of any 'mainstream' chat apps, but I have one I wrote for 
a
client (gpl licensed) that's ~800 lines and uses SQLite as a 
data-source
(would be simple to change to MySQL).  If you want it, let me know and 
I'll
put it up somewhere.

But this is simple: the client refreshes every variable number of 
seconds (say
1), uses basic html (font, bold, italics, etc) and a bit of browser 
detection
magic for frames and font depths.  Something you could probably write 
in an
hour ;)

Elfyn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Web-Chat Software

2004-04-13 Thread Galen
Hi,

You guys are all making some great suggestions. I think that javascript 
option (hidden frame) would work pretty well. I've done stuff like that 
on a project, though for a different purpose.

However, I'm not really looking to write my own chat software right 
now. Maybe I will if it's absolutely necessary, but if I have to, it'll 
be a while before I get around to it.

So to restate my question, how about pre-written software? Anyone got 
experience with it? Maybe any authors of it on this list? The problem 
I've seen with several of the packages is that the web browser 
performance is much less than optimal.

-Galen

On Apr 13, 2004, at 5:56 AM, Will wrote:

Hi,

I had a thought while reading the postings.
You could open a frameset with one frame a hundred% and the other *,
thus hiding the frame. The hidden frame could be the on checking the db
and then using JavaScript you could update the main window? I'm not to
up on JavaScript so I'd have to research it myself if I wanted to do 
it.
But within my knowledge it should be possible?

Will



I've stopped 2,419 spam messages. You can too!
One month FREE spam protection at http://www.cloudmark.com/spamnetsig/
-Original Message-
From: Galen [mailto:[EMAIL PROTECTED]
Sent: 13 April 2004 08:13
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Web-Chat Software
Hi PHP people,

I'm looking for PHP-based chat software. This is more of casual thing,
otherwise I'd go out and write my own that works exactly the way I
want, but I just don't have the time.
I've tried several packages, and every single one has very significant
browser problems. The problems go on and on and on... which chat
programs (don't forget to mention the version you're using) have
"robust" web-based chatting interfaces? I'd rather not try all of the
hundreds of packages out there on several different browsers to find
out!
Also, this has gotta be PHP/MySQL only - no daemons please! The
requirements are simple, so I don't need loads of complex stuff,
simpler (interface-wise) is better here, but I most need something that
plain works!
Thanks,
Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] GD createpng and getting different png formats

2004-05-14 Thread Galen
IIRC, the goal of PNG is lossless output and it outputs that exactly 
with PHP. What you send is what you get out. When you're using GD, I 
suggest you make an 8 bit GD image resource, then make that into PNG. 
There are several functions dealing with converting bit depth and such, 
poke around the GD image reference section in the PHP manual.

Sorry if this is too vague, it's all off the top of my head but I think 
it will give you enough to go on.

-Galen

On May 14, 2004, at 3:05 PM, Sam Joseph wrote:

Hi all,

I've recently got the GD libraries set up and working with php and I 
have been resizing and reformating images to my hearts content.
One thing I notice however is that when I output png images they seem 
by default to come out in the larger size PNG32 format, as opposed to 
the lightweight PNG8 format that I would prefer.

I've checked the archives and googled and found no direct reference to 
this issue.

If anybody can tell me how to adjust the png output format php I'd be 
very grateful.  Although I have the feeling that this might well 
require hacking away at the gd source 

Thanks in advance.

CHEERS> SAM

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] GD createpng and getting different png formats

2004-05-14 Thread Galen
Sam,

OK, sorry, I only had a few moments before. Let's see if this points  
you in the right direction.

Basically, you can have "standard" 8-bit images ("color") and then  
"true" color images (24 bit). When you "create" the GD image resource,  
you use a function to do that. One such function is imagecreate() -  
this generates a palette based image that (IIRC, 8 bit or less) will  
compress to that smaller PNG 8 file. imagecreatetruecolor() typically  
makes full-depth ("true color") images that become PNG 24/32 and  
support transparency and everything. You may find  
imagetruecolortopalette() also of interest as it transforms a true  
color image into a palette based image.

So the distinction is this: true color = 32 bit (24 bit + alpha  
channel), palette based = exact number of colors + no alpha channel

I may be subtly wrong on a few of these smaller points, and please  
accept my apologies if I am, but the gist is that you need a  
palette-based image to get 8-bit PNGs!

-Galen

On May 14, 2004, at 4:27 PM, Sam Joseph wrote:

Hi Galen,

Many thanks for your reply.  I tried to find things in the php manual  
relating to bit depth, but I didn't find anything relevant:

http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF 
-8&oe=UTF-8&q=site:www%2Ephp%2Enet+bit+depth

I haven't read every single one of the image functions in detail, but  
I did look through them all, and at the moment I can't see anything  
that allows me to manipulate the bit depth.  The closest thing I can  
see is the imagecolorstotal function which returns the number of  
colors in the specified image's palette.

Apologies if I'm missing something obvious, but if anybody knows about  
a specific function that does this I'd be very interested to hear  
about it.

Many thanks in advance.

CHEERS> SAM

Galen wrote:

IIRC, the goal of PNG is lossless output and it outputs that exactly  
with PHP. What you send is what you get out. When you're using GD, I  
suggest you make an 8 bit GD image resource, then make that into PNG.  
There are several functions dealing with converting bit depth and  
such, poke around the GD image reference section in the PHP manual.

Sorry if this is too vague, it's all off the top of my head but I  
think it will give you enough to go on.

-Galen

On May 14, 2004, at 3:05 PM, Sam Joseph wrote:

Hi all,

I've recently got the GD libraries set up and working with php and I  
have been resizing and reformating images to my hearts content.
One thing I notice however is that when I output png images they  
seem by default to come out in the larger size PNG32 format, as  
opposed to the lightweight PNG8 format that I would prefer.

I've checked the archives and googled and found no direct reference  
to this issue.

If anybody can tell me how to adjust the png output format php I'd  
be very grateful.  Although I have the feeling that this might well  
require hacking away at the gd source 

Thanks in advance.

CHEERS> SAM

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] GD createpng and getting different png formats

2004-05-15 Thread Galen
Sam,
File size totally depends on what you're working with. For text and 
graphics, PNG is significantly smaller than JPEGs that have quality 
settings anywhere near close to looking similar. For other things, it's 
tricky.

Certainly, reducing the number of colors is a good way to cut file 
size. If you're really picky about this, you could use exec() and call 
the pngcrush binary for your pngs (though this will slow the process 
down enough to not be a good idea if you're running it in real time). 
Depending on many factors, pngcrush can often yield a 5-25% reduction 
in file size with zero quality loss.

Also, I'm not sure what you're actually compressing, but turning off 
antialiasing will cut the number of colors required by a lot 
(automatically saving space) and eliminate all the excess edge detail 
(also saving a bunch). If you're compositing the image in real time 
(i.e. image + text) try cutting the colors on each one individually 
(before compositing) and you may be able to use fewer colors (i.e. make 
the antialiased text be only 3-4 colors but allow the image to retain 
more quality).

You might also like using imagemagick (in the command line) and working 
with things there. I haven't yet found enough of a need for it to play 
with it yet, but I would bet you could do all sorts of things that 
might help file size (better color reduction, etc) and it doesn't look 
too tricky.

Good luck!
-Galen
On May 14, 2004, at 7:37 PM, Sam Joseph wrote:
Hi Galen,
Thanks for that - all sorted now.  I had looked at 
imagetruecolortopalette, but had not taken it on board.  I'm now using 
it as follows to get a balance between image quality and file size 
(for png output):

imagetruecolortopalette ( $myImage, true, 64);
It's just remarkable how much better quality I can get for a given 
size with jpeg as opposed to png - but then I'm unable to use jpeg for 
my current application.

Many, many thanks for your help.
CHEERS> SAM
Galen wrote:
Sam,
OK, sorry, I only had a few moments before. Let's see if this points  
you in the right direction.

Basically, you can have "standard" 8-bit images ("color") and then  
"true" color images (24 bit). When you "create" the GD image 
resource,  you use a function to do that. One such function is 
imagecreate() -  this generates a palette based image that (IIRC, 8 
bit or less) will  compress to that smaller PNG 8 file. 
imagecreatetruecolor() typically  makes full-depth ("true color") 
images that become PNG 24/32 and  support transparency and 
everything. You may find  imagetruecolortopalette() also of interest 
as it transforms a true  color image into a palette based image.

So the distinction is this: true color = 32 bit (24 bit + alpha  
channel), palette based = exact number of colors + no alpha channel

I may be subtly wrong on a few of these smaller points, and please  
accept my apologies if I am, but the gist is that you need a  
palette-based image to get 8-bit PNGs!

-Galen
On May 14, 2004, at 4:27 PM, Sam Joseph wrote:
Hi Galen,
Many thanks for your reply.  I tried to find things in the php 
manual  relating to bit depth, but I didn't find anything relevant:

http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF 
-8&oe=UTF-8&q=site:www%2Ephp%2Enet+bit+depth

I haven't read every single one of the image functions in detail, 
but  I did look through them all, and at the moment I can't see 
anything  that allows me to manipulate the bit depth.  The closest 
thing I can  see is the imagecolorstotal function which returns the 
number of  colors in the specified image's palette.

Apologies if I'm missing something obvious, but if anybody knows 
about  a specific function that does this I'd be very interested to 
hear  about it.

Many thanks in advance.
CHEERS> SAM
Galen wrote:
IIRC, the goal of PNG is lossless output and it outputs that 
exactly  with PHP. What you send is what you get out. When you're 
using GD, I  suggest you make an 8 bit GD image resource, then make 
that into PNG.  There are several functions dealing with converting 
bit depth and  such, poke around the GD image reference section in 
the PHP manual.

Sorry if this is too vague, it's all off the top of my head but I  
think it will give you enough to go on.

-Galen
On May 14, 2004, at 3:05 PM, Sam Joseph wrote:
Hi all,
I've recently got the GD libraries set up and working with php and 
I  have been resizing and reformating images to my hearts content.
One thing I notice however is that when I output png images they  
seem by default to come out in the larger size PNG32 format, as  
opposed to the lightweight PNG8 format that I would prefer.

I've checked the archives and googled and found no direct 
reference  to this issue.

If anybody can tell me how to adjust the png output format php I'd 
 

Re: [PHP] ColdFusion / SQL > PHP / mySQL HELP!

2004-05-30 Thread Galen
Yeah, I'd say it's completely hopeless in a week. PHP is a totally 
different language than ColdFusion. SQL and MySQL may be different. The 
databases alone, as others have mentioned, could easily be a week even 
if you're experienced. Moving BOTH databases and scripting languages 
will probably mean you have to more reimplement, not just duplicate 
exact. Certain features may exist in your current database and not in 
MySQL, making it impossible to port your database as-is and requiring 
massively more function.

If you really want this thing done and don't know what you're doing, 
try giving yourself 6 months. Or more. And a very long read through the 
PHP and MySQL documentation. And lots of posts to the php list when you 
can't figure things out.

You could also try outsourcing your code. If ALL you want is an exact 
copy in PHP, I bet there are plenty off off-shore (well, off the U.S. 
shore) companies willing to do it for a very reasonable rate. I can't 
speak for their design and how easy the code will be to work with, but 
that would be the way to do it fast and cheap (well, relatively cheap). 
But it better be important, because I bet it would be massively cheaper 
to buy another ColdFusion license than to try and re-implement 
ColdFusion in PHP on this scale!

Please post back here and let us know what happened with this. I'm 
guessing you posted feeling pretty freaked out after your boss pushed 
you to do this. Or perhaps you just thought that ColdFusion and PHP 
were very similar and there was some kind of converter or easy process, 
like going from GIF to PNG or something. Unfortunately, that's just not 
the case. If you come back and ask smaller, more specific questions, 
preferably somewhat pre-researched (just spend 3 minutes googling), we 
can help and we promise not to group-lynch you :)

-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP & User Interface

2004-06-05 Thread Galen
I've been working with PHP for a few years now. I like doing the "real" 
programming that really does something, but I find I'm wasting a great 
deal of time working with UI via HTML.

Are there any setups (classes, functions, etc) for PHP that drastically 
streamline working with the UI? Especially form-related things, it's 
really annoying to deal with. Also security is another concern, having 
to double check that the contents of the form submit (i.e. menu) are 
valid and include what you handed out in the first place can be very 
obnoxious! I know I could code something to accelerate this process, 
but before I look at doing this (and spend hours upon hours doing it), 
I want to check and see that nothing else is already out there.

Thoughts anybody?
-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help installing imagick

2004-06-06 Thread Galen
Hey, I hope I'm not stating the obvious, but last time I used 
ImageMagick (5.5.7 - in my receipts folder, I just checked) for use 
with PHP under Mac OS X, I just downloaded a package from 
http://entropy.ch/ and installed it and life was good. I think it's 
still up for download. No messing with tar or anything else - just 
simple, straightforward GUI installation.

Also, fink ( http://fink.sf.net/ ) can install ImageMagick for you. 
Personally, unless you have special needs, I would say to go for the 
.pkg installed from entropy.ch, but whatever works for you.

As far as the specific process you're working on, if you really want 
_that_ installation, somebody else will have to tell you how to make it 
work. I don't know the specific process off hand.

-Galen
On Jun 6, 2004, at 5:03 PM, Robert Duran wrote:
PHP 4.3.6
Image Magick 5.5.7
imagick 0.9.10
OS: Mac OS X (10.3.4)
  I'm trying to install imagick so that I can use ImageMagick 
functions in PHP.  I was using GD, but I need to load images from TIFF 
and write thumbnails in jpeg with added text.  I had it all working 
with jpegs, but got stumped on reading in full sized TIFF images with 
GD.

  I've been using PHP 4.3.6 for a while and have successfully worked 
with GD and installed a module for openbase support.   I'm totally 
stumped with imagick however.  It seems I just can't get PHP to 
recognize that the imagick module is installed.
  The installation instructions include:

1) make sure the path to Magick-config (the ImageMagick configuration
   script) is in your PATH environment variable
2) cd /usr/src/php/ext
3) untar the imagick tar
4) if the directory created is anything other then imagick, rename it 
to
   imagick
5) cd /usr/src/php/ext/imagick
6) phpize
7) cd /usr/src/php
8) rm ./configure
9) ./buildconf
10) run configure as you normally would and add --with-imagick
If Imagemagick is installed in a non standard dir, add this dir to 
--with-im
agick=dir
If you want GraphicsMagick instead of ImageMagick as backend, add 
--with-ima
gick-gm
11) make
12) make install

  When I go thru these steps, phpinfo shows no reference to imagick.  
Yes, I used --with-imagick and tried --with-imagick= as well.
  I've noticed when I rebuild the configure file, there is no 
reference in it for imagick.  Conversely, there ARE references for my 
openbase module, so I am assuming the problem is in the module 
installation itself (i.e. telling php that the module exists).  Is 
that the job of phpize?

  Any help would be appreciated.
Robert
p.s. During the install process I never got errors, but did get a few 
warnings that look like they are just complaining about doing things 
the "old way":

./buildconf --force
Forcing buildconf
using default Zend directory
buildconf: checking installation...
buildconf: autoconf version 2.57 (ok)
buildconf: Your version of autoconf likely contains buggy cache code.
   Running cvsclean for you.
   To avoid this, install autoconf-2.13 and automake-1.5.
buildconf: libtool version 1.5 (ok)
rebuilding configure
rebuilding main/php_config.h.in
WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
WARNING: and `config.h.top', to define templates for `config.h.in'
WARNING: is deprecated and discouraged.
WARNING: Using the third argument of `AC_DEFINE' and
WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
WARNING: `acconfig.h':
WARNING:   AC_DEFINE([NEED_MAIN], 1,
WARNING: [Define if a function `main' is needed.])
WARNING: More sophisticated templates can also be produced, see the
WARNING: documentation.
-
Robert Duran
[EMAIL PROTECTED]
-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP + JPEG2000

2004-06-10 Thread Galen
I'm developing a photo gallery/store site. I am storing 
full-resolution, full-quality images on my server and generating (and 
caching) lower resolution thumbnails for previewing the images. As it 
stands, I accept PNG and JPEG images via the GD image functions. 
Typically, I upload PNG files, but if I happen to upload a JPEG file, 
it will be retained as a JPEG (to reduce space requirements - no reason 
to convert).

All of the above is working perfectly in PHP using GD image functions, 
including an automatic watermarking scheme.

PNG files typically offer a nice reduction in file size over 
uncompressed lossless files while not throwing away any image data. 
I've been relatively pleased with it, at least until I discovered 
JPEG2000 lossless. Completely lossless, just like PNG, but 1/3 smaller. 
That means 50% more images can fit in the same space. And considering 
that web space is quite valuable (especially when you're looking at 
storing hundreds, thousands, or more of several megapixel plus 
full-color images online at all times) this is a very significant thing 
to me.

So, has anybody worked with JPEG 2000 and PHP? I'm guessing ImageMagick 
is the program to use, does that support JPEG2000, and if so, does it 
work well and everything?

Also, there might be other formats out there that support lossless 
photo compression, any suggestions that would match/beat JPEG2000 and 
be usable with PHP? (I'm only going to be accessing the 
full-resolution, losslessly encoded images when a customer actually 
buys the image, so there is no need for extreme PHP integration or 
anything, just a decent way to archive and de-archive the images and, 
most important of all - save space!)

Suggestions and thoughts anybody?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Best Lossless Hi-Res Photo Storage with PHP

2004-06-11 Thread Galen
I'm working on a photo site and most of it is working. The intent is to 
store original high-resolution photos that will only be accessed when 
purchased, and then a variety of thumbnails that will be accessed when 
viewing. Because they're high-resolution, I need maximal image 
compression but I can't sacrifice image quality. With hundreds (or 
more) of many megapixel images, space requirements quickly soar.

I am currently using PNG, but that's not all that great for lossless 
photo compression. JPEG 2000 is significantly better in terms of file 
size, but I haven't ever used that with PHP (and it seems I'll have to 
use it via ImageMagick or something). Are there any other (free) 
formats for high image compression out there that I can use (maybe even 
just via the shell) with PHP?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Best Lossless Hi-Res Photo Storage with PHP

2004-06-13 Thread Galen
On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote:
well, there are formats that have impressed me. The Mpg-4 format
which requires plugins all over the place is really amazing, from 
e-vue.
They also provide a plugin atleast for IE to browse the images.

I dont know if you can compress images outside the windows platform
however.
That's a key problem. I don't touch Windows unless I have to, so I 
don't primarily run it at home and my servers _never_ run it, so this 
format is totally out of the running - I need to be able to 
compress/decompress on *nix based machines.

If your looking for supreme quality however, you would need to stay
away from the lossy formats and probably go for TIFF which is a great
format and is also supported by any major software. PNG however is
abit "strange", woudnt sendt PNG images to a publisher...
You could ZIP the TIF images on the HD to same space, you often
get good results on this. This would also make the downloads better
for the user, and since all the browsing online would use thumbnails 
you
dont need to waste CPU do depack the images, since you all users
can depack a ZIP file (thats the least you would expect from a user 
that
purchase a High resolution image).
I've experimented, PNG is notably better than ZIP for compressing image 
material. PNG retains 100% quality and offers the smallest file sizes 
around in a file that can be read by almost any system (i.e. all 
half-recent browsers, photoshop, most other graphics applications, 
etc). There's no reason I can't also offer a TIFF file, but I'll 
primarily route the user to the PNG file because it's simply the 
smallest download yet retains 100% quality and is a completely "free" 
format.

Ive created such systems myself, and my sollution was another :
Plug in a new harddrive. We save the images as jpg, tif, eps, ai or 
whatever
the original image was created as, and create thumbnails at various
resolutions in high compressed jpg for fast browsing. Often I tend to
ZIP the lossless images aswell, but then again I dont need to since HD 
isnt
a problem atleast in my case.

I have a similar system implemented with thumbnails and caching and all 
sorts of things. Works great. But hard drive space is a major concern, 
so I have to be more conservative with the hi-res versions.

Hope this helps.
Well, it's good to know that somebody else works with this sort of 
thing. Although I was really hoping to hear from someone who's worked 
with JPEG 2000 lossless (much higher than PNG image compression ratio!) 
via ImageMagick or something similar to that. Or perhaps any other 
interesting solutions people have come up with that beat PNG for 
compression. More thoughts anybody?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] help ???

2004-07-02 Thread Galen
On Jul 2, 2004, at 9:46 AM, Dannis Yang wrote:
Dear:
I wonder why my website runs smooth in PHP 4.1.1 but it does not in 
4.3.7.
 Dannis

Please go through and tell us more information! We can't help you 
otherwise!

At least tell us what your site does and define what "smooth" is and is 
not. And if you can possibly, please give us more than a sentence of 
detail.

-Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Size of Arrays

2004-01-30 Thread Galen
Should anyone be planning experiments or projects with large arrays, 
use a for() loop instead of a foreach() loop when working with your 
array. And be sure to count the array, stick that result into a 
variable, then compare against the variable instead of running the 
count() again.

On huge arrays (hundreds of thousands of elements, three dimensions, 
several megabytes) the performance impact is huge! The downside is 
you'll probably have to use numeric keys instead of associative, but 
for big arrays, numeric keys will probably also keep more memory free 
and improve performance a bit.

Good luck with your arrays!

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Selling PHP Code? PHP Careers?

2004-02-02 Thread Galen
Hi PHP list,

I seem to have a knack for really powerful, creative PHP code. With a 
little effort, I have yet to find any real limitations I cannot 
overcome with PHP/MySQL/PostgreSQL. Not that there aren't any, just 
that almost (emphasis on "almost") anything web related, I can do. I'm 
pretty confident I could develop things as complex as Amazon.com and 
eBay and perhaps even improve on them. At least that's what I like to 
think :)

I'm not the kind of person who likes to spend years on a project. I put 
lots of energy, creativity, and effort in, get an amazing result, then 
move onto something else. That's my tendency, although I can restrain 
myself a bit, especially if there is significant profit for me. 
Creative programming is my thing. I'm pretty good at graphic design 
(i.e. web page layouts) too...

I keep developing PHP-related ideas I want to pursue. Some of them are 
fully implemented, others partially, and many not at all. Already I've 
developed a powerful fuzzy search system that most programmers find 
very impressive. Others projects go all up and down the spectrum of 
possibilities.

I'm writing this to ask the collective "advice" of the php mailing 
list. As it stands, I'm a college student and working part-time on PHP 
development in Vancouver, Washington, USA. I've had excellent raises, 
now making over 60% more since September, but I'm probably not going to 
go much further in this small company. I'm thinking about other options 
- maybe self employment or going in with a business partner - or 
perhaps some more clear career paths.

Does anyone have suggestions for me? I'm especially interested in 
anyone self-employed or working with a business partner - something I'm 
seriously considering - or in some kind of start up company. What are 
your thoughts and feelings? Do you like it?

Feel free to reply off-list if you think this topic is off-topic and/or 
you don't want to blast your information to the whole world.

Thanks,
Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] how to conver a string to float

2004-02-07 Thread Galen
Look at:
exec()
Be careful if you don't control the input of course.

-Galen

On Feb 7, 2004, at 7:56 AM, Sebastian wrote:

Is there a possibility to convert a string like "10*500" (parsed from a
XML-File) to a float?
When i try to store this String in a float variable it only coverts 
the "10"
but nothing after the "*"-sign, but i need the result of this 
expresison...
Is there a function to calculate such string expressions?

Thanx...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: speeding up PHP

2004-02-10 Thread Galen
Yes, compression is key. Faster servers with HUGE internet connections 
serving COMPRESSED content make sites feel snappy. Look under 
microtime() in the php manual for an example that will benchmark how 
much time your page actually takes to produce... you'll probably find 
it incredibly small... like 0.02 seconds or something if it's a decent 
shared host like mine. The rest is compression (reduces data transfer), 
page complexity (simpler HTML shows up faster, fewer images make the 
page load faster), and internet latency/bandwidth (fast, fat pipes are 
way better than a site hosted off DSL - latency in packet delievery 
alone could cost 1/2 second in some situations).

So before you look into PHP accelerators, benchmark your code. It's not 
likely your PHP, it's more likely your too complex HTML and/or no 
compression and/or a slow (either bandwidth or latency) internet 
connection.

Even 1/4 second script parsing feels peppy with a big, low-latency 
pipe, simple HTML formatting, and on-the-fly compression. Just look at 
Google.

-Galen

On Feb 10, 2004, at 5:46 AM, Manuel Lemos wrote:

Hello,

On 02/09/2004 11:36 PM, Merlin wrote:
I do have a performance question regarding php processing. There are 
some sites on the net like google, heise and others which are 
incredible fast in response time. Of course companies like google are 
running totally other systems, but there are smaller sites and 
companies doing almost the same verry fast page delivery.
Now I am wondering how this is possible on a LAMP application. My 
site is not slow, but also not fast. I was reading about php 
accellerator. Can anybody recommend this tool, is it complicated to 
install and configure? Are there any speed gains and are ther tools 
to messure the page delivery times?
Most details about Google and other sites speed do not have much to do 
the actual code that generates the pages. For instance, they use 
distributed data centers and DNS around the world to make the servers 
that you actually access be closer to you and start serving pages 
sooner.

They also use compressed pages to reduce the actual size of the 
information that is transferred. You can use compression of pages in 
PHP too, but in my experience it is much simpler to use a module of 
your Web server that does that job transparently, like for instance 
mod_gzip for Apache.

Search engines also do not use SQL databases. Usually they just lookup 
static indexes to speedup lookup.

Sites like Google also avoid using many images. Images can make a site 
look nicer but they are often irrelevant and retard the site loading.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Unique ID - again

2004-02-12 Thread Galen
MySQL (or another SQL database) is the answer. You can check for an 
existing OR use it's auto_increment or whatever else you like.

Create a field to track all this stuff. There is no other way to 
guarantee that an ID is unique than to check it against existing. 
"Random" functions yield random results, so each time, there is ALWAYS 
a chance of a number being repeated. Microtime works pretty well, but 
there is STILL a chance two people could have a transaction at the same 
time. Yes, the odds can be insanely, insanely small for various 
functions (i.e. MD5) but as you shorten the length of your number, the 
odds get higher.

And yes, it's important to realize that a 6 digit unique identifier is 
limited to 1 million possible combinations, not nearly enough for most 
banks.

I might suggest you do some more PHP learning before you go and develop 
an online bank application - this stuff is pretty fundamental 
programming and database concepts. If your overall skill level isn't 
very high, you're likely to make mistakes, and either have errors, 
problems in functionality, or, worse, security problems.

-Galen

On Feb 12, 2004, at 3:00 AM, Alex wrote:

Hi folks,
I'm using usual md5(microtime()); to create IDs, but now I've 
encountered a
problem with that. I need to create explicitly 6 digit unique
number(decimal). Yes, I know I can use for/while loop to fill a string 
with
digits, but is it ABSOLUTELY sure that the random will never return 
same
number when seed is microtime()? It is very important as the number 
will
identify a bank transfer...

Is there any other way than checking with all previous IDs? Or some 
MySQL
function to do this for me?

thank you
Alex
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Advanced PHP Mailing List?

2004-03-05 Thread Galen
Hi,

Don't mind if I ask this, but are there any other large PHP mailing 
lists out there that target the mid to high range of PHP development?

This list is great, and incredible for beginners, but a large portion 
of it is stuff like "what's broken with this code" (simple typo) and 
"how do I write SQL" and discussing plain weird problems, often due to 
pretty simple user error. Really, this is very important to the 
community for this kind of zero-prerequisite list to exist. But I'm 
wondering if there are more complex lists where I might at least start 
just listening and see what's going on. I would like to hear about very 
complex, high-end PHP coding and techniques and perhaps interact a 
little too.

Anyone got suggestions? Anyone else have the same interest?

Feel free to reply off-list if you don't think this is on-topic.

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Let's start a php-advanced list!

2004-03-05 Thread Galen
From my earlier post, I've had a number of people email me, on and off 
list, that there isn't much in the way of an "advanced" php mailing 
list. It also sounds like at least a few people are quite interested in 
the possibility.

Who runs the php official mailing lists? Can we ask them to start a 
php-advanced list? Give it a description like "Ready to take you coding 
to the next level? Got questions about high-level PHP code? This is the 
list for you." Redirect people asking questions like "What is SQL" and 
"What's wrong with this code" or "How do I " (which 
a search in the manual would have found the function to do this) to the 
php-general list. That would leave our group free to discuss meaty 
things and really get somewhere.

Anybody else interested in this type of list?

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Let's start a php-advanced list!

2004-03-06 Thread Galen
Hello All,

You do make some excellent points. Maybe an advanced list isn't the 
greatest idea. But at least listen to what I had envisioned:

My goal was to provide an area that fosters stretching PHP. Big 
projects, unusual projects, weird hacks... all kinds of advanced stuff. 
I have thought that providing an "advanced" area might make people more 
likely to post stuff like "Look at this..." and provide some intriguing 
discussion and such. Not that it's impossible with php-general, but 
reading 150 posts (or at least the subject) makes it easy for that type 
of thing to get lost.

Obviously, the community doesn't think this is a good idea, and I do 
see validity in many of your points, so I'll drop this topic unless 
someone else wants to pursue it.

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] e - comerce website

2004-03-17 Thread Galen
You have a major challenge. First, I notice you don't seem to speak 
English natively. I don't know how well you comprehend English (this 
varies from person to person) but you might see if there's a PHP manual 
in your native language. It might help.

Second, you don't seem to know all that much and one week is not very 
long to learn PHP and whip out an ecommerce product.

Third, you gotta gotta gotta ask questions! We can answer questions, 
but we can't do it for you.

Sorry, but you can't come crying to us. You can, however, ask how to do 
a _specific_ task. What exactly are you having trouble with regarding 
sessions? We _can_ and _do_ help people when they ask something in 
specific. If you want a tutorial on building a simple ecommerce site, 
Google for one. I bet you'll find several good ones.

Good luck!

-Galen

On Mar 15, 2004, at 6:07 PM, [EMAIL PROTECTED] wrote:

Hai..
I have a homework from my scholl. We must make a simple website of e - 
comerce
use php. I just still confuse to use the session in this work. And I 
must make
a different page for a administrator that have a full access and a 
just user.
But I still don't know how to make it. There is an order and a 
checkout if we
want to leave the website.
Please help me, I just have time 1 week to finish it.

Warm regards:
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Domain & Sub-domain Handling with PHP

2004-03-23 Thread Galen
Hi,

I've done loads and loads with PHP and MySQL and stuff like that... but 
never had to really deal with actually creating new domains and 
subdomains with PHP. Especially with subdomains, I've seen lots of 
sites create subdomains automatically.

What is the "best" technique for doing all this (if there is one)? I'm 
sure I could hack something together (I always have) but I'd really 
like the "best" way - cleanest, fastest, whatever the technique may be.

Thanks,
Galen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Domain & Sub-domain Handling with PHP

2004-03-23 Thread Galen
Yeah, I'm aware PHP doesn't do DNS stuff, at least not directly. But I 
am curious as to how people handle subdomains. The 404 error seems like 
an interesting option, how does anyone else handle this?

-Galen

On Mar 23, 2004, at 10:58 AM, Justin Patrin wrote:

Galen wrote:

Hi,
I've done loads and loads with PHP and MySQL and stuff like that... 
but never had to really deal with actually creating new domains and 
subdomains with PHP. Especially with subdomains, I've seen lots of 
sites create subdomains automatically.
What is the "best" technique for doing all this (if there is one)? 
I'm sure I could hack something together (I always have) but I'd 
really like the "best" way - cleanest, fastest, whatever the 
technique may be.
Thanks,
Galen
You're confusing a couple of concepts I think. PHP cannot create 
subdomains and such (unless you alter your DNS records with PHP, but I 
don't think that's what you're talking about.)

Some other people have suggested having your DNS set up to resolve all 
sub-domains to your main web server, then using a custom 404 script 
(or index on the site) to look at the requested URL and redirect 
accordingly.

--
paperCrane 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] slow script

2004-03-27 Thread Galen
Gustavo,

1) Read the manual - though I can understand how you might have missed 
this:
http://us2.php.net/manual/en/function.microtime.php

Basically, there's a function based on microtime that does 
benchmarking. This is vital to timing your script. Use it extensively. 
If you're not sure where to start, break your script into chunks and 
figure out where most of your time is being spent.

2) Evaluate where time is being spent. If it's on database-access-bound 
portions, not a lot you can do from the PHP-end.

3) Evaluate the remainder of your code. In many tight loops (many 
iterations, not a lot of actual processing per iteration), particularly 
those modifying arrays, I get much better performance using while() or 
for() loops instead of foreach() generally. Obviously, this isn't 
always applicable, but I have found few ways to optimize GD image 
manipulations while I've found plenty for tight loops, so I'm only 
giving you suggestions on what I know.

4) Consider some overall performance enhancing stuff. Like the Zend 
Optimizer (free) which can sometimes help a lot, sometimes not at all. 
Also I'd say turckmmcache or something like that, but I'm pretty sure 
there's no Windows 98 version.

5) Evaluate your code. 160 KB (kilobytes, I'm assuming) is a pretty 
huge amount of PHP code for data replication. I hope that lots of it is 
content-type things and not all PHP commands, otherwise I would guess 
(though I could be wrong - some applications are very complex) that you 
are not coding efficiently. Very few of my projects even approach 160 
KB of pure PHP, even things as massive as a complete online store 
creation and management application I developed not too long ago.

Good luck! Re-post to php-general if you have further questions!

-Galen

On Mar 27, 2004, at 1:43 PM, Luis Gustavo Faccioni Barcellos wrote:

Hi all.
I am developing a system using php 4.3.2 + apache 1.3.29. The db is a 
mssql msde (we’re going to mysql, but not yet due to some internal 
reasons). All things are running in a local, standalone station, 
because we had to use the app on line and off line states. The 
off-line one should have all stuff, so. It just connect to internet to 
send a data replication. The stations are windows 98.
The problem is: I have to run this stuff in small boxes, like some 
pentium 200mhz with 64-80mb ram, and in these machines the system is 
very slow. The html page takes about 70 seconds to be showed in the 
browser. I saw cpu and ram, and are all normal, even the mssql. Just 
the apache activity goes up to 70% cpu. We notice that while the php 
is running, anything happens and suddenly(after ~70 seconds) the page 
arises. Our php code is a kind of big, about 160kb, and the html is 
generated equally big. I am going to break the jscript stuff it in 
some small peaces, but will not help to much, I guess.
Well, if someboddy could point out me a way, a tip or a tool to 
discover what the script is doing while I am waiting its response, or 
just an ideia, I would really thank you.
Gustavo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Measurement Problem

2004-03-27 Thread Galen
How about a MySQL table, like you're saying, with the lengths?

Two columns: English and Metric.
Then just do a select metric where english = 6 1/8 (my pseudo-SQL) with 
MySQL and get the length. I suspect there are only a limited number of 
standard lengths and this would work nicely.

You could also do a standard mathematical metric-english conversion and 
then round to the nearest five. That might do the trick also, it would 
require less data input but there is the slight chance (you'd have to 
check examples) that you'll find some instance in which it produces the 
incorrect number. The trickier part will be going in the opposite 
direction, although that too is manageable.

Good luck!

-Galen

On Mar 27, 2004, at 6:55 PM, Karl Timmermann wrote:

Hi,

I am working on a PHP/MySQL solution to have a webpage where users can 
rate cigars. I ran into a problem though. One variable that exists is 
the length of the cigar. In the cigar world, the lengths are usually 
written like 6 1/8" or 155 mm or 4 15/16" or 125 mm. I don't want to 
make the length column in the database be a string with data like "6 
1/8"" in it, because as the user submits cigars, different users could 
type it a different way, screwing up searches that are searching by 
length. I also want to have a real time metric conversion as well.

So my question is, how should I do this? Should I have a float column 
with the lengths as mm and it converts it to inches? If so, then how 
would I convert 155.57500mm to 6 1/8", or 155mm to 6 1/8". It's hard 
to explain, but I can't come up with a good solution. Please ask if 
you need clarification.

Any help is much appreciated!

Thanks!
Karl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: PHP Crypt on MacOSX

2004-10-26 Thread Galen
I use md5 all the time and OS X is my web development staging 
environment! I write and test all my scripts on OS X and then send off 
to the server. I don't use crypt, but I have never seen any problems 
going between the two. apache, php, mysql, rsync, ssh, scp, everything 
*nixy plus a nice interface makes OS X the ideal web development 
environment - at least for me.

Not only can MySQL do md5, there is an md5 function in php which I've 
used many times under OS X no problem:
http://us2.php.net/md5

If that wasn't enough, OS X ships with an md5 binary that's in the 
usual file path so typing "md5" in the command line will pull it up and 
"man md5" gives all the info you could need on using it. I don't 
encourage the use of the command line version of md5 for php because it 
will be slower than the built in php function, but it is there!

-Galen
On Oct 25, 2004, at 10:38 AM, Daniel Schierbeck wrote:
Kris wrote:
I recently moved a site to a MacOSX based Apache/PHP server.  
Apparently crypt only uses DES.  I read somewhere that "there is no 
way to get it use use MD5", which sounds hard to beleive considering 
the OS is BSD based.
So.. here is my dilema.. My db contains usernames and passwords.  The 
passwords are MD5 $1ljdslkjdsf$lkjdsaflkjdsf (created by crypt().)  
So on this new box, new accounts created get DES passwords.  I just 
as well prefer to not see any DES encryptions used in this db.
Any Mac OSX'ers in here that may have a solution?  All my users 
recreating new passwords for their account is not an option.
Thanks for any ideas,
Kris
Can't you just use the db's (i assume you use MySQL, most do) built-in 
MD5 function?

	SELECT id, username FROM users WHERE username LIKE 'myuser' AND 
password = MD5('mypass') LIMIT 1

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/register&r=6584

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Best method for threading?

2005-01-15 Thread Galen
I'm working on a web spider application where the server has 
considerable latency in serving the information I require, but 
simultaneous requests do not have a significant performance hit. I have 
a nice little class that handles all the sessions, cookies, etc 
perfectly. What's the best way to basically hand off a bunch of threads 
to access this information without hanging up the execution of my 
script? I plan to handle inter-thread coordination via MySQL and code 
in the main script. I've done threads before like this and have had 
great luck, but all my solutions have been hack-ish at best. What are 
the cleanest solution for this? What do you all do to handle situations 
like this?

I will be running PHP 4.3.1.0 under Linux and Mac OS X, depending on 
location.

Thoughts anybody?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Standalone PHP Client?

2003-06-20 Thread Galen P. Zink
I work for a small networking company. We're working on a piece of 
software that will be run server-side with PHP and MySQL. It allows the 
user to develop an online store and handles all the complex shopping 
cart stuff with ease. It is a port of an originally client-side 
application. We would like to be able to hand out demo discs that do 
not require the internet to try it out - having a standalone try-out 
version is a big source of customers.

Is there any kind of standalone PHP/MySQL engine that could be 
reasonably installed from a CD and run on most Windows machines? If 
there was some method to compile the PHP into a binary or otherwise 
protect it, it would be really good because our company would not be 
too excited about handing out the near-complete source to our product 
on all the demo discs. It would be nice if there was support for 
non-Windows OSes, but Windows is by far the majority in market share 
and the other OSes could easily just pop into an HTML document that 
directs them to our online version.

Thanks,

Galen P. Zink

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Standalone PHP Client?

2003-06-20 Thread Galen P. Zink
Well, having a solid product that people can look at offline has been a 
major selling point in the past. The customers we cater to appreciate a 
physical product. We could give them HTML that sends them online, but 
we could just as easily give them a card with an URL on it and not 
waste CD media for a 1K shortcut file. I can't confess to completely 
understand these people who really want a local product for something 
that must be uploaded to the internet in the end and is dependent on 
our servers to handle checkout and order processing - it's just a 
psychological thing, I guess.

I'm trying to investigate how hard it would be to get a demo product on 
a CD that basically goes through an installer process and installs some 
back end PHP/MySQL stuff so a demo can be run locally. What exactly 
would be involved in compiling a PHP client with the source myself - 
are there any existing products along these lines? It probably wouldn't 
be practical to develop a whole project our selves, but if there was 
something already out there, we might use it.

-Galen

On Friday, June 20, 2003, at 11:04 AM, Michael A Smith wrote:

Why not have them all do that? HTML that re-directs? Other than taking
the source, compiling yourself, or taking the pre-compiled windows
binaries and including them, that's the only way.
-Michael
On Fri, 2003-06-20 at 09:57, Galen P. Zink wrote:
I work for a small networking company. We're working on a piece of
software that will be run server-side with PHP and MySQL. It allows 
the
user to develop an online store and handles all the complex shopping
cart stuff with ease. It is a port of an originally client-side
application. We would like to be able to hand out demo discs that do
not require the internet to try it out - having a standalone try-out
version is a big source of customers.

Is there any kind of standalone PHP/MySQL engine that could be
reasonably installed from a CD and run on most Windows machines? If
there was some method to compile the PHP into a binary or otherwise
protect it, it would be really good because our company would not be
too excited about handing out the near-complete source to our product
on all the demo discs. It would be nice if there was support for
non-Windows OSes, but Windows is by far the majority in market share
and the other OSes could easily just pop into an HTML document that
directs them to our online version.
Thanks,

Galen P. Zink




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Standalone PHP Client?

2003-06-20 Thread Galen P. Zink
On Friday, June 20, 2003, at 11:42 AM, Brian V Bonini wrote:

On Fri, 2003-06-20 at 13:57, Galen P. Zink wrote:
I work for a small networking company. We're working on a piece of
software that will be run server-side with PHP and MySQL. It allows 
the
user to develop an online store and handles all the complex shopping
cart stuff with ease. It is a port of an originally client-side
application. We would like to be able to hand out demo discs that do
not require the internet to try it out - having a standalone try-out
version is a big source of customers.

Is there any kind of standalone PHP/MySQL engine that could be
reasonably installed from a CD and run on most Windows machines? If
there was some method to compile the PHP into a binary or otherwise
protect it, it would be really good because our company would not be
too excited about handing out the near-complete source to our product
on all the demo discs. It would be nice if there was support for
non-Windows OSes, but Windows is by far the majority in market share
and the other OSes could easily just pop into an HTML document that
directs them to our online version.


How about demoing the client app and saying there is also an on-line
version...??

Well, I wish that it was that easy, but although there are a lot of 
loyal users to our client version, it has *major* flaws. We're 
basically taking the existing functionality and wrapping it into a 
similar but correct GUI and fixing so many bugs and changing the 
interface at least enough to confuse the user. Also, we plan to 
eliminate the client side version for new users once the server side 
version is up. So basically, we can't.

-Galen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php