php-general Digest 4 Sep 2007 10:53:20 -0000 Issue 4999
Topics (messages 261661 through 261677):
Re: PHP Developer Required
261661 by: Robert Cummings
261662 by: Robert Cummings
261664 by: tedd
Re: Pragmatically changing a "Record Number"
261663 by: tedd
261665 by: brian
Re: amfphp
261666 by: Miles Thompson
can php5.2.3 support Java Integration?
261667 by: zebra yan
Dealing with auto-increment in MySQL
261668 by: Steve Finkelstein
261669 by: Chris
261671 by: Greg Donald
261672 by: Larry Garfield
261674 by: Per Jessen
261677 by: Jay Blanchard
Re: Create a matrix gallery
261670 by: Yamil Ortega
urldecode & header
261673 by: alexus
Re: Generating foldout menus in php
261675 by: Arno Kuhl
261676 by: Arno Kuhl
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Mon, 2007-09-03 at 13:47 -0400, mlists wrote:
> Wow!
>
> Spend $100K on a university degree in computer science, work
> successfully for five years with all the major technologies, and then
> get paid $25 per hour?
The poster didn't mention anything about being competent.
> My auto mechanic charges an average of $99 per hour.
>
> Sounds like a great deal for the university. Maybe the successful
> candidate can work off his student loans.
Well 100k is a bit high for a 4 year program. And then again it depends
on whether you had to move away from your parents to attend university.
If you live within commute range of your university then you can get
away with 20 to 30k expenses in Canada (depending on University). If you
have to cover rent then it's a different story :) That said, Toronto is
one of the most expensive cities in Canada in which to live. IMHO he
still thinks the tech sector is in a depression and developers with 5
years experience can be had for a pittance. What made me laugh was the
"4%" vacation pay. That's a legal requirement in Canada for full time
employment. Not a bonus.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On Mon, 2007-09-03 at 14:38 -0400, tedd wrote:
> At 1:47 PM -0400 9/3/07, mlists wrote:
> >Wow!
> >
> >Spend $100K on a university degree in computer science, work
> >successfully for five years with all the major technologies, and then
> >get paid $25 per hour?
>
> You can really get that much?
Please be joking.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
At 4:45 PM -0400 9/3/07, Robert Cummings wrote:
On Mon, 2007-09-03 at 14:38 -0400, tedd wrote:
At 1:47 PM -0400 9/3/07, mlists wrote:
>Wow!
>
>Spend $100K on a university degree in computer science, work
>successfully for five years with all the major technologies, and then
>get paid $25 per hour?
You can really get that much?
Please be joking.
Cheers,
Rob.
Rob:
I was joking, but I've worked for far less. Keep in mind that $25 per
hour is a bit above $50k per year (just double the hourly rate and
multiply by 1K).
In the last 20 years, my yearly income has varied considerably from
under $10k to over $300k. So, in the lean years, I would have jumped
at a $50k job and considered myself lucky.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 3:17 PM -0400 9/3/07, brian wrote:
tedd wrote:
As for the "gap" problem, there is no gap problem if you create
another field for record number and alter it to your liking (NOTE:
I did not say AUTO_INCREMENT). If you add/delete a record, then
adjust the "field for record number" accordingly. You don't have to
adjust the database's index to handle gaps.
Well, yes, that would work also but is horribly inefficient because
the *entire table* must be altered any time a row is deleted.
"horribly inefficient"?
Renumbering anything is pretty quick these days. To me, things that
are "horribly inefficient" are also slow. So, I don't agree. If I
remember correctly, I can even renumber a 100K item dB auto_increment
index in less than one second -- but I wouldn't recommend it. I think
that's pretty quick.
I don't see the problem here other than misunderstanding what's been said.
Well, not seperating data and presentation would be another problem,
IMO. What if the client decides that Roman notation is cooler? You
have to ask yourself what this 'counting column' is doing in your
database. Let PHP/Python/XSL/whatever take care of numbering the
rows.
brian
No one said that what was in the dB had to be presented in any form,
but I do have clients who have items in their dBs and want to see a
record number as they pursue their records -- it's only natural.
As for maintaining a record number in a dB I don't see any conflict
whatsoever in separating data and presentation. After all, what's in
your dB should be data and not presentation (however -- I have found
exceptions to this in practical situations when dealing with clients
-- they like adding <b> tags to their presentation via their CMS).
Presentation is made during presentation, obviously, by using css and
proper html and pulling data from your dB to assemble presentation.
If the client wants Roman notation, it's a simple process to provide
that. There is no "separating data and presentation" in this issue.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
tedd wrote:
At 3:17 PM -0400 9/3/07, brian wrote:
Well, yes, that would work also but is horribly inefficient because
the *entire table* must be altered any time a row is deleted.
"horribly inefficient"?
Renumbering anything is pretty quick these days. To me, things that are
"horribly inefficient" are also slow. So, I don't agree. If I remember
correctly, I can even renumber a 100K item dB auto_increment index in
less than one second -- but I wouldn't recommend it. I think that's
pretty quick.
It may be just fine in your case, but from a DB design standpoint it
most certainly is not efficient. Why re-order the entire table for
something like this? Altering an entire table because one row has been
deleted suggests to me that the schema needs to revisited.
Well, not seperating data and presentation would be another problem,
IMO. What if the client decides that Roman notation is cooler? You
have to ask yourself what this 'counting column' is doing in your
database. Let PHP/Python/XSL/whatever take care of numbering the rows.
No one said that what was in the dB had to be presented in any form, but
I do have clients who have items in their dBs and want to see a record
number as they pursue their records -- it's only natural.
But this column you're suggesting isn't a "record number" in the
ProductId, PLU, serial # sense, though, is it? One would certainly never
select for it, would they? A particular value would be only *very
tenuously* related to its row, and only until the next time some row is
deleted. So why store it in the row at all?
As for maintaining a record number in a dB I don't see any conflict
whatsoever in separating data and presentation. After all, what's in
your dB should be data and not presentation (however -- I have found
exceptions to this in practical situations when dealing with clients --
they like adding <b> tags to their presentation via their CMS).
It's not about confilcting anything and it's not a presentational issue
in the same sense as having HTML markup in some TEXT field. The issue is
that you want to store a column that is completely unnecessary save for
displaying it. It's a value that should be left to whatever mechanism it
is that's doing the displaying.
Presentation is made during presentation, obviously, by using css and
proper html and pulling data from your dB to assemble presentation. If
the client wants Roman notation, it's a simple process to provide that.
So now you want to rewrite your triggers to use Roman notation? I wasn't
aware that MySQL had such terrific Roman numeral math support.
There is no "separating data and presentation" in this issue.
I don't buy that. Doing it that way is attaching unnecessary
presentation-specific baggage to your data. The column is only as
relational as it was the last time it changed. That is, it was pointing
to a completely different record then. This isn't a "separating data and
presentation" issue?
brian
--- End Message ---
--- Begin Message ---
Nathan,
The web server, MySQL and PHP are all running on the web server. Localhost
is a default address for the MySQL host; to use another you will have to set
it up.
There's nothing wrong with localhost - fits right in with the web server /
PHP environment.
They are all running locally.
Not a v. good explanation I'm afraid, but hope it helps.
Miles Thompson
On 9/3/07, Nathan Wallis <[EMAIL PROTECTED]> wrote:
>
> Hey there,
>
>
>
> I am running amfphp on my webserver locally and it works well when I use
> localhost, so I change localhost to my computers local IP address which is
> 192.168.1.2 and then test it from another machine. Nothing happens, the
> remote procedure does not get called.
>
>
>
> Any ideas on this?
>
>
>
> Thanks,
>
>
>
> Nathan
>
>
--- End Message ---
--- Begin Message ---
Description:
------------
My php version is 5.2.3,apache version is 2.2.4,and my workstation is
Windows XP SP2. Now I want to configure php to support Java Integration.
My jdk version is jdk1.5.0.
Reproduce code:
---------------
My php.ini configuration for Java is:
extension=php_java.dll
[Java]
java.class.path = "D:\php5\ext\php_java.jar; C:\Program
Files\Java\jdk1.5.0\jre\lib;C:\Program Files\Java\jdk1.5.0;"
Java.home = "C:\Program Files\Java\jdk1.5.0\bin"
java.library = "C:\Program Files\Java\jdk1.5.0\jre\bin\server\jvm.dll"
java.library.path = "D:\php5\ext"
My test sample is :
<?
// get instance of Java class java.lang.System in PHP
$system = new Java('java.lang.System');
// demonstrate property access
echo 'Java version=' . $system->getProperty('java.version') . '<br
/>';
echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />';
echo 'OS=' . $system->getProperty('os.name') . ' ' .
$system->getProperty('os.version') . ' on ' .
$system->getProperty('os.arch') . ' <br />';
// java.util.Date example
$formatter = new Java('java.text.SimpleDateFormat',
"EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
echo $formatter->format(new Java('java.util.Date'));
?>
Expected result:
----------------
When I run the test sample,the apache httpd.exe occured an error and
the script doesn't run correctly.
------------------------------------------------------------------------
How can I do now ?? Please help me!
--- End Message ---
--- Begin Message ---
How're you folks dealing with records that are auto incremented in MySQL
after a delete is made? I've noticed the only way to get a sequential order
back is to truncate the table completely.
Do you use logic in your code to find a missing ID and insert new records
based on that? Or do you just ignore it, let mysql handle the numbering and
go on with your lives?
Just curious.
Thanks!
- sf
--- End Message ---
--- Begin Message ---
Steve Finkelstein wrote:
How're you folks dealing with records that are auto incremented in MySQL
after a delete is made? I've noticed the only way to get a sequential order
back is to truncate the table completely.
Do you use logic in your code to find a missing ID and insert new records
based on that? Or do you just ignore it, let mysql handle the numbering and
go on with your lives?
Don't touch the deleted id's. You don't need them.
If you re-order your id's, you're creating havoc (think of table "b"
referencing the first table - all the id's are screwed up there too).
What problem are you trying to solve?
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On Mon, Sep 03, 2007 at 11:53:22PM -0400, Steve Finkelstein wrote:
> How're you folks dealing with records that are auto incremented in MySQL
> after a delete is made? I've noticed the only way to get a sequential order
> back is to truncate the table completely.
Re-numbering is a bad idea for anything more than a simple database, you risk
breaking foreign keys relations.
> Do you use logic in your code to find a missing ID and insert new records
> based on that? Or do you just ignore it, let mysql handle the numbering and
> go on with your lives?
I can't see that it matters, especially if you use unsigned ints for maximum
range.
--
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/
--- End Message ---
--- Begin Message ---
On Monday 03 September 2007, Steve Finkelstein wrote:
> How're you folks dealing with records that are auto incremented in MySQL
> after a delete is made? I've noticed the only way to get a sequential order
> back is to truncate the table completely.
>
> Do you use logic in your code to find a missing ID and insert new records
> based on that? Or do you just ignore it, let mysql handle the numbering and
> go on with your lives?
>
> Just curious.
>
> Thanks!
>
> - sf
The whole point of a surrogate key is that it never changes, ever, and doesn't
have any intrinsic meaning in and of itself. If you want a unique ID that
has meaning, don't use auto-increment. It's an either/or question.
Auto-increment and don't worry about what the numbers are as long as they're
unique or do your own IDs that have some semantic meaning.
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
Steve Finkelstein wrote:
> Do you use logic in your code to find a missing ID and insert new
> records based on that? Or do you just ignore it, let mysql handle the
> numbering and go on with your lives?
The latter.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
[snip]
Do you use logic in your code to find a missing ID and insert new
records
based on that? Or do you just ignore it, let mysql handle the numbering
and
go on with your lives?
[/snip]
The answer is B. There is a long standing discussion on this right now.
--- End Message ---
--- Begin Message ---
> -----Mensaje original-----
> De: Stut [mailto:[EMAIL PROTECTED]
> Enviado el: Lunes, 03 de Septiembre de 2007 06:31 p.m.
> Para: Humani Power
> CC: [EMAIL PROTECTED]
> Asunto: Re: [PHP] Create a matrix gallery
>
> Humani Power wrote:
> > hi list. I wonder if anyone can help me with this.
> > i have a database with the file name of several images stored in a
> > filesystem, and I want to create a table containing the image results of
> a
> > query.
> >
> > this is my code
> >
> <snip>
> > while ($rows=mysql_fetch_assoc($getpic))
> > {
> > extract ($rows);
> > echo "<tr>";
> > echo "<td><a href=editing_image.php?pic=".$rows['image_id']."><img
> > src=".$ImageThumb.$rows['image_id'].".jpg></td>";
> > }
> <snip>
> > With this code, I am able to see the thumb images with their respective
> link
> > ok, but if I have a query with 40 results, I will have a big row of
> images.
> > ____________________________________________________
> >
> > |pic1 | pic2 | pic3 | pic4 | pic5 | pic6 | pic7 | pic8 | pic9 | pic10 |
> > ______________________________________________________
> >
> >
> > What I want to to do is insert a new <td> after showing 5 thumb images,
> and
> > continue with the next picture on the next row.
> > something like this
> > __________________________
> > |pic1 | pic2 | pic3 | pic4 | pic5 |
> > __________________________
> > |pic6 | pic7 | pic8 | pic9 | pic10 |
> > __________________________
> > |pic11 | pic12 | pic13 |
> > __________________
>
> This is really quite simple...
>
> $col = 1;
> while ($rows=mysql_fetch_assoc($getpic))
> {
> extract ($rows);
> if ($col == 1) echo "<tr>";
> echo "<td><a href=editing_image.php?pic=".$rows['image_id']."><img
> src=".$ImageThumb.$rows['image_id'].".jpg></td>";
> if ($col++ == 5)
> {
> echo "</tr>";
> $col = 1;
> }
> }
>
> Not sure why you are using extract when you then go on to use $rows as
> an array. Also, you're lacking quotes around the href in the link you
> output, and also the src in the image. It's also missing a closing </a>
> tag. And you should be using urlencode when putting values into a URL.
> And while I'm at it, $row is more semantically correct than $rows.
>
> Try this...
>
> $col = 1;
> while ($row = mysql_fetch_assoc($getpic))
> {
> if ($col == 1) echo '<tr>';
> $image_id = urlencode($row['image_id']);
> echo '<td><a
> href="editing_image.php?pic='.urlencode($image_id).'"><img
> src="'.$ImageThumb.urlencode($image_id).'.jpg" /></a></td>';
> if ($col++ == 5)
> {
> echo '</tr>';
> $col = 1;
> }
> }
>
> -Stut
>
> --
> http://stut.net/
--- End Message ---
--- Begin Message ---
hi
i was wondering if someone can give me a hand (i'm very new to php).
i have a form that user suppose to fill out that then get submitted to
index.php (current setup)
now what i need is another let's say index2.php that would take
everything from that form, rewrite one of the field and spits it back
to index.php
now, i dont know but as far as i know stuff that form spits out is
urlencoded, so i need to use urldecode function (
http://us.php.net/urldecode ) to decode and then header function (
http://us2.php.net/header ) to spit it back to index.php
now after all that i'm pretty much stuck here, i dont know how to do
it.. if someone can a spare a minute or two and write that code for me
i'd highly appreciate that.
thanks in advance
--
http://alexus.org/
--- End Message ---
--- Begin Message ---
> I'm looking for a way to generate dropdown/foldout menus (horizontal
> and
> vertical) on the fly, but all the javascript solutions I've seen use
> absolute or relative pixel positioning, which means I can't use them
> because I don't know at the time of generating a specific menu item
> how many pixels across or down the preceding items have already used.
> I'm currently using a javascript menu that works really well, but all
> the top-level menu items have to be preset with specific x-y pixel
> coordinates, and all the subsequent items are then relative to the
> top-level items. So I can generate the second-level and subsequent
> items on the fly but not the top-level items. Is there a way to use
> css or dhtml or something else (maybe something in javascript that I
missed) to do this?
Is this: http://www.phpguru.org/static/dynContext.example.html what you
mean?
--
Richard Heyes
--
Thanks for the reference Richard. dynContext looks pretty good and is
similar to what I'm already using, but it looks like it also uses x-y
coordinates for the top-level item (looking at the show() function, unless I
misunderstood the manual).
I had problems making it work on my local machine. The
annotated.example.html displayed an error code (I presume) on right click.
BTW I stumbled across cssplay in my search and think it may be the solution.
Just trying to figure if lack of support for IE5 is a problem or not
(supports IE5.5 etc and all other browsers).
Cheers
Arno
--- End Message ---
--- Begin Message ---
>This may not be directly php related but I'm hoping that generating the
>code with PHP will keep it on topic.
>
>I'm looking for a way to generate dropdown/foldout menus (horizontal
>and
>vertical) on the fly, but all the javascript solutions I've seen use
>absolute or relative pixel positioning, which means I can't use them
>because I don't know at the time of generating a specific menu item how
>many pixels across or down the preceding items have already used. I'm
>currently using a javascript menu that works really well, but all the
>top-level menu items have to be preset with specific x-y pixel
>coordinates, and all the subsequent items are then relative to the
>top-level items. So I can generate the second-level and subsequent
>items on the fly but not the top-level items. Is there a way to use css
>or dhtml or something else (maybe something in javascript that I missed) to
do this?
>
>Thanks
>Arno
Arno:
There's really no way to do this just using php. I can envision a way to use
php with a couple of other languages to provide drop-down and pop-out menus,
but that would be more complicated than just using css with js, like so:
http://sperling.com/examples/menuh/
http://sperling.com/examples/menuv/
Why complicate your life?
Cheers,
tedd
--
Hi tedd
Thanks, that's pretty much what I was looking for. I found something similar
at cssplay, except the examples I saw didn't use .htc file. Like your
examples the cssplay code only runs on IE5.5 and up (and other browsers).
Not sure yet if that would be a problem. I don't have IE5 to test with, so I
don't know if there's a graceful fallback that would still allow the user to
navigate. As you said, it doesn't look like there's a solution to fit all
browsers and versions.
Cheers
Arno
--- End Message ---