Re: [PHP] Character Encoding for em-dash

2010-06-30 Thread Gaurav Kumar
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  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 — to display it in html.
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>


[PHP] Re: Regular Expression to get the whole Comma Separated String in Array Key

2010-06-30 Thread Gaurav Kumar
Hey Richard,

Thanks!!! You have resolved my problem..

GK


On Wed, Jun 30, 2010 at 7:42 PM, Gaurav Kumar
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
>
>
>


Re: [PHP] Brandon Rampersad wants to chat

2010-06-30 Thread George Langley
	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).








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



[PHP] Exec not functioning

2010-06-30 Thread kronos

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:

	$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/

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



[PHP] Re: Exec not functioning [SOLVED]

2010-06-30 Thread kronos

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:





Btw, it sounds pretty awful!




On Tue, 29 Jun 2010 17:46:01 -0400,  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:

	$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/

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



Re: [PHP] Integers

2010-06-30 Thread Stephen

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: 00100010
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



[PHP] Integers

2010-06-30 Thread David McGlone
Hi again

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

Binary: 00100010
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.

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



Re: [PHP] php processing name vs. id field

2010-06-30 Thread Adam Richardson
On Wed, Jun 30, 2010 at 9:16 PM, David Mehler  wrote:

> Hello,
> I've got a php form processing question. I've got a text field like so:
>
> 
> Name*:
>  
> 
>
> 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


[PHP] php processing name vs. id field

2010-06-30 Thread David Mehler
Hello,
I've got a php form processing question. I've got a text field like so:


Name*:
 


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



[PHP] Past discussion

2010-06-30 Thread David McGlone
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.

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



Re: [PHP] Re: Is this a bug with date() ?

2010-06-30 Thread Hans Åhlin
A year can have 52 or 53 weeks and it can begin with week nr 1, 52 or 53
check this algorithm
http://www.threesides.se/blogg/2010/04/15/date-calculation-algorithm/


**
 Hans Åhlin
   Tel: +46761488019
   icq: 275232967
   http://www.kronan-net.com/
   irc://irc.freenode.net:6667 - TheCoin
**



2010/6/30 Lester Caine :
> Michael Alaimo wrote:
>>
>> I have found a bug report.  This is the correct functionality.
>>
>> Mike
>>
>>> I understand that technically there are more than 52 weeks in a year.
>>> Well at least google says 1 year = 52.177457 weeks.
>>>
>>> So I run the command:
>>> php>  echo date('W' , mktime(0, 0, 0, 1, 1, date('Y')));
>>> 53
>>>
>>> As you can see the result is 53.
>>>
>>> Any thoughts on this?
>
> http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/1016ca2b-7f43-2b10-8199-a78d1bcc49e9&overridelayout=true
> Covers it nicely ...
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.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] PHP Trick or Not - You Be the Judge

2010-06-30 Thread Michael Shadle
biggest difference:

http://php.net/print
print() returns 1, always - which means it's returning a value

http://php.net/echo
doesn't return anything

Sara Golemon's "how long is a piece of string" blog post
(http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html
which appears to be down or something right now) I believe shows the
different opcodes (using VLD - http://pecl.php.net/package/vld)

This is a micro-level optimization. I believe echo is "faster" or
"less intensive" because it does not need to return a value, but on
modern CPUs saving a couple ops is probably not that big of a deal
(even thousands of them) - I think the general consensus is "there is
really no difference" last I saw. Only very very small optimizations.

On Wed, Jun 30, 2010 at 10:22 AM, Jim Lucas  wrote:
> Brandon Rampersad wrote:
>> Hello guys, i was just doing some testing and was wondring if echo is faster
>> than print or print_r. I think since echo is a language construct and
>> print_r is a function, echo is faster.
>>
>> Please let me know.
>>
>> Thanks
>>
>
> People in the past have said that echo and print as actually the same call
> within PHP core system.  I have never dug through the core code that makes up
> PHP so I cannot confirm this claim.
>
> print_r on the other hand is a totally different thing.  It takes and 
> processes
> strings, arrays, objects, etc... So, with that said, it will be much slower.  
> It
> has to detect what type of object it is and then deal with all the pieces.  
> And
> then in the end, output everything to the screen.
>
> --
> Jim Lucas
>
> A: Maybe because some people are too annoyed by top-posting.
> Q: Why do I not get an answer to my question(s)?
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
> --
> 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] PHP Trick or Not - You Be the Judge

2010-06-30 Thread Robert Cummings
Hey Brandon, do you think you could spend some time reading the Google 
talk manual? It's kind of irritating seeing your "Brandon Rampersad 
wants to chat" spam on the list repeatedly.


As for which is faster... your assertion is right.

Cheers,
Rob.



Brandon Rampersad wrote:

Hello guys, i was just doing some testing and was wondring if echo is faster
than print or print_r. I think since echo is a language construct and
print_r is a function, echo is faster.

Please let me know.

Thanks



--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] PHP Trick or Not - You Be the Judge

2010-06-30 Thread Jim Lucas
Brandon Rampersad wrote:
> Hello guys, i was just doing some testing and was wondring if echo is faster
> than print or print_r. I think since echo is a language construct and
> print_r is a function, echo is faster.
> 
> Please let me know.
> 
> Thanks
> 

People in the past have said that echo and print as actually the same call
within PHP core system.  I have never dug through the core code that makes up
PHP so I cannot confirm this claim.

print_r on the other hand is a totally different thing.  It takes and processes
strings, arrays, objects, etc... So, with that said, it will be much slower.  It
has to detect what type of object it is and then deal with all the pieces.  And
then in the end, output everything to the screen.

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



Re: [PHP] Problem with SOAP and authentication? SoapFault exception: [HTTP] Unauthorized

2010-06-30 Thread robert mena
Well,

I've captured using wireshark both communications:

The one that works

POST /XISOAPAdapter/MessageServlet?channel=:Y_BS_SIP_DEV:cc_soap_snd_sip_dev
HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://sap.com/xi/WebService/soap1.1";
User-Agent: Jakarta Commons-HttpClient/3.1
Host: X.Y.Z.W:5
Content-Length: 535

Using cUrl I tried to mimic the behavior.  The content is the same (I've
even tried to reproduce some of the headers). but I get an error.

POST /XISOAPAdapter/MessageServlet?channel=:Y_BS_SIP_DEV:cc_soap_snd_sip_dev
HTTP/1.1
Authorization: Basic Ym9sOmJlbW9sMjAxMA==
Host: X.Y.Z.W:5
Accept: */*
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://sap.com/xi/WebService/soap1.1";
User-Agent: Jakarta Commons-HttpClient/3.1
Content-Length: 535

Any ideas?

On Tue, Jun 29, 2010 at 6:45 PM, robert mena  wrote:

> Hi,
>
> I am using soapUI which is a client soap tester (that works with this
> webservice) to compare what is being generated.  In the header I see
> Authorization: Basic =XYS
>
> So the default (using SoapClient) should also work...
>
> I've captured the tcpdump file and will try to load using wireshark.
>
>
> On Tue, Jun 29, 2010 at 5:18 PM, Richard Quadling wrote:
>
>> On 29 June 2010 20:53, robert mena  wrote:
>> > Hi Richard,
>> > Thanks for taking the time.
>> >
>> > Unfortunately I can't give you access to the actual webservice.   I am
>> using
>> > Zend_Soap_Client so my code is like this
>> > $soapOptions = array(
>> >   "login"  => 'xxx',
>> >   "password"   => 'y');
>> > $client = new Zend_Soap_Client('http://myproviders.com/wsdl.xml',
>> > $soapOptions);
>> > $rc = $client->mi_request($var);
>> > I get
>> > PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Unauthorized in
>> > /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php:987
>> > Stack trace:
>> > #0 [internal function]: SoapClient->__doRequest('> > 'http://10.200', 'http://sap.com/...', 2)
>> > #1
>> /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php(987):
>> > call_user_func(Array, 'http://10.200',
>> > 'http://sap.com/...', 2)
>> > #2 [internal function]:
>> > Zend_Soap_Client->_doRequest(Object(Zend_Soap_Client_Common), '> > version="...', 'http://10.200', 'http://sap.com/...', 2, 0)
>> > #3
>> >
>> /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client/Common.php(70):
>> > call_user_func(Array, Object(Zend_Soap_Client_Common), '> version="...',
>> > 'http://10.200', 'http://sap.com/...', 2, 0)
>> > #4 [internal function]: Zend_Soap_Client_Common->__doRequest('> > version="...', 'http://10.200', 'http://sap.com/...', 2, 0)
>> > #5
>> /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php(1113):
>> > SoapClient->__soapCall('mi_request_ in
>> > /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php on line
>> 987
>> > Calling the SoapClient directly gives me the same result.
>> >
>> > On Tue, Jun 29, 2010 at 9:41 AM, Richard Quadling 
>> > wrote:
>> >>
>> >> On 29 June 2010 13:58, robert mena  wrote:
>> >> > I was hoping for a "userland" soap library (like nuSoap if I
>> understand
>> >> > correctly).   I can't change the fact that the remote webservice
>> >> > requires
>> >> > http auth.
>> >> > Hopefully someone in this list uses either zend_soap or soapClient
>> >> > directly
>> >> > with auth to confirm or deny that the problem is in this part
>> >> > specifically.
>> >> >
>> >> > On Tue, Jun 29, 2010 at 7:23 AM, Richard Quadling <
>> rquadl...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> On 28 June 2010 22:37, robert mena  wrote:
>> >> >> > Hi,
>> >> >> > I'll have a look.  I am using Zend Framework's Zend_Soap_Client
>> which
>> >> >> > in
>> >> >> > turn uses SoapClient.  I'll try to use SoapClient directly.
>> >> >> > I am not using https and I am not going through a proxy (using a
>> non
>> >> >> > standard port).  I've tested with another SOAP client (a
>> standalone
>> >> >> > application called SoapUI) without a problem.
>> >> >> >
>> >> >> > Is there anyone using SoapClient (or Zend_Soap_Client) with auth
>> with
>> >> >> > success?   What other library (that does not use SoapClient) could
>> I
>> >> >> > try?
>> >> >> > On Mon, Jun 28, 2010 at 6:27 AM, Richard Quadling
>> >> >> > 
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> On 26 June 2010 23:46, robert mena 
>> wrote:
>> >> >> >> > Hi,
>> >> >> >> >
>> >> >> >> > I am trying to access a webservice using php's soapclient but I
>> >> >> >> > keep
>> >> >> >> > getting
>> >> >> >> > the error SoapFault exception: [HTTP] Unauthorized
>> >> >> >> >
>> >> >> >> > If I try using a web browser I can authenticate using the same
>> >> >> >> > credentials
>> >> >> >> > used by the php code.
>> >> >> >> >
>> >> >> >> > I've searched but the only mention that I found led to a 'won't
>> >> >> >> > fix'
>> >> >> >> > bug
>> >> >> >> > registered to php 5.1.6.  I am using 5.2.10.
>> >> >> >> >
>> >> >> >> > Any ideas of 

[PHP] PHP Trick or Not - You Be the Judge

2010-06-30 Thread Brandon Rampersad
Hello guys, i was just doing some testing and was wondring if echo is faster
than print or print_r. I think since echo is a language construct and
print_r is a function, echo is faster.

Please let me know.

Thanks

-- 
A Brandon_R Production


Re: [PHP] Re: Is this a bug with date() ?

2010-06-30 Thread Lester Caine

Michael Alaimo wrote:

I have found a bug report.  This is the correct functionality.

Mike


I understand that technically there are more than 52 weeks in a year.
Well at least google says 1 year = 52.177457 weeks.

So I run the command:
php>  echo date('W' , mktime(0, 0, 0, 1, 1, date('Y')));
53

As you can see the result is 53.

Any thoughts on this?


http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/1016ca2b-7f43-2b10-8199-a78d1bcc49e9&overridelayout=true
Covers it nicely ...

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Brandon Rampersad wants to chat

2010-06-30 Thread Brandon Rampersad
---

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-806ae18504-KOgzrPXRyt_-nvSOA0A6kJ3ATvY
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-806ae18504-KOgzrPXRyt_-nvSOA0A6kJ3ATvY

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).

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



[PHP] Re: Is this a bug with date() ?

2010-06-30 Thread Michael Alaimo
I have found a bug report.  This is the correct functionality.

Mike

> I understand that technically there are more than 52 weeks in a year.
> Well at least google says 1 year = 52.177457 weeks.
>
> So I run the command:
> php > echo date('W' , mktime(0, 0, 0, 1, 1, date('Y')));
> 53
>
> As you can see the result is 53.
>
> Any thoughts on this?
>
> Mike
>


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



[PHP] Is this a bug with date() ?

2010-06-30 Thread Michael Alaimo
I understand that technically there are more than 52 weeks in a year. 
Well at least google says 1 year = 52.177457 weeks.

So I run the command:
php > echo date('W' , mktime(0, 0, 0, 1, 1, date('Y')));
53

As you can see the result is 53.

Any thoughts on this?

Mike

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



Re: [PHP] Regular Expression to get the whole Comma Separated String in Array Key

2010-06-30 Thread Richard Quadling
On 30 June 2010 15:12, Gaurav Kumar  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
>

Try ...

preg_match('/chapters? ?((?:\d++(?:, )?)+)/im', $old_string, $a_Matches))


chapters? ?((?:\d++(?:, )?)+)

Match the characters “chapter” literally «chapter»
Match the character “s” literally «s?»
   Between zero and one times, as many times as possible, giving back
as needed (greedy) «?»
Match the character “ ” literally « ?»
   Between zero and one times, as many times as possible, giving back
as needed (greedy) «?»
Match the regular expression below and capture its match into
backreference number 1 «((?:\d++(?:, )?)+)»
   Match the regular expression below «(?:\d++(?:, )?)+»
  Between one and unlimited times, as many times as possible,
giving back as needed (greedy) «+»
  Match a single digit 0..9 «\d++»
 Between one and unlimited times, as many times as possible,
without giving back (possessive) «++»
  Match the regular expression below «(?:, )?»
 Between zero and one times, as many times as possible, giving
back as needed (greedy) «?»
 Match the characters “, ” literally «, »


Created with RegexBuddy
-- 
-
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

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



[PHP] Re: Regular Expression to get the whole Comma Separated String in Array Key

2010-06-30 Thread Jo�o C�ndido de Souza Neto
Not tested, but I think it should work:

preg_match_all('/(\d+),/', $postText, $matches);

-- 
João Cândido de Souza Neto

"Gaurav Kumar"  escreveu na mensagem 
news:aanlktikdb_ismnkpomicxzsfzixg4dedznunrcimj...@mail.gmail.com...
> 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
> 



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



[PHP] Regular Expression to get the whole Comma Separated String in Array Key

2010-06-30 Thread Gaurav Kumar
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


Re: [PHP] form validation code

2010-06-30 Thread Richard Quadling
On 30 June 2010 14:53, Shreyas Agasthya  wrote:
> http://www.php.net/manual/en/types.comparisons.php
> The first table actually gives a very good understanding.
> --Shreyas
>
> On Wed, Jun 30, 2010 at 7:05 PM, Richard Quadling 
> wrote:
>>
>> On 30 June 2010 14:23, Daniel P. Brown  wrote:
>> >    (Hint: isset != empty)
>>
>> More importantly ...
>>
>> isset != !empty
>>
>> $a = Null;
>> $b = '';
>> // $c = undefined;
>> $d = 'Hello';
>>
>> isset($a) = False vs True  = empty($a)
>> isset($b) = True  vs True  = empty($b)
>> isset($c) = False vs True  = empty($c)
>> isset($d) = True  vs False = empty($d)
>>
>>
>>
>> --
>> -
>> 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
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> --
> Regards,
> Shreyas Agasthya
>

empty() === !boolean()

and

isset() === !is_null()



-- 
-
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

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



Re: [PHP] Array form processing

2010-06-30 Thread tedd

At 4:54 PM -0400 6/29/10, Ron Piggott wrote:

I am trying to process a form where the user uses checkboxes:

Sharp
Stabbing
Jabbing

When I do:

foreach($_REQUEST as $key => $val) {
 $$key = $val;
 echo $key . ": " . $val . "";
}

The output is:

painDesc: Array

I need to know the values of the array (IE to know what the user is
checking), not that there is an array.  I hope to save these values to the
database.

Thank you.

Ron


Ron:

Try this:

http://php1.net/b/form-checkbox/

If you want the form to retain the values, try this:

http://php1.net/b/form-checkbox1/


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



RE: [PHP] Login form + User level access

2010-06-30 Thread tedd

At 8:07 PM + 6/29/10, Carlos Sura wrote:
Thank you for your answer Ted, You are right, well, I do have my 
login form, but what I do not understand is how to implement switch 
statement.


switch ($level){

case 0:

include ("admin.php");

break;

case 1:

include ("sales.php");

break;

case 2:

include ("superuser.php");

break;

}


Try:

case 0:
header('location:admin.php');
exit();
break;

Instead of includes.



Now I'm wondering if every page has to have something like:

if ($level==2){

} else {

}



Of course, you must check the level of permission granted to the user 
before allowing them to see any protected page.


I would suggest using a $_SESSION['level'] during logon to set the 
level of permission and then on each protected page do something like 
this:


$level = isset($_SESSION['level']) ? $_SESSION['level'] : null;

if($level < 2)
   {
   // redirect to somewhere else
  header('location:admin.php');
  exit();
   }

   // this will allow the super-user (level 2) to see everything 
while redirecting everyone else elsewhere



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



Re: [PHP] form validation code

2010-06-30 Thread Shreyas Agasthya
http://www.php.net/manual/en/types.comparisons.php

The first table actually
gives a very good understanding.

--Shreyas

On Wed, Jun 30, 2010 at 7:05 PM, Richard Quadling wrote:

> On 30 June 2010 14:23, Daniel P. Brown  wrote:
> >(Hint: isset != empty)
>
> More importantly ...
>
> isset != !empty
>
> $a = Null;
> $b = '';
> // $c = undefined;
> $d = 'Hello';
>
> isset($a) = False vs True  = empty($a)
> isset($b) = True  vs True  = empty($b)
> isset($c) = False vs True  = empty($c)
> isset($d) = True  vs False = empty($d)
>
>
>
> --
> -
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Regards,
Shreyas Agasthya


Re: [PHP] form validation code

2010-06-30 Thread Richard Quadling
On 30 June 2010 14:23, Daniel P. Brown  wrote:
>    (Hint: isset != empty)

More importantly ...

isset != !empty

$a = Null;
$b = '';
// $c = undefined;
$d = 'Hello';

isset($a) = False vs True  = empty($a)
isset($b) = True  vs True  = empty($b)
isset($c) = False vs True  = empty($c)
isset($d) = True  vs False = empty($d)



-- 
-
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

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



Re: [PHP] last modified on a page

2010-06-30 Thread tedd

At 4:41 PM -0400 6/29/10, Paul M Foster wrote:

On Tue, Jun 29, 2010 at 03:44:37PM -0400, tedd wrote:


 At 12:11 AM -0400 6/14/10, David Mehler wrote:

 Hello,
 I've got what is probably a simple question. I've got a site with a
 footer include file. I want to have a section that displays the last
 time the page was modified. So for example say the index.php was last
 modified today and another page  was modified two days ago. When the
 include is run on the other page it says something like this page was
 last modified and it would be two days ago, but for the index file I
 get this page was last modified and today's date.
 Thanks.
 Dave.


 Dave:

 A bit late but try this:

 


Wha--? I never heard of that function before (getlastmod)! Kewl.

Paul


Paul:

Our knowledge is a bit like Swiss cheese, some parts are there and 
some parts are missing.  :-)


I have the distinct impression that my missing parts are getting larger.

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



Re: [PHP] form validation code

2010-06-30 Thread Daniel P. Brown
On Wed, Jun 30, 2010 at 09:07, David Mehler  wrote:
> Hello,
> I've been looking at this to long, and am not seeing the issue. When i
> had the below php code set to !empty instead of !isset as it is now I
> got the value of the name variable echoed back, yet on sql insert that
> field, along with all others are empty, though no error is generated,
> just a bogus record is inserted.
> When I changed to !isset I'm now getting the die statement echoed as
> if no value was passed from the form. This is not the case, I filled
> it out completely.
> Can anyone tell me where this code went wrong?

Sure.

> php Code:
> // Check if fields are isset
> echo "Field Checs.";
> if (!isset($_POST['name'])) {

 the line above.

(Hint: isset != empty)



(Another hint: with !empty(), you told PHP, "if it's not empty."
Now, with !isset(), you're saying, "if it's not set.")




(Answer: Remove the exclamation point from !isset().)


-- 

UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



RE: [PHP] Array form processing

2010-06-30 Thread Ford, Mike
> -Original Message-
> From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
> Sent: 29 June 2010 22:22
> 
> Am I on the right track?  I don't know what to do with the second
> "FOREACH"

Sort of.

> 
>  
> foreach($_REQUEST as $key => $val) {
>  $$key = $val;
>echo $key . ": " . $val . "";
> 
>if ( $val == "Array" ) {

I would prefer to use is_array() here:

if (is_array($val))

>   $i=0;
> 

At this point, you've just proved that $val is an array (whichever test you 
use!), so simply foreach it like one. I know you know how to do that as you did 
it with $_REQUEST above!

>   foreach ($val) {
>   echo "$val[$i]";
>   $i++;
>   }

foreach ($val as $option) {
   echo "$option\n";
}

> 
>}
> }
> 
> ?>

Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] form validation code

2010-06-30 Thread David Mehler
Hello,
I've been looking at this to long, and am not seeing the issue. When i
had the below php code set to !empty instead of !isset as it is now I
got the value of the name variable echoed back, yet on sql insert that
field, along with all others are empty, though no error is generated,
just a bogus record is inserted.
When I changed to !isset I'm now getting the die statement echoed as
if no value was passed from the form. This is not the case, I filled
it out completely.
Can anyone tell me where this code went wrong?
Thanks.
Dave.

Html form:
Fields marked with a * (star) are required.


Name*:
 











php Code:
// Check if fields are isset
echo "Field Checs.";
if (!isset($_POST['name'])) {
echo "The value of Name is " . $_POST['name']. "";
} else {
die('ERROR: Missing value - Event Name');
}

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