php-general Digest 1 Jul 2010 12:38:34 -0000 Issue 6825

Topics (messages 306582 through 306594):

Past discussion
        306582 by: David McGlone

php processing name vs. id field
        306583 by: David Mehler
        306584 by: Adam Richardson
        306594 by: Bob McConnell

Integers
        306585 by: David McGlone
        306586 by: Stephen
        306592 by: Shreyas Agasthya

Re: Exec not functioning [SOLVED]
        306587 by: kronos.aolohr.com

Exec not functioning
        306588 by: kronos.aolohr.com

Re: Brandon Rampersad wants to chat
        306589 by: George Langley

Re: Regular Expression to get the whole Comma Separated String in Array Key
        306590 by: Gaurav Kumar
        306593 by: Richard Quadling

Re: Character Encoding for em-dash
        306591 by: Gaurav Kumar

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi everyone,

I have been searching the archives for a past discussion where some software 
that some folks use to (I think) save code snippets from e-mails for future 
references or something of such.

Does anyone remember that discussion? I am trying to figure out a good way to 
create my own "wiki" type thing so I can use it to help me and be able to go 
back and review very helpful e-mails or code that was very helpful to my 
understanding of how it works.

Here lately I've been remembering things that were brought up on the list that 
had very helpful info, but remembering what thread they were in or what topic, 
so I can find it in the archives is harder than I thought it would be.

Anyone have any suggestions, techniques or remember that discussion so I can 
find it in the archives again?

-- 
Blessings,
David M.

--- End Message ---
--- Begin Message ---
Hello,
I've got a php form processing question. I've got a text field like so:

<div>
<label for="txtname">Name*:</label>
<input type="text" name="name" id="name" size="30" value="<?php echo
htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ?>" /> <br />
</div>

My question is what is the purpose of the id field? I know the name
field is what php references, but am not sure what id is for?
Thanks.
Dave.

--- End Message ---
--- Begin Message ---
On Wed, Jun 30, 2010 at 9:16 PM, David Mehler <dave.meh...@gmail.com> wrote:

> Hello,
> I've got a php form processing question. I've got a text field like so:
>
> <div>
> <label for="txtname">Name*:</label>
> <input type="text" name="name" id="name" size="30" value="<?php echo
> htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ?>" /> <br />
> </div>
>
> My question is what is the purpose of the id field? I know the name
> field is what php references, but am not sure what id is for?
> Thanks.
> Dave.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Dave,

Sometimes it's helpful to target a specific element for stylistic or
functional purposes, and that's when you'll find an id attribute helpful.

In your example above, label elements use the id in the 'for' attribute
(and, speaking to your example, you should have for="name" instead of
for="txtname"):
http://www.w3schools.com/tags/tag_label.asp

In terms of CSS, you can specifically reference the element by it's id using
the notation tag_name#id_value, and id's have the highest order of
specificity (i.e., if you try and style an element by tag name, class,
and/or id, the id styles are what will take precedent, all other things
equal.)
http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

In terms of javascript, you can reference the element by it's id by using
the function getElementById('id_value):
http://www.tizag.com/javascriptT/javascript-getelementbyid.php

Just remember that a particular id can only occur once on a page (another
difference between the name attributes in a form, as you could have multiple
forms on a page and each form could have an input with a "zip" name without
issue, but that same page could only have one id with the value "zip".)

That all said, with the advent of javascript data attributes, you'll have
one more way to target elements for design and functionality:
http://ejohn.org/blog/html-5-data-attributes/

Hope this helps,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
From: Adam Richardson

> On Wed, Jun 30, 2010 at 9:16 PM, David Mehler <dave.meh...@gmail.com>
wrote:
> 
>> Hello,
>> I've got a php form processing question. I've got a text field like
so:
>>
>> <div>
>> <label for="txtname">Name*:</label>
>> <input type="text" name="name" id="name" size="30" value="<?php echo
>> htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ?>" /> <br />
>> </div>
>>
>> My question is what is the purpose of the id field? I know the name
>> field is what php references, but am not sure what id is for?
> 
> Sometimes it's helpful to target a specific element for stylistic or
> functional purposes, and that's when you'll find an id attribute
helpful.
> 
> In your example above, label elements use the id in the 'for'
attribute
> (and, speaking to your example, you should have for="name" instead of
> for="txtname"):
> http://www.w3schools.com/tags/tag_label.asp
> 
> In terms of CSS, you can specifically reference the element by it's id
using
> the notation tag_name#id_value, and id's have the highest order of
> specificity (i.e., if you try and style an element by tag name, class,
> and/or id, the id styles are what will take precedent, all other
things
> equal.)
> http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
> http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html
> 
> In terms of javascript, you can reference the element by it's id by
using
> the function getElementById('id_value):
> http://www.tizag.com/javascriptT/javascript-getelementbyid.php
> 
> Just remember that a particular id can only occur once on a page
(another
> difference between the name attributes in a form, as you could have
multiple
> forms on a page and each form could have an input with a "zip" name
without
> issue, but that same page could only have one id with the value
"zip".)
> 
> That all said, with the advent of javascript data attributes, you'll
have
> one more way to target elements for design and functionality:
> http://ejohn.org/blog/html-5-data-attributes/

If you look at the current HTML 4.01 and XHTML 1.0 specification, you
will find 'name' is no longer listed as a standard attribute. It is all
but obsolete and has been replaced by 'id' almost everywhere. They
actually recommend you put both attributes into tags with identical
values until your applications can be updated to drop all uses of the
name attribute.

<http://www.w3schools.com/tags/default.asp>

Bob McConnell

--- End Message ---
--- Begin Message ---
Hi again

I'm trying to learn about octal numbers and I don't understand this:

Binary: 001000101111
breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7

I know it's similar to unix permissions, but I'm not understanding where for 
example: 111 = 7

wikipedia has got me all confused.

-- 
Blessings,
David M.

--- End Message ---
--- Begin Message ---
On 10-06-30 10:02 PM, David McGlone wrote:
Hi again

I'm trying to learn about octal numbers and I don't understand this:

Binary: 001000101111
breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7

I know it's similar to unix permissions, but I'm not understanding where for
example: 111 = 7
In base 10, which you use every day, we go
0
1
2
3
4
5
6
7
8
9
10

The number 10 is the number of distinct digits we use.

In binary we only us two, 0 and 1, so 10 is 2 decimal

So we go

0 = 0 decimal
1 = 1 << important
10 = 2 << important
11 = 3
100 = 4 << important
101 = 5
110 = 6
111 = 7

So binary 111 is 4 + 2 + 1 = 7

Stephen

--- End Message ---
--- Begin Message ---
It would also mean that 7 (8 digits which includes 0) is the highest numeric
representation that you can have or go up to in an octal representation.

So to take your example and represent an octal number :

001000101111 (subscript 2) = 1057(subscript 8)

--Shreyas

On Thu, Jul 1, 2010 at 7:42 AM, Stephen <stephe...@rogers.com> wrote:

> On 10-06-30 10:02 PM, David McGlone wrote:
>
>> Hi again
>>
>> I'm trying to learn about octal numbers and I don't understand this:
>>
>> Binary: 001000101111
>> breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7
>>
>> I know it's similar to unix permissions, but I'm not understanding where
>> for
>> example: 111 = 7
>>
>>
> In base 10, which you use every day, we go
> 0
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
>
> The number 10 is the number of distinct digits we use.
>
> In binary we only us two, 0 and 1, so 10 is 2 decimal
>
> So we go
>
> 0 = 0 decimal
> 1 = 1 << important
> 10 = 2 << important
> 11 = 3
> 100 = 4 << important
> 101 = 5
> 110 = 6
> 111 = 7
>
> So binary 111 is 4 + 2 + 1 = 7
>
> Stephen
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Regards,
Shreyas Agasthya

--- End Message ---
--- Begin Message ---
I forgot that PHP saves stuff in the /tmp directory (in my case
/var/www/html/tmp [with permissins/owner set accordingly].

So, it works with:


<?php

        $command = "/usr/bin/espeak -g0 -ven+m3 -p22 -s170 'Hallo Toofie' -w
                    /var/www/html/tmp/aba.wav";
        
        exec($command);

?>


Btw, it sounds pretty awful!




On Tue, 29 Jun 2010 17:46:01 -0400, <kro...@aolohr.com> wrote:

Hi,

I'm trying to utilize EXEC to have some text from a db query converted to a wav file using 'espeak'. The 'espeak' command works admirably by cli, but no matter what I do, exec does not
seem to function on my Linux box, even though safe_mode is off.

I've stripped the db query out, and ran a simplified text, 'Hallo Toofie' in the code. First off,
I made sure that the espeak code worked by cli. It does.

The code:

<?php

$command = "/usr/bin/espeak -g0 -ven+m3 -p22 -s170 'Hallo Toofie' -w aba.wav";
        
        exec($command);

?>


I've tried every combination I can think of including using 'espeak' without '/usr/bin',
directing wav output to '-f /home/kronos/aba.wav'.

What am I doing wrong?

Any help, pointers, suggestions appreciated!




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message ---
Hi,

I'm trying to utilize EXEC to have some text from a db query converted to a wav file using 'espeak'. The 'espeak' command works admirably by cli, but no matter what I do, exec does not
seem to function on my Linux box, even though safe_mode is off.

I've stripped the db query out, and ran a simplified text, 'Hallo Toofie' in the code. First off,
I made sure that the espeak code worked by cli. It does.

The code:

<?php

$command = "/usr/bin/espeak -g0 -ven+m3 -p22 -s170 'Hallo Toofie' -w aba.wav";
        
        exec($command);

?>


I've tried every combination I can think of including using 'espeak' without '/usr/bin',
directing wav output to '-f /home/kronos/aba.wav'.

What am I doing wrong?

Any help, pointers, suggestions appreciated!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message --- Actually, it's been SEVEN times since 19 May, including today's. Perhaps the List Mom could step in here?

George

On 10-Jun-10, at 3:07 PM, Ashley Sheridan wrote:

Please could you not send out these auto messages Brandon as I believe
this is the second time a message has hit both my email address and the
mailing list with a request for Google chat from you.

Thanks,
Ash
http://www.ashleysheridan.co.uk



On Thu, 2010-06-10 at 13:46 -0700, Brandon Rampersad wrote:

-----------------------------------------------------------------------

Brandon Rampersad wants to stay in better touch using some of Google's
coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-b89a7a894d-87f44ca42c-QxVqdDj-Y-taKgwQ_V0g-Q8WRBY
You'll need to click this link to be able to chat with Brandon Rampersad.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with Brandon Rampersad, visit:
http://mail.google.com/mail/a-b89a7a894d-87f44ca42c-QxVqdDj-Y-taKgwQ_V0g-Q8WRBY

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
 emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
 that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
 client

We're working hard to add new features and make improvements, so we might also ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).






--- End Message ---
--- Begin Message ---
Hey Richard,

Thanks!!! You have resolved my problem..

GK


On Wed, Jun 30, 2010 at 7:42 PM, Gaurav Kumar
<kumargauravjuke...@gmail.com>wrote:

> Hi All,
>
> Need help in resolving the below problem-
>
>
> I would like to get the whole comma separated string into an array value-
>
> 1. $postText = "chapters 5, 6, 7, 8";
> OR
> 2. $postText = "chapters 5, 6;
> OR
> 3. $postText = "chapters 5, 6, 7";
>
> What i have done so far is-
> preg_match('/chapter[s]*[ ]*(\d+, \d+, \d+)/i', $postText, $matches);
>
> The above will exactly match the third value $postText = "chapters 5, 6,
> 7";
>
> By Above $matches will contain a value of : $matches[1] = '5, 6, 7';
>
> Now i need a SINGLE regular expression which can match first, second
> variable above or any number of comma separated string and IMPORTANTLY
> provide me that whole comma separated sting value (as above) in single array
> key element like below-
>
> $matches[1] = '5, 6, 7';
> OR
> $matches[1] = '5, 6';
> OR
> $matches[1] = '5, 6, 7, 8, 9';
>
>
> Also I have to use regular expression only as the flow of the code does not
> permit to use any other method to get comma separated string from the
> master/base string.
>
> Thanks,
>
> Gaurav Kumar
>
>
>

--- End Message ---
--- Begin Message ---
On 1 July 2010 06:47, Gaurav Kumar <kumargauravjuke...@gmail.com> wrote:
> Hey Richard,
>
> Thanks!!! You have resolved my problem..
>
> GK
>
>
> On Wed, Jun 30, 2010 at 7:42 PM, Gaurav Kumar
> <kumargauravjuke...@gmail.com>wrote:
>
>> Hi All,
>>
>> Need help in resolving the below problem-
>>
>>
>> I would like to get the whole comma separated string into an array value-
>>
>> 1. $postText = "chapters 5, 6, 7, 8";
>> OR
>> 2. $postText = "chapters 5, 6;
>> OR
>> 3. $postText = "chapters 5, 6, 7";
>>
>> What i have done so far is-
>> preg_match('/chapter[s]*[ ]*(\d+, \d+, \d+)/i', $postText, $matches);
>>
>> The above will exactly match the third value $postText = "chapters 5, 6,
>> 7";
>>
>> By Above $matches will contain a value of : $matches[1] = '5, 6, 7';
>>
>> Now i need a SINGLE regular expression which can match first, second
>> variable above or any number of comma separated string and IMPORTANTLY
>> provide me that whole comma separated sting value (as above) in single array
>> key element like below-
>>
>> $matches[1] = '5, 6, 7';
>> OR
>> $matches[1] = '5, 6';
>> OR
>> $matches[1] = '5, 6, 7, 8, 9';
>>
>>
>> Also I have to use regular expression only as the flow of the code does not
>> permit to use any other method to get comma separated string from the
>> master/base string.
>>
>> Thanks,
>>
>> Gaurav Kumar
>>
>>
>>
>


No problem.

If you are on Windows, then the RegexBuddy application from JGSoft is
pretty good. It allows you to build regex in a step by step way with a
full description of what the regex will do, along with testing and
code snippets. Also has a lot of examples to work from and a built in
support forum.

BTW. I'm not connected to JGSoft. Just a happy licensee.

Richard.
-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
Thanks Tedd, but I cant make this change in the application UI level code
for this problem. This application is a SAAS and we have certain quality
standards which we need to follow..

Any other suggestion?

Thanks,

-GK

On Sun, Jun 27, 2010 at 3:06 AM, tedd <tedd.sperl...@gmail.com> wrote:

> At 9:03 PM +0530 6/17/10, Gaurav Kumar wrote:
>
>> Hi All,
>>
>> My client has a database (Sybase) in which a table column URL contains a
>> string like-
>> http://www.pjonline.com/cpd/nutrition_ _drugnutrient_interactions
>>
>> The box like un-recognized character is emdash.
>> I need to display the data on the web lets say in a HTML page where box
>> should be decoded somehow to be displayed as emdash. We cant change
>> anything
>> in the dataabse as such. So anything we need to do has to be done on the
>> fly.
>>
>> I have tried using online tool like http://2cyr.com/decode/ which just
>> converts the string to a best match decoded string and also displays box
>> as
>> emdash!!
>> This means we can do something in PHP to convert the box to emdash
>> somehow.
>>
>> Is there any possibility in php to convert to real emdash?
>>
>> I have alreasy tried urldecode, mb_convert_encoding etc. Also the
>> interesting thing is that "http://2cyr.com/decode/"; website says that the
>> string is of encoding hp-roman8!
>>
>> I want the string to look like-
>> http://www.pjonline.com/cpd/nutrition_--
>> _prescribing_parenteral_nutrition.html
>>
>> Any help?
>>
>> Thanks,
>>
>> Gaurav Kumar
>>
>
> Gaurav:
>
> When you encounter the emdash, used &mdash; to display it in html.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>

--- End Message ---

Reply via email to