php-general Digest 4 May 2011 19:21:00 -0000 Issue 7297

Topics (messages 312660 through 312666):

using XHTML FRAMESET with Zend Layout on Zend_App (MVC)
        312660 by: Dare Williams

sem_get invalid argument for existing semaphore
        312661 by: Jeremy Greene
        312662 by: Mike Mackintosh
        312663 by: Jeremy Greene

Re: what would be the best way to build a 'add page function' to my cms?
        312664 by: tedd
        312665 by: Adam Preece

filter_var using regex
        312666 by: Jason Gerfen

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 ---
Dear Developer,
Can anybody help with tips on how to implement a XHTML1_FRAMESET type on a 
Zend_Layout API in a Zend_Application(MVC).
example.in your bootstrap resources plugin 
(setting.ini).resources.layout.layout = "main"resources.layout.layoutPath = "/path/to/layout"
then on main.phtml you have this code<? $this->DocType() ; 
?>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd";><html 
xmlns="http://www.w3.org/1999/xhtml";><head><? $this->HeadMeta ; ?><? 
$this->HeadTitle ; ?><? $this->HeadScript; ?><? $this->HeadLink; ?></head>
<frameset rows="80,*" cols="*" frameborder="no" border="0" framespacing="0">  
<frame src="top.phtml" name="topFrame" scrolling="No" noresize="noresize" 
id="topFrame" title="topFrame" />  <frameset cols="80,*" frameborder="no" 
border="0" framespacing="0">    <frame src="left.phtml" name="leftFrame" 
scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />    
<frame src="mainDisplay.phtml" name="mainFrame" id="mainFrame" 
title="mainFrame" />  
</frameset></frameset><noframes><body></body></noframes></html>
While mainDisplay.phtml stands as your main script that should load the Layout 
Content variable i.e <? $this->layout()->content; ?>
My main question is how do you make <? $this->layout()->content; ?> works on 
the external script(src="mainDisplay.phtml") that is called on main.phtml on 
mainFrameset .
Thank you.

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

 

I am trying to do a sem_get on a semaphore that has already been created
by

a c++ program. But I'm getting this warning:

 

PHP Warning:  sem_get(): failed for key 0x31006dc2: Invalid argument in
/home/jgreene/views/latest/lcast/apps/webapp/webApp.php on line 11

 

Here is the line 11:

    sem_get($key, 1, 0666);

 

And here is ipcs -s before and after the php script runs:

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems     

0x31006dc2 1245191    jgreene   666        1         

0x31006e01 1277960    jgreene   666        1         

 

I have another c++ program that can get the existing sem with no
problem.

 

I can get the php script to create a new sem with no problem.

 

It does not seem to like to get a sem that's already created... although
I haven't tried getting a sem that's been created by another php
script... But the entire point is that php is an ephemeral client and a
C++ app server creates and responds/locks a resource (in this case
shared memory - which does work fine).

 

Btw, in the archives, way back in 2001, there was a pretty much exact
same post... unfortunately there was no conclusion posted... I really
hope I have better luck!!

 

Jeremy

 

 

 


--- End Message ---
--- Begin Message ---
Are you using the whole hex key or removing the 0x prefix? 

Sent from my iPhone

On May 4, 2011, at 8:13, "Jeremy Greene" <[email protected]> wrote:

> Hi,
> 
> 
> 
> I am trying to do a sem_get on a semaphore that has already been created
> by
> 
> a c++ program. But I'm getting this warning:
> 
> 
> 
> PHP Warning:  sem_get(): failed for key 0x31006dc2: Invalid argument in
> /home/jgreene/views/latest/lcast/apps/webapp/webApp.php on line 11
> 
> 
> 
> Here is the line 11:
> 
>    sem_get($key, 1, 0666);
> 
> 
> 
> And here is ipcs -s before and after the php script runs:
> 
> 
> 
> ------ Semaphore Arrays --------
> 
> key        semid      owner      perms      nsems     
> 
> 0x31006dc2 1245191    jgreene   666        1         
> 
> 0x31006e01 1277960    jgreene   666        1         
> 
> 
> 
> I have another c++ program that can get the existing sem with no
> problem.
> 
> 
> 
> I can get the php script to create a new sem with no problem.
> 
> 
> 
> It does not seem to like to get a sem that's already created... although
> I haven't tried getting a sem that's been created by another php
> script... But the entire point is that php is an ephemeral client and a
> C++ app server creates and responds/locks a resource (in this case
> shared memory - which does work fine).
> 
> 
> 
> Btw, in the archives, way back in 2001, there was a pretty much exact
> same post... unfortunately there was no conclusion posted... I really
> hope I have better luck!!
> 
> 
> 
> Jeremy
> 
> 
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Sorry for the bad formatting... 
Anyway, I did figure out the problem: php creates/expects each system v
semaphore to be a semaphore group of 3. So, not only is that weird, it
really should be documented.

Jeremy

-----Original Message-----
From: Jeremy Greene [mailto:[email protected]] 
Sent: Wednesday, May 04, 2011 8:14 AM
To: [email protected]
Subject: [PHP] sem_get invalid argument for existing semaphore

Hi,

 

I am trying to do a sem_get on a semaphore that has already been created
by

a c++ program. But I'm getting this warning:

 

PHP Warning:  sem_get(): failed for key 0x31006dc2: Invalid argument in
/home/jgreene/views/latest/lcast/apps/webapp/webApp.php on line 11

 

Here is the line 11:

    sem_get($key, 1, 0666);

 

And here is ipcs -s before and after the php script runs:

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems     

0x31006dc2 1245191    jgreene   666        1         

0x31006e01 1277960    jgreene   666        1         

 

I have another c++ program that can get the existing sem with no
problem.

 

I can get the php script to create a new sem with no problem.

 

It does not seem to like to get a sem that's already created... although
I haven't tried getting a sem that's been created by another php
script... But the entire point is that php is an ephemeral client and a
C++ app server creates and responds/locks a resource (in this case
shared memory - which does work fine).

 

Btw, in the archives, way back in 2001, there was a pretty much exact
same post... unfortunately there was no conclusion posted... I really
hope I have better luck!!

 

Jeremy

 

 

 


--- End Message ---
--- Begin Message ---
At 7:19 PM +0100 5/2/11, Adam Preece wrote:
the reason, why i don't want to use word press and any other open source solution, is that i want to learn how it is all done. im sure i can figure it out myself but i would like to ask others and see how they would tackle it.

the idea with the modules sounds really cool, template type system.

if you have the time could you please tell me more how i could achieve a modular template system?

Adam:

You have at least three big problems to consider.

---- First, is creating a template you can live it

A template standardizes methods of how to show data. But the template also has to be flexible enough to be creative. This is not trivial.

---- Second, is a way to make add/delete pages as you want.

You need to have a method where you can add more pages AND delete pages as you want. You should give additional thought as to what to do with the content of the pages you delete, such as to archive them.

All of this can be done via a simple "create a record for each page" in a database where the contents are stored and retrieved as needed. This is the least of the three problems.

---- Third, how you can update any of those pages via a CMS.

You have to make a decision to either allow the client to:

1. Enter HTML directly into the CMS thus allowing for major screw-ups;

2. OR -- you control every aspect of the data entry allowing only filtered data to be entered in specific areas in the template, which is a nightmare of a coding-client communication problem. To control everything means a lot of work;

3. OR -- you handle everything yourself, which is the way I usually do it for clients. That way they give me what they want and I can change the display to best balance their needs with the requirements of the medium.

Good luck,

Cheers,

tedd

--
-------
http://sperling.com/

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

thank you for your response,

i am in the process now of creating this function, and its very deceptive how 
complex you can actually make it.

but im sure i'll get there.

i have taken a some of your points into consideration.

thanks again.

On 4 May 2011, at 17:20, tedd wrote:

> At 7:19 PM +0100 5/2/11, Adam Preece wrote:
>> the reason, why i don't want to use word press and any other open source 
>> solution, is that i want to learn how it is all done. im sure i can figure 
>> it out myself but i would like to ask others and see how they would tackle 
>> it.
>> 
>> the idea with the modules sounds really cool, template type system.
>> 
>> if you have the time could you please tell me more how i could achieve a 
>> modular template system?
> 
> Adam:
> 
> You have at least three big problems to consider.
> 
> ---- First, is creating a template you can live it
> 
> A template standardizes methods of how to show data. But the template also 
> has to be flexible enough to be creative. This is not trivial.
> 
> ---- Second, is a way to make add/delete pages as you want.
> 
> You need to have a method where you can add more pages AND delete pages as 
> you want. You should give additional thought as to what to do with the 
> content of the pages you delete, such as to archive them.
> 
> All of this can be done via a simple "create a record for each page" in a 
> database where the contents are stored and retrieved as needed. This is the 
> least of the three problems.
> 
> ---- Third, how you can update any of those pages via a CMS.
> 
> You have to make a decision to either allow the client to:
> 
> 1. Enter HTML directly into the CMS thus allowing for major screw-ups;
> 
> 2. OR -- you control every aspect of the data entry allowing only filtered 
> data to be entered in specific areas in the template, which is a nightmare of 
> a coding-client communication problem. To control everything means a lot of 
> work;
> 
> 3. OR -- you handle everything yourself, which is the way I usually do it for 
> clients. That way they give me what they want and I can change the display to 
> best balance their needs with the requirements of the medium.
> 
> Good luck,
> 
> Cheers,
> 
> tedd
> 
> -- 
> -------
> http://sperling.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
I am running into a problem using the REGEXP option with filter_var().

The string I am using: 09VolunteerApplication.doc
The PCRE regex I am using:
/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di

The function in it's entirety:
return (!filter_var('09VolunteerApplication.doc',
FILTER_VALIDATE_REGEXP,
array('options'=>array('regexp'=>'/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di'))))
? false : true;

Anyone have any insight into this?

--- End Message ---

Reply via email to