php-general Digest 6 Dec 2007 08:44:33 -0000 Issue 5166
Topics (messages 265479 through 265496):
Re: Array numeric key -> alpha key replacement
265479 by: scotdiddle.silverdarkroom.com
Re: Need a hint how to track an error
265480 by: Jochem Maas
zip codes and lat/longs
265481 by: tedd
265482 by: Bastien Koert
265483 by: mike
Professional inquiry for you freelancers
265484 by: Steve Finkelstein
265485 by: Jeremy Privett
265486 by: Paul Scott
265487 by: Nathan Nobbe
265488 by: tedd
Another form handling posting question
265489 by: Mike Smith
265490 by: Mike Smith
265491 by: Casey
265492 by: admin.buskirkgraphics.com
265493 by: admin.buskirkgraphics.com
265494 by: Casey
265495 by: jencisson.unicoco.com
shared memory access - shmod_open
265496 by: Rolf_
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 ---
Jochem,
Yes, that did the trick quite nicely.
As I said, I overlooked it... a function called array_combine did
not cause me to read the drill-down, because I figured it was for a
union of two arrays ( it is, kind of... ) and I wanted to replace key
values, not combine arrays : array_combine( (1,2,3,4), (5,6,7,8)) =
array(1,2,3,4,5,6,7,8) which is what the name of the function implies
is does, and which, for those of us who have read that portion of the
manual knows, is accomplished by array_merge.
Thanks for the help.
Scot
Quoting Jochem Maas <[EMAIL PROTECTED]>:
[EMAIL PROTECTED] wrote:
Quoting Jochem Maas <[EMAIL PROTECTED]>:
...
$newArray = array('FAF1', 'ODM1', /* bla bla bla */);
$inputArray = array_combine($newArray, $inputArray);
I guess reading through this page was too much trouble for you:
http://php.net/array
Jochem: Nope, not too much trouble... I tried to find what I was looking
for on http://php.net/array.
Sorry I was such a bother.
no bother, if everyone read the manual and found their answers there
who would
I vent my speel at?
I'll assume that array_combine() does the trick for you.
--- End Message ---
--- Begin Message ---
Al Rider wrote:
> The key word in my assertion "Make your code W3C compatible and it'll
> work on all modern browsers." is "modern". I've never had a browser
> incompatibly with IE7, Netscape browsers, etc.
very good. here in the real world IE6 still makes up a very significant number
of browser in daily use.
your assertion also doesn't cover CSS compatibility amonst 'modern'
browsers (note: the box model is still broken in IE7 with the added bonus
that the hacks that previously allowed people to work around it have been
'fixed')
validation is the first step to cross-browser capatibility not the last
and not the only, imho.
>
> The other thing I've been doing lately is to conform to XHTML 1.0
> strict. It's no significant extra effort and a good habit to develop
> good practice.
>
> Al...............
>
>
> Jochem Maas wrote:
>> Al wrote:
>>
>>> Install the Firefox extension "HTML Validator". It does a real time Tidy
>>> check for every page.
>>>
>>
>> good advice.
>>
>>
>>> Make your code W3C compatible and it'll work on all modern browsers.
>>>
>>
>> less good advice. I agree you should be doing everything to make your code
>> validate 100% BUT having 100% valid code doesn't garantee jack about it
>> working on all browsers.
>>
>> that said not having 100% validated HTML means you have nothing to
>> base anything on ... so the only sane option is to validate and then
>> work out any problems you have from that point.
>>
>> And Al does implie an important point, namely that most errors will indeed
>> never surface when your HTML validates.
>>
>>
>>> Ronald Wiplinger wrote:
>>>
>>>> My php program is working with Firefox, but not with Internet Explorer.
>>>>
>>>> I cannot see anything I did wrong, like forgotten " or > where Firefox
>>>> is more forgiving than IE.
>>>>
>>>> I used the error console from Firefox combined with a lynx output to see
>>>> what line it is.
>>>>
>>>> The error output in IE is:
>>>>
>>>> Line: 2
>>>> Char: 104
>>>> Error: Object doesn't support this property or method
>>>> Code: 0
>>>> URL: http://xxx.xxx.xx/mypage.php
>>>>
>>>>
>>>> In Firefox:
>>>> Line 225
>>>> Field has no properties
>>>> http://xxx.xxx.xx/mypage.php
>>>>
>>>>
>>>> Not even the same line!!! Line 114 ~ 250 is a long comment!
>>>>
>>>> Is there a tool to find the problem?
>>>>
>>>> bye
>>>>
>>>> Ronald
>>>>
>>>>
>>
>>
>>
--- End Message ---
--- Begin Message ---
Hi gang:
I'm entertaining how to determine what zip codes fall within a 50
mile radius of another zip code.
Anyone done this before?
Also, does anyone have any sources for zip codes and lat/long databases?
TIA for any help/suggestions.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
hate to say it,but there is lots on google like
http://www.code322.com/zipcode_locator.php
bastien> Date: Wed, 5 Dec 2007 20:58:52 -0500> To: [EMAIL PROTECTED]> From:
[EMAIL PROTECTED]> Subject: [PHP] zip codes and lat/longs> > Hi gang:> > I'm
entertaining how to determine what zip codes fall within a 50 > mile radius of
another zip code.> > Anyone done this before?> > Also, does anyone have any
sources for zip codes and lat/long databases?> > TIA for any help/suggestions.>
> Cheers,> > tedd> -- > -------> http://sperling.com http://ancientstones.com
http://earthstones.com> > -- > PHP General Mailing List (http://www.php.net/)>
To unsubscribe, visit: http://www.php.net/unsub.php>
_________________________________________________________________
Discover new ways to stay in touch with Windows Live! Visit the City @ Live
today!
http://getyourliveid.ca/?icid=LIVEIDENCA006
--- End Message ---
--- Begin Message ---
Here's code I had, but it recently stopped working
It takes the zip code for the user and the user you're viewing, looks
them up from the data table (z_data_zips) and does the calculation.
The formula is in a handful of places - I converted mine from a MySQL
example (I think, or vice versa)
You can get the zip code lat/long info from the Census Bureau
I believe this is where you get the file:
http://www.census.gov/geo/www/gazetteer/places2k.html
You want the "ZCTAs (ZIP Code Tabulation Areas): (33,233 records)"
file - the schema is at the bottom of the page.
Perhaps someone else might also find the error in my code below that's
changed and save me the time to figure out why it no longer works :)
(for all I know it could be a problem with MySQL result set too)
if($visitor['uid'] > 0) {
$uchk = db_query("SELECT up.country,uz.zip FROM user_profile
up LEFT JOIN user_zip uz ON uz.uid=up.uid WHERE up.uid=$visitor
[uid]");
if(db_numrows($uchk) == 1) {
list($vc,$vz) = db_rows($uchk);
$vz = intval($vz);
$user_zip = intval($user_zip);
$zchk1 = db_query("SELECT latitude,longitude
FROM z_data_zips WHERE zip=$user_zip");
list($ulat,$ulong) = db_rows($zchk1);
db_free($zchk1);
$zchk2 = db_query("SELECT latitude,longitude
FROM z_data_zips WHERE zip=$vz");
list($vlat,$vlong) = db_rows($zchk2);
db_free($zchk2);
$distance =
number_format(ceil(69*rad2deg(acos(sin(deg2rad($ulat)) *
sin(deg2rad($vlat)) + cos(deg2rad($ulat
)) * cos(deg2rad($vlat)) * cos(deg2rad($ulong - $vlong))))));
echo " <li><b>Distance from
you:</b> $distance miles.</li>\n";
}
db_free($uchk);
}
On 12/5/07, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> I'm entertaining how to determine what zip codes fall within a 50
> mile radius of another zip code.
>
> Anyone done this before?
>
> Also, does anyone have any sources for zip codes and lat/long databases?
>
> TIA for any help/suggestions.
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi all,
Going to cut it short and to the point. Do most of you freelancers get
by with enough work that does not require front-end UI/design? Do you
find it easier to get more work when you're strengths in design are
just as creative as your programming capabilities?
These are questions I'm entertaining myself with as I teach myself
more design work. I love my full-time job doing development/system
administration, and I can attest to a lack of design skills. However I
am efficient with CSS/XHTML and can create layouts np.
I do also enjoy creating buttons and tabs when I have the time for my
own work with Photoshop CS3, but that's one aspect of the web I don't
see myself ever getting paid for, professionally.
Basically what I'm asking is, am I going to be end up being a jack of
all trades, master of none, if I continue pursuing design AND
development? Is there plenty of work out there for folks who just
stick to development?
Thanks for your humble opinions. Appreciate the feedback!
Cheers,
- sf
--- End Message ---
--- Begin Message ---
Steve Finkelstein wrote:
Hi all,
Going to cut it short and to the point. Do most of you freelancers get
by with enough work that does not require front-end UI/design? Do you
find it easier to get more work when you're strengths in design are
just as creative as your programming capabilities?
These are questions I'm entertaining myself with as I teach myself
more design work. I love my full-time job doing development/system
administration, and I can attest to a lack of design skills. However I
am efficient with CSS/XHTML and can create layouts np.
I do also enjoy creating buttons and tabs when I have the time for my
own work with Photoshop CS3, but that's one aspect of the web I don't
see myself ever getting paid for, professionally.
Basically what I'm asking is, am I going to be end up being a jack of
all trades, master of none, if I continue pursuing design AND
development? Is there plenty of work out there for folks who just
stick to development?
Thanks for your humble opinions. Appreciate the feedback!
Cheers,
- sf
Personally, when the client requires both design and development, I get
with a friend of mine who does design work for a living and split the
difference based on the client's needs.
Jeremy
--- End Message ---
--- Begin Message ---
On Wed, 2007-12-05 at 23:33 -0500, Steve Finkelstein wrote:
> Basically what I'm asking is, am I going to be end up being a jack of
> all trades, master of none, if I continue pursuing design AND
> development? Is there plenty of work out there for folks who just
> stick to development?
>
It all depends on your situation, your environment, your interests and
your goals.
I have, so far been able to make a decent living from purely back end
work, except in my student days when I did it all for extra cash.
I have, however, started messing around with CSS, GIMP, Inkscape and
such for my own personal projects, and it all seems pretty easy to do.
The problem of course, being that I am a code artist, not a graphic
artist, and my HID skills need some tweaking.
What I would suggest you do, is to read up on Human Interface Design and
usability rather than graphic design. Find out all about accessibility
etc, and then start. As I say, the tools are easy to master, but the
magic isn't.
If you are not interested in that, stick to PHP code. It is far less
finicky and will treat you way better IMHO.
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
On Dec 5, 2007 11:33 PM, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Basically what I'm asking is, am I going to be end up being a jack of
> all trades, master of none, if I continue pursuing design AND
> development? Is there plenty of work out there for folks who just
> stick to development?
>
if youre worried about not being able to find a shop where you sit
and code all day; allow me to allay your fears ;)
personally, i enjoy switching from task to task; after days /
weeks / months of coding the same sort of stuff i get a little burned
out. but to answer your question, yes; there are plenty of shops where
they have you just sit around and code. many of them i find will have
you develop uis; but they dont really care about much beyond a simple
interface. as long as it works and isnt too painful on the eyes... at
least that is a trait of shops that focus on development in my experience.
-nathan
--- End Message ---
--- Begin Message ---
At 11:33 PM -0500 12/5/07, Steve Finkelstein wrote:
Hi all,
Going to cut it short and to the point. Do most of you freelancers get
by with enough work that does not require front-end UI/design? Do you
find it easier to get more work when you're strengths in design are
just as creative as your programming capabilities?
-snip-
Thanks for your humble opinions. Appreciate the feedback!
Steve:
I can't speak for others, but I'm one of those "do it all" guys (or
at least I try).
I program about equally well in most web languages (php, mysql, css,
javascript, ajax, html, xml, flash, whatever). To me, all languages
are basically the same and I mix them thoroughly throwing variables
into css and having ajax controlling php, playing with Flash, and
doing odd stuff with jQuery and such.
While I often recommend to my clients that they use someone other
than me to design a layout (not the css, but the artwork), my clients
often find my artwork acceptable. I guess their taste is a bad as
mine.
However, what I think is of major importance is the way things look
to the client. Of course, it goes without saying that your code
should run efficiently and be secure and so on, but the end-result it
has to look impressive to the client.
Considering I came from a Macintosh programming background, GUI comes
second nature to me. While my greatest joy is programming php, I have
to marvel at the unobtrusive DOM scripting that javascript does.
There's lot's of opportunity to put frosting on the cake, so to speak.
So, while it may be nice to work for a shop where you're doing just
one thing, but as a freelancer the larger you can cast your net, the
more clients you land. Most of mine don't even know what a host is
and rely on me to make everything work the way they want it -- and
the only thing they really have a say so in (besides functionality)
is the way things look. as such, the better my work looks, the less
work for me.
Anyway, that's the way it is for me.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
I am trying to recursively send data to the same form. Based on the data, I
want to determine which "action" is to be processed. It appears that the
$_POST is not being cleared out or cached once it is sent to the server.
Here is my code that I'm trying to test with. It doesn't seem to
consistently send me to the correct page each time.
<?php
$process = $_POST['process'];
if ($process == "Pass")
{
echo "<form method='POST' action=success.php>";
}
else
{
echo "<form method='POST' action=recursive.php>";
}
?>
<table border="0" id="table1" width="58">
<tr>
<td align="center">
<input type="radio" checked name="process" value="Pass"
tabindex="1"></td>
<td align="left">Pass</td>
</tr>
<tr>
<td align="center" width="20">
<input type="radio" name="process" value="Fail" tabindex="2"></td>
<td align="left" width="28">
Fail</td>
</tr>
</table>
<input type="submit" value="Submit" name="B1"> <input type="reset"
value="Reset" name="B2">
</form>
I want to use a single submit button that will send the "action" to the
right page.
What is the best practice for doing this?
--- End Message ---
--- Begin Message ---
I'm trying to
--- End Message ---
--- Begin Message ---
Hm. Tell me if this works:
<?php
if ($_POST['process'] == 'pass')
echo '<form action="success.php" method="post">';
else echo '<form action="recursive.php" method="post">';
?>
<button type="submit" name="process" value="pass">Pass</button>
<button type="submit" name="process" value="fail">Fail</button>
</form>
On Dec 5, 2007 9:30 PM, Mike Smith <[EMAIL PROTECTED]> wrote:
> I'm trying to
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
-Casey
--- End Message ---
--- Begin Message ---
<?
if($_POST['process'] == "Pass"){$action = "success.php";}ELSE{$action =
"recursive.php";}
echo "<form method='POST' action='$action'>";
?>
>I am trying to recursively send data to the same form. Based on the data, I
>want to determine which "action" is to be processed. It appears that the
>$_POST is not being cleared out or cached once it is sent to the server.
>Here is my code that I'm trying to test with. It doesn't seem to
>consistently send me to the correct page each time.
>
><?php
>
> $process = $_POST['process'];
>
> if ($process == "Pass")
> {
> echo "<form method='POST' action=success.php>";
> }
> else
> {
> echo "<form method='POST' action=recursive.php>";
> }
>?>
>
> <table border="0" id="table1" width="58">
> <tr>
> <td align="center">
> <input type="radio" checked name="process" value="Pass"
>tabindex="1"></td>
> <td align="left">Pass</td>
> </tr>
> <tr>
> <td align="center" width="20">
> <input type="radio" name="process" value="Fail" tabindex="2"></td>
> <td align="left" width="28">
> Fail</td>
> </tr>
> </table>
> <input type="submit" value="Submit" name="B1"> <input type="reset"
>value="Reset" name="B2">
></form>
>
>I want to use a single submit button that will send the "action" to the
>right page.
>
>What is the best practice for doing this?
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Or try
<?
echo "<form action=";if(($_POST['process'] == "Pass") || ($_POST['process'] ==
"")){echo "success.php";}ELSE{echo "recursive.php";}echo " METHOD='post'>";
?>
There are a 1000 and 1 ways to make the script smaller yet still produce the
same effect.
Remember there is no reason to declare the POST array for matching in this
particular setup. Some may disagree
Notice I added a error checking if the array is blank.
I am going to stop at this because there are many reasons why the _POST array
would or did not pass which may not be related to this script directly but
cause the issue of less then 100% effective.
>I am trying to recursively send data to the same form. Based on the data, I
>want to determine which "action" is to be processed. It appears that the
>$_POST is not being cleared out or cached once it is sent to the server.
>Here is my code that I'm trying to test with. It doesn't seem to
>consistently send me to the correct page each time.
>
><?php
>
> $process = $_POST['process'];
>
> if ($process == "Pass")
> {
> echo "<form method='POST' action=success.php>";
> }
> else
> {
> echo "<form method='POST' action=recursive.php>";
> }
>?>
>
> <table border="0" id="table1" width="58">
> <tr>
> <td align="center">
> <input type="radio" checked name="process" value="Pass"
>tabindex="1"></td>
> <td align="left">Pass</td>
> </tr>
> <tr>
> <td align="center" width="20">
> <input type="radio" name="process" value="Fail" tabindex="2"></td>
> <td align="left" width="28">
> Fail</td>
> </tr>
> </table>
> <input type="submit" value="Submit" name="B1"> <input type="reset"
>value="Reset" name="B2">
></form>
>
>I want to use a single submit button that will send the "action" to the
>right page.
>
>What is the best practice for doing this?
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
<?php
echo '<form action="', $_POST['process'] == 'pass' ? 'success' :
'recursive', '.php" method="post">';
?>
>:D
On Dec 5, 2007 11:35 PM, <[EMAIL PROTECTED]> wrote:
> Or try
>
> <?
> echo "<form action=";if(($_POST['process'] == "Pass") || ($_POST['process']
> == "")){echo "success.php";}ELSE{echo "recursive.php";}echo " METHOD='post'>";
> ?>
>
> There are a 1000 and 1 ways to make the script smaller yet still produce the
> same effect.
> Remember there is no reason to declare the POST array for matching in this
> particular setup. Some may disagree
>
> Notice I added a error checking if the array is blank.
>
> I am going to stop at this because there are many reasons why the _POST array
> would or did not pass which may not be related to this script directly but
> cause the issue of less then 100% effective.
>
>
>
>
>
>
>
> >I am trying to recursively send data to the same form. Based on the data, I
> >want to determine which "action" is to be processed. It appears that the
> >$_POST is not being cleared out or cached once it is sent to the server.
> >Here is my code that I'm trying to test with. It doesn't seem to
> >consistently send me to the correct page each time.
> >
> ><?php
> >
> > $process = $_POST['process'];
> >
> > if ($process == "Pass")
> > {
> > echo "<form method='POST' action=success.php>";
> > }
> > else
> > {
> > echo "<form method='POST' action=recursive.php>";
> > }
> >?>
> >
> > <table border="0" id="table1" width="58">
> > <tr>
> > <td align="center">
> > <input type="radio" checked name="process" value="Pass"
> >tabindex="1"></td>
> > <td align="left">Pass</td>
> > </tr>
> > <tr>
> > <td align="center" width="20">
> > <input type="radio" name="process" value="Fail" tabindex="2"></td>
> > <td align="left" width="28">
> > Fail</td>
> > </tr>
> > </table>
> > <input type="submit" value="Submit" name="B1"> <input type="reset"
> >value="Reset" name="B2">
> ></form>
> >
> >I want to use a single submit button that will send the "action" to the
> >right page.
> >
> >What is the best practice for doing this?
> >
> >--
> >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
>
>
--
-Casey
--- End Message ---
--- Begin Message ---
hi,mike i suggest that you use Javascript to done this work. like this: <form
onsubmit="submitprocess();" method="post" id="form1">...<input type="text"
id="process" value="pass"></form> <script>function submitprocess(){var
pobj=document.getElementById("process");var
fobj=document.getElementById("form1");if (pobj.value=="pass"){
fobj.action="sucess.php";//change form1's action value return true;//submit the
form1}else{ fobj.action="recursive.php"; return true;} }</script>
> To: [EMAIL PROTECTED]> From: [EMAIL PROTECTED]> Date: Wed, 5 Dec 2007
> 22:36:57 -0700> Subject: [PHP] Another form handling posting question> > I am
> trying to recursively send data to the same form. Based on the data, I > want
> to determine which "action" is to be processed. It appears that the > $_POST
> is not being cleared out or cached once it is sent to the server. > Here is
> my code that I'm trying to test with. It doesn't seem to > consistently send
> me to the correct page each time.> > <?php> > $process = $_POST['process'];>
> > if ($process == "Pass")> {> echo "<form method='POST'
> action=success.php>";> }> else> {> echo "<form method='POST'
> action=recursive.php>";> }> ?>> > <table border="0" id="table1" width="58">>
> <tr>> <td align="center">> <input type="radio" checked name="process"
> value="Pass" > tabindex="1"></td>> <td align="left">Pass</td>> </tr>> <tr>>
> <td align="center" width="20">> <input type="radio" name="process"
> value="Fail" tabindex="2"></td>> <td align="left" width="28">> Fail</td>>
> </tr>> </table>> <input type="submit" value="Submit" name="B1"> <input
> type="reset" > value="Reset" name="B2">> </form>> > I want to use a single
> submit button that will send the "action" to the > right page.> > What is the
> best practice for doing this? > > -- > PHP General Mailing List
> (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
Your smile counts. The more smiles you share, the more we donate. Join in!
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate. Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
--- End Message ---
--- Begin Message ---
Dear List,
I have a problem working with shmop_open() in a Solaris environment. The
following cli-script works fine, except shmod_open returns a warning 'unable
to attach or create shared memory segment':
<?php
$sem = "/tmp/" . rand() . ".sem";
touch ($sem);
echo "sem $sem \n";
$sem_key = ftok($sem, 'w');
echo "sem_key $sem_key \n";
if ($sem_key == -1) { die ("ftok error"); }
$shm_id = shmop_open($sem_key, "w", 0644, 1);
echo "shm_id $shm_id\n";
?>
I checked the $sem_key with the Solaris ipcs command. The file exists and
the read/write rights are correct. I tried explictly to call shmop_open with
the right key - the error message remains the same.
Checking out different access mode like "r" does not succeed too. In the
Xdebug output, php changes the value 0644 to 420, i.e.
shmop_open(1258300033, 'w', 420, 1). Of course, I compiled php with
--enable-shmop.
Does anyone has an idea what I might also check?
Thanks in advance,
Rolf_
--
View this message in context:
http://www.nabble.com/shared-memory-access---shmod_open-tf4954760.html#a14188465
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---