Re: [fw-general] Zend Search Lucene: Searching for URLs

2007-04-03 Thread Dave Dash

You bet.

It's ITS/ Indexed Tokenized Stored (like most of my fields).

Here's the query logic:

public function executeSearch()
{
$query = strtolower($this->getRequestParameter('q'));

$hits = array();

if ($query)
{   

$index =
Zend_Search_Lucene::open(sfConfig::get('app_search_card_index_file'));


Zend_Search_Lucene_Analysis_Analyzer::setDefault(new
Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num());

$hits = $index->find($query);
}

An example query in my form would be 

hawaiimoves.com

or

url:hawaiimoves.com

The same queries work fine in Luke.  Also other fields seem to work just
fine.

Thanks!


Alexander Veremyev wrote:
> 
> Hi Dave,
> 
> Could you describe field type used for URL (in context of this 
> description - 
> http://framework.zend.com/manual/en/zend.search.html#zend.search.index-creation.understanding-field-types)
>  
> and give an example of search query?
> 
> 
> With best regards,
> Alexander Veremyev.
> 
> 
> Dave Dash wrote:
>> So I've indexed a document that has a field called "url" filled with URLs
>> (e.g. http://reviewsby.us/, http://spindrop.us/, http://www.nabble.com,
>> etc,
>> etc).
>> 
>> I can find these in Luke just fine by searching for the url (without the
>> http:// in fact)
>> 
>> But in my ZSL 0.9.1 app I get nothing.  If I search for http or https I
>> do
>> get results, but nothing after the ://
>> 
>> Luke was using the default analyzer (Keyword) and ZSL was using UTF8_Num,
>> but it should be able to find these, I have a feeling the dots in the
>> URLs
>> are choking things up.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend-Search-Lucene%3A-Searching-for-URLs-tf3521912s16154.html#a9827630
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Parser

2007-04-03 Thread Kevin McArthur

the new api looks like this..

$image = Zend_Pdf_Image::imageWithPath($pathtofile);

It will use the new parsers and the filename (should be mime detecting) to 
determine what Zend_Pdf_FileParser_Image derived object to use on a 
Zend_Pdf_FileParserDataSource_File resource.. It was done this way such that 
an imageFromBinaryString() or imageFromUrl() static methods could be added 
and not care if the data is in a file or a stream or whatever.


The other two old parsers jpeg + tiff require that they know the filename 
(jpeg because it passes it off to gd) and the tiff because I haven't gotten 
around to rewriting the parser to work with the new architecture.


It would likely be harder to get the old stuff to fit in the new 
architecture than to just rewrite the file parsers to the new format (though 
jpeg might be hard because no one actually ever wrote a proper jpeg 
parser)


In the patch i passed along, the new classes of importance are..

/Pdf/Resource/Image/PNG.php (note uppercase)
class Zend_Pdf_Resource_Image_PNG extends Zend_Pdf_Resource_Image
   public function __construct(Zend_Pdf_FileParser_Image_PNG $imageParser)
...

/Pdf/Image.php
abstract class Zend_Pdf_Image
   public static function imageWithPath($filePath)
   protected static function _extractJpegImage($dataSource)
   protected static function _extractPngImage($dataSource)
   protected static function _extractTiffImage($dataSource)

/Pdf/FileParser.php
abstract class Zend_Pdf_FileParser
   abstract public function screen();
   abstract public function parse();
   public function __construct(Zend_Pdf_FileParserDataSource $dataSource)

/Pdf/FileParserDataSource/File.php
/Pdf/FileParserDataSource/String.php
//Todo: url.php, stream.php

class Zend_Pdf_FileParserDataSource_File extends 
Zend_Pdf_FileParserDataSource

   public function __construct($filePath)
class Zend_Pdf_FileParserDataSource_String extends 
Zend_Pdf_FileParserDataSource

   public function __construct($string)


/Pdf/FileParser/Image.php
abstract class Zend_Pdf_FileParser_Image extends Zend_Pdf_FileParser
   public function __construct(Zend_Pdf_FileParserDataSource $dataSource)


/Pdf/FileParser/Image/PNG.php
class Zend_Pdf_FileParser_Image_PNG extends Zend_Pdf_FileParser_Image

   public function parse()
   public function getWidth()
   public function getHeight()
   public function getBitDepth()
   etc.


What needs to be done is

/Pdf/FileParser/Image/Jpeg.php
/Pdf/FileParser/Image/Tiff.php
/Pdf/Resource/Image/Jpeg.php
/Pdf/Resource/Image/Tiff.php

Following the png example already created.

The old Resource files must die.

There should also probably be a Zend_Pdf_FileParser_Image_Interface created 
to handle the common methods created in Zend_Pdf_FileParser_Image_PNG


Its a fairly labourous peice of work, but isn't highly technical (except 
maybe the jpeg parser to factor out gd)


If this gets translated to a common api, everything except for the Resource* 
classes would get shifted out of /Pdf/ entirely


Meaning, Zend_Pdf_FileParser* would need to be relocated and re-mapped 
elsewhere -- as for PDF using the new parsers, its fairly trivial because 
they operate over a standard api...calling things like $this->_width 
= $imageParser->getWidth(); and such. The new resource classes dont parse 
any binary data, but instead only handle the imagedata->pdf translation of 
the image.


Hope that helps..


Kevin












- Original Message - 
From: "Alexander Veremyev" <[EMAIL PROTECTED]>

To: "Kevin McArthur" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Zend Framework General" 


Sent: Tuesday, April 03, 2007 2:44 PM
Subject: Re: [fw-general] Zend_Parser



Kevin McArthur wrote:
The factory is going, but the other parsers arent ready so changing the 
api right now would break jpeg/tiff support and leave only png.


Could we add only an API and use old implementation through this API? (So 
it will work as wrapper)


I assume matt's GIF parser can extract the bitmap data from the gif, 
which should then be embeddable in the doc (similar how i had to parse 
png data)


Yes, that what should be done.


With best regards,
   Alexander Veremyev.



K
- Original Message - From: "Alexander Veremyev" 
<[EMAIL PROTECTED]>

To: "Kevin McArthur" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Zend Framework General" 


Sent: Tuesday, April 03, 2007 6:41 AM
Subject: Re: [fw-general] Zend_Parser



Hi Kevin,

GIF support would be good feature. The difficulty is that GIF is not 
supported by PDF as internal format. So it needs a little bit more 
processing.



There was no any activities in Zend_Pdf for some time. So your patch 
could be applied to current SVN version. (I have some strange problems 
with applying this patch with 'patch' utility, but I checked it 
manually).



I agree ZF-11 can be postponed up to generalized parser support.

The important thing is to fix user API.
So if we are planing to use something else than 
'Zend_Pdf_ImageFactory::fact

Re: [fw-general] Zend Search Lucene: Searching for URLs

2007-04-03 Thread Alexander Veremyev

Hi Dave,

Could you describe field type used for URL (in context of this 
description - 
http://framework.zend.com/manual/en/zend.search.html#zend.search.index-creation.understanding-field-types) 
and give an example of search query?



With best regards,
   Alexander Veremyev.


Dave Dash wrote:

So I've indexed a document that has a field called "url" filled with URLs
(e.g. http://reviewsby.us/, http://spindrop.us/, http://www.nabble.com, etc,
etc).

I can find these in Luke just fine by searching for the url (without the
http:// in fact)

But in my ZSL 0.9.1 app I get nothing.  If I search for http or https I do
get results, but nothing after the ://

Luke was using the default analyzer (Keyword) and ZSL was using UTF8_Num,
but it should be able to find these, I have a feeling the dots in the URLs
are choking things up.




Re: [fw-general] Zend_Parser

2007-04-03 Thread Alexander Veremyev

Kevin McArthur wrote:
The factory is going, but the other parsers arent ready so changing the 
api right now would break jpeg/tiff support and leave only png.


Could we add only an API and use old implementation through this API? 
(So it will work as wrapper)


I assume matt's GIF parser can extract the bitmap data from the gif, 
which should then be embeddable in the doc (similar how i had to parse 
png data)


Yes, that what should be done.


With best regards,
   Alexander Veremyev.



K
- Original Message - From: "Alexander Veremyev" 
<[EMAIL PROTECTED]>

To: "Kevin McArthur" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Zend Framework General" 


Sent: Tuesday, April 03, 2007 6:41 AM
Subject: Re: [fw-general] Zend_Parser



Hi Kevin,

GIF support would be good feature. The difficulty is that GIF is not 
supported by PDF as internal format. So it needs a little bit more 
processing.



There was no any activities in Zend_Pdf for some time. So your patch 
could be applied to current SVN version. (I have some strange problems 
with applying this patch with 'patch' utility, but I checked it 
manually).



I agree ZF-11 can be postponed up to generalized parser support.

The important thing is to fix user API.
So if we are planing to use something else than 
'Zend_Pdf_ImageFactory::factory()', it would be good to add it now.

Even if it works only as wrapper to current implementation.


With best regards,
   Alexander Veremyev.

Kevin McArthur wrote:

Matthew,


Feel like interfacing that with zend_pdf?

We have JPEG/PNG/TIFF supprt though only PNG has been translated to 
the new parser format. Gif support would be cool.



Alex


Can you explain what you've updated in ZPDF lately, my patch is out 
of date. Seems like its been reorganized and the parsers moved to 
Pdf/Resource/Image but they havnt been modernized at the same time.


Here's my patch so far (just png support) this is the current status 
of ZF-11 http://framework.zend.com/issues/browse/ZF-11


Maybe we should end ZF-11 and start thinking about a generalized file 
parser, and then integrating that into pdf.


I hope the patch below will apply cleanly to a recent version but it 
was written long ago. (Should be applied in /Zend/Library/Pdf/)


Kevin
 SNIP 
Index: FileParser.php
===
--- FileParser.php  (revision 4305)
+++ FileParser.php  (working copy)
@@ -178,6 +178,14 @@
$this->_dataSource->moveToOffset($offset);
}

+public function getOffset() {
+   return $this->_dataSource->getOffset();
+}
+
+public function getSize() {
+   return $this->_dataSource->getSize();
+}
+
/**
 * Convenience wrapper for the data source object's readBytes() 
method.

 *
Index: Exception.php
===
--- Exception.php   (revision 4305)
+++ Exception.php   (working copy)
@@ -321,7 +321,6 @@
const CANT_DETERMINE_FONT_TYPE = 0x0602;


-
  /* Text Layout System */

/**
@@ -330,4 +329,12 @@
const BAD_ATTRIBUTE_VALUE = 0x0701;


+  /* Zend_Pdf_Image and Subclasses */
+
+const CANT_DETERMINE_IMAGE_TYPE = 0x0801;
+const WRONG_IMAGE_TYPE = 0x0802;
+const UNSUPPORTED_IMAGE_ENCODING_OPTIONS = 0x0803;
+const IMAGE_FILE_CORRUPT = 0x0804;
+
+
}
Index: Resource/ImageFactory.php
===
--- Resource/ImageFactory.php   (revision 4305)
+++ Resource/ImageFactory.php   (working copy)
@@ -1,68 +0,0 @@
-http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to [EMAIL PROTECTED] so we can send you a copy immediately.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- */
-
-
-/** Zend_Pdf */
-require_once 'Zend/Pdf.php';
-
-
-/**
- * Zend_Pdf_ImageFactory
- *
- * Helps manage the diverse set of supported image file types.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- * @todo   Use Zend_Mime not file extension for type determination.
- */
-class Zend_Pdf_ImageFactory
-{
-public static function factory($filename) {
-if(!is_file($filename)) {
-throw new Zend_Pdf_Exception("Cannot create image 
resource. File not found.");

-}
-$extension = pathinfo($filename, PATHINFO_EXTENSION);
-/*
- * There are plans to use Zend_Mime and not file extension. 
In the mean time, if you need to
- * use an alternate file extension just spin up the right 
processor directly.

- */
-switch (strtolower($extension)) {
-

Re: [fw-general] search engine

2007-04-03 Thread Alexander Veremyev

Performance of what? ;)

To talk about increasing (or decreasing) performance we should have 
things to compare.

Relational database doesn't give full-text search capabilities.

Using LIKE SQL clause can't give some features (like sorting result set 
by relevance) and needs full data scan (so Zend_Search_Lucene is much 
more faster, except some trivial cases).



Some RDBMS offer full-text search extensions or you can use any special 
product for full-text searching.
But we should compare concrete products. (We don't have any comparisons 
with other products now, only some comparisons with Java Lucene)


It's clear they have all chances to be faster, but you have to choose 
system according to simplicity of system installation and configuration, 
performance, supported features (including supported query language) and 
so on.

I can say that Zend_Search_Lucene is a good choice.


With best regards,
   Alexander Veremyev.

José de Menezes Soares Neto wrote:

Nice! And it increases the performance??
 
 


- Original Message -
*From:* Alexander Veremyev 
*To:* José de Menezes Soares Neto 
*Cc:* fw-general@lists.zend.com 
*Sent:* Tuesday, April 03, 2007 9:47 AM
*Subject:* Re: [fw-general] search engine

Hi José,

There are two possibilities:
1) As it already was mentioned by Joshua, it's possible to use your
database capabilities for full-text searching or use any other tool.

2) Use Zend_Search_Lucene as full-text index in addition to you
relational database.
It's not data duplication. You can store only index information without
storing field values.
Data from your relational database can be indexed absolutely the same
way you can index filesystem data.

Just use 'SELECT * ...' instead of fread() :)


With best regards,
Alexander Veremyev.


José de Menezes Soares Neto wrote:
 > I am trying to explain what I want in a simple way...
 > 
 > I want to create a search engine not for files, but for a

database with
 > products. They produtcs will be sorted by date or price.
 > 
 > I want to create a form input for it, but with Zend_Search its

possible?
 > Cause I only found Zend_Search examples for files, not for
databases...
 > 
 > Other question:
 > 
 > What is the best way to build an search engine service (like

google or
 > open directory project) using Zend Framework? I would like to
storage
 > 100.000.000 records in the database...
 > 
 > Thanks!
 > 
 > 
 >

 > - Original Message -
 > *From:* José de Menezes Soares Neto 
 > *To:* Alexander Veremyev 
 > *Cc:* fw-general@lists.zend.com
 
 > *Sent:* Monday, April 02, 2007 3:10 PM
 > *Subject:* Re: [fw-general] search engine
 >
 > Hi,
 > 
 > But I already have a database, and this article shows how to

search
 > an index created by zend_search_lucene
 > 
 > So, I need to create a index from my database, and this is

not what
 > they explain...
 > 
 > Thanks!
 > 
 >

 > - Original Message -
 > *From:* Alexander Veremyev 
 > *To:* José de Menezes Soares Neto 
 > *Cc:* fw-general@lists.zend.com
 
 > *Sent:* Monday, April 02, 2007 1:33 PM
 > *Subject:* Re: [fw-general] search engine
 >
 > Hi,
 >
 > It looks like you need Zend_Search_Lucene component to be
used
 > (http://framework.zend.com/manual/en/zend.search.html).
 >
 > Some number of Zend Search Lucene tutorials can be found
here -
 > http://www.zftutorials.com/zend-search/
 >
 >
 > With best regards,
 > Alexander Veremyev.
 >
 >
 > José de Menezes Soares Neto wrote:
 >  > hi friends,
 >  > how to create a search engine using zend framework??
 >  >
 >  > i have a database with a lot of products, and when
someone type
 >  > "notebook" for example, it searchs title and
description fields.
 >  >
 >  > best regards,
 >  >
 >  > José de Menezes




[fw-general] Re: Re: Forwarding - Redirecting

2007-04-03 Thread Joshua Ross
Thanks Gavin, that helped to clear things up.

-Joshua-
"Gavin Vess" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi Joshua,
>
> Despite the notices at the top of the Wikipedia entry, I think you will 
> find what you are looking for here:
>
>  http://en.wikipedia.org/wiki/Post/Redirect/Get
>
>  http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost
>
> Yes, _forward() is simply a technique for internal action chaining without 
> requiring another request from the user agent:
>
> 
> http://framework.zend.com/fisheye/browse/Zend_Framework/trunk/library/Zend/Controller/Action.php?r=trunk#l621
>
> Cheers,
> Gavin
>
> P.S. The demo/tutorial uses both _forward and _redirect in the 
> "forum/controllers/IndexController.php" controller:
>
>   http://framework.zend.com/wiki/display/ZFDEV/Tutorial
>
> Joshua Ross wrote:
>> I am also curious about this.  In order to separate logic in my actions I 
>> forward when I have post data. My initial thinking was that redirect 
>> sends and recieves some data from the client and as such forward would 
>> make more sense. However after looking at the code I don't think that is 
>> the case. Can anyone help me out by giving some clear examples on the 
>> intended uses of forward and redirect?
>>
>> Thanks,
>> -Joshua-
>>
>>
>>
>> "Ian Warner" <[EMAIL PROTECTED]> 
>> wrote in message 
>> news:[EMAIL PROTECTED]
>>
>>> Hi
>>>
>>> When creating my application I use the forward action to separate logic.
>>>
>>> However the downfall of this is when a user hits Refresh on the browser 
>>> or F5 they are taken back to the action that initiated the forwarding.
>>>
>>> I use this for validating forms and sending the user through different 
>>> paths depending on results.
>>>
>>> Is there a better method to handle this within Zend?
>>>
>>> How do other handle user pathing ?
>>>
>>> Cheers
>>>
>>> Ian
>>>
> 





Re: [fw-general] Zend_Filter_Input on ZFW 0.9.1

2007-04-03 Thread Ed Finkler

On 4/3/07, Juan Felipe Alvarez Saldarriaga <[EMAIL PROTECTED]> wrote:


Well, so I need to to filter all data one per one ? Cause when I was
doing it with Zend_Filter_Input the result object was a protect object
of the ZFW, there's a way to do this ? or just making a
$this->getRequest on the Controller ?


Yes.

No.

Not sure I understand.

--
- Ed Finkler
http://funkatron.com/


Re: [fw-general] Zend_Filter_Input on ZFW 0.9.1

2007-04-03 Thread Juan Felipe Alvarez Saldarriaga

Ed Finkler wrote:

On 4/3/07, Juan Felipe Alvarez Saldarriaga <[EMAIL PROTECTED]> wrote:

Hey :).

Im trying to migrate from ZFW 0.8 to 0.9.1 and I saw that I have a lot
of issues there, for example, Zend_Input_Filter was dropped :S, so how
can I filter the POST or GET methods ? cause actually im doing something
like this:

class MyControllerController extends Zend_Controller_Action
{
public function MyAccionAction
{
   // Filter $_POST method.
$objFilterPost = new Zend_Filter_Input( $_POST );

   // Get array data.
   $arrMyArray = $objFilterPost->getRaw( 'my_array' );
}
}


There is no comparable functionality remaining in ZFW.  It may appear
after Version 1.0.  You'll need to filter all of your input "by hand"
using the Filter and Validator components.

Well, so I need to to filter all data one per one ? Cause when I was 
doing it with Zend_Filter_Input the result object was a protect object 
of the ZFW, there's a way to do this ? or just making a 
$this->getRequest on the Controller ?


Thx.


[fw-general] Zend Search Lucene: Searching for URLs

2007-04-03 Thread Dave Dash

So I've indexed a document that has a field called "url" filled with URLs
(e.g. http://reviewsby.us/, http://spindrop.us/, http://www.nabble.com, etc,
etc).

I can find these in Luke just fine by searching for the url (without the
http:// in fact)

But in my ZSL 0.9.1 app I get nothing.  If I search for http or https I do
get results, but nothing after the ://

Luke was using the default analyzer (Keyword) and ZSL was using UTF8_Num,
but it should be able to find these, I have a feeling the dots in the URLs
are choking things up.
-- 
View this message in context: 
http://www.nabble.com/Zend-Search-Lucene%3A-Searching-for-URLs-tf3521912s16154.html#a9824811
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Filter_Input on ZFW 0.9.1

2007-04-03 Thread Juan Felipe Alvarez Saldarriaga

Hey :).

Im trying to migrate from ZFW 0.8 to 0.9.1 and I saw that I have a lot 
of issues there, for example, Zend_Input_Filter was dropped :S, so how 
can I filter the POST or GET methods ? cause actually im doing something 
like this:


class MyControllerController extends Zend_Controller_Action
{
   public function MyAccionAction
   {
  // Filter $_POST method.
   $objFilterPost = new Zend_Filter_Input( $_POST );

  // Get array data.
  $arrMyArray = $objFilterPost->getRaw( 'my_array' );
   }
}


Thx.


Re: [fw-general] Zend_Stream (was Zend_Parser)

2007-04-03 Thread Matthew Turland

So long as we don't end up like this...

http://benjismith.net/index.php/2005/09/30/hate-frameworks

... I'm good. :)


Re: [fw-general] Zend_Stream (was Zend_Parser)

2007-04-03 Thread Kevin McArthur

Matt,

So long as it works i'm very flexible. However, do take a look at the plans 
for improving the memory handling of zend pdf streams. Loading data from a 
parser, then into like 5 or 6 classes is going to suck performance (and 
memory) wise when using these on larger binary files.


The memory consumption used by parser/writer pairs should be close to the 
max-size of the file and not 5 or 6x times filesize. So keep that in mind.


Other than that, whatever works.

K
- Original Message - 
From: "Matthew Ratzloff" <[EMAIL PROTECTED]>

To: "Zend Framework General" 
Sent: Tuesday, April 03, 2007 12:52 PM
Subject: Re: [fw-general] Zend_Stream (was Zend_Parser)



So, I was talking with Ralph and we came to the conclusion that everything
I'm doing can be done using streams.

Ah, streams--that dark, deserted, slightly scary corner of the PHP world.

Zend_Stream_Reader seems to be a better fit, name-wise, when you look at
its derivatives.

   Zend_Stream_Reader_Interface
   Zend_Stream_File_Reader (or Zend_File_Reader?) implements
Zend_Stream_Reader_Interface
   Zend_Pdf_Reader extends Zend_Stream_File_Reader
   My_Image_Gif_Reader extends Zend_Stream_File_Reader

That way, when we inevitably come up with writers (deriving from
Zend_Stream_Writer), they correspond very obviously:

   Zend_Pdf_Writer extends Zend_Stream_File_Writer (Zend_Pdf becomes the
input stream class, extending Zend_File/Zend_Stream_File)
   My_Image_Gif_Writer extends Zend_Stream_File_Writer

Streams could then be combined in any number of ways to make reading and
writing very simple and consistent.  It also has the added effect of
promoting the use of streams in PHP.

Thoughts?

-Matt





Re: [fw-general] Zend_Stream (was Zend_Parser)

2007-04-03 Thread Matthew Ratzloff
So, I was talking with Ralph and we came to the conclusion that everything
I'm doing can be done using streams.

Ah, streams--that dark, deserted, slightly scary corner of the PHP world.

Zend_Stream_Reader seems to be a better fit, name-wise, when you look at
its derivatives.

Zend_Stream_Reader_Interface
Zend_Stream_File_Reader (or Zend_File_Reader?) implements
Zend_Stream_Reader_Interface
Zend_Pdf_Reader extends Zend_Stream_File_Reader
My_Image_Gif_Reader extends Zend_Stream_File_Reader

That way, when we inevitably come up with writers (deriving from
Zend_Stream_Writer), they correspond very obviously:

Zend_Pdf_Writer extends Zend_Stream_File_Writer (Zend_Pdf becomes the
input stream class, extending Zend_File/Zend_Stream_File)
My_Image_Gif_Writer extends Zend_Stream_File_Writer

Streams could then be combined in any number of ways to make reading and
writing very simple and consistent.  It also has the added effect of
promoting the use of streams in PHP.

Thoughts?

-Matt



Re: [fw-general] Zend_Parser

2007-04-03 Thread Matthew Ratzloff
On Tue, April 3, 2007 2:39 am, [EMAIL PROTECTED] wrote:
> For say, Zend_String, the interfaces and abstracts are around what one
> would expect. Main difference though which might cloud the connection is
> that a string can contain multi-byte characters so the method names
> referring to the "byte" wouldn't be completely suitable. You can imagine
> the String classes also needing a wrapper to allow for mbstring functions
> to replace use of substr() and other such non-multibyte friendly functions
> where required (likely a user option since mbstring support varies across
> those troublesome shared hosts).

Well, I was thinking:

Zend_String_Parser extends Zend_Parser_Abstract
Zend_String implements Zend_Parser_DataSource_Interface
Zend_String_Multibyte extends Zend_String

The actual read methods are implemented by the data source objects, so one
parser would work for both.  Zend_String_Parser and Zend_String would be
easy (Willy's already done much of the work), but Zend_String_Multibyte
would be a job in and of itself, if it wasn't stipulated to be dependent
on mbstring and/or iconv.

I'm not sure how it should work in cases where you are parsing a binary
file and come across certain bytes that are, for instance, Unicode.  I
guess something like

$string = new Zend_String_Multibyte($bytes, 'UTF-16LE');

isn't too awkward.

> Would it be possible to generalise the method naming from readByte,
> skipByte, etc., to a simple read(), skip() style? Similarly Zend_File
> shouldn't be specifically for binary files IMO. Strings can be either a
> PHP string type, or a file resource (from fopen() for example).
> Distinction needs to be made between a binary or plain text file in the
> hierarchy since both types are not truly interchangeable without a little
> abstraction of the read methods.

Yeah, that's probably a good idea.  Implementation specifics can be
documented.

> Sorry if I'm poking at this with a stick ;). I know the immediate need is
> for binary parsing and Zend_String or whatever is down the line a ways
> even in terms of a Proposal.

No, thinking about stuff like this now is great, so we don't have to
refactor down the line.  :-)

-Matt



Re: [fw-general] search friendly

2007-04-03 Thread José de Menezes Soares Neto
Very nice answers, but I am getting a little problem cause I am newbie in ZF.

I will try your suggestion for urls like

http://localhost/project/search/test

But I dont know where in the project I have to put the code above (index.php? 
SearchController.php?):

$router = $front->getRouter();
$searchRoute = new Zend_Controller_Router_Route_Static(
'search/:query',
array('controller' => 'search', 'action' => 'index')
);
$router->addRoute('search', $searchRoute);

So, I tried to put at index.php and I got this error:

Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 
'SearchController::okAction() does not exist and was not trapped in __call()' 
in D:\www\projeto\lib\Zend\Controller\Action.php:474 Stack trace: #0 [internal 
function]: Zend_Controller_Action->__call('okAction', Array) #1 
D:\www\projeto\lib\Zend\Controller\Action.php(488): 
SearchController->okAction() #2 
D:\www\projeto\lib\Zend\Controller\Dispatcher\Standard.php(214): 
Zend_Controller_Action->dispatch('okAction') #3 
D:\www\projeto\lib\Zend\Controller\Front.php(753): 
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
 Object(Zend_Controller_Response_Http)) #4 D:\www\projeto\index.php(61): 
Zend_Controller_Front->dispatch() #5 {main} thrown in 
D:\www\projeto\lib\Zend\Controller\Action.php on line 474

I don´t know what to do exactly... My index.php is attached...

Thanks very much again



  - Original Message - 
  From: Matthew Weier O'Phinney 
  To: fw-general@lists.zend.com 
  Sent: Tuesday, April 03, 2007 11:55 AM
  Subject: Re: [fw-general] search friendly


  -- José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote
  (on Tuesday, 03 April 2007, 10:33 AM -0300):
  > I've made a searchAction in IndexController. But, when I do a search, the 
url
  > shown is:
  >  
  > http://localhost/project/index/search?query=test
  >  
  > And I was wondering if it could be:
  >  
  > http://localhost/project/search?query=test
  >  
  > Cause it is more beautiful. 

  So either create a new route for this:

  $router = $front->getRouter();
  $searchRoute = new Zend_Controller_Router_Route_Static(
  'search',
  array('controller' => 'index', 'action' => 'search')
  );
  $router->addRoute('search', $searchRoute);

  OR create a new controller, SearchController, with indexAction() that
  performs the search.

  > In other way, the best way I think, the url could be:
  >  
  > http://localhost/project/search/test
  >  
  > And it calls the search engine and lists all the results for the word "test"

  Easy: create a custom route:

  $router = $front->getRouter();
  $searchRoute = new Zend_Controller_Router_Route_Static(
  'search/:query',
  array('controller' => 'search', 'action' => 'index')
  );
  $router->addRoute('search', $searchRoute);

  > The problem for this last url is the form submission, cause it constructs
  > search?test and not search/test

  You're not going to be able to get a form submission to append to the
  url path unless you use javascript; forms either populate the query
  string ($_GET in PHP) or POST content ($_POST in PHP). I'd suggest *not*
  using javascript, and instead doing something like:

  
  
  
  

  This will work with either of the routes listed above, and will work
  with javascript as well.

  > Maybe using a javascript... does anybody knows where I can found about it?

  There are plenty of tutorials on javascript out there -- google is your
  friend. :-)


  > - Original Message -
  > From: José de Menezes Soares Neto
  > To: Alexander Veremyev
  > Cc: fw-general@lists.zend.com
  > Sent: Tuesday, April 03, 2007 9:50 AM
  > Subject: Re: [fw-general] search engine
  > 
  > Nice! And it increases the performance??
  >  
  >  
  > 
  > - Original Message -
  > From: Alexander Veremyev
  > To: José de Menezes Soares Neto
  > Cc: fw-general@lists.zend.com
  > Sent: Tuesday, April 03, 2007 9:47 AM
  > Subject: Re: [fw-general] search engine
  > 
  > Hi José,
  > 
  > There are two possibilities:
  > 1) As it already was mentioned by Joshua, it's possible to use your
  > database capabilities for full-text searching or use any other tool.
  > 
  > 2) Use Zend_Search_Lucene as full-text index in addition to you
  > relational database.
  > It's not data duplication. You can store only index information 
without
  > storing field values.
  > Data from your relational database can be indexed absolutely the 
same
  > way you can index filesystem data.
  > 
  > Just use 'SELECT * ...' instead of fread() :)
  > 
  > 
  > With best regards,
  > Alexander Veremyev.
  > 
  > 
  > José de Menezes Soares Neto wrote:
  > > I am tr

Re: [fw-general] map domain name to module

2007-04-03 Thread martin sarsale

Michael Depetrillo wrote:

Hello Everyone

Has anyone written any code to map a domain name to a specific 
module?  I would like to be able to have a admin-specific-domain.com 
 parked on top of my application and 
then route all requests to the admin module. 


Have you checked the router component?
http://framework.zend.com/wiki/display/ZFDOCDEV/7.+Zend_Controller#7.Zend_Controller-RouteProcess



Re: [fw-general] zend_session question

2007-04-03 Thread Gavin Vess

Hi Tomek,

I proposed adding an option to disable the check for save_path 
previously.  I attached the test patch to the issue below.


If you set save_path to anything writable the exception will not occur.  
Setting a save_path has no effect, if you are not using the default 
files-based save handler.


http://framework.zend.com/issues/browse/ZF-1102

Also see this save handler proposal from Jordan and Ralf:
http://framework.zend.com/wiki/x/vFE

Cheers,
Gavin

Tomek Nowak wrote:
i wrote a class 


require_once 'Zend/Session/SaveHandler/Interface.php';

class Session2 implements  Zend_Session_SaveHandler_Interface
{

public  $maxLifeTime;

public  $dbConnect;

 public function __construct($dbConnect,$maxLifeTime = 1500) {
$this->dbConnect = $dbConnect;
$this->maxLifeTime = $maxLifeTime;
 }

public function open($save_path, $name){
   $this->gc( $this->maxLifeTime);
   return true;
}


public function close() {
return true;
}

public function read($id){
$select = $this->dbConnect->select();
$select->from('sessions');
$select->where('session_id = ?',$id);
$fetch = $this->dbConnect->fetchAll($select);
if (count($fetch) == 1) {
return stripslashes($fetch[0]['dane']);
} else {
$dane = 
array('session_id'=>$id,'last_update'=>date("Y-m-d
H:i:s"),'dane'=>"");
$this->dbConnect->insert('sessions',$dane);
return '';
}
}

public function write($id, $data){

$this->dbConnect->update('sessions',array('dane'=>addslashes($data),'last_update'=>date("Y-m-d

H:i:s")),$this->dbConnect->quoteInto('session_id = ?',$id));
return true;
}

public function destroy($id){
$this->dbConnect->delete('sessions',$db->quoteInto('session_id =
?',$id));
return true;
}

public function gc($maxlifetime){
$select=$this->dbConnect->select();
$select->from('sessions','session_id');

$select->where('DATE_ADD(last_update,INTERVAL ? SECOND) <
now()',$maxlifetime);

$this->dbConnect->delete('sessions',$this->dbConnect->quoteInto('DATE_ADD(last_update,INTERVAL
? SECOND) < now()',$maxlifetime));
return true;
}

}


and in index.php i wrote 
Zend_Session::setSaveHandler(new Session2($db));


why i have to write something like that 
Zend_Session::setOptions(array('save_path'=>'/home/test/app/session/'));
without this i get error 
exception 'Zend_Session_Exception' with message 'Unwritable
session.save_path: ' 
when i am using zend_auth


sesion should be in  db  with this i t works but i think session is in two
places ??

Help
  


Re: [fw-general] Params

2007-04-03 Thread Matthew Weier O'Phinney
-- Ian Warner <[EMAIL PROTECTED]> wrote
(on Tuesday, 03 April 2007, 04:35 PM +0100):
> I am using
> 
> $this->_getParam('name')
> 
> which is an array from a form post
> 
> It print out:
> 
> //POST array(3) {
> //  ["salutation"] => string(3) "Mr."
> //  ["first_name"] => string(10) "Ian Warner"
> //  ["last_name"] => string(10) "Ian Warner"
> //}
> 
> How do I extract just the salutation from this?
> 
> Dead easy problem just cant think at the mo.
> 
> I use
> 
> Zend_Debug::dump($this->_getAllParams(), 'POST', false);
> Zend_Debug::dump($this->_getParam('name'), 'POST', true);
> 
> is using a _method even the best thing to do here, is it better than 
> using the $_POST var

The request object (and by extension, the accessors to it in the action
controller) does not have array awareness. You can either access it
using $_POST, or do a two-step access like the following:

$name = $this->_getParam('name');
$salutation = $name['salutation'];

The request object is mainly to facilitate mapping requests to
module/controller/action names and request parameters not normally
available via PHP (i.e., not available via $_GET and $_POST, such as
URL path segments). The HTTP request object has hooks into $_GET and
$_POST simply because it may grab some of the above information from
those arrays if not found in the path.

Currently, because the request object has no filtering or validation,
the main use for it in your scripts should be to access URL path
information as set by the router (e.g., if matching /blog/:id, you can
access 'id' as $this->_getParam('id')).

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] search friendly

2007-04-03 Thread Gavin Vess

Matthew Weier O'Phinney wrote:

The problem for this last url is the form submission, cause it constructs
search?test and not search/test

Maybe using a javascript... does anybody knows where I can found about it?



There are plenty of tutorials on javascript out there -- google is your
friend. :-)
  

The Google search page does something similar.
View source and then change the way the pieces are replaced.

Cheers,
Gavin


[fw-general] Params

2007-04-03 Thread Ian Warner

Hi

I am using

$this->_getParam('name')

which is an array from a form post

It print out:

//POST array(3) {
//  ["salutation"] => string(3) "Mr."
//  ["first_name"] => string(10) "Ian Warner"
//  ["last_name"] => string(10) "Ian Warner"
//}

How do I extract just the salutation from this?

Dead easy problem just cant think at the mo.

I use

Zend_Debug::dump($this->_getAllParams(), 'POST', false);
Zend_Debug::dump($this->_getParam('name'), 'POST', true);

is using a _method even the best thing to do here, is it better than 
using the $_POST var


Ian


Re: [fw-general] Re: Forwarding - Redirecting

2007-04-03 Thread Gavin Vess

Hi Stephan,

I have not seen any specific problems mentioned with the functionality 
of _forward() and _redirect().  However, I have seen open source 
applications that ambiguously used the word "forward" to perform HTTP 
redirection.  Words used ambiguously can be confusing.  Maybe the names 
are not ideal?


_forward()  =  internally forward to an action controller (e.g. 
module/controller/action)


_redirect() = external HTTP redirect (e.g. any URL via 301/302/303 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)


They do different things:
http://framework.zend.com/fisheye/browse/Zend_Framework/trunk/library/Zend/Controller/Action.php?r=trunk#l621

Cheers,
Gavin

Stephan Stapel wrote:

Hi!

I asked myself why _forward() and _redirect() haven't the same footprint.
As they are relatives without doubt, this would make the interface more
consistent.
Why not simply make the function look like this:

_redirect($action, $controller = null, $module = null, $params = null); ?

I guess this would make it even easier to distinguish both functions as -
from the viewpoint of a developer - there must be a reason that a class
comes with two different functions with identical parameters...

cheers,

Stephan
  


Re: [fw-general] Re: Forwarding - Redirecting

2007-04-03 Thread Nico Edtinger
Won't work if you have a different URI design. I.e. we use http:// 
example.org/index.php/contact.add.import instead of http:// 
example.org/index.php/contact/add/import or http://example.org/ 
index.php/contact_add/import or ... as controller (+ module) name.


If the default Action class is changed to have the same parameters in  
_redirect() as in _forward(), it won't be easy to change that in your  
own class extending the Action class. But it's easy to create an  
Action class, that has the same parameters with the current Action  
class:


class Example_Controller_Action {
	function _redirect($action, $controller = null, $module = null,  
array $options = null) {

if ($controller === null) {
$controller = 
$this->getRequest()->getControllerName();
}
$url = $controller . '/' . $action;
if ($module !== null) {
$url = $module . '/' . $url;
}
parent::_redirect($url, $options);
}
}

nico

[03.04.2007 08:39] Stephan Stapel wrote:


Hi!

I asked myself why _forward() and _redirect() haven't the same  
footprint.
As they are relatives without doubt, this would make the interface  
more

consistent.
Why not simply make the function look like this:

_redirect($action, $controller = null, $module = null, $params =  
null); ?


I guess this would make it even easier to distinguish both  
functions as -
from the viewpoint of a developer - there must be a reason that a  
class

comes with two different functions with identical parameters...

cheers,

Stephan





Re: [fw-general] search friendly

2007-04-03 Thread Matthew Weier O'Phinney
-- José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote
(on Tuesday, 03 April 2007, 10:33 AM -0300):
> I've made a searchAction in IndexController. But, when I do a search, the url
> shown is:
>  
> http://localhost/project/index/search?query=test
>  
> And I was wondering if it could be:
>  
> http://localhost/project/search?query=test
>  
> Cause it is more beautiful. 

So either create a new route for this:

$router = $front->getRouter();
$searchRoute = new Zend_Controller_Router_Route_Static(
'search',
array('controller' => 'index', 'action' => 'search')
);
$router->addRoute('search', $searchRoute);

OR create a new controller, SearchController, with indexAction() that
performs the search.

> In other way, the best way I think, the url could be:
>  
> http://localhost/project/search/test
>  
> And it calls the search engine and lists all the results for the word "test"

Easy: create a custom route:

$router = $front->getRouter();
$searchRoute = new Zend_Controller_Router_Route_Static(
'search/:query',
array('controller' => 'search', 'action' => 'index')
);
$router->addRoute('search', $searchRoute);

> The problem for this last url is the form submission, cause it constructs
> search?test and not search/test

You're not going to be able to get a form submission to append to the
url path unless you use javascript; forms either populate the query
string ($_GET in PHP) or POST content ($_POST in PHP). I'd suggest *not*
using javascript, and instead doing something like:






This will work with either of the routes listed above, and will work
with javascript as well.

> Maybe using a javascript... does anybody knows where I can found about it?

There are plenty of tutorials on javascript out there -- google is your
friend. :-)


> - Original Message -
> From: José de Menezes Soares Neto
> To: Alexander Veremyev
> Cc: fw-general@lists.zend.com
> Sent: Tuesday, April 03, 2007 9:50 AM
> Subject: Re: [fw-general] search engine
> 
> Nice! And it increases the performance??
>  
>  
> 
> - Original Message -
> From: Alexander Veremyev
> To: José de Menezes Soares Neto
> Cc: fw-general@lists.zend.com
> Sent: Tuesday, April 03, 2007 9:47 AM
> Subject: Re: [fw-general] search engine
> 
> Hi José,
> 
> There are two possibilities:
> 1) As it already was mentioned by Joshua, it's possible to use your
> database capabilities for full-text searching or use any other tool.
> 
> 2) Use Zend_Search_Lucene as full-text index in addition to you
> relational database.
> It's not data duplication. You can store only index information 
> without
> storing field values.
> Data from your relational database can be indexed absolutely the same
> way you can index filesystem data.
> 
> Just use 'SELECT * ...' instead of fread() :)
> 
> 
> With best regards,
> Alexander Veremyev.
> 
> 
> José de Menezes Soares Neto wrote:
> > I am trying to explain what I want in a simple way...
> > 
> > I want to create a search engine not for files, but for a database
> with
> > products. They produtcs will be sorted by date or price.
> > 
> > I want to create a form input for it, but with Zend_Search its
> possible?
> > Cause I only found Zend_Search examples for files, not for
> databases...
> > 
> > Other question:
> > 
> > What is the best way to build an search engine service (like google
> or
> > open directory project) using Zend Framework? I would like to 
> storage
> > 100.000.000 records in the database...
> > 
> > Thanks!
> > 
> > 
> >
> > - Original Message -
> > *From:* José de Menezes Soares Neto 
> > *To:* Alexander Veremyev 
> > *Cc:* fw-general@lists.zend.com 
>  >
> > *Sent:* Monday, April 02, 2007 3:10 PM
> > *Subject:* Re: [fw-general] search engine
> >
> > Hi,
> > 
> > But I already have a database, and this article shows how to
> search
> > an index created by zend_search_lucene
> > 
> > So, I need to create a index from my database, and this is not
> what
> > they explain...
> > 
> > Thanks!
> > 
> >
> > - Original Message -
> > *From:* Alexander Veremyev 
> > *To:* José de Menezes Soares Neto 
> > *Cc:* fw-gen

Re: [fw-general] Zend_Parser

2007-04-03 Thread Kevin McArthur
The factory is going, but the other parsers arent ready so changing the api 
right now would break jpeg/tiff support and leave only png.


I assume matt's GIF parser can extract the bitmap data from the gif, which 
should then be embeddable in the doc (similar how i had to parse png data)


K
- Original Message - 
From: "Alexander Veremyev" <[EMAIL PROTECTED]>

To: "Kevin McArthur" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Zend Framework General" 


Sent: Tuesday, April 03, 2007 6:41 AM
Subject: Re: [fw-general] Zend_Parser



Hi Kevin,

GIF support would be good feature. The difficulty is that GIF is not 
supported by PDF as internal format. So it needs a little bit more 
processing.



There was no any activities in Zend_Pdf for some time. So your patch could 
be applied to current SVN version. (I have some strange problems with 
applying this patch with 'patch' utility, but I checked it manually).



I agree ZF-11 can be postponed up to generalized parser support.

The important thing is to fix user API.
So if we are planing to use something else than 
'Zend_Pdf_ImageFactory::factory()', it would be good to add it now.

Even if it works only as wrapper to current implementation.


With best regards,
   Alexander Veremyev.

Kevin McArthur wrote:

Matthew,


Feel like interfacing that with zend_pdf?

We have JPEG/PNG/TIFF supprt though only PNG has been translated to the 
new parser format. Gif support would be cool.



Alex


Can you explain what you've updated in ZPDF lately, my patch is out of 
date. Seems like its been reorganized and the parsers moved to 
Pdf/Resource/Image but they havnt been modernized at the same time.


Here's my patch so far (just png support) this is the current status of 
ZF-11 http://framework.zend.com/issues/browse/ZF-11


Maybe we should end ZF-11 and start thinking about a generalized file 
parser, and then integrating that into pdf.


I hope the patch below will apply cleanly to a recent version but it was 
written long ago. (Should be applied in /Zend/Library/Pdf/)


Kevin
 SNIP 
Index: FileParser.php
===
--- FileParser.php  (revision 4305)
+++ FileParser.php  (working copy)
@@ -178,6 +178,14 @@
$this->_dataSource->moveToOffset($offset);
}

+public function getOffset() {
+   return $this->_dataSource->getOffset();
+}
+
+public function getSize() {
+   return $this->_dataSource->getSize();
+}
+
/**
 * Convenience wrapper for the data source object's readBytes() 
method.

 *
Index: Exception.php
===
--- Exception.php   (revision 4305)
+++ Exception.php   (working copy)
@@ -321,7 +321,6 @@
const CANT_DETERMINE_FONT_TYPE = 0x0602;


-
  /* Text Layout System */

/**
@@ -330,4 +329,12 @@
const BAD_ATTRIBUTE_VALUE = 0x0701;


+  /* Zend_Pdf_Image and Subclasses */
+
+const CANT_DETERMINE_IMAGE_TYPE = 0x0801;
+const WRONG_IMAGE_TYPE = 0x0802;
+const UNSUPPORTED_IMAGE_ENCODING_OPTIONS = 0x0803;
+const IMAGE_FILE_CORRUPT = 0x0804;
+
+
}
Index: Resource/ImageFactory.php
===
--- Resource/ImageFactory.php   (revision 4305)
+++ Resource/ImageFactory.php   (working copy)
@@ -1,68 +0,0 @@
-http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to [EMAIL PROTECTED] so we can send you a copy immediately.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- */
-
-
-/** Zend_Pdf */
-require_once 'Zend/Pdf.php';
-
-
-/**
- * Zend_Pdf_ImageFactory
- *
- * Helps manage the diverse set of supported image file types.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- * @todo   Use Zend_Mime not file extension for type determination.
- */
-class Zend_Pdf_ImageFactory
-{
-public static function factory($filename) {
-if(!is_file($filename)) {
-throw new Zend_Pdf_Exception("Cannot create image resource. 
File not found.");

-}
-$extension = pathinfo($filename, PATHINFO_EXTENSION);
-/*
- * There are plans to use Zend_Mime and not file extension. In 
the mean time, if you need to
- * use an alternate file extension just spin up the right 
processor directly.

- */
-switch (strtolower($extension)) {
-case 'tif':
-//Fall through to next case;
-case 'tiff':
-return new Zend_Pdf_Image_Tiff($filename);
-break;
-case 'png':
-   

RE: [fw-general] Zend_Db pdo_mssql error

2007-04-03 Thread Bill Karwin
Hi Sir or Madam,

Would you state which version of Zend Framework you are using?

Would you please post the output of echo $select->__toString();

Regards,
Bill Karwin

> -Original Message-
> From: Roman1975 [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 02, 2007 11:45 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Zend_Db pdo_mssql error
> 
> 
> php 5.2.1
> 
> Mistake at use Zend_Db pdo_mssql
>// conect ok
>$db = $model->getDb();
> $select = $db->select();
> $select->from('Firms');
> $db->fetchAll($select);
> 
> Error:
> 
> Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message
> 'SQLSTATE[HY000]: General error: 10007 Line 2: Incorrect syntax near
'.'.
> [10007] (severity 5) [(null)]' in
>
C:\home\t\texrdcom\project1\library\Zend\Db\Adapter\Pdo\Abstract.php:156
> Stack trace: #0
> C:\home\t\texrdcom\project1\library\Zend\Db\Adapter\Abstract.php(329):
> Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array) #1
>
C:\home\t\texrdcom\project1\application\mssqladmin\controllers\IndexCont
ro
> ller.php(12):
> Zend_Db_Adapter_Abstract->fetchAll(Object(Zend_Db_Select)) #2
> C:\home\t\texrdcom\project1\library\Zend\Controller\Action.php(488):
> Mssqladmin_IndexController->indexAction() #3
>
C:\home\t\texrdcom\project1\library\Zend\Controller\Dispatcher\Standard.
ph
> p(214):
> Zend_Controller_Action->dispatch('indexAction') #4
> C:\home\t\texrdcom\project1\library\Zend\Controller\Front.php(753):
> Zend_Controller_Dispatcher_Standard-
> >dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http)) #5
> C:\home\t\texrdcom\project1\public_ in
> C:\home\t\texrdcom\project1\library\Zend\Db\Adapter\Pdo\Abstract.php
on
> line
> 156
> 
> --
> View this message in context: http://www.nabble.com/Zend_Db-pdo_mssql-
> error-tf3510102s16154.html#a9804519
> Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Db mysqli

2007-04-03 Thread Bill Karwin
Thanks Vladas, I have logged http://framework.zend.com/issues/browse/ZF-1187 to 
track this issue.

 

Regards,

Bill Karwin

 



From: Vladas Dirzys [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 03, 2007 3:12 AM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Db mysqli

 

Hi!

where is not possible to change mysql port using mysqli adapter.

i've changed Zend_Db_Adapter_Mysqli // function _connect() to this:

protected function _connect()
{
if ($this->_connection) { 
return;
}

+$port = ($this->_config['port']) ? $this->_config['port'] : null;

// Suppress connection warnings here.
// Throw an exception instead. 
@$this->_connection = new mysqli(
$this->_config['host'],
$this->_config['username'],
$this->_config['password'],
$this->_config['dbname'], 
+  $port
);
if ($this->_connection === false || mysqli_connect_errno()) {
throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
}
}


-- 
Pagarbiai // Gruß,
Vladas Diržys
tel.: +370 677 17851
www.dirzys.com 



[fw-general] Very basic question : how to download a file ?

2007-04-03 Thread fred wolf

Hi Zenders,

this is a very basic thing, but I can't make it working out. How can I
download a pdf file for example ? 

I tried to use Zend_Http and set an header with content type
application/pdf, then I got the content file then push it in the
Zend_Http_Response, but It doesn't work.

I'm stuck on planet Zend and  I need some help to get down with my pdf
file...

regards,

fred

 


-- 
View this message in context: 
http://www.nabble.com/Very-basic-question-%3A-how-to-download-a-file---tf3514234s16154.html#a9812950
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] search friendly

2007-04-03 Thread Alan Wagstaff

Hi,

On 03/04/07, José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote:


 Hi again friends,

I've made a searchAction in IndexController. But, when I do a search, the
url shown is:

http://localhost/project/index/search?query=test



Cause it is more beautiful. In other way, the best way I think, the url
could be:

http://localhost/project/search/test

And it calls the search engine and lists all the results for the word
"test"

The problem for this last url is the form submission, cause it constructs
search?test and not search/test

Maybe using a javascript... does anybody knows where I can found about it?




I'm no expert by any stretch of the imagination so best wait for a real
answer, but if it was me, rather than create a searchAction in the
IndexController, I would create a SearchController, with the default action
doing the search.

That should get the URL's looking more how you want them.

Thanks,
Alan.


Re: [fw-general] zend_session question

2007-04-03 Thread Raphael Stolt

Have you checked the session.save_path in your php.ini. I ran in the same
problem when updating from ZF 0.8 to 0.9.1, because in my php.ini it wasn't
set and so also not writeable. Setting the path would also switch to the use
of file-based session storage and retrieval.

Hope this is a starting point.

Raphael Stolt


Tomek Nowak wrote:
> 
> i wrote a class 
> 
> require_once 'Zend/Session/SaveHandler/Interface.php';
> 
> class Session2 implements  Zend_Session_SaveHandler_Interface
> {
> 
>   public  $maxLifeTime;
> 
>   public  $dbConnect;
> 
>public function __construct($dbConnect,$maxLifeTime = 1500) {
>   $this->dbConnect = $dbConnect;
>   $this->maxLifeTime = $maxLifeTime;
>}
> 
> public function open($save_path, $name){
>$this->gc( $this->maxLifeTime);
>return true;
> }
> 
> 
> public function close() {
>   return true;
> }
> 
> public function read($id){
>   $select = $this->dbConnect->select();
>   $select->from('sessions');
>   $select->where('session_id = ?',$id);
>   $fetch = $this->dbConnect->fetchAll($select);
>   if (count($fetch) == 1) {
>   return stripslashes($fetch[0]['dane']);
>   } else {
>   $dane = 
> array('session_id'=>$id,'last_update'=>date("Y-m-d
> H:i:s"),'dane'=>"");
>   $this->dbConnect->insert('sessions',$dane);
>   return '';
>   }
> }
> 
> public function write($id, $data){
> 
> $this->dbConnect->update('sessions',array('dane'=>addslashes($data),'last_update'=>date("Y-m-d
> H:i:s")),$this->dbConnect->quoteInto('session_id = ?',$id));
>   return true;
> }
> 
> public function destroy($id){
>   $this->dbConnect->delete('sessions',$db->quoteInto('session_id =
> ?',$id));
>   return true;
> }
> 
> public function gc($maxlifetime){
>   $select=$this->dbConnect->select();
>   $select->from('sessions','session_id');
> 
>   $select->where('DATE_ADD(last_update,INTERVAL ? SECOND) <
> now()',$maxlifetime);
>   
> $this->dbConnect->delete('sessions',$this->dbConnect->quoteInto('DATE_ADD(last_update,INTERVAL
> ? SECOND) < now()',$maxlifetime));
>   return true;
> }
> 
> }
> 
> 
> and in index.php i wrote 
> Zend_Session::setSaveHandler(new Session2($db));
> 
> why i have to write something like that 
> Zend_Session::setOptions(array('save_path'=>'/home/test/app/session/'));
> without this i get error 
> exception 'Zend_Session_Exception' with message 'Unwritable
> session.save_path: ' 
> when i am using zend_auth
> 
> sesion should be in  db  with this i t works but i think session is in two
> places ??
> 
> Help 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/zend_session-question-tf3510986s16154.html#a9811258
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] search friendly

2007-04-03 Thread José de Menezes Soares Neto
Hi again friends,

I've made a searchAction in IndexController. But, when I do a search, the url 
shown is:

http://localhost/project/index/search?query=test

And I was wondering if it could be:

http://localhost/project/search?query=test

Cause it is more beautiful. In other way, the best way I think, the url could 
be:

http://localhost/project/search/test

And it calls the search engine and lists all the results for the word "test"

The problem for this last url is the form submission, cause it constructs 
search?test and not search/test

Maybe using a javascript... does anybody knows where I can found about it?


  - Original Message - 
  From: José de Menezes Soares Neto 
  To: Alexander Veremyev 
  Cc: fw-general@lists.zend.com 
  Sent: Tuesday, April 03, 2007 9:50 AM
  Subject: Re: [fw-general] search engine


  Nice! And it increases the performance??


- Original Message - 
From: Alexander Veremyev 
To: José de Menezes Soares Neto 
Cc: fw-general@lists.zend.com 
Sent: Tuesday, April 03, 2007 9:47 AM
Subject: Re: [fw-general] search engine


Hi José,

There are two possibilities:
1) As it already was mentioned by Joshua, it's possible to use your 
database capabilities for full-text searching or use any other tool.

2) Use Zend_Search_Lucene as full-text index in addition to you 
relational database.
It's not data duplication. You can store only index information without 
storing field values.
Data from your relational database can be indexed absolutely the same 
way you can index filesystem data.

Just use 'SELECT * ...' instead of fread() :)


With best regards,
Alexander Veremyev.


José de Menezes Soares Neto wrote:
> I am trying to explain what I want in a simple way...
>  
> I want to create a search engine not for files, but for a database with 
> products. They produtcs will be sorted by date or price.
>  
> I want to create a form input for it, but with Zend_Search its possible? 
> Cause I only found Zend_Search examples for files, not for databases...
>  
> Other question:
>  
> What is the best way to build an search engine service (like google or 
> open directory project) using Zend Framework? I would like to storage 
> 100.000.000 records in the database...
>  
> Thanks!
>  
>  
> 
> - Original Message -
> *From:* José de Menezes Soares Neto 
> *To:* Alexander Veremyev 
> *Cc:* fw-general@lists.zend.com 
> *Sent:* Monday, April 02, 2007 3:10 PM
> *Subject:* Re: [fw-general] search engine
> 
> Hi,
>  
> But I already have a database, and this article shows how to search
> an index created by zend_search_lucene
>  
> So, I need to create a index from my database, and this is not what
> they explain...
>  
> Thanks!
>  
> 
> - Original Message -
> *From:* Alexander Veremyev 
> *To:* José de Menezes Soares Neto 
> *Cc:* fw-general@lists.zend.com 
> *Sent:* Monday, April 02, 2007 1:33 PM
> *Subject:* Re: [fw-general] search engine
> 
> Hi,
> 
> It looks like you need Zend_Search_Lucene component to be used
> (http://framework.zend.com/manual/en/zend.search.html).
> 
> Some number of Zend Search Lucene tutorials can be found here -
> http://www.zftutorials.com/zend-search/
> 
> 
> With best regards,
> Alexander Veremyev.
> 
> 
> José de Menezes Soares Neto wrote:
>  > hi friends,
>  > how to create a search engine using zend framework??
>  > 
>  > i have a database with a lot of products, and when someone type
>  > "notebook" for example, it searchs title and description 
fields.
>  > 
>  > best regards,
>  > 
>  > José de Menezes


Re: [fw-general] search engine

2007-04-03 Thread José de Menezes Soares Neto
Nice! And it increases the performance??


  - Original Message - 
  From: Alexander Veremyev 
  To: José de Menezes Soares Neto 
  Cc: fw-general@lists.zend.com 
  Sent: Tuesday, April 03, 2007 9:47 AM
  Subject: Re: [fw-general] search engine


  Hi José,

  There are two possibilities:
  1) As it already was mentioned by Joshua, it's possible to use your 
  database capabilities for full-text searching or use any other tool.

  2) Use Zend_Search_Lucene as full-text index in addition to you 
  relational database.
  It's not data duplication. You can store only index information without 
  storing field values.
  Data from your relational database can be indexed absolutely the same 
  way you can index filesystem data.

  Just use 'SELECT * ...' instead of fread() :)


  With best regards,
  Alexander Veremyev.


  José de Menezes Soares Neto wrote:
  > I am trying to explain what I want in a simple way...
  >  
  > I want to create a search engine not for files, but for a database with 
  > products. They produtcs will be sorted by date or price.
  >  
  > I want to create a form input for it, but with Zend_Search its possible? 
  > Cause I only found Zend_Search examples for files, not for databases...
  >  
  > Other question:
  >  
  > What is the best way to build an search engine service (like google or 
  > open directory project) using Zend Framework? I would like to storage 
  > 100.000.000 records in the database...
  >  
  > Thanks!
  >  
  >  
  > 
  > - Original Message -
  > *From:* José de Menezes Soares Neto 
  > *To:* Alexander Veremyev 
  > *Cc:* fw-general@lists.zend.com 
  > *Sent:* Monday, April 02, 2007 3:10 PM
  > *Subject:* Re: [fw-general] search engine
  > 
  > Hi,
  >  
  > But I already have a database, and this article shows how to search
  > an index created by zend_search_lucene
  >  
  > So, I need to create a index from my database, and this is not what
  > they explain...
  >  
  > Thanks!
  >  
  > 
  > - Original Message -
  > *From:* Alexander Veremyev 
  > *To:* José de Menezes Soares Neto 
  > *Cc:* fw-general@lists.zend.com 
  > *Sent:* Monday, April 02, 2007 1:33 PM
  > *Subject:* Re: [fw-general] search engine
  > 
  > Hi,
  > 
  > It looks like you need Zend_Search_Lucene component to be used
  > (http://framework.zend.com/manual/en/zend.search.html).
  > 
  > Some number of Zend Search Lucene tutorials can be found here -
  > http://www.zftutorials.com/zend-search/
  > 
  > 
  > With best regards,
  > Alexander Veremyev.
  > 
  > 
  > José de Menezes Soares Neto wrote:
  >  > hi friends,
  >  > how to create a search engine using zend framework??
  >  > 
  >  > i have a database with a lot of products, and when someone type
  >  > "notebook" for example, it searchs title and description fields.
  >  > 
  >  > best regards,
  >  > 
  >  > José de Menezes


Re: [fw-general] search engine

2007-04-03 Thread Alexander Veremyev

Hi José,

There are two possibilities:
1) As it already was mentioned by Joshua, it's possible to use your 
database capabilities for full-text searching or use any other tool.


2) Use Zend_Search_Lucene as full-text index in addition to you 
relational database.
It's not data duplication. You can store only index information without 
storing field values.
Data from your relational database can be indexed absolutely the same 
way you can index filesystem data.


Just use 'SELECT * ...' instead of fread() :)


With best regards,
   Alexander Veremyev.


José de Menezes Soares Neto wrote:

I am trying to explain what I want in a simple way...
 
I want to create a search engine not for files, but for a database with 
products. They produtcs will be sorted by date or price.
 
I want to create a form input for it, but with Zend_Search its possible? 
Cause I only found Zend_Search examples for files, not for databases...
 
Other question:
 
What is the best way to build an search engine service (like google or 
open directory project) using Zend Framework? I would like to storage 
100.000.000 records in the database...
 
Thanks!
 
 


- Original Message -
*From:* José de Menezes Soares Neto 
*To:* Alexander Veremyev 
*Cc:* fw-general@lists.zend.com 
*Sent:* Monday, April 02, 2007 3:10 PM
*Subject:* Re: [fw-general] search engine

Hi,
 
But I already have a database, and this article shows how to search

an index created by zend_search_lucene
 
So, I need to create a index from my database, and this is not what

they explain...
 
Thanks!
 


- Original Message -
*From:* Alexander Veremyev 
*To:* José de Menezes Soares Neto 
*Cc:* fw-general@lists.zend.com 
*Sent:* Monday, April 02, 2007 1:33 PM
*Subject:* Re: [fw-general] search engine

Hi,

It looks like you need Zend_Search_Lucene component to be used
(http://framework.zend.com/manual/en/zend.search.html).

Some number of Zend Search Lucene tutorials can be found here -
http://www.zftutorials.com/zend-search/


With best regards,
Alexander Veremyev.


José de Menezes Soares Neto wrote:
 > hi friends,
 > how to create a search engine using zend framework??
 > 
 > i have a database with a lot of products, and when someone type

 > "notebook" for example, it searchs title and description fields.
 > 
 > best regards,
 > 
 > José de Menezes




Re: [fw-general] Zend_Parser

2007-04-03 Thread Alexander Veremyev

Hi Kevin,

GIF support would be good feature. The difficulty is that GIF is not 
supported by PDF as internal format. So it needs a little bit more 
processing.



There was no any activities in Zend_Pdf for some time. So your patch 
could be applied to current SVN version. (I have some strange problems 
with applying this patch with 'patch' utility, but I checked it manually).



I agree ZF-11 can be postponed up to generalized parser support.

The important thing is to fix user API.
So if we are planing to use something else than 
'Zend_Pdf_ImageFactory::factory()', it would be good to add it now.

Even if it works only as wrapper to current implementation.


With best regards,
   Alexander Veremyev.

Kevin McArthur wrote:

Matthew,


Feel like interfacing that with zend_pdf?

We have JPEG/PNG/TIFF supprt though only PNG has been translated to the 
new parser format. Gif support would be cool.



Alex


Can you explain what you've updated in ZPDF lately, my patch is out of 
date. Seems like its been reorganized and the parsers moved to 
Pdf/Resource/Image but they havnt been modernized at the same time.


Here's my patch so far (just png support) this is the current status of 
ZF-11 http://framework.zend.com/issues/browse/ZF-11


Maybe we should end ZF-11 and start thinking about a generalized file 
parser, and then integrating that into pdf.


I hope the patch below will apply cleanly to a recent version but it was 
written long ago. (Should be applied in /Zend/Library/Pdf/)


Kevin
 SNIP 
Index: FileParser.php
===
--- FileParser.php  (revision 4305)
+++ FileParser.php  (working copy)
@@ -178,6 +178,14 @@
$this->_dataSource->moveToOffset($offset);
}

+public function getOffset() {
+   return $this->_dataSource->getOffset();
+}
+
+public function getSize() {
+   return $this->_dataSource->getSize();
+}
+
/**
 * Convenience wrapper for the data source object's readBytes() method.
 *
Index: Exception.php
===
--- Exception.php   (revision 4305)
+++ Exception.php   (working copy)
@@ -321,7 +321,6 @@
const CANT_DETERMINE_FONT_TYPE = 0x0602;


-
  /* Text Layout System */

/**
@@ -330,4 +329,12 @@
const BAD_ATTRIBUTE_VALUE = 0x0701;


+  /* Zend_Pdf_Image and Subclasses */
+
+const CANT_DETERMINE_IMAGE_TYPE = 0x0801;
+const WRONG_IMAGE_TYPE = 0x0802;
+const UNSUPPORTED_IMAGE_ENCODING_OPTIONS = 0x0803;
+const IMAGE_FILE_CORRUPT = 0x0804;
+
+
}
Index: Resource/ImageFactory.php
===
--- Resource/ImageFactory.php   (revision 4305)
+++ Resource/ImageFactory.php   (working copy)
@@ -1,68 +0,0 @@
-http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to [EMAIL PROTECTED] so we can send you a copy immediately.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- */
-
-
-/** Zend_Pdf */
-require_once 'Zend/Pdf.php';
-
-
-/**
- * Zend_Pdf_ImageFactory
- *
- * Helps manage the diverse set of supported image file types.
- *
- * @packageZend_Pdf
- * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. 
(http://www.zend.com)
- * @licensehttp://framework.zend.com/license/new-bsd New BSD 
License

- * @todo   Use Zend_Mime not file extension for type determination.
- */
-class Zend_Pdf_ImageFactory
-{
-public static function factory($filename) {
-if(!is_file($filename)) {
-throw new Zend_Pdf_Exception("Cannot create image resource. 
File not found.");

-}
-$extension = pathinfo($filename, PATHINFO_EXTENSION);
-/*
- * There are plans to use Zend_Mime and not file extension. In 
the mean time, if you need to
- * use an alternate file extension just spin up the right 
processor directly.

- */
-switch (strtolower($extension)) {
-case 'tif':
-//Fall through to next case;
-case 'tiff':
-return new Zend_Pdf_Image_Tiff($filename);
-break;
-case 'png':
-return new Zend_Pdf_Image_Png($filename);
-break;
-case 'jpg':
-//Fall through to next case;
-case 'jpe':
-//Fall through to next case;
-case 'jpeg':
-return new Zend_Pdf_Image_Jpeg($filename);
-break;
-default:
-throw new Zend_Pdf_Exception("Cannot create image 
resource. File extension not known or unsupported type.");

-break;
-}
-}
-}
-?>
Index: Resource/

[fw-general] zend_session question

2007-04-03 Thread Tomek Nowak

i wrote a class 

require_once 'Zend/Session/SaveHandler/Interface.php';

class Session2 implements  Zend_Session_SaveHandler_Interface
{

public  $maxLifeTime;

public  $dbConnect;

 public function __construct($dbConnect,$maxLifeTime = 1500) {
$this->dbConnect = $dbConnect;
$this->maxLifeTime = $maxLifeTime;
 }

public function open($save_path, $name){
   $this->gc( $this->maxLifeTime);
   return true;
}


public function close() {
return true;
}

public function read($id){
$select = $this->dbConnect->select();
$select->from('sessions');
$select->where('session_id = ?',$id);
$fetch = $this->dbConnect->fetchAll($select);
if (count($fetch) == 1) {
return stripslashes($fetch[0]['dane']);
} else {
$dane = 
array('session_id'=>$id,'last_update'=>date("Y-m-d
H:i:s"),'dane'=>"");
$this->dbConnect->insert('sessions',$dane);
return '';
}
}

public function write($id, $data){

$this->dbConnect->update('sessions',array('dane'=>addslashes($data),'last_update'=>date("Y-m-d
H:i:s")),$this->dbConnect->quoteInto('session_id = ?',$id));
return true;
}

public function destroy($id){
$this->dbConnect->delete('sessions',$db->quoteInto('session_id =
?',$id));
return true;
}

public function gc($maxlifetime){
$select=$this->dbConnect->select();
$select->from('sessions','session_id');

$select->where('DATE_ADD(last_update,INTERVAL ? SECOND) <
now()',$maxlifetime);

$this->dbConnect->delete('sessions',$this->dbConnect->quoteInto('DATE_ADD(last_update,INTERVAL
? SECOND) < now()',$maxlifetime));
return true;
}

}


and in index.php i wrote 
Zend_Session::setSaveHandler(new Session2($db));

why i have to write something like that 
Zend_Session::setOptions(array('save_path'=>'/home/test/app/session/'));
without this i get error 
exception 'Zend_Session_Exception' with message 'Unwritable
session.save_path: ' 
when i am using zend_auth

sesion should be in  db  with this i t works but i think session is in two
places ??

Help 

-- 
View this message in context: 
http://www.nabble.com/zend_session-question-tf3510986s16154.html#a9807260
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Db mysqli

2007-04-03 Thread Vladas Dirzys

Hi!

where is not possible to change mysql port using mysqli adapter.

i've changed Zend_Db_Adapter_Mysqli // function _connect() to this:

   protected function _connect()
   {
   if ($this->_connection) {
   return;
   }

+$port = ($this->_config['port']) ? $this->_config['port'] : null;

   // Suppress connection warnings here.
   // Throw an exception instead.
   @$this->_connection = new mysqli(
   $this->_config['host'],
   $this->_config['username'],
   $this->_config['password'],
   $this->_config['dbname'],
+  $port
   );
   if ($this->_connection === false || mysqli_connect_errno()) {
   throw new
Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
   }
   }


--
Pagarbiai // Gruß,
Vladas Diržys
tel.: +370 677 17851
www.dirzys.com


Re: [fw-general] Zend_Parser

2007-04-03 Thread padraic . brady
>Theoretically, if there were something like Zend_String, it could
>implement Zend_Parser_DataSource_Interface and Zend_String_Parser could
>implement Zend_Parser_Interface.

For say, Zend_String, the interfaces and abstracts are around what one would 
expect. Main difference though which might cloud the connection is that a 
string can contain multi-byte characters so the method names referring to the 
"byte" wouldn't be completely suitable. You can imagine the String classes also 
needing a wrapper to allow for mbstring functions to replace use of substr() 
and other such non-multibyte friendly functions where required (likely a user 
option since mbstring support varies across those troublesome shared hosts).

Would it be possible to generalise the method naming from readByte, skipByte, 
etc., to a simple read(), skip() style? Similarly Zend_File shouldn't be 
specifically for binary files IMO. Strings can be either a PHP string type, or 
a file resource (from fopen() for example). Distinction needs to be made 
between a binary or plain text file in the hierarchy since both types are not 
truly interchangeable without a little abstraction of the read methods.

Sorry if I'm poking at this with a stick ;). I know the immediate need is for 
binary parsing and Zend_String or whatever is down the line a ways even in 
terms of a Proposal.

Regards,
Pádraic
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


- Original Message 
From: Matthew Ratzloff <[EMAIL PROTECTED]>
To: Zend Framework General 
Sent: Monday, April 2, 2007 4:57:58 PM
Subject: Re: [fw-general] Zend_Parser

This weekend I wrote a GIF parser, and refactored it a bit to use these
classes (I do have a life--I did other things, too!).  I've renamed some
things and added some things (like setByteOrder() and BYTE_ORDER_MACHINE)
and spent a couple hours writing an invisible buffering mechanism before
determining that it actually made performance worse.  :-D

Currently, and this is by no means finalized, but this is the structure:

Zend_Parser_Interface
Zend_Parser_DataSource_Interface
Zend_File implements Zend_Parser_DataSource_Interface
Zend_File_Parser_Abstract implements Zend_Parser_Interface
My_Image_Gif extends Zend_File
My_Image_Gif_Parser extends Zend_File_Parser_Abstract

Theoretically, if there were something like Zend_String, it could
implement Zend_Parser_DataSource_Interface and Zend_String_Parser could
implement Zend_Parser_Interface.

If you have suggestions on a better structure, I'd like to hear your
thoughts.

-Matt

On Mon, April 2, 2007 3:26 am, Pádraic Brady wrote:
> Spent part of the weekend implementing a file buffer class and parser for
> yet another format (string, not binary). So I'm reading this email topic
> with a lot of interest.
>
> It would be good to see some general interface/abstract for file/string
> reading and parsing. I just looked at the StringParser and other files
> briefly (would just note the lack of Unicode string parsing ;)) and they
> all bear similarities to a parser I spent some hours mocking a partial
> implementation of.
>
> There's a lot of re-useable code under the Zend/Pdf location that could be
> generalised, moved as suggested, and improved and I'd love to see that
> happen. I have a chunk of ideas that could use it! As it stands I have to
> give some though to using the current code (even if it's another non-PDF
> file, it's all plain text) in favour of what I might write - general or
> not it's better than reinventing something already in the framework. If
> nothing else it might help cut down development time even if I have to
> make minor changes via subclasses.
>
> ++1 to a proposal. :)
>
> Pádraic Brady
> http://blog.astrumfutura.com
> http://www.patternsforphp.com
>
>
> - Original Message 
> From: Matthew Ratzloff <[EMAIL PROTECTED]>
> To: Kevin McArthur <[EMAIL PROTECTED]>
> Cc: fw-general@lists.zend.com
> Sent: Saturday, March 31, 2007 11:39:13 PM
> Subject: Re: [fw-general] Zend_File_Parser, Zend_String,   etc.
> (was: Operating with file system: OO approach)
>
> On second thought, it makes more sense to have
>
> Zend_Parser_Interface
> Zend_Parser_DataSource_Interface*
>
> Neither with concrete classes (like SPL).  Then Zend_File can implement
> Zend_Parser_DataSource_Interface and Zend_File_Parser can implement
> Zend_Parser_Interface.
>
> I'll look into this more thoroughly tonight.  I can see all kinds of
> applications for it.
>
> -Matt
>
> * There's probably a better name for this.
>
> On Sat, March 31, 2007 2:42 pm, Kevin McArthur wrote:
>> We suggested this when it was written (and I'm yet to have fully
>> translated
>> the image parsers to use the new one, open issue yadayada) so if you're
>> going to create a proper fileparser class, do it soon and we can update
>> the
>> outstanding changes to use the new class.
>>
>> Willie wrote this class when getting the font support for zpdf going and
>> its
>> quite robust.
>>
>> We sugge