Re: [PHP] Re: phpDesigner 2008?

2008-11-18 Thread Eric Butera
On Tue, Nov 18, 2008 at 6:00 AM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
> Waynn Lue wrote:
>>
>> I know the IDE wars spring up occasionally, but looking through the
>> archives, I haven't seen any discussions pro or con for phpDesigner 2008 (
>> http://www.mpsoftware.dk/phpdesigner.php).  Anyone had a chance to use it
>> and think it's good or not?
>>
>> I just installed PDT + Eclipse today, and I'm still getting used to the
>> integration.  I'm used to Eclipse + Java, so it somewhat throws me for a
>> loop in trying to figure out what works in what scope.  I do wish I could
>> have it do some kind of analysis of my files plus dependencies so any
>> problems could be discovered at compile time, rather than run time.
>>
>> Thanks,
>> Waynn
>>
>
> php isn't pre-compiled though..
>
> did you go for ganymede with pdt 2 or the all in one?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I saw someone say they were using that on the zend framework list
saying it was super buggy.  I've never been smart enough to not use
the all-in-one though. :D

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



Re: [PHP] PHP performance profiling

2008-11-18 Thread Eric Butera
On Tue, Nov 18, 2008 at 10:11 AM, Gryffyn
<[EMAIL PROTECTED]> wrote:
> I did a search and didn't find anything really astounding sounding, so I
> wanted to ask for some "live" recommendations from the crowd here.
>
> I was wondering if anyone had used FirePHP with Firebug or could recommend a
> good profiling method for figuring out where the slow parts of your PHP
> code are.
>
> I'm curious about solutions that don't require installing something on the
> server side, since that's not usually an option with shared web hosting and
> all.
>
> I used to love Zend Studio's server component along with the IDE, but it
> doesn't help so much with shared web hosts where you can't install the
> server component.
>
> Ideally, I'd love to see what segments of the code are running slow, but at
> the very minimum, I want to see if it's the PHP code or the MySQL calls
> that are slow.   I know I can just add my own statements in the code, but I
> was hoping there was a more comprehensive solution available.
>
> Thanks in advance.
>
> -TG
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

If you cannot install stuff on your server, set yourself up a local
dev environment.  You should really be doing this anyways.  One of the
easiest ways to do this is to download a pre-made vmware player server
application.  Or you could do the xampp thing.

Once you have that you can use xdebug [1] to profile your code.  It
has a lot of various ways of profiling.  It doesn't require you
modifying your code at all.  Then it generates these files that you
can use kcachegrind/wincachegrind to see every single function your
script calls, how long it took, etc.  There's also another tool to
view these files called webgrind[2]

[1] http://www.xdebug.org/docs/profiler
[2] http://code.google.com/p/webgrind/

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



Re: [PHP] store class zithin session

2008-11-20 Thread Eric Butera
On Thu, Nov 20, 2008 at 8:37 AM, Yeti <[EMAIL PROTECTED]> wrote:
> If you can't load the class before calling session_start you can store
> the serialized object in a file and simple set a
> $_SESSION['path_to_file'] session variable..
>
> EXAMPLE:
>  session_start();
>
> //some code
>
> class apple_tree {
> var $apples = 17;
> }
>
> $temporary_file = 'appletree.txt';
> $file_content = serialize(new apple_tree());
>
> if ($fp = fopen($temporary_file, 'w')) {
> fwrite($fp, $file_content);
> $_SESSION['path_to_file'] = $temporary_file;
> fclose($fp);
> }
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Autoload.  Why on earth would you do such a thing?

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



Re: [PHP] store class zithin session

2008-11-20 Thread Eric Butera
On Thu, Nov 20, 2008 at 2:07 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Eric Butera schreef:
>> On Thu, Nov 20, 2008 at 8:37 AM, Yeti <[EMAIL PROTECTED]> wrote:
>
> ...
>
>>>
>>
>> Autoload.  Why on earth would you do such a thing?
>
> autoload ... your neighbourhood opcode cache performance killer,
> then again so is file based sessions (for ease of use I stick
> my session files on /dev/shm/foo [i.e. RAM] if/when using a
> file based session handler ... I figure if the box goes down and
> takes /dev/shm with it the lost session data is the least of
> my worries ... besides by the time the box is up current visitors
> will generally have given up and left already)
>
> ... and storing a path to
> a file containing a serialized object in the session is a bit nuts,
> you might as well store the serialized object in the session and
> save at least one file write/read. storing a serialized object,
> as opposed to letting the session handler do transparent serialization
> can help you get round an infrastructure problem (where you can't
> load the class before starting the session) and also can improve
> performance where you might not want/need to initialize the
> given object on every request.
>
>>
>
>

Well I wouldn't put objects into the session to begin with.  I was
just talking about this specific case.  Wouldn't autoload be fine if
the file was already in the opcode cache?

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



Re: [PHP] store class zithin session

2008-11-20 Thread Eric Butera
On Thu, Nov 20, 2008 at 2:51 PM, Stut <[EMAIL PROTECTED]> wrote:
> On 20 Nov 2008, at 19:35, Eric Butera wrote:
>>
>> Well I wouldn't put objects into the session to begin with.
>
> Why not? I do it all the time and it works fine.
>
>> I was
>> just talking about this specific case.  Wouldn't autoload be fine if
>> the file was already in the opcode cache?
>
> Opcode caches work during the compilation phase, so any dynamic loading such
> as that provided by autoloaders cannot be optimised. This has been discussed
> in the past on this list, check the archives for more details.
>
> -Stut
>
> --
> http://stut.net/
>


http://till.vox.com/library/post/zendframework-performance.html?_c=feed-rss-full

Item #3: Get rid off require_once, use __autoload (and the Zend_Loader)

It just lead me to believe that after autoload found a class it
somehow cached the code for it.  I'll look into this when I get some
free time for testing.

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



Re: [PHP] Re: Open Project

2008-11-23 Thread Eric Butera
On Sun, Nov 23, 2008 at 5:34 PM, Alex Chamberlain
<[EMAIL PROTECTED]> wrote:
>> Nathan Rixham wrote:
>> > Evening All,
>> >
>> > I'm feeling the need to either start or contribute to something
>> > opensource and in PHP.
>> >
>> > Anybody have any worthy causes or projects they'd like to collab on
>> to
>> > get off the ground; open to all options preference going to anything
>> > framework, orm, webservice or basically anything without an html
>> front
>> > end :)
>> >
>>
>> Afternoon,
>>
>> I've had a look through the two frameworks that Alex and Craige have
>> sent through, done a lot of thinking and came to a decision, well more
>> of an idea. I'd be interested in thoughts / comments.
>>
>> What:
>> A light generic framework for php developers, built API style with a
>> public interface (web service) and a private interface (PHP 5 classes).
>>
>> =Base=:
>>
>> 3rd Party WS Integrations:
>> Amazon AWS and S3 services, Yahoo's API's, OpenCalais, Google API's
>> (more..?)
>>
>> Additional Product Integrations:
>> Apache SOLR, ARC2 (for rdf and sparql support?), Doctrine (ORM)?
>>
>> Templating:
>> Smart, other or custom.
>>
>> DB:
>> PDO/Doctrine + contrib to doctrine project as well (or fork?) OR custom
>> ORM built on top of PDO.
>>
>> PHP Client Lib's:
>> HTTP 1.1, SOAP 1.2 (with the ws-* suite), xml-rpc and maybe XMPP?
>>
>> XML:
>> Generic XML Parser using DOM API
>> Object to XML and XML to Object support, aim to add __toXML() for all
>> classes.
>> Specific XML Parsers, XHTML, RSS, ATOM, SOAP, RDF, XML-RPC (maybe XMPP)
>> Specific XML Writers (same as above)
>>
>> Helpers:
>> Some things like a Arrays, HashMaps, Tree class, filesystem
>> negotiation,
>> verification for common data types (emails and the like) Primitive
>> types
>> maybe byte, int, real, string classes too?) - Dates and thoughts on an
>> Arbitary Precision Class as well for the hell of it?
>>
>> Internals:
>> Framework structure and design pattern(s), Generic Object Class with
>> id's etc, Generic Cache Class (unless in ORM layer), interfaces,
>> Exception handler, logging, autoloader(s) etc.
>> An additional I'd like in here is auto initiation via an "initiator"
>> interface(s) and analysis on all framework classes via reflection to
>> auto initiate classes upon framework load.
>>
>> [probably do all of the above in reverse order eh.. the framework core,
>> all with private api's (eg classes)]
>>
>> Second Layer: (all with private and public api's)
>> After the above a series of generic domain model/business object
>> classes
>> such as user, address, article etc etc built on top of the ORM stuff.
>> tbd! Probably worth getting a load agreed, defined and drawn up in UML.
>>
>> and really no point going any further here..
>>
>> Thoughts? (open to all obviously)
>
> This all seems a bit complicated, qhich is what I am trying to avoid.
>
> Alex
>
> No virus found in this outgoing message. Scanned by AVG Free 8.0
> Checked by AVG - http://www.avg.com
> Version: 8.0.175 / Virus Database: 270.9.9/1806 - Release Date: 22/11/2008
> 18:59
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I looked into your framework for a little bit.  So far I see a lot of
things that would be painful in my daily work if I were using such a
thing.  The reason everything is so "complicated" is because people
really need complicated, varying things.  Lots of projects need to be
able to handle authentication or databases differently.  I'd say that
if you wanted something that is very straight forward, then perhaps
you should use an existing framework that has all of the thousands of
man hours invested already, but use something like the adapter pattern
to make the api interfaces much easier.  If you're always going to use
one way of doing things, then perhaps just create your own class
wrapper that works that exact way.

I went down this road too.  I developed my own set of tools back in
php4 days since we couldn't use php5 at the time.  I pulled what I
thought were the best ideas at the time from a lot of various
frameworks.  It ended up okay, but there's a lot of problems.  First
off there's really not a lot of documentation.  Open source frameworks
usually have pretty good docs on usage of their code.  Secondly, my
code coverage is kinda poor because real work got in the way.  I just
don't have the time to invest into getting things in their best shape.
 Keeping motivation for such things is hard too.  After working on
code for 40 hours a week, do I really want to write more of it?  Then
finally, it's a one man show.  There's no community for answering
questions, adding features, etc.  That is just my experience though.
I think it has been a good learning experience for me though.  I got
to see the strengths and weaknesses of various code bases.  Plus lots
of different ways of doing the same thing.

Good luck to you!

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

Re: [PHP] PHP friendly web software?

2008-11-25 Thread Eric Butera
On Tue, Nov 25, 2008 at 10:03 AM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Tue, 2008-11-25 at 12:54 -0200, uaca man wrote:
>> I use vs.php to edit php and dreamweaver to html and im  happy with those 
>> two.
>>
>> 2008/11/25 John Boy <[EMAIL PROTECTED]>:
>> > Can anyone recommend a wysiwyg web development software which is php
>> > friendly, i.e. you can design the page in wysiwyg and insert php code into
>> > the html without destroying the screen image preview. I've been using
>> > Frontpage to compose the page then dev-php to insert the php code. This has
>> > worked well but if layout changes need to be made Frontpage displays stuff
>> > all over the place. Just trying MS Expression but this shows blank page 
>> > when
>> > any php code is present. Any ideas?
>> >
>> >
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
> At work, the other guys use Dreamweaver to edit HTML and PHP, and it
> works well for them. Myself, I do everything with a text editor anyways,
> even C# and C++!
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Life's too short to not have code completion! :D

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



Re: [PHP] PHP friendly web software?

2008-11-25 Thread Eric Butera
On Tue, Nov 25, 2008 at 1:20 PM, uaca man <[EMAIL PROTECTED]> wrote:
> 2008/11/25  <[EMAIL PROTECTED]>:
>>
>>> Life's too short to not have code completion! :D
>>
>> I tried to help a guy out yesterday, and his silly code completion thingie 
>> ended up writing bogus HTML as I typed...
>>
>> I don't NEED code completion, thank you very much, I know what I'm doing, so 
>> get out of my way!
>>
>> :-p
>>
>> (I've tried them all, and end up in 'vi' almost always.)
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> I completely agree with you! Why use a car when you can walk?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Well I work on a lot of various projects.  Some procedural, some oop.
Lots written by different developers too.  It saves me time not having
to remember where things are, what they'renamed, parameter orders,
etc.  Being able to also click on a function and open its source file
without worrying about paths saves a lot of time too.

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



Re: [PHP] PHP attaching css and JS files to current page

2008-11-30 Thread Eric Butera
On Sun, Nov 30, 2008 at 8:23 AM, Alain Roger <[EMAIL PROTECTED]> wrote:
> Hi,
>
> is there a way how a PHP class can attach JS (javascript) and CSS documents
> to current web page in which the class is instanced ?
> till now i used an "echo" which "write" a  code into
> current document.
> in this javascript, i used to have a createElement function to attache
> C\other CSS or JS file.
>
> it's not so clean and maybe a better possibility exists. Thanks to let me
> know.
>
> --
> Alain
> ---
> Windows XP x64 SP2
> PostgreSQL 8.3.5 / MS SQL server 2005
> Apache 2.2.10
> PHP 5.2.6
> C# 2005-2008
>

I've created a few helper classes that I use on projects for this
"problem."  What I do is have a directory that I put css and js files
into.  Then I have a main "page" class that has various sub-classes
for things like css & javascript.  Inside of a controller or view if I
have some code that needs to include a js/css file all they have to do
is something like this:

$page = page::getInstance();
$page->css->add('css.css')->add('css2.css');
$page->js->add('file.js')->add('file2.js')

By calling the add() methods page maps to that the specific js and css
directories.

Then in my main site wrapper template I call upon page again to render
out any css/js files that had been "included."  This way my design has
no idea of what js/css that needs to be included and anywhere along
the execution path of my code I can add css/js.

This also allows for some speed increases in page load since you can
get your css included in the header while delaying script includes
until way down in the body.  This prevents browsers from blocking
while compiling your scripts and the user sees something a lot faster.

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Eric Butera
On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> Shawn McKenzie wrote:
>> Jim Lucas wrote:
>>> Boyd, Todd M. wrote:
> -Original Message-
> From: Jagdeep Singh [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 04, 2008 8:39 AM
> To: php-general@lists.php.net
> Subject: [PHP] How to fetch .DOC or .DOCX file in php
> Importance: Low
>
> Hi !
>
> I want to fetch text from .doc / .docx file and save it into database
> file.
> But when  I tried to fetch text with fopen/fgets etc ... It gave me
> special
> characters with text.
>
> (With .txt files everything is fine)
> Only problem is with doc/docx files.
> I dont know whow to remove "SPECIAL CHARACTERS" from this text ...
 A.) This has been handled on this list several times. Please search the
 archives before posting a question.
 B.) Did you even TRY to Google for this? In the first 5 matches for "php
 open ms word" I found this:

 http://www.developertutorials.com/blog/php/extracting-text-from-word-doc
 uments-via-php-and-com-81/

 You will need an MS Windows machine for this solution to work. If you're
 using *nix... well... good luck.


 // Todd

>>> Ah, not true about the MS requirement.  If all you want is the clear/clean
>>> text (without any formatting), then I can do it with php on any platform.
>>>
>>> If this is what is needed, here is the code to do it.
>>>
>>> >>
>>> $filename = './12345.doc';
>>> if ( file_exists($filename) ) {
>>>
>>>  if ( ($fh = fopen($filename, 'r')) !== false ) {
>>>
>>>  $headers = fread($fh, 0xA00);
>>>
>>>  # 1 = (ord(n)*1) ; Document has from 0 to 255 characters
>>>  $n1 = ( ord($headers[0x21C]) - 1 );
>>>
>>>  # 1 = ((ord(n)-8)*256) ; Document has from 256 to 63743 
>>> characters
>>>  $n2 =   ( ( ord($headers[0x21D]) - 8 ) * 256 );
>>>
>>>  # 1 = ((ord(n)*256)*256) ; Document has from 63744 to 16775423 
>>> characters
>>>  $n3 =   ( ( ord($headers[0x21E]) * 256 ) * 256 );
>>>
>>>  # (((ord(n)*256)*256)*256) ; Document has from 16775424 to 
>>> 4294965504 characters
>>>  $n4 = ( ( ( ord($headers[0x21F]) * 256 ) * 256 ) * 256 );
>>>
>>>  # Total length of text in the document
>>>  $textLength = ($n1 + $n2 + $n3 + $n4);
>>>
>>>  $extracted_plaintext = fread($fh, $textLength);
>>>
>>>  # if you want the plain text with no formatting, do this
>>>  echo $extracted_plaintext;
>>>
>>>  # if you want to see your paragraphs in a web page, do this
>>>  echo nl2br($extracted_plaintext);
>>>
>>>  }
>>>
>>> }
>>>
>>> ?>
>>>
>>> Hope this helps.
>>>
>>> I am working on a set of php classes that will be able to read the text 
>>> with the formatting included and convert it to a standard document format.
>>> The standard format that it will end up in has yet
>>>
>>   "has yet"...  what?
>>
>> Are you O.K. Jim?  Did you die while writing this?
>>
>
> Sorry, still kickin'
>
> I was going to say that I haven't yet decided on what the final output format 
> is going to be.  Probably either rtf or OpenXML.
>
> How about I ask for suggestions on what would be the best format to store the 
> final copy.
>
> I figured that this tool would mainly be used for .doc to web conversion, but 
> I guess it could be used to also convert to other document formats too.
>
> But, I would like to have the ability to at least store the formating inline 
> with the text.  So, either some form of xml.  Be it (x)HTML or plain XML
> or even OpenXML.
>
> A question to all then.  How would you like to see the text, with formating, 
> stored?
>
> All suggestions welcome!
>
> --
> Jim Lucas
>
>   "Some men are born to greatness, some achieve greatness,
>   and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
>by William Shakespeare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Is there a way to make it so that additional output renderers could be
created?  I'd lean towards xml though, since that can be parsed fairly
easily.

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:13 PM, Jason Todd Slack-Moehrle
<[EMAIL PROTECTED]> wrote:
> Here is the output I am printing:
>
> 'tempUploads/1425182872.xlsUploaded The File.'
>
> What is the issue?
>
> -Jason
>
>
> On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:
>
>> Hi All,
>>
>> I am uploading a file and it says it worked, but I dont see it in the
>> directory
>>
>> Here is my code so far:
>>
>>$allowed_ext = array('csv','xls');
>>$ext = end(explode('.',$_FILES['uploadedfile']['name']));
>>$ran2 = rand().".";
>>$target = "tempUploads/";
>>$target = $target . $ran2.$ext;
>>
>>if($_FILES['uploadedfile']['size'] > 200){
>>$message = 'File over 2MB';
>>echo $message;
>>exit;
>>}
>>
>>if($message == NULL && !in_array($ext,$allowed_ext)){
>>$message = 'File extension not allowed'.' extension
>> is:'.$ext;
>>echo $message;
>>exit;
>>}
>>
>>if($message == NULL) {
>>if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
>> $target))
>>{
>>$message = "Uploaded The File.";
>>echo $message;
>>
>>// upload was successful, now lets work with it
>>include '_functions.inc'; // Utility Functions
>>
>>include '_fileHeaders.inc'; // CSV File Headers
>> that we expect, in the proper order
>>
>>include '_fileParse.inc'; // CSV File Parsing
>>}
>>else
>>{
>>$message = "Sorry, there was a problem uploading
>> your file.";
>>echo $message;
>>}
>>}
>>
>> How can I verify it is there? I ftp in and I dont see it.
>>
>> -Jason
>>
>>
>> --
>> 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
>
>

Read up!

http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:40 PM, Jason Todd Slack-Moehrle
<[EMAIL PROTECTED]> wrote:
> Hi Eric,
>
> 'tempUploads/1425182872.xlsUploaded The File.'
>
> http://us2.php.net/manual/en/function.is-uploaded-file.php
> http://us2.php.net/manual/en/features.file-upload.errors.php
>
> So do I still use move_uploaded_file?
> -Jason

Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.

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



Re: [PHP] A MySQL Question

2008-12-07 Thread Eric Butera
On Sun, Dec 7, 2008 at 10:03 AM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> I just interviewed for a job teaching at the local college (imagine me
> taking minds of mush and molding them to the world according to tedd --
> frightening huh?)
>
> In any event, the interviewer asked me how long I've been using MySQL and I
> replied several years. After which she asked a single question, which was
> "What does EXIST mean?"
>
> Now without running to the manuals, please be honest and tell me how many of
> you know off the top of your head what EXIST means? I would be curious to
> know.
>
> I answered the question correctly, (I'm one of those weird types who read
> manuals for fun) but I have never used EXIST in a query. Have any of you?
>
> And while we're on the subject of MySQL -- while we all know how to write
> it, how do you say it?
>
> I've read that the common way is to say "My Squell", or something like that.
> But I always sounded out each letter, such as "My S-Q-L". The interviewer
> pronounced it the same as I, but I have heard others say it differently.
>
> What say you?
>
> 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
>
>

Sounds like someone thinks they're pretty clever.  I'll never
understand why interviewers want to ask really odd edge case questions
instead of ones that really show practical knowledge.  I know that I
don't know the syntax to everything.  What I do know is where to find
it in seconds if I need it.  There's better ways of weeding out resume
fibbers. :)  I've never actually used EXIST before, but maybe now that
I've looked at it I'll find a use.  I'm more used to using joins, but
this might be a little more readable in cases.

On their site I saw once they said they call it My-S-Q-L, but the
other way works too.  I prefer My-SQL.

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



Re: [PHP] pear Mail/Mime problem on new Ubuntu Linux server

2008-12-09 Thread Eric Butera
On Tue, Dec 9, 2008 at 6:57 AM, German Geek <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Can someone think of a reason why when changing from a Windows 2003 Web
> Edition server running PHP 5.2 to a Ubuntu machine, also with PHP 5.2 can
> cause the following problem:
>
> The emails sent from the server, which should be in HTML format (the client
> wanted this specifically) now only show the plain text email, but only in
> Outlook XP or 2003. The Outlook 2007 on my work machine receives it fine,
> also my gmail account. Unfortunately, the client uses the Outlook version
> with the problem.
>
> Might it be the Unix newline characters?
>
> My first suspicion was to blame M$ for letting Outlook check the headers for
> example.com, postfix or Linux, but that might be a bit exajurated paranoia.
> lol
>
> Thanks for even reading this, even more for replying. :)
>
> Tim
>

I just had this problem.  Try normalizing the line returns of your
email before sending it.  I was building mine from multiple sources
(db, files, etc) and some had unix line returns, mac line returns, and
windows.  Normalizing them into a consistent format fixed it.

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



Re: [PHP] PECL JSON package

2008-12-11 Thread Eric Butera
On Thu, Dec 11, 2008 at 5:43 AM, Phil Ewington - iModel
<[EMAIL PROTECTED]> wrote:
> Phil Ewington - iModel wrote:
>>
>> Hi All,
>>
>> I have just installed the PECL JSON package, or at least think I have!!
>> But how do I use it?? I was expecting /usr/share/pear/Services/JSON.php to
>> be found on my system for include but not so. My system tells me I have
>> 1.2.1 successfully installed but I cannot find any docs that tell me how to
>> make use of it. I am running PHP 5.1.6 at present.
>>
>> TIA
>>
>> Phil.
>>
> OK, seems I am confusing PECL and PEAR. Have now configured extension using
> phpize and enabled in php.ini.
>
> - Phil.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

If you're using the pecl version, it is json_encode().

If you're using the pear version you say
require_once 'Services/JSON.php';
$json = new Services_JSON();
$output = $json->encode($value);

If you're using php5, you should have json in the build unless it was
disabled for some reason.  If you're going to be using it a lot,
you're really going to want the speed of the c version.

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



Re: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-11 Thread Eric Butera
On Thu, Dec 11, 2008 at 9:56 AM, Terion Miller <[EMAIL PROTECTED]> wrote:
> Hey Everyone, I am wondering if using a framework such as one of these may
> make my life easier, which do any of you use and what has been your
> experience with the learning curve of them?
> I just put Cake on my local server, basically I want to know which is
> easiest? LOL...
> Terion
>

Define easiest.  What is it that you need to code?  If you mean cookie
cutter sites that have been done a million times with minimal
flexibility... :)  I'm in the same boat as you though.  I don't know
which one meets the needs I have the best.  There's stuff like cake
which is really easy to start up, then there's stuff like symphony
that will let you do anything, but you really have to work at it.

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



Re: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-11 Thread Eric Butera
On Thu, Dec 11, 2008 at 10:22 AM, Bastien Koert <[EMAIL PROTECTED]> wrote:
>
>
> On Thu, Dec 11, 2008 at 10:15 AM, Eric Butera <[EMAIL PROTECTED]> wrote:
>>
>> On Thu, Dec 11, 2008 at 9:56 AM, Terion Miller <[EMAIL PROTECTED]>
>> wrote:
>> > Hey Everyone, I am wondering if using a framework such as one of these
>> > may
>> > make my life easier, which do any of you use and what has been your
>> > experience with the learning curve of them?
>> > I just put Cake on my local server, basically I want to know which is
>> > easiest? LOL...
>> > Terion
>> >
>>
>> Define easiest.  What is it that you need to code?  If you mean cookie
>> cutter sites that have been done a million times with minimal
>> flexibility... :)  I'm in the same boat as you though.  I don't know
>> which one meets the needs I have the best.  There's stuff like cake
>> which is really easy to start up, then there's stuff like symphony
>> that will let you do anything, but you really have to work at it.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> There are definite learning curves when picking these up.
>
> symfony and ZF have the largest because they either do more (symfony) or are
> designed to be used piecemeal (ZF)
>
> CodeIgnitor is one of the easiest ones to start using with Cake not far
> behind
>
> --
>
> Bastien
>
> Cat, the other other white meat
>

One huge part of this that I didn't mention before is the community
around the frameworks too.  Do they have good docs, examples, stuff
like that.  Can you ask questions and get quality answers?

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



Re: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-11 Thread Eric Butera
On Thu, Dec 11, 2008 at 12:12 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> On Thu, Dec 11, 2008 at 8:25 AM, Eric Butera <[EMAIL PROTECTED]> wrote:
>>
>> On Thu, Dec 11, 2008 at 10:22 AM, Bastien Koert <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> > On Thu, Dec 11, 2008 at 10:15 AM, Eric Butera <[EMAIL PROTECTED]>
>> > wrote:
>> >>
>> >> On Thu, Dec 11, 2008 at 9:56 AM, Terion Miller
>> >> <[EMAIL PROTECTED]>
>> >> wrote:
>> >> > Hey Everyone, I am wondering if using a framework such as one of
>> >> > these
>> >> > may
>> >> > make my life easier, which do any of you use and what has been your
>> >> > experience with the learning curve of them?
>> >> > I just put Cake on my local server, basically I want to know which is
>> >> > easiest? LOL...
>> >> > Terion
>> >> >
>> >>
>> >> Define easiest.  What is it that you need to code?  If you mean cookie
>> >> cutter sites that have been done a million times with minimal
>> >> flexibility... :)  I'm in the same boat as you though.  I don't know
>> >> which one meets the needs I have the best.  There's stuff like cake
>> >> which is really easy to start up, then there's stuff like symphony
>> >> that will let you do anything, but you really have to work at it.
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >
>> > There are definite learning curves when picking these up.
>> >
>> > symfony and ZF have the largest because they either do more (symfony) or
>> > are
>> > designed to be used piecemeal (ZF)
>> >
>> > CodeIgnitor is one of the easiest ones to start using with Cake not far
>> > behind
>> >
>> > --
>> >
>> > Bastien
>> >
>> > Cat, the other other white meat
>> >
>>
>> One huge part of this that I didn't mention before is the community
>> around the frameworks too.  Do they have good docs, examples, stuff
>> like that.  Can you ask questions and get quality answers?
>
> i also take performance into consideration.  heres a comparison between some
> of the aforementioned frameworks,
>
> http://www.avnetlabs.com/php/php-framework-comparison-benchmarks
>
> -nathan
>
>

Here's another

http://www.yiiframework.com/performance/

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



Re: [PHP] Re: apache and PHP / Eclipse

2008-12-15 Thread Eric Butera
On Sun, Dec 14, 2008 at 10:33 AM, Nathan Rixham  wrote:
> Eduardo Vizcarra wrote:
>>
>> I am having a hard time trying to get some pages work. I have PHP 5.2.8,
>> Apache 2.2 and MySQL 5.1 running in a Windows Vista home edition. All
>> packages were installed, and configured, the strange thing is that pages
>> commonly work but when I add a new line (e.g. an echo line) with a dummy
>> text, Apache crashes and it is restarted
>>
>> I am using Eclipese europa to create the code
>>
>> e.g. I have this code and the page works:
>> include 'upper_pagina.php';
>> include 'forma.php';
>>  $link = mysql_connect("127.0.0.1","root","root");
>>  if (!$link)
>>  {
>>  echo "> bordercolor='FF'>\n";
>>  echo "\n";
>>  echo "\n";
>>  echo "La Base de datos no esta disponible en este momento.";
>>  echo "Disculpe las molestias, intente mas tarde";
>>  echo "\n";
>>  echo "\n";
>>  echo "\n";
>>  }
>>  mysql_select_db("estoydevacacionesdb") or die("No pudo seleccionarse la
>> BD.");
>>  $busquedasql1 = "select * from servicios";
>> include 'bottom_pagina.php';
>>
>> but if I add a new line   ($servicios1 = mysql_query($busquedasql1);)
>> before the last include line, apache crashes, it has been very hard for me
>> to identify what it is causing this problem
>>
>> any clue ?
>>
>> Regards
>> Eduardo
>
> also.. you may find it worth while to upgrade to the PDT 2.0 version of
> eclipse which uses ganymede and comes with the zend debugger, allowing you
> to test and debug you're code in eclipse.
>
> http://www.zend.com/en/community/pdt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I was playing with that last week at work.  It's quite buggy.

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



Re: [PHP] Create PHP form from MySQL table structure

2008-12-23 Thread Eric Butera
On Sun, Dec 21, 2008 at 5:35 AM, R B MacGregor
 wrote:
> Hi folks
>
> Anybody got any recommendations for a utility which would create a quick head
> start by creating the php/html code for a basic form using the field structure
> of a MySQL table ?
>
> Thanks for any suggestions.
>
> --
> Ronnie MacGregor
> Scotland
>
> Ronnie at
> dBASEdeveloper
> dot co dot uk
>
> www.dBASEdeveloper.co.uk
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

a lot of frameworks have scaffolding or crud screens they can make for
you to do this. (cake, akelos, yii, code igniter)

http://codeigniter.com/user_guide/general/scaffolding.html
http://book.cakephp.org/view/311/Scaffolding
http://www.yiiframework.com/doc/guide/quickstart.first-app#implementing-crud-operations

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



Re: [PHP] Re: Problem with fetching values...

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 7:57 AM, Michelle Konzack
 wrote:
> Am 2008-12-29 22:09:16, schrieb chris smith:
>> > So, PostgreSQL catch the array by "name"
>> >
>> >pg_fetch_array($db_query, null, PGSQL_ASSOC)
>> >
>> > and MySQL use the "position"
>> >
>> >mysql_fetch_array($db_query, MYSQL_NUM)
>>
>> Why?
>>
>> http://www.php.net/mysql_fetch_array
>>
>> Use MYSQL_ASSOC as the 2nd param, or leave it out and by default it
>> uses BOTH.
>
> Argh!!! Asshole !!! (me)  --  I have not seen the tree in the wood!
>
> Thanks, Greetings and nice Day/Evening
>Michelle Konzack
>Systemadministrator
>24V Electronic Engineer
>Tamay Dogan Network
>Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> # Debian GNU/Linux Consultant #
>    
> Michelle Konzack   Apt. 917  ICQ #328449886
> +49/177/935194750, rue de Soultz MSN LinuxMichi
> +33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)
>

FWIW you can also use mysql_fetch_assoc

http://us2.php.net/mysql_fetch_assoc

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



Re: [PHP] Need Help

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 2:39 PM, dlinden  wrote:
> I am getting this error and can't resolve;
>
> Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result,
> boolean given in /home5/camfulco/public_html/CompanyHome.php on line 132
>

I'm not going to read all 500 lines of that, but I'm seeing your error
says boolean given.  Maybe your query failed and is false instead of a
resource.

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



Re: [PHP] Need Help - apology

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 3:18 PM, John Corry  wrote:
>
> That was too heavy handed.
>
> I'm sorry. Please forgive my harshness.
>
> John
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Having a bad day at work? ;)

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



Re: [PHP] Architecture patterns in PHP

2008-12-30 Thread Eric Butera
On Tue, Dec 30, 2008 at 2:07 AM, Nathan Nobbe  wrote:
>> on 12/30/2008 01:13 AM Sancar Saran said the following:
>> > and please read this why
>> >
>> > http://talks.php.net/show/drupal08/0
> it also acts as a nice control mechanism to compare so many frameworks,
> trivial php, and html.  really nice to see the numbers like that; so cake is
> horrifically slow, solar & zend are pretty fast and code igniter is like
> twice as fast as those.

One thing I'd like to point out is that hello world might show the
overhead of putting something to screen, it doesn't touch the database
or any of the harder parts of a "real" app like sessions & acls.
Things quickly go downhill from there.

I saw these slides and started comparing my custom developed framework
vs most of the standard picks out there.  At first I was really
disappointed with myself after seeing my apache bench numbers suck.
Turns out when you actually start building an app mine wasn't nearly
as slow as I thought.  But on a simple hello world it fared pretty
pathetically because it ran a lot of other routines that I always use
in real apps, but not in hello world.

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



Re: [PHP] Architecture patterns in PHP

2008-12-30 Thread Eric Butera
On Tue, Dec 30, 2008 at 12:42 PM, Nathan Nobbe  wrote:
>
>
> On Tue, Dec 30, 2008 at 10:15 AM, Eric Butera  wrote:
>>
>> On Tue, Dec 30, 2008 at 2:07 AM, Nathan Nobbe 
>> wrote:
>> >> on 12/30/2008 01:13 AM Sancar Saran said the following:
>> >> > and please read this why
>> >> >
>> >> > http://talks.php.net/show/drupal08/0
>> > it also acts as a nice control mechanism to compare so many frameworks,
>> > trivial php, and html.  really nice to see the numbers like that; so
>> > cake is
>> > horrifically slow, solar & zend are pretty fast and code igniter is like
>> > twice as fast as those.
>>
>> One thing I'd like to point out is that hello world might show the
>> overhead of putting something to screen, it doesn't touch the database
>> or any of the harder parts of a "real" app like sessions & acls.
>> Things quickly go downhill from there.
>
> yeah, i dont think ive ever seen a real world app (more specifically an app
> from one of the companies ive worked at) that didnt hit the database on even
> the most simple of pages.
>
>>
>> I saw these slides and started comparing my custom developed framework
>> vs most of the standard picks out there.  At first I was really
>> disappointed with myself after seeing my apache bench numbers suck.
>> Turns out when you actually start building an app mine wasn't nearly
>> as slow as I thought.  But on a simple hello world it fared pretty
>> pathetically because it ran a lot of other routines that I always use
>> in real apps, but not in hello world.
>
> clearly there are other facets to compare, like a database layer would be
> nice to compare.  ci uses what they call active record, which basically
> means runtime introspection of the database.  im not sure how it works in
> cake or zend, but i know symphony has an abstraction layer which theyve
> already mapped propel and doctrine to.  lots of room for performance
> differences there no doubt.
>
> what i tend to think about when i see these numbers tho, is that if i were
> to ever build a company w/ a php app that was slated for growth, cake would
> be probly the last option on the list.  the differences arent so bad when
> you have a tiny website, but we've got 2000 servers at photobucket for
> example.  imagine how many servers you can save at that scale w/ a php
> framework that does its job and gets out of the way.
>
> i just happen to know another popular web company here in denver running on
> some hacked version of cake, and honestly, i feel sorry for them :D
>
> -nathan
>


I was following the blog tutorial on cake and here's what I got from
hitting the post/index page:

081230 12:51:55 316 Connect r...@localhost on
316 Init DB cake
316 Query   SHOW TABLES FROM `cake`
316 Query   DESCRIBE `posts`
316 Query   SELECT `Post`.`id`, `Post`.`title`,
`Post`.`body`, `Post`.`created`, `Post`.`modified` FROM `posts` AS
`Post`   WHERE 1 = 1
316 Quit

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



Re: [PHP] Architecture patterns in PHP

2008-12-30 Thread Eric Butera
On Tue, Dec 30, 2008 at 1:07 PM, Robert Cummings  wrote:
> On Tue, 2008-12-30 at 12:53 -0500, Eric Butera wrote:
>> On Tue, Dec 30, 2008 at 12:42 PM, Nathan Nobbe
>>
>> I was following the blog tutorial on cake and here's what I got from
>> hitting the post/index page:
>>
>> 081230 12:51:55   316 Connect r...@localhost on
>>   316 Init DB cake
>>   316 Query   SHOW TABLES FROM `cake`
>>   316 Query   DESCRIBE `posts`
>>   316 Query   SELECT `Post`.`id`, `Post`.`title`,
>> `Post`.`body`, `Post`.`created`, `Post`.`modified` FROM `posts` AS
>> `Post`   WHERE 1 = 1
>>   316 Quit
>
> A good framework will allow you to replace the introspection step with a
> static definition of the database table, thus easily bypassing the extra
> queries. Although, I can't fathom why they've requested all the tables.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>

To be fair cake did "cache" the show tables/describe magically for a
few seconds if I sat there refreshing the page. :)

I always generate my Gateways & VO's from table definitions &
hand-code any non-crud statements.  I've never really dealt with this
stuff before but it is a little disheartening.  I would rather take
the 5 minutes re-generating a few files for an updated table versus
infinite amounts of computer power wasted trying to just make it work.

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



Re: [PHP] Re: How to count transfered kBytes in File-Download

2009-01-03 Thread Eric Butera
On Sat, Jan 3, 2009 at 9:23 AM, Ashley Sheridan
 wrote:
> On Sat, 2009-01-03 at 13:27 +0100, Michelle Konzack wrote:
>> Good morning Jim,
>>
>> Thank your for your help, I will now adapt my scripts and test it.
>>
>> And if a user had done a partial download, how can I set the pointer  to
>> resume the download?  I personaly find websites offering  downloads  but
>> not resuming very annoying, so I like to do it better...  :-)
>>
>> I know I have to get a $_HTTP[''] header for  the  partial  request,
>> but which?  And then I have too seek fread() right?  But how?
>>
>> > Then here, do this...
>> >
>> > $current_size = 0;
>> > while ( !feof($HANDLER) ) {
>> > $current_size += $buffer;
>> > echo fread($HANDLE, $buffer);
>> > }
>> >
>> > Now, do what you want with $current_size
>> >
>> > Maybe have a variable that you check it against that contains the users
>> > allow amount of transfer...
>> >
>> > $current_size = 0;
>> > while ( !feof($HANDLER) && $current_size < $allowed_limit ) {
>> > $current_size += $buffer;
>> > echo fread($HANDLE, $buffer);
>> > }
>> >
>> > Hope this gets you leading down the right path...
>>
>> Yes.  :-)
>>
>> However, I do not want to break downloads...
>> So I check the $current_size AFTER each  completed  download  and  since
>> $USER can only download one file at once, it  should  work  without  any
>> problems.
>>
>> Thanks, Greetings and nice Day/Evening
>> Michelle Konzack
>> Systemadministrator
>> 24V Electronic Engineer
>> Tamay Dogan Network
>> Debian GNU/Linux Consultant
>>
>>
> I don't think this is actually possible. I've never seen it happen
> before. It would need some sort of dedicated client-side software to
> recognise exactly how much has been downloaded and then request the rest
> of it. A browser doesn't yet have this capability I believe.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


$_SERVER['HTTP_RANGE']

???

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



Re: [PHP] Re: Re: How to count transfered kBytes in File-Download

2009-01-03 Thread Eric Butera
On Sat, Jan 3, 2009 at 5:19 PM, Michelle Konzack
 wrote:
> Am 2009-01-03 10:16:43, schrieb Eric Butera:
>> On Sat, Jan 3, 2009 at 9:23 AM, Ashley Sheridan
>> > I don't think this is actually possible. I've never seen it happen
>> > before. It would need some sort of dedicated client-side software to
>> > recognise exactly how much has been downloaded and then request the rest
>> > of it. A browser doesn't yet have this capability I believe.
>
> "wget" and "curl" support resum broken download...
>
>> $_SERVER['HTTP_RANGE']
>>
>> ???
>
> Hmmm, what is the value of this VAR?
>
> The BYTE where to start?  If yes, how can I include this in my script?
>
> I mean, if I fread() I must skip this ammount of BYTES  and  then  start
> sending, but how to skip it?
>
> Or I am wrong with fread()?
>
> Thanks, Greetings and nice Day/Evening
>Michelle Konzack
>Systemadministrator
>24V Electronic Engineer
>Tamay Dogan Network
>Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> # Debian GNU/Linux Consultant #
> <http://www.tamay-dogan.net/>   <http://www.can4linux.org/>
> Michelle Konzack   Apt. 917  ICQ #328449886
> +49/177/935194750, rue de Soultz MSN LinuxMichi
> +33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)
>

I don't know how it works, just know of it.

Maybe I'm misunderstanding you, but are you looking for fseek?

http://us3.php.net/manual/en/function.fseek.php

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



Re: [PHP] Re: How to count transfered kBytes in File-Download

2009-01-04 Thread Eric Butera
On Sun, Jan 4, 2009 at 1:39 PM, Michelle Konzack
 wrote:
> Hi Jim...  ;-)
>
> The code:
>
> [ '/usr/share/tdphp-vserver/includes/02_functions.inc' ]
> function fncPushBinary($type='show', $file, $mime='') {
> 
>$BUFFER=1024;
>
>$HANDLER=fopen($file, r);
>
>$CUR_SIZE=0;
>while ( !feof($HANDLER) ) {
>  $CUR_SIZE+=$BUFFER;
>  echo fread($HANDLER, $BUFFER);
>}
>fclose($HANDLER);
>
>fncUserUpdate($user, 'downloads', $file, $CUR_SIZE, $FSIZE);
>exit();
> 
> }
>
> function fncUserUpdate($user, $type, $file, $cur_size, $file_size) {
>  echo "What The Hell Is Going On Here?\n";
>  $HANDLER=fopen('/tmp/fncUserUpdate.log', a);
>  $DATE=date("r");
>  fwrite($HANDLER, "$DATE   $user   $file   $cur_size   $file_size\n");
>  fclose($HANDLER);
> }
> 
>
> is working without any errors, but in my log I get every time:
>
> [ '/tmp/fncUserUpdate.log' ]
> Sun, 04 Jan 2009 18:48:51 +0100 dummy   
> /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
> Sun, 04 Jan 2009 18:49:44 +0100 dummy   
> /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
> Sun, 04 Jan 2009 18:53:22 +0100 dummy   
> /var/www/customers/konzack/CONFIG_musica.tamay-dogan.net/music/Iran/Arian_Band_-_Bi_To_Ba_To.jpg
> 
>
> which is a little bit weird, since I  have  downloaded  the  files  with
> 'wget' and interrupted the transfer.
>
> Speek, the $CUR_SIZE is always the filesize rounded up (1kByte) but  NOT
> the actual downloaded partial size, which is, what I want...
>
> Any sugestions?
>
> Thanks, Greetings and nice Day/Evening
>Michelle Konzack
>Systemadministrator
>24V Electronic Engineer
>Tamay Dogan Network
>Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> # Debian GNU/Linux Consultant #
>    
> Michelle Konzack   Apt. 917  ICQ #328449886
> +49/177/935194750, rue de Soultz MSN LinuxMichi
> +33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)
>


Maybe a combination of ignore_user_abort & connection_status will get
you what you need.  This way the user doesn't make the script die, but
you can keep checking to make sure the connection is active.  If not,
update that db and exit out.  I've never attempted anything like this,
so I don't really have any concrete answers for you.

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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-06 Thread Eric Butera
On Tue, Jan 6, 2009 at 10:43 AM, Dotan Cohen  wrote:
> 2009/1/5 Frank Stanovcak :
>> It's been a while since I've programed (VB was on version 4) I was wondering
>> if any one could tell me what the diff is between char, varchar, and text in
>> mysql.
>> I know this isn't a mysql news group, but since I am using php for the
>> interaction it seemed like the place to ask.  Thanks in advance, and have a
>> great day!
>>
>> Frank
>>
>
> http://justfuckinggoogleit.com/search?q=char+varchar+text+mysql
>
> --
> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
>
> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
> ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
> А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
> а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
> ä-ö-ü-ß-Ä-Ö-Ü
>

Nice :D


Re: [PHP] get file from object

2009-01-06 Thread Eric Butera
On Tue, Jan 6, 2009 at 3:20 PM, Jack Bates  wrote:
> How do I get the file where a class is defined, from an instance of that
> class?
What are you trying to do?

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



Re: [PHP] First steps towards unix and php

2009-01-08 Thread Eric Butera
On Thu, Jan 8, 2009 at 11:44 AM, Frank Stanovcak
 wrote:
> I've been a microshaft punk for some time now, and am just getting ready to
> try to step over to unix on one of my own boxes.
>
> Does anyone have any suggestions on which flavor would be a good idea to
> start with?  I'm looking mostly for compatibility with php, mysql, and other
> web based programming languages.
>
> Thanks in advance!
>
> Frank
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I use Ubuntu and love it.  I want to use the computer, not have to
waste my time compiling crap, figuring out dependencies, whatever.  It
recognized all of my hardware and was a breeze to set up.  So far I've
been able to do everything with it that I've need to as far as lamp
development goes.

Setting it up as a dev box is really easy too with apt-get.  Basically
you install apache2, php & mysql and it just works.  Plus if you get
stuck there's a ton of help with google search & ubuntu forums.

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



Re: [PHP] Re: hello - thread on topic or not?

2009-01-09 Thread Eric Butera
On Thu, Jan 8, 2009 at 7:21 PM, Mattias Thorslund  wrote:
> I thought this was the PHP list, not the OS vs. OS list?
>
> Is this type of discussion now considered OK here? I recall people getting
> flamed for borderline off-topic posts even, just a few years ago.
>
> Mattias

:(

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



Re: [PHP] Re: First steps towards unix and php

2009-01-09 Thread Eric Butera
On Thu, Jan 8, 2009 at 6:14 PM, Ross McKay  wrote:
> On Thu, 8 Jan 2009 11:44:48 -0500, Frank Stanovcak wrote:
>
>>I've been a microshaft punk for some time now, and am just getting ready to
>>try to step over to unix on one of my own boxes.
>>
>>Does anyone have any suggestions on which flavor would be a good idea to
>>start with?  I'm looking mostly for compatibility with php, mysql, and other
>>web based programming languages.
>
> What Nathan said, test each candidate in a VM like VirtualBox to see
> which you might be comfortable in. Then pick Fedora :)
>
> Seriously, any of the major distros (or their derivatives) would be
> good, as they take care of the build dependencies for you via packaging
> systems. Check them out here:
>
> http://distrowatch.com/dwres.php?resource=major
>
> Picking a desktop is harder, especially coming from a Windows world.
> Linux has a great many desktops, each with advantages and disadvantages.
> Many distros allow you to easily switch between at least KDE and GNOME,
> maybe even XFCE. A tiny distro called DSL-N (damned small linux NOT)
> allows you to boot up in several of the lighter desktops to check them
> out. Realise that you can pick a GNOME or KDE desktop and still run apps
> made to suit one of the others, with maybe just some minor integration
> glitches; I run GNOME and use a number of KDE programs just fine.
>
> You should also check out editors and IDEs - STFW for previous posts
> made to this and other groups. Then pick Geany ;)
>
> And don't forget to add a revision control system, e.g. Subversion.
> --
> Ross McKay, Toronto, NSW Australia
> "Let the laddie play wi the knife - he'll learn"
> - The Wee Book of Calvin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I've tried Fedora & Suse before.  Fedora was a pain for me because it
didn't auto mount my windows partition.  It also did not come with any
easy way to do so or to play media.  I know Ubuntu doesn't come with
the ability to play mp3's out of the box, but it was quite easier to
get going.  But my experience has been anything but Ubuntu gave me a
lot of fight, and that isn't what I need when I'm supposed to be
working. ;)

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



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 12:22 PM, Wolf  wrote:
>
>  Gary  wrote:
>> I've done a number of sites in html and am now venturing into php.
>>
>> Can I create a page in html and insert php code that will work? (for
>> example, take an existing page and insert a date command)
> Yup

Um... if the file ext is .html and php isn't set to run that then nope.

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



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 12:18 PM, Gary  wrote:
> Can I create a page with the php extension that contains only contains html
> and no php?  If so are there advantages/disadvantages?
>
> Can I mix and match file formats (php/html) in a single site?

If it were me, I'd make sure all the files were .php.  If you have a
page right now that is static, but needs to become dynamic, then
you're in for some hurt.  Never create 404's.  You can of course do a
301 redirect to indicate the html has moved to php, but that is really
annoying.  The best solution though is to not have any file extensions
on your urls to begin with.  That is out of the scope of this email
though.

You can force php to run .html files, but then you've just really
killed the performance of your web host.  Servers are really fast at
serving static files, but the second you load php, even to just do a
 you've slashed your maximum requests per
second significantly.

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



Re: [PHP] Editing in a text area field

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 2:38 PM,   wrote:
> Rule #1.
> Never, ever, ever, alter the user's input, EXCEPT for sanitizing/filtering.

Probably shouldn't recommend sanitizing then.  Only validate & reject. :P

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



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 3:22 PM,   wrote:
>
> The slowdown of just running raw HTML through PHP was once benchmarked as 
> about 5 to 10 %.
>
> You could, in theory, use .htaccess and  to ForceType specific .html 
> files as PHP, while leaving the rest of your .html files as static.
>
> I am not recommending this, just being pedantic. :-)
>
> Definitely better to either do them all and take performance hit, which is 
> probably irrelevant to a beginner, or plan better now and strip .xyz from the 
> URLs.
>
> ymmv.
>
> Personally, I've been quite happy for over a decade running all .html through 
> PHP, on 99% of the sites I work on.
>
> If it's big enough to *need* static content, they usually have already gone 
> the route of CDN and have static HTML off on those nodes anyway, in my 
> limited experience.

I was just talking myself.  I use objects and such so I'm really not
as worried about performance either.  But it was a "downside" that I
knew about from some css/js stuff I'd done a while ago.  I still had 2
files on my box from some framework stuff I'd been messing with.  Here
were some results from my local testing (from the Yii framework).


-- index.html --
$ cat index.html
hello world

$ ab -t 30 -c 50 http://localhost/benchmarks/baseline/index.html
Requests per second:631.07 [#/sec] (mean)
Time per request:   79.23 [ms] (mean)
Time per request:   1.58 [ms] (mean, across all concurrent requests)


-- index.php --
$ cat index.php


$ ab -t 30 -c 50 http://localhost/benchmarks/baseline/index.php
Requests per second:358.21 [#/sec] (mean)
Time per request:   139.58 [ms] (mean)
Time per request:   2.79 [ms] (mean, across all concurrent requests)

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



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 4:45 PM,   wrote:
>
> With all due respect, Eric, you're not testing what we're discussing.
>
> A "real" CLI test would be more like:
>
> time cat foo.html
> time php -q foo.html
>
> I.E., how long does PHP take to read/write foo.html without breaking into PHP 
> "mode" for static HTML.
>
> Of course, it's still a lousy benchmark with CLI instead of Apache wrapper, 
> but you get my point, I trust.
>
> Q: How much slower is it to force all static .html files through PHP wrapper 
> of Apache?
> A: About 5 to 10 % (as of a couple years ago...)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

In my original post I was talking about the time it takes to run the
full apache-php whatever cycle vs just apache.  I wasn't trying to do
a cli test.  I use mod php which runs them based on file extension, so
I used ab w/ 2 different files.  I'm not trying to be difficult (for
once ;), I just don't follow what you're talking about?

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



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Eric Butera
On Fri, Jan 9, 2009 at 5:53 PM,   wrote:
>
> I'm talking about having PHP rip through .html files without any
> 
> inside of them.
>
> You added 
>
> Don't do that. :-)
>
> ln -s foo.html foo.php
>
> Surf to both and time it.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Is this better?

$ cat hello-world.html
Hello World

$ ab -c 50 -t 30 http://localhost/benchmarks/hello-world.html
Requests per second:4030.52 [#/sec] (mean)
Time per request:   12.405 [ms] (mean)
Time per request:   0.248 [ms] (mean, across all concurrent requests)

Requests per second:4730.00 [#/sec] (mean)
Time per request:   10.571 [ms] (mean)
Time per request:   0.211 [ms] (mean, across all concurrent requests)
Transfer rate:  1529.37 [Kbytes/sec] received

Requests per second:4866.09 [#/sec] (mean)
Time per request:   10.275 [ms] (mean)
Time per request:   0.206 [ms] (mean, across all concurrent requests)
Transfer rate:  1573.24 [Kbytes/sec] received

Requests per second:4313.09 [#/sec] (mean)
Time per request:   11.593 [ms] (mean)
Time per request:   0.232 [ms] (mean, across all concurrent requests)
Transfer rate:  1394.62 [Kbytes/sec] received

$ mv hello-world.php hello-world.html

$ ab -c 50 -t 30 http://localhost/benchmarks/hello-world.php
Requests per second:2649.66 [#/sec] (mean)
Time per request:   18.870 [ms] (mean)
Time per request:   0.377 [ms] (mean, across all concurrent requests)
Transfer rate:  685.87 [Kbytes/sec] received

Requests per second:2774.03 [#/sec] (mean)
Time per request:   18.024 [ms] (mean)
Time per request:   0.360 [ms] (mean, across all concurrent requests)
Transfer rate:  718.05 [Kbytes/sec] received

Requests per second:2722.94 [#/sec] (mean)
Time per request:   18.363 [ms] (mean)
Time per request:   0.367 [ms] (mean, across all concurrent requests)
Transfer rate:  704.79 [Kbytes/sec] received

Requests per second:2769.77 [#/sec] (mean)
Time per request:   18.052 [ms] (mean)
Time per request:   0.361 [ms] (mean, across all concurrent requests)
Transfer rate:  717.00 [Kbytes/sec] received

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



Re: [PHP] Unique Object Instance ID..?

2009-01-10 Thread Eric Butera
On Sat, Jan 10, 2009 at 6:31 PM, Nathan Rixham  wrote:
> Evening All,
>
> Not too often I ask a question here, but here goes;
>
> I'm making an "Object" class which all of my other classes extend, and I
> need each instance to have it's own unique id, seemed simple but it's harder
> than I thought (the difficulty is when it comes to deciding the syntax).
>
> so far each object has an OBJECT_ID which is a simple static incremented
> integer representing the instance of the object, here's a simplified
> example:
>
> abstract class Object {
>
>  private static $INSTANCES = 0;
>  private $OBJECT_ID = 0;
>
>  public function __construct()
>  {
>$this->OBJECT_ID = ++self::$INSTANCES;
>  }
>
> }
>
> Now back to the problem, I also need the object to have
> private $UNIQUE_ID;
>
> this unique_id needs to have:
> timestamp
> classname
> object_id
>
> combining the three makes a unique id; but it's only unique to that session,
> no good for a real world application as there could be 50 sessions all
> running at the same time on the server; and odds are rather high that two
> instances of the object could have the same id. Thus an extra completely
> unique identified needs added to the three values above.
>
> I'd thought a simple random integer would possibly be enough (combined with
> the timestamp), but there could still be collission.
>
> so the best I've got so far is:
>  [OBJECT_ID:private] => 3
>  [UNIQUE_ID:private] => instance://1231629...@testobject.3:97739
> timestamp @ class . instance : randomInteger
>
> all I need is a completely unique id for each object instance that can never
> be repeated at any time, even in a multiserver environment (and without
> using any kind of incremented value from a db table or third party app)
>
> thoughts, ideas, recommendations?
>
> regards!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I was going to say uuid, but maybe SplObjectStorage might be of some help.

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



Re: [PHP] Editing in a text area field

2009-01-10 Thread Eric Butera
On Sat, Jan 10, 2009 at 8:51 PM, Murray  wrote:
> Interesting, I've never seen this presented as an issue of ethics before. I
> think I can see your point, but I'd suggest that there's an interplay of
> ethical obligations between a user and the host / creator of an application
> in which perhaps the user should or in many cases has to accept a
> de-prioritised ethical consideration.
>
> For example, I would guess that a user doesn't have the right to expect an
> application to perform exactly to his or her expectations, regardless of
> what they might be. So, I wouldn't consider myself ethically obligated to
> work out how to accept 3gb of text from a POSTed form without truncating /
> modifying that text due to practical limitations of my application. (not
> suggesting this is a possible real-world example).
>
> But still, an interesting observation!
>
> M is for Murray
>
>
> On Sat, Jan 10, 2009 at 6:36 AM, Daniel Brown  wrote:
>
>>Well, of course you have the _right_ to do it --- as long as it's
>> legal, and it's not something that *requires* the data to remain
>> unaltered, you have the right to do manipulate it however you want.
>> The question comes down to ethics and in predicting the preferences of
>> the user.
>>
>

I don't see any problem with accepting html/xhtml/xml in an input
area.  I do it all the time with FCKEditor.  You can argue that it is
nice because you can use things like htmlpurifier to keep it sane
while also not having to invent weird things to give the input
structure/looks.  Also being able to parse it with
simplexml/domdocument is useful too in a lot of cases.

One easy way to get around the problem with "modifying" the user
input, just give the user a preview of what you've done.  They can
then decide whether or not it is acceptable.

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



Re: [PHP] Editing in a text area field

2009-01-11 Thread Eric Butera
On Sun, Jan 11, 2009 at 8:50 AM, tedd  wrote:
> At 11:12 AM +1100 1/11/09, Ross McKay wrote:
>>
>> With a little cooperation from the client, and a properly configured
>> TinyMCE, you can fairly easily limit what HTML tags they use.
>
> Yes, when you have intelligent and cooperative clients -- have any to spare?
>
>>  You can
>> then provide a set of CSS classes for specific styles used within the
>> site, and tell TinyMCE about those classes so that the user can make use
>> of them (via the Styles drop-down).
>
> That's a good idea -- I like that.
>

In my FCKEditor installs I use the style.xml to define h1, h2, h3, h4
as headers so in the markup the client only gets to inject header tags
& p tags.

Unfortunately I have the same problems of pasting from Word/Apple apps
too.  Yes, that's right.  Copy something from Mail.app and it is
filled with apple span style crap.  The paste from word routine only
works if they click a special button and make sure to paste into that,
which of course nobody does.

I tried using tidy to clean up some of that stuff but it was giving me
even more problems.  I enjoyed having valid docs with all the crap
ripped out, but I use my editor blocks on lots of different parts of
the site, so having it remove/combine style tags was really annoying.
I'd really like to revisit this problem again, but unfortunately I've
got other more pressing issues so this always seems to fall to the
back burner.

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



Re: [PHP] String variable

2009-01-11 Thread Eric Butera
On Sun, Jan 11, 2009 at 8:59 AM, MikeP  wrote:
> Hello,
> I am trying yo get THIS:
> where ref_id = '1234'
> from this.
> $where="where ref_id="."'$Reference[$x][ref_id]'";
>
> but i certainly have a quote problem.
>
> Any help?
> Thanks
> Mike
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Looks like you're missing the single tics around ref_id.  In your
example you'd want one of these:

$where="where ref_id="."'{$Reference[$x]['ref_id']}";
$where="where ref_id="."$Reference[$x]['ref_id'];
$where=sprintf("where ref_id=%d", (int)$Reference[$x]['ref_id']); <--
use this one or else! (sql injection)

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



Re: [PHP] Couple of beginner questions

2009-01-11 Thread Eric Butera
On Sun, Jan 11, 2009 at 10:36 AM, Ashley Sheridan
 wrote:
> echo "http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Couple of beginner questions

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 10:16 AM,   wrote:
>
>> $ mv hello-world.php hello-world.html
>
> Isn't this backwards?...
>
> :-)
>
> 39% seems awfully high overhead for what is essentially an extra readfile.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yea, but it's still the same file.  I just copied the wrong line.

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



Re: [PHP] Editing in a text area field

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 10:42 AM,   wrote:
>
> Google for BBCode.
>
> It's just str_replace(array('[b]','[/b]'),array('',''),$text) in the 
> end.
>
> And it's not really going to be any better than just letting them type  
> and  if that is needed.
>
> Your sanitization process will be the same no matter what, and will have the 
> same flaws/risks either way.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Just to add to the discussion:

http://kore-nordmann.de/blog/why_are_you_using_bbcodes.html

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



Re: [PHP] RSS feeder in PHP5?

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 11:02 AM,   wrote:
>
>> You actually mean application/xml not text/xml
>
> That depends on if you want the Userland RSS standard or the Other [blanking 
> on name] RSS standard.
>
> Unfortunately, the RSS camps are still at war over syntax and required 
> elements, and there are 9 mutually-incompatible often-used versions of the 
> RSS standard over the years, with TWO current 2.0 "standards"
>
> You have to try to hit the lowest common denominator and test in many RSS 
> clients/readers.
>
> PITA.
>
> Like early browser days, really...
>
> Sigh.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

But I thought it was really simple? ;D

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



Re: [PHP] Data trasfer between PHP pages

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:03 PM, Ashley Sheridan
 wrote:
> I tend to use $_REQUEST to capture a lot of my data, as I end up mixing
> get and post a lot throughout my code. $_REQUEST is an amalgamate of
> $_COOKIE, $_GET and $_POST (in that order I believe, with $_GET
> overwritting $_COOKIE, and $_POST overwriting $_GET). This is especially
> useful when altering how a form sends data. Only today we had to update
> a form to use GET instead of POST, as IE managed to break the back
> button because of the POST values not auto-submitting. It would have
> meant a lot of code changes had $_REQUEST not been used.

It's okay if you want to do such things, but I really wouldn't
recommend it.  It leads to buggy apps (from almost every example I've
ever seen).  Most code I've seen using $_REQUEST doesn't validate it
either which would be the loophole to it.  Any app allowing user input
should function no matter where it comes from or what it is, but still
why not be very clear about it.

GET is for the state of the page & POST is for data.  So you really
shouldn't mix the two concepts.  If I need to display a form based on
an id I might have a url that looks like /form.php?id=x which
indicates I'm working with id x and it will make the post action also
have id=x in the query string since it is the resource I'm working on,
not the data.  That save page will still technically have a GET & POST
mixed, but they're two totally different things.

You can fix IE back button problems with the PRG pattern [1].  It's
kind of lame but I got over that after not having to see page expired
anymore.

[1] http://en.wikipedia.org/wiki/Post/Redirect/Get

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



Re: [PHP] Data trasfer between PHP pages

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:21 PM, Robert Cummings  wrote:
> On Mon, 2009-01-12 at 15:15 -0500, Eric Butera wrote:
>> On Mon, Jan 12, 2009 at 3:03 PM, Ashley Sheridan
>>  wrote:
>> > I tend to use $_REQUEST to capture a lot of my data, as I end up mixing
>> > get and post a lot throughout my code. $_REQUEST is an amalgamate of
>> > $_COOKIE, $_GET and $_POST (in that order I believe, with $_GET
>> > overwritting $_COOKIE, and $_POST overwriting $_GET). This is especially
>> > useful when altering how a form sends data. Only today we had to update
>> > a form to use GET instead of POST, as IE managed to break the back
>> > button because of the POST values not auto-submitting. It would have
>> > meant a lot of code changes had $_REQUEST not been used.
>>
>> It's okay if you want to do such things, but I really wouldn't
>> recommend it.  It leads to buggy apps (from almost every example I've
>> ever seen).  Most code I've seen using $_REQUEST doesn't validate it
>> either which would be the loophole to it.  Any app allowing user input
>> should function no matter where it comes from or what it is, but still
>> why not be very clear about it.
>>
>> GET is for the state of the page & POST is for data.  So you really
>> shouldn't mix the two concepts.
>
> Most systems using a front-end loader to get to a page containing a form
> wouldn't work if you DIDN'T mix the two concepts.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

I use MVC w/ front controllers all the time.  I dunno what you're
talking about though so hopefully you can elaborate more.

demo_form would accept GET id=1
demo_save would accept GET id=1 and POST name, description, etc

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



Re: [PHP] switch vs elseif

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
 wrote:
> I've googled, and found some confusing answers.
> I've tried searching the history of the news group, and only found info on
> switch or elseif seperately.  :(
>
> Strictly from a performance stand point, not preference or anything else, is
> there a benefit of one over the other?
>
>
> for($i=0;$i<3;$i++){
>switch($i){
>case 0:
>header pg1 code
>break;
>case 1:
>header pg2 code
>break;
>case 3:
>header pg3 code
>break;
>};
> };
>
>
> or would that be better served using an if...elseif structure?
>
> Frank
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

This might be of interest in answering your question:

http://www.suspekt.org/switchtable/

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



Re: [PHP] Data trasfer between PHP pages

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:34 PM, Robert Cummings  wrote:
> On Mon, 2009-01-12 at 15:29 -0500, Eric Butera wrote:
>> On Mon, Jan 12, 2009 at 3:21 PM, Robert Cummings  
>> wrote:
>> > On Mon, 2009-01-12 at 15:15 -0500, Eric Butera wrote:
>> >> On Mon, Jan 12, 2009 at 3:03 PM, Ashley Sheridan
>> >>  wrote:
>> >> > I tend to use $_REQUEST to capture a lot of my data, as I end up mixing
>> >> > get and post a lot throughout my code. $_REQUEST is an amalgamate of
>> >> > $_COOKIE, $_GET and $_POST (in that order I believe, with $_GET
>> >> > overwritting $_COOKIE, and $_POST overwriting $_GET). This is especially
>> >> > useful when altering how a form sends data. Only today we had to update
>> >> > a form to use GET instead of POST, as IE managed to break the back
>> >> > button because of the POST values not auto-submitting. It would have
>> >> > meant a lot of code changes had $_REQUEST not been used.
>> >>
>> >> It's okay if you want to do such things, but I really wouldn't
>> >> recommend it.  It leads to buggy apps (from almost every example I've
>> >> ever seen).  Most code I've seen using $_REQUEST doesn't validate it
>> >> either which would be the loophole to it.  Any app allowing user input
>> >> should function no matter where it comes from or what it is, but still
>> >> why not be very clear about it.
>> >>
>> >> GET is for the state of the page & POST is for data.  So you really
>> >> shouldn't mix the two concepts.
>> >
>> > Most systems using a front-end loader to get to a page containing a form
>> > wouldn't work if you DIDN'T mix the two concepts.
>> >
>> > Cheers,
>> > Rob.
>> > --
>> > http://www.interjinn.com
>> > Application and Templating Framework for PHP
>> >
>> >
>>
>> I use MVC w/ front controllers all the time.  I dunno what you're
>> talking about though so hopefully you can elaborate more.
>>
>> demo_form would accept GET id=1
>> demo_save would accept GET id=1 and POST name, description, etc
>
> Front end controller usually receives a GET variable indicating what
> page or content is being requested... add a form with POSTed data and
> you need to mix GET and POST. unless you go through the hoops of putting
> the front end loader information into the form. There's absolutely
> nothing wrong with mixing GET and POST as long as you know what you're
> doing.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

Yep.  I guess I was just trying to define what knowing what I'm doing
meant.  My url might have id=1 in it, but that is the only thing.  On
a post page I still need that id=1 in the url because it has to know
what record to update.  Some could argue to throw that in the form
itself, I used to even, but over time it has just made more sense for
it to be in the url since it defines what page/record you're working
with.

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



Re: [PHP] switch vs elseif

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:58 PM, Frank Stanovcak
 wrote:
>
> ""Eric Butera""  wrote in message
> news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
>> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
>>  wrote:
>>> I've googled, and found some confusing answers.
>>> I've tried searching the history of the news group, and only found info
>>> on
>>> switch or elseif seperately.  :(
>>>
>>> Strictly from a performance stand point, not preference or anything else,
>>> is
>>> there a benefit of one over the other?
>>>
>>>
>>> for($i=0;$i<3;$i++){
>>>switch($i){
>>>case 0:
>>>header pg1 code
>>>break;
>>>case 1:
>>>header pg2 code
>>>break;
>>>case 3:
>>>header pg3 code
>>>break;
>>>};
>>> };
>>>
>>>
>>> or would that be better served using an if...elseif structure?
>>>
>>> Frank
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> This might be of interest in answering your question:
>>
>> http://www.suspekt.org/switchtable/
>
> Wow...so if I read that right.  the only difference in the root code of PHP
> is that the pre compiled code is easier to read.  PHP actually generates the
> If...elseif...elseif... structure any way when it compiles the script.
>
> ewww.
>
> Frank.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yea I was bummed out to hear that too because I had heard switch was
faster.  Oh well. :)

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



Re: [PHP] switch vs elseif -- switchtable

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 4:00 PM, Daevid Vincent  wrote:
> On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote:
>
>> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
>>  wrote:
>> > I've googled, and found some confusing answers.
>> > I've tried searching the history of the news group, and only found info on
>> > switch or elseif seperately.  :(
>> >
>> > Strictly from a performance stand point, not preference or anything else, 
>> > is
>> > there a benefit of one over the other?
>> >
>> >
>> > for($i=0;$i<3;$i++){
>> >switch($i){
>> >case 0:
>> >header pg1 code
>> >break;
>> >case 1:
>> >header pg2 code
>> >break;
>> >case 3:
>> >header pg3 code
>> >break;
>> >};
>> > };
>> >
>> >
>> > or would that be better served using an if...elseif structure?
>> >
>> > Frank
>
>
>
>> This might be of interest in answering your question:
>>
>> http://www.suspekt.org/switchtable/
>
>
> How do I install this? The page and .tgz both give no instructions?!
>
> Are there any benchmarks to show speed comparisons?
>
> Also, is there any plans to have this patch/extension incorporated into
> the real PHP trunk?
>
> Daevid.
> http://daevid.com
>

Hi Daevid,

Someone wrote a quick bench on this url:
http://www.suspekt.org/2008/07/31/switch-table-extension/

As for all your other questions, you'll have to contact the author.  I
just thought it applied to this thread.

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



Re: [PHP] Data trasfer between PHP pages

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 4:18 PM, tedd  wrote:
> At 8:03 PM + 1/12/09, Ashley Sheridan wrote:
>>
>> I tend to use $_REQUEST to capture a lot of my data, as I end up mixing
>> get and post a lot throughout my code. $_REQUEST is an amalgamate of
>> $_COOKIE, $_GET and $_POST (in that order I believe, with $_GET
>> overwritting $_COOKIE, and $_POST overwriting $_GET). This is especially
>> useful when altering how a form sends data. Only today we had to update
>> a form to use GET instead of POST, as IE managed to break the back
>> button because of the POST values not auto-submitting. It would have
>> meant a lot of code changes had $_REQUEST not been used.
>>
>>
>> Ash
>> www.ashleysheridan.co.uk
>
> Arr.
>
> I was thinking you were up there with the PHP greats until you said that.
>  :-0
>
> I never use requests -- you simply don't know where the data is coming from
> and that presents a possible security risk as well as confusion if you have
> to review/trouble-shoot the code later.
>
> Am I wrong?
>
> 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
>
>

I can just as easily make firefox/curl send data via cookie or post as
a get.  It's how you validate it that is the most important (security
wise).

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



Re: [PHP] Couple of beginner questions

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 4:17 PM, Robert Cummings  wrote:
> On Mon, 2009-01-12 at 16:02 -0500, tedd wrote:
>>
>> True, css does not allow numeric classes (like sessions). But, I
>> never need them anyway.
>>
>> As I provided before:
>>
>> http://webbytedd.com/b/color-rows/
>>
>> this is my solution for alternating row style.
>
> 
>abc
>abc
>abc
> 
>
> That's just wasteful... Here's better:
>
> 
>abc
>abc
>abc
> 
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You guys with your clever bit-shifting.  :)

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



Re: [PHP] HowTo use Eclipse PDT and existing mounted directory tree?

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 8:13 PM, Daevid Vincent  wrote:
> I must be retarded or something because I can't figure out in Eclipse
> PDT (Linux) how in the heck do I start a new project and have it "point"
> to an existing directory tree.
>
> I DO NOT want Eclipse to pull in a copy of the files or do anything
> wacky like that. I simply want it to look at a mount point (sshfs)
> directory and use the files that exist there already. These are served
> up via apache on a dedicated development server, so obviously I want to
> change them and not a 'local copy'.
>
> The files are physically in /var/www/vincentd/ on the dev box but are
> in /home/vincentd/mydev/ on my local Ubuntu as a share. Or in other
> words... localhost:/home/vincentd/pse02 ->
> development:/var/www/vincentd/
>
> I've Googled around and can't seem to find the right words to get an
> answer to what would seem an obvious task.
>
> D.Vin
> http://daevid.com
>
>

There's a checkbox near the project name.  Can't remember what it's
called, but it lets you use a different workspace location.  Try that.

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



Re: [PHP] HowTo use Eclipse PDT and existing mounted directory tree?

2009-01-13 Thread Eric Butera
On Mon, Jan 12, 2009 at 8:51 PM, Eric Butera  wrote:
> On Mon, Jan 12, 2009 at 8:13 PM, Daevid Vincent  wrote:
>> I must be retarded or something because I can't figure out in Eclipse
>> PDT (Linux) how in the heck do I start a new project and have it "point"
>> to an existing directory tree.
>>
>> I DO NOT want Eclipse to pull in a copy of the files or do anything
>> wacky like that. I simply want it to look at a mount point (sshfs)
>> directory and use the files that exist there already. These are served
>> up via apache on a dedicated development server, so obviously I want to
>> change them and not a 'local copy'.
>>
>> The files are physically in /var/www/vincentd/ on the dev box but are
>> in /home/vincentd/mydev/ on my local Ubuntu as a share. Or in other
>> words... localhost:/home/vincentd/pse02 ->
>> development:/var/www/vincentd/
>>
>> I've Googled around and can't seem to find the right words to get an
>> answer to what would seem an obvious task.
>>
>> D.Vin
>> http://daevid.com
>>
>>
>
> There's a checkbox near the project name.  Can't remember what it's
> called, but it lets you use a different workspace location.  Try that.
>

The checkbox is labeled "Use Default" under the "Project Contents" group.

If all of your sites are in this share and you'll use it each time, I
would recommend changing your default workspace location.  On my local
ubuntu I change it to /home/eric/Sites.

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



Re: [PHP] switch vs elseif

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 9:50 AM, Jochem Maas  wrote:
> switch (true) {
>case ($x === $y):
>// something
>break;
>
>case ($a != $b):
>// something
>break;
>
>case (myFunc()):
>// something
>break;
>
>case ($my->getChild()->hasEatenBeans()):
>// something
>break;
> }
>
> evil ... but it works.
>
> PS - hi, people happy new year (or whatever)

You too!

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



Re: [PHP] Re: RewriteRules

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim  wrote:
>
> On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote:
>
>> On Tue, 2009-01-13 at 09:33 -0500, tedd wrote:
>>>
>>> At 2:33 PM + 1/13/09, Ashley Sheridan wrote:

 On Tue, 2009-01-13 at 09:20 -0500, tedd wrote:
>
>  Jason:
>
>  In addition to what everyone else has said, try this:
>
>  $self = basename($_SERVER['SCRIPT_NAME'])
>
>  I use it for forms -- you might find it useful.
>
>  Cheers,
>
>  tedd
>  --
>  ---
>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>
 No need to use it on forms, as leaving the action attribute empty means
 the form sends to itself anyway.

 Ash
>>>
>>>
>>> Ash:
>>>
>>> That's what I've said for years, but (I think it was on this list,
>>> but too lazy to look) there was a concern that some browsers may not
>>> follow that default behavior.
>>>
>>> However, using what I provided will work regardless.
>>>
>>> Cheers,
>>>
>>> tedd
>>>
>>> --
>>> ---
>>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>>
>> I've not yet seen a browser that doesn't do this, and it's pretty old
>> HTML really, so I don't see a reason why any new browsers wouldn't
>> incorporate it.
>
> I prefer to be specific in my programming :)
>
> What I typically do with self submitting forms is:
>  $self = $_SERVER['PHP_SELF'];
>
>
> echo <<
> ...
>
> 
> HTML;
> ?>
>
> But to each his (Or her) own right?
>
>
> --
> Jason Pruim
> japr...@raoset.com
> 616.399.2355
>
>
>
>

You know that's asking for xss, right?

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



Re: [PHP] Re: RewriteRules

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 1:32 PM, Jason Pruim  wrote:
>
> On Jan 13, 2009, at 1:29 PM, Eric Butera wrote:
>
> On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim  wrote:
>
> On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote:
>
> On Tue, 2009-01-13 at 09:33 -0500, tedd wrote:
>
> At 2:33 PM + 1/13/09, Ashley Sheridan wrote:
>
> On Tue, 2009-01-13 at 09:20 -0500, tedd wrote:
>
>  Jason:
>  In addition to what everyone else has said, try this:
>  $self = basename($_SERVER['SCRIPT_NAME'])
>  I use it for forms -- you might find it useful.
>  Cheers,
>  tedd
>  --
>  ---
>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> No need to use it on forms, as leaving the action attribute empty means
> the form sends to itself anyway.
> Ash
>
> Ash:
> That's what I've said for years, but (I think it was on this list,
> but too lazy to look) there was a concern that some browsers may not
> follow that default behavior.
> However, using what I provided will work regardless.
> Cheers,
> tedd
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> I've not yet seen a browser that doesn't do this, and it's pretty old
> HTML really, so I don't see a reason why any new browsers wouldn't
> incorporate it.
>
> I prefer to be specific in my programming :)
> What I typically do with self submitting forms is:
>  $self = $_SERVER['PHP_SELF'];
>
> echo <<
> ...
> 
> HTML;
> ?>
> But to each his (Or her) own right?
>
> --
> Jason Pruim
> japr...@raoset.com
> 616.399.2355
>
>
>
>
> You know that's asking for xss, right?
>
> Not until just now But I'll be looking into that and changing it to
> something more secure very shortly.
> --
> Jason Pruim
> japr...@raoset.com
> 616.399.2355
>
>
>

This might help:
http://www.thespanner.co.uk/2008/01/14/exploiting-php-self/

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



Re: [PHP] Suggestions?

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 2:00 PM, Dan Shirah  wrote:
> Hello all!
>
> I have written some code that will calculate all static and floating
> holidays.
>
> I have also written some code that will act as a business day counter.
>
> My application currently determines a set number of business days to count.
> (2 business days and 7 business days from today)
>
> This part works great and gives the results I want.
>
> What I need to do is tie in my pre dertermined static and floating holidays
> and factor those into the busniess day counter.
>
> I was thinking of putting the holidays into an array and then doing a check
> to determine if any date in the array equaled today's date through the
> ending date.
>
> But I'm drawing a blank on how to create the array.
>
> // Create an empty array
> $holidays = array();
>
> But then how do I put each holiday value into the array as it is
> calculated?  Can I assign it that way?
>
> Or should I calculate all of the values and then build the array at the end?
>
> Or should I not even use an array?
>
> Thanks,
> Dan
>

Are you asking how to do

$holidays[] = date;
array_push($holidays, date); ?

If you were generating dates to compare against today tho, you could
just return upon a match at that point and not even store them.  No
point in creating some big array in a loop only to loop through it
again when you could have done it the first time around.  I'd put this
into a function though so that I could return out upon a match.

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



Re: [PHP] Re: RewriteRules

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 5:27 PM, Ashley Sheridan
 wrote:
> On Tue, 2009-01-13 at 13:29 -0500, Eric Butera wrote:
>> On Tue, Jan 13, 2009 at 1:14 PM, Jason Pruim  wrote:
>> >
>> > On Jan 13, 2009, at 9:46 AM, Ashley Sheridan wrote:
>> >
>> >> On Tue, 2009-01-13 at 09:33 -0500, tedd wrote:
>> >>>
>> >>> At 2:33 PM + 1/13/09, Ashley Sheridan wrote:
>> >>>>
>> >>>> On Tue, 2009-01-13 at 09:20 -0500, tedd wrote:
>> >>>>>
>> >>>>>  Jason:
>> >>>>>
>> >>>>>  In addition to what everyone else has said, try this:
>> >>>>>
>> >>>>>  $self = basename($_SERVER['SCRIPT_NAME'])
>> >>>>>
>> >>>>>  I use it for forms -- you might find it useful.
>> >>>>>
>> >>>>>  Cheers,
>> >>>>>
>> >>>>>  tedd
>> >>>>>  --
>> >>>>>  ---
>> >>>>>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>> >>>>>
>> >>>> No need to use it on forms, as leaving the action attribute empty means
>> >>>> the form sends to itself anyway.
>> >>>>
>> >>>> Ash
>> >>>
>> >>>
>> >>> Ash:
>> >>>
>> >>> That's what I've said for years, but (I think it was on this list,
>> >>> but too lazy to look) there was a concern that some browsers may not
>> >>> follow that default behavior.
>> >>>
>> >>> However, using what I provided will work regardless.
>> >>>
>> >>> Cheers,
>> >>>
>> >>> tedd
>> >>>
>> >>> --
>> >>> ---
>> >>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>> >>>
>> >> I've not yet seen a browser that doesn't do this, and it's pretty old
>> >> HTML really, so I don't see a reason why any new browsers wouldn't
>> >> incorporate it.
>> >
>> > I prefer to be specific in my programming :)
>> >
>> > What I typically do with self submitting forms is:
>> > > > $self = $_SERVER['PHP_SELF'];
>> >
>> >
>> > echo <<> >
>> > ...
>> >
>> > 
>> > HTML;
>> > ?>
>> >
>> > But to each his (Or her) own right?
>> >
>> >
>> > --
>> > Jason Pruim
>> > japr...@raoset.com
>> > 616.399.2355
>> >
>> >
>> >
>> >
>>
>> You know that's asking for xss, right?
> How would you go about XSS on this? As I see it, you'd need
> register_globals on for that to work.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

Read the examples in the link I provided.

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



Re: [PHP] Quotes in querys

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 11:17 AM, MikeP  wrote:
> Hello,
> I am trying to get the following to work:
> "Select Netid from Users where Netid = '$_SESSION[phpCAS][user]'"
> Netid is a string type.
> No matter where of if I put the quotes, I still get array[phpCAS] not the
> value.
> If there is anything I still have trouble with after all these years its
> quoting variables.
> Help?
> Thanks
> Mike
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Dude we just helped you with this same exact thing the other day.  And
you're still allowing SQL injection.

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



Re: [PHP] Quotes in querys

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 11:34 AM, MikeP  wrote:
>
> ""Eric Butera""  wrote in message
> news:6a8639eb0901140825h1d603d01i3ffcce919dca6...@mail.gmail.com...
>> On Wed, Jan 14, 2009 at 11:17 AM, MikeP  wrote:
>>> Hello,
>>> I am trying to get the following to work:
>>> "Select Netid from Users where Netid = '$_SESSION[phpCAS][user]'"
>>> Netid is a string type.
>>> No matter where of if I put the quotes, I still get array[phpCAS] not the
>>> value.
>>> If there is anything I still have trouble with after all these years its
>>> quoting variables.
>>> Help?
>>> Thanks
>>> Mike
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Dude we just helped you with this same exact thing the other day.  And
>> you're still allowing SQL injection.
>
> No, actually I test my querys first and then wrap them in
> mysql_real_escape_string().
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Mike,

Well to be fair, I don't see any escaping in "Select Netid from Users
where Netid = '$_SESSION[phpCAS][user]'".  You could write:

$sql = sprintf(
"Select Netid from Users where Netid = '%s'",
mysql_real_escape_string($_SESSION['phpCAS']['user'])
);

and not have any of these problems.  If you're escaping outside of
that statement, then it's potentially tainting your data.

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



Re: [PHP] Zend Framework...where to start?

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 3:36 PM,   wrote:
> I've been reading about these great new 'frameworks' for PHP development.
>
> The most similar experience I have so far is using PEAR/Smarty in
> application development.
>
> I am becoming very interested in adding one (or more) of these frameworks to
> my work existence.
>
> I'm leaning toward the Zend Framework for the following reasons:
> 1. Zend's commitment to PHP in the enterprise environment
> 2. I'm studying for Zend PHP certification...so remaining within the same
> family sort of makes sense.
> 3. It's widely heralded as a very good 'framework'
> 4. Integration with my IDE, Zend Studio
> 5. Great support/userbase/forums/docs
>
> I'm getting ready to start a new project that is going to be somewhat of a
> stretch for me. It'll be probably the most complex project I've done where
> I'm the only designer/developer and have to do everything myself: from func
> spec to mockups to wireframes to database design to documentation to code to
> maintenance...all of it is me.
>
> What do you think, should I kill 2 birds with one stone and use the ZF to
> build this new project? Or would it slow me down to add 'learning the ins
> and outs of a new way of working' to my already long list of tasks and short
> time to complete them?
>
> Zend touts this thing as 'saving time' and 'letting you work more
> efficiently'. Will the new developer who is learning how to use ZF realize
> those efficiencies or are they only for the people who are quite experienced
> with the framework?
>
> I'm curious about whether it's practical to begin with a framework by using
> it on a real, production project.
>
> ??
>
> John Corry
>

ZF isn't going to save you any time on a single project.  The time
savings is over time with multiple projects where everything is
organized the same way, code sharing, new developers not having to
learn something new each time, etc.  It is also one of the hardest to
actually use too since it can be customized on any part of it.  I'd
recommend it though because it does have a good community, lots of
eyes on it, frequent releases, & docs.

The only way to really know if it works though is to use it for real.
When I play code at home I'm never going to give myself the hard time
about some weird edge case business rule that I have to at work.
Using ZF on a project is going to make you have to do that and learn
where it works and doesn't work for you.

There's a lot more to this discussion though.  So keep researching and
trying different ones out.

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



Re: [PHP] Zend (or other) Framework...where to start?

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 4:30 PM, John Corry  wrote:
> Well, bummer.
>
> I *seriously* need to divine a way to increase my efficiency both
> immediately and for the long term as I maintain tomorrow the
> applications I build today.
>
> For the new-to-frameworks, is there a better/easier framework to use
> that will streamline the development process from the beginning?
>
> I've looked at Codeigniter and LOVE the user guide/documentation...the
> underlying philosophy of that product looks very attractive too.
>
> Any others?
>
> I'd love to have the time to 'play around' with one or more of these
> to get an idea of strengths/weaknesses...but due to schedule and
> commitments, this 'playing around' is going to have to take place in
> the production, for-hire context.
>
> Surely we're all familiar with 'on the job training', right? ; )
>
> John Corry

Good luck with that.  ;)  If you aren't willing to invest the effort
you're not going to reap the rewards.

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



Re: [PHP] Zend Framework...where to start? -- don't.

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 4:39 PM, Daevid Vincent  wrote:
> http://daevid.com

"It appears your browser does not support some of the advanced
features this site requires."

That is pretty enteprisey! ;D

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



Re: [PHP] Zend Framework...where to start? -- don't.

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 5:03 PM, Robert Cummings  wrote:
> On Wed, 2009-01-14 at 17:01 -0500, Robert Cummings wrote:
>> On Wed, 2009-01-14 at 16:50 -0500, Eric Butera wrote:
>> > On Wed, Jan 14, 2009 at 4:39 PM, Daevid Vincent  wrote:
>> > > http://daevid.com
>> >
>> > "It appears your browser does not support some of the advanced
>> > features this site requires."
>> >
>> > That is pretty enteprisey! ;D
>>
>> I got the same message... 2001 called-- they'd like they're web
>> technology back.
>
> Hmmm.. so I opened it up in Firefox and there's this little window just
> like one I programmed for IE/Firefox/Opera 4 years ago. Not sure why
> Opera isn't supported, or any other browser with JavaScript and CSS.
> Reall, if the browser doesn't support the window thingy, it should just
> degrade to a normal content box.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

I'm using Safari. :D

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



Re: [PHP] Zend Framework...where to start? -- don't.

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 6:47 PM, Daevid Vincent  wrote:
> On Wed, 2009-01-14 at 14:28 -0800, Kyle Terry wrote:
>
>> On Wed, Jan 14, 2009 at 2:18 PM, Eric Butera  wrote:
>>
>> > On Wed, Jan 14, 2009 at 5:03 PM, Robert Cummings 
>> > wrote:
>> > > On Wed, 2009-01-14 at 17:01 -0500, Robert Cummings wrote:
>> > >> On Wed, 2009-01-14 at 16:50 -0500, Eric Butera wrote:
>> > >> > On Wed, Jan 14, 2009 at 4:39 PM, Daevid Vincent 
>> > wrote:
>> > >> > > http://daevid.com
>> > >> >
>> > >> > "It appears your browser does not support some of the advanced
>> > >> > features this site requires."
>> > >> >
>> > >> > That is pretty enteprisey! ;D
>> > >>
>> > >> I got the same message... 2001 called-- they'd like they're web
>> > >> technology back.
>> > >
>> > > Hmmm.. so I opened it up in Firefox and there's this little window just
>> > > like one I programmed for IE/Firefox/Opera 4 years ago. Not sure why
>> > > Opera isn't supported, or any other browser with JavaScript and CSS.
>> > > Reall, if the browser doesn't support the window thingy, it should just
>> > > degrade to a normal content box.
>> > >
>> > > Cheers,
>> > > Rob.
>> > > --
>> > > http://www.interjinn.com
>> > > Application and Templating Framework for PHP
>> > >
>> > >
>> >
>> > I'm using Safari. :D
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>> His website made firefox crash! >=[!
>>
>
>
> Um. I am using FF on Ubuntu right now at work, and it works just fine. I
> develop at home on XP and IE6 and IE7 and it also works. I guarantee you
> that crash was not related to my site.
>
> All of you are spending way too much time on something that is besides
> the point. My personal site has NOTHING to do with
> Symfony/Zend/Cake/etc. frameworks per se. The reason you can't load it
> in safari is a Javascript check and not PHP -- again off topic from this
> conversation. It doesn't degrade nicely b/c I never bothered to
> implement the other part of the Winlike "kit" which will degrade (as you
> can see on their site http://www.winlike.net as I honestly don't really
> care about Safari users (like 7% of the market) to be honest. It's my
> own personal site and if a Mac person can't use FF to view it, it's not
> sweat off either of our backs.)
> http://www.macobserver.com/article/2008/07/01.9.shtml
>
> Can we please get back on topic? If you really want to see my
> credentials, then go here: http://resume.daevid.com or go to my personal
> site in Firefox or IE.
>
>

Oh comon I was just playing.

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



Re: [PHP] Zend (or other) Framework...where to start?

2009-01-15 Thread Eric Butera
On Thu, Jan 15, 2009 at 1:57 AM, Usamah M. Ali  wrote:
> On Thu, Jan 15, 2009 at 1:59 AM, Paul M Foster  
> wrote:
>
>> If you're going to go with a prebuilt framework, I'd recommend
>> CodeIgniter for your first time out. If the docs look good to you (and
>> they are pretty good), you'll probably do fine with it. It's about the
>> lightest weight platform out there. It doesn't get in your way too much,
>> but gives you the benefits of using a framework.
>>
>
> I downloaded CI because of recommendations from this list as well, but
> was totally shocked when I discovered that its codebase is written in
> PHP4! I looked up for an alpha version that is written in PHP5 to no
> avail. I just can't understand why would they still be in PHP4 while
> Symfony, a framework born after CI, requires PHP5 since version one
> and takes full advantage of PHP5's advanced OO features!
>
> Regards,
> Usamah
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Yes, I ran into this problem too when I downloaded it and looked.
Same thing with cakephp too.  There's a php5 based framework at
http://kohanaphp.com/ that says it is based off CI.  I started looking
at it but all the FW classes are top level with no namespace prefix
which made me really sad.

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



Re: [PHP] To check for existing user in database

2009-01-16 Thread Eric Butera
> $result = mysql_query($query) or die(mysql_error());

You know guys, after seeing all this talk of sql injection over the
past few days, I'd also like to point out or die is pretty bad too.
Especially when coupled with mysql_error().  It can expose sensitive
system info (security vuln) when a simple if (!$result) { show error
page } would have worked.  I know I laugh and leave whenever I see
such an error on some site I stumble across.

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



Re: [PHP] Vertical Search Engine

2009-01-16 Thread Eric Butera
On Fri, Jan 16, 2009 at 1:03 PM, Neil Rosewarm  wrote:
> Dear Friends,
>
> I am planning to launch a Vertical Jobs Search Engine (Ref: www.linkup.com 
> and www.indeed.com) which crawls, spiders and Indexes the job listings.
>
> I have com across couple of open sources like Nutch and Lucene which are very 
> compatable for Java. But, I would like to know similiar ones for PHP.
>
> Please advise
>
> Thanks
>
> Neil
>


This might help http://derickrethans.nl/files/search-zendcon8.pdf

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Eric Butera
On Thu, Jan 15, 2009 at 5:13 PM, Edmund Hertle
 wrote:
> Hey,
> I want to "parse" a href-attribute in a given String to check if there is a
> relative link and then adding an absolute path.
> Example:
> $string  = ' href="/foo/bar.php" >';
>
> I tried using regular expressions but my knowledge of RegEx is very limited.
> Things to consider:
> - $string could be quite long but my concern are only those href attributes
> (so working with explode() would be not very handy)
> - Should also work if href= is not using quotes or using single quotes
> - link could already be an absolute path, so just searching for href= and
> then inserting absolute path could mess up the link
>
> Any ideas? Or can someone create a RegEx to use?
>
> Thanks
>

You could also use DOM for this.

http://us2.php.net/manual/en/domdocument.getelementsbytagname.php

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Eric Butera
On Fri, Jan 16, 2009 at 1:59 PM, mike  wrote:
> On Fri, Jan 16, 2009 at 10:58 AM, mike  wrote:
>
>> only if it's parseable xml :)
>>
>
> Or not! Ignore me. Supposedly this can handle HTML too. I'll have to
> try it next time. Normally I wind up having to use tidy to scrub a
> document and try to get it into xhtml and then use simplexml. I wonder
> how well this would work with [crappy] HTML input.
>

Great if you use @.  ;)  I'd try to make sure all of my input was
stored as proper x/html in the db before I really tried parsing it, so
I'm not sure of his setup, but I use getElementsByTagName all the time
and love it.

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



Re: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Eric Butera
On Fri, Jan 16, 2009 at 6:18 PM, Kevin Waterson  wrote:
> This one time, at band camp, Eric Butera  wrote:
>
>>
>> You could also use DOM for this.
>>
>> http://us2.php.net/manual/en/domdocument.getelementsbytagname.php
>
> http://www.phpro.org/examples/Get-Links-With-DOM.html
>
>
> Kevin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Nice ;)

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



Re: [PHP] Re: Opinions / Votes Needed

2009-01-17 Thread Eric Butera
On Sat, Jan 17, 2009 at 2:42 PM, Daniel Brown  wrote:
>Well, since Nathan asked especially for the opinions of those who
> would disagree with him, I thought all was well
>
> On Sat, Jan 17, 2009 at 13:33, Tony Marston
>  wrote:
>>
>> If your feeble brain can't handle the differences
>> then I suggest you stick with your previous language and LEAVE PHP ALONE!
>
> until this line.  Can't quite tell if it's a joke or what it
> was.  Kinda' killed the validity of the rest of the message.


Yea even I thought feeble was a bit over the top. ;)

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



Re: [PHP] 100% CPU Usage somewhere in script - how to find it?

2009-01-18 Thread Eric Butera
On Sun, Jan 18, 2009 at 3:16 AM, Alex Davies  wrote:
> Hi,
>
> I use a (externally developed) library within my application which
> used to work fine. However, after a recent update (which unfortunately
> we can't roll back due to dependencies) I have crazy CPU loads - there
> are ~20 cores in total on the webservers and they have gone from an
> average utilization of ~5% to >99%. I am using lighttpd, and so I can
> see the php-cgi processes using 99% all my CPU!
>
> I have an extremely basic understanding of how to track this down, and
> using XDebug and KCacheGrind I think that I have a pretty good idea
> which area the problem lies in, but the "problem" is that because
> whatever it is that has broken is using up the whole CPU everything
> else slows down. Furthermore, it would appear that a large part of
> what gets scheduled is luck because sometimes things are instant and
> the same activity a short while later can take forever. However, based
> on absolute CPU time's from this XDebug/KCacheGrind analysis and a gut
> hunch based upon what has changed recently I think I know roughly what
> it is. I do have a diff of the recent code change, and I have looked
> at it to no avail.
>
> My questions are:
> - Is there a better way to see what is using up the CPU? There must be
> a single loop or something talking to an external service, that is
> using so much CPU user time. Is there a super-quick way to do to this?
> I really need to know what function (or even line) is using all that
> CPU time, because I can't spot it in the code. Perhaps this
> information can be obtained from XDebug but I can't find it!
> - If there is no such magic answer to this question, what is the
> correct way to find such a phantom problem? Are there any other
> applications that might be better?
>
> If anyone has any personal recommendations for Consultants able to
> look at and fix this sort of problem that would be much appreciated
> too; I am now well out of my depth and sinking fast!
>
> Many thanks for any help,
>
> Alex
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

XDebug can produce a result showing time spent in each function across
an entire run.  So if you were somehow able to turn on xdebug and
reproduce this issue, it would indeed say what function/method this
was happening in.

http://xdebug.org/docs/profiler

Sounds like that'd be pretty tricky, so good luck.

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



Re: [PHP] Re: Opinions / Votes Needed

2009-01-19 Thread Eric Butera
On Sun, Jan 18, 2009 at 11:44 AM, Per Jessen  wrote:
> I think that's at best an example of someone having chosen the wrong
> tool. I can easily appreciate the frustration.  My own rule-of-thumb -
> scripts are for small things and rapid prototyping. Once when a script
> (regardless of language) grows towards 1000 lines, start thinking about
> writing it in C (or whatever else is appropriate).  I know of too many
> situations where thousands of lines of script code have turned into
> maintenance nightmares.

Sorry to deviate from the thread, but I wanted to talk about this
point for a second.  Are you serious?  Do you write php extensions for
every app and have tons of them on your server?

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



Re: [PHP] phpMailer Problem!

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 12:28 AM, shahrzad khorrami
 wrote:
> I tested with port 25, but it didn't work.
> I confuse, I don't know what problem is
>  it works well with gmail...
>
> thanks for reply :)
>

http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

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



Re: [PHP] Need List Advice

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 11:33 AM,   wrote:
> I have been looking but can't find which PHP list is best to post info
> regarding a new PHP tool. I have seen new product/service announcements on
> this list, but thought there might be a better list. Any suggestions?
>
> Thanks in advance.

Try it and see if you get flamed.  ;)  Seriously though, I think this
one is fine.

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



Re: [PHP] Need List Advice

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 12:42 PM, Robert Cummings  wrote:
> On Mon, 2009-01-19 at 12:25 -0500, Daniel Brown wrote:
>> On Mon, Jan 19, 2009 at 11:33,   wrote:
>> > I have been looking but can't find which PHP list is best to post info
>> > regarding a new PHP tool. I have seen new product/service announcements on
>> > this list, but thought there might be a better list. Any suggestions?
>>
>> As long as it's an announcement and not a commercial
>> advertisement, you'll be fine.  One thing that we generally consider
>> "bad etiquette" as well would be only posting to this list to announce
>> your product or project.  Being a helpful contributor to the list in
>> general will buy you some Brownie Points[tm].
>
> We get brownie points for helping? Crap, who's keeping track of mine? I
> had no idea!! Can they be cashed in for treats? :B
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Oh man... 3312 msg

http://marc.info/?a=10639834826&r=1&w=4

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



Re: [PHP] Re: Opinions / Votes Needed

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 2:37 PM, VamVan  wrote:
> Why are you guys Burning your egos here? Its not the right place.
>
>
>
> On Mon, Jan 19, 2009 at 11:03 AM, Kyle Terry  wrote:
>
>> On Mon, Jan 19, 2009 at 10:59 AM, Robert Cummings > >wrote:
>>
>> > On Mon, 2009-01-19 at 10:50 -0800, Kyle Terry wrote:
>> > > On Mon, Jan 19, 2009 at 10:35 AM, Daniel Brown 
>> wrote:
>> > >
>> > > > On Mon, Jan 19, 2009 at 13:22, Kyle Terry 
>> wrote:
>> > > > >>
>> > > > > Aside from a few perl scripts, I have rewritten all my bash scripts
>> > in
>> > > > PHP.
>> > > > > It's just easier to manage for me.
>> > > >
>> > > > /me nods.
>> > > >
>> > > >In 2001, I started rewriting a library of Perl scripts I'd been
>> > > > building since 1995 (5.0.0.1), which meant rewriting about 300
>> > > > scripts.  There's a single script left out of that library that I
>> > > > didn't convert, and only because it was the first usable Perl I'd
>> ever
>> > > > written.  Sentimental reasons, I suppose (and the fact that I rarely
>> > > > have a need for it).  It just ran a recursive loop through
>> directories
>> > > > to convert all file extensions from UPPER or Variable to lower case.
>> > > >
>> > > > --
>> > > > 
>> > > > daniel.br...@parasane.net || danbr...@php.net
>> > > > http://www.parasane.net/ || http://www.pilotpig.net/
>> > > > Unadvertised dedicated server deals, too low to print - email me to
>> > find
>> > > > out!
>> > > >
>> > >
>> > > Nice! I lied though, I use 1 python script that takes the ID3 tags from
>> > mp3s
>> > > and oggs and makes the filename pretty. It does this recursively once a
>> > week
>> > > through my music directory.
>> >
>> > I have a PHP script that does something similar :)
>> >
>> > Cheers,
>> > Rob.
>> > --
>> > http://www.interjinn.com
>> > Application and Templating Framework for PHP
>> >
>> >
>> Maybe I'm due for a rewrite :)
>>
>> --
>> Kyle Terry | www.kyleterry.com
>>
>

It's community building.  If everything's all work and serious people
wouldn't be as interested in being here.

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



[PHP] Re: ANNOUNCEMENT: ModBox - an Open Platform as a Service (OPaaS)

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 2:57 PM, Robert Cummings  wrote:
> Ok, you just hijacked a thread (I think (I don't have threading
> enabled)) and you top posted. You've probably burned through your
> goodwill in one shot :/
>
> Cheers,
> Rob.
>
>
>
> On Mon, 2009-01-19 at 14:32 -0500, c...@wizzyweb.com wrote:
>> After posting to this list to see if it is appropriate and getting good
>> feedback, I'm posting an announcement I think is very relative to this list
>> as I have been using PHP ever since it was a Perl script (PHP/FI) and have
>> been heavily influenced by it's concept and evolution when creating what I
>> am announcing. So the announcement is the launch of something I have been
>> working on in my spare time for a long time and what I believe will be a
>> logical next step in Internet development - ModBox an "Open Platform as a
>> Service" (OPaaS). Ok, what the #...@#$ is OPaaS? OPaaS is PaaS, but open. 
>> Think
>> Force.com/Google App Engine/Amazon EC2 - but open. Really open. Not fake
>> open like so much other BS services that try to lock you in. In a nutshell,
>> ModBox is a Web-based distributed development environment that is completely
>> neutral in every way. So, you can use any infrastructure you want, any
>> programming language, any server, any OS, any database, etc. to
>> create/distribute applications. Also, because ModBox works over standard
>> HTTP, you can incorporate existing applications or web services into the
>> applications you create. ModBox brings all the pieces together seemlessly
>> for programmers and users. I hope I have borrowed the best ideas from IDE's,
>> RAD, frameworks, Web services grid/cloud computing and Open Source to make a
>> logical ecosystem which puts a much needed front-end/face on all of it. This
>> list is the first place I have announced ModBox and I welcome you to Rock
>> the Box and let me know if it makes as much sense to you as it does to me. I
>> would, of course greatly appreciate any feedback as I am not so bold to
>> think I have cracked the code on the 1.0. The URL is below.
>>
>> ModBox - Open Platform as a Service:
>> http://www.sullivansoftwaresystems.com/modbox
>>
>> Thanks for your time.
>>
>> Brian Sullivan
>> Sullivan Software Systems
>> ModBox - Rock the Box.
>>
>> - Original Message -
>> From: "Robert Cummings" 
>> To: "Eric Butera" 
>> Cc: "Daniel Brown" ; ;
>> 
>> Sent: Monday, January 19, 2009 1:20 PM
>> Subject: Re: [PHP] Need List Advice
>>
>>
>> > On Mon, 2009-01-19 at 12:55 -0500, Eric Butera wrote:
>> >> On Mon, Jan 19, 2009 at 12:42 PM, Robert Cummings 
>> >> wrote:
>> >> > On Mon, 2009-01-19 at 12:25 -0500, Daniel Brown wrote:
>> >> >> On Mon, Jan 19, 2009 at 11:33,   wrote:
>> >> >> > I have been looking but can't find which PHP list is best to post
>> >> >> > info
>> >> >> > regarding a new PHP tool. I have seen new product/service
>> >> >> > announcements on
>> >> >> > this list, but thought there might be a better list. Any
>> >> >> > suggestions?
>> >> >>
>> >> >> As long as it's an announcement and not a commercial
>> >> >> advertisement, you'll be fine.  One thing that we generally consider
>> >> >> "bad etiquette" as well would be only posting to this list to announce
>> >> >> your product or project.  Being a helpful contributor to the list in
>> >> >> general will buy you some Brownie Points[tm].
>> >> >
>> >> > We get brownie points for helping? Crap, who's keeping track of mine? I
>> >> > had no idea!! Can they be cashed in for treats? :B
>> >> >
>> >>
>> >> Oh man... 3312 msg
>> >>
>> >> http://marc.info/?a=10639834826&r=1&w=4
>> >
>> >
>> > Good ol' Marc, that guy keeps track of everything!
>> >
>> > Now... about those treats
>> >
>> >
>> > --
>> > http://www.interjinn.com
>> > Application and Templating Framework for PHP
>> >
>>
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

Well it was his thread at first.  Just mad you haven't got your treat yet?

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 8:00 PM, Kyle Terry  wrote:
> On Mon, Jan 19, 2009 at 4:58 PM, Edmund Hertle <
> edmund.her...@student.kit.edu> wrote:
>
>> 2009/1/20 Nathan Rixham 
>>
>>> sounds like a starting point. and the starting point imho, interfaces and
>>> abstracts, then implementations.
>>>
>>> [can't wait for a discussion on the implementation of "Email" lmfao]
>>>
>>> can i gather that this is a postive response and a few interested parties?
>>>
>>> if so important things like is this discussed on this list or where, need
>>> for server space and svn? etc scope for a user group / list @ php on this?
>>> or what..?
>>>
>>> + all monkeys no organ grinder approach, no release until all happy
>>> (negating obvious trouble makers) and maybe a release manager for svn.
>>>
>>> more thoughts please
>>>
>> Well, I think we should not go to fast... maybe we are setting up SVN,
>> webspace, domain, mailing-list and in the end this is only used by 4-5
>> people. Because than this can be discussed on this mailinglist. But if there
>> are quite enough people interested, it would be indeed a good idea to start
>> some other kind of communication...
>>
>> but now I will go to bed (2 am here) and maybe there will be about >50
>> answers to this tomorrow ;)
>>
>>
> Well, I use Comcast and they put a 250gig cap per month of their residential
> customer, so my server can only be used temporarily if we need one.
>
> --
> Kyle Terry | www.kyleterry.com
>

Guys there's plenty of free "open source" hosted svn/git servers.  Do
a google search.

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 8:35 PM, Nathan Rixham  wrote:
> Kyle Terry wrote:
>>
>> On Mon, Jan 19, 2009 at 5:12 PM, Nathan Rixham  wrote:
>>>
>>> Eric Butera wrote:
>>>>
>>>> On Mon, Jan 19, 2009 at 8:00 PM, Kyle Terry  wrote:
>>>>>
>>>>> On Mon, Jan 19, 2009 at 4:58 PM, Edmund Hertle <
>>>>> edmund.her...@student.kit.edu> wrote:
>>>>>>
>>>>>> 2009/1/20 Nathan Rixham 
>>>>>>>
>>>>>>> sounds like a starting point. and the starting point imho, interfaces
>>>>>>> and abstracts, then implementations.
>>>>>>>
>>>>>>> can i gather that this is a postive response and a few interested
>>>>>>> parties?
>>>>>>>
>>>>>>> if so important things like is this discussed on this list or where,
>>>>>>> need
>>>>>>> for server space and svn? etc scope for a user group / list @ php on
>>>>>>> this?
>>>>>>> or what..?
>>>>>>>
>>>>>>> + all monkeys no organ grinder approach, no release until all happy
>>>>>>> (negating obvious trouble makers) and maybe a release manager for
>>>>>>> svn.
>>>>>>>
>>>>>>> more thoughts please
>>>>>>>
>>>>>> Well, I think we should not go to fast... maybe we are setting up SVN,
>>>>>> webspace, domain, mailing-list and in the end this is only used by 4-5
>>>>>> people.
>>>>>>
>>>>>>
>>>>> Well, I use Comcast and they put a 250gig cap per month of their
>>>>> residential
>>>>> customer, so my server can only be used temporarily if we need one.
>>>>>
>>>>>
>>>> Guys there's plenty of free "open source" hosted svn/git servers.  Do
>>>> a google search.
>>>>
>>>>
>>> lol and sourceforge [doh]; that way if anything takes off natural user
>>> base
>>> and integrated promotion "most active" - possibly with aid of tony :D
>>>
>>>
>> http://gitorious.org/
>>
>
> open to debate; my preference for now goes to sourceforge as it's all there
> including space with php support; proven you know. However i like new
> projects as well so open but overall +1 goes to whatever gets us up and
> running with the least time spent.
>
> and on the other side.. to open things up
>
> interface Object {
> }
>
> or
>
> abstract class Object {
> }
>
> or
>
> class Object {
> }
>
> nothing else for now:
>
> reason:
> to address the current and forseable lack of function(object $obj) in php;
> in addition to allow future scope for any common to all methods (or any
> implementation of this to have)
>
> i guess first is it a good idea to have any of the above and to address
> this, then next if so which?
>

That needs to be prefixed.  Or maybe namespaces if you're targeting
5.3?  It'd suck to have a lot of code using such a thing only to
become a reserved word.

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 9:04 PM, Nathan Rixham  wrote:
> Eric Butera wrote:
>>
>> On Mon, Jan 19, 2009 at 8:35 PM, Nathan Rixham  wrote:
>>>
>>> Kyle Terry wrote:
>>>
>>> and on the other side.. to open things up
>>>
>>> interface Object {
>>> }
>>>
>>> or
>>>
>>> abstract class Object {
>>> }
>>>
>>> or
>>>
>>> class Object {
>>> }
>>>
>>> nothing else for now:
>>>
>>> reason:
>>> to address the current and forseable lack of function(object $obj) in
>>> php;
>>> in addition to allow future scope for any common to all methods (or any
>>> implementation of this to have)
>>>
>>> i guess first is it a good idea to have any of the above and to address
>>> this, then next if so which?
>>>
>>
>> That needs to be prefixed.  Or maybe namespaces if you're targeting
>> 5.3?  It'd suck to have a lot of code using such a thing only to
>> become a reserved word.
>
> agreed, prefixed or namespaced (2 versions preference)
>
> thought now that should php introduce a superclass all others inherit, then
> "ours" should inherit it as well.. so non clashing name for sure.
>
> that's if we need one..? [imho +1 to one of the above]
>
>

Java has pojo's [1].  Maybe PHP can have popo's. :)

[1] http://en.wikipedia.org/wiki/POJO

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 9:13 PM, Kyle Terry  wrote:
> On Mon, Jan 19, 2009 at 6:07 PM, Daniel Brown  wrote:
>
>> On Mon, Jan 19, 2009 at 19:58, Edmund Hertle
>>  wrote:
>> >
>> > Well, I think we should not go to fast... maybe we are setting up SVN,
>> > webspace, domain, mailing-list and in the end this is only used by 4-5
>> > people. Because than this can be discussed on this mailinglist. But if
>> there
>> > are quite enough people interested, it would be indeed a good idea to
>> start
>> > some other kind of communication...
>>
>> I flat-out disagree with this, Ed.  Nothing at all against you, though.
>>
>>This is the General list for PHP, and while this project is
>> PHP-related (and "general" in nature), if we allow even the "regulars"
>> to do so here, how can we then tell others that we won't allow them to
>> discuss their PHP-related projects on this list?
>>
>>Putting the code on a proper system to begin with means no
>> screwing around later when the project is running at full steam.
>> And even if there are only four or five people working on it, if those
>> folks put in a good effort, they can work wonders.
>>
>> --
>> 
>> daniel.br...@parasane.net || danbr...@php.net
>> http://www.parasane.net/ || http://www.pilotpig.net/
>> Unadvertised dedicated server deals, too low to print - email me to find
>> out!
>>
>
> I work on a development team of 3; me and 2 others. 1 of which only develops
> about a quarter of his time here. Even with my co worker sitting next to me,
> if we weren't using a repo, we would both be at a complete loss (right
> word?).
>
> --
> Kyle Terry | www.kyleterry.com
>

I have been using svn for 3 years by myself.  Recently I talked my
other co workers to play with it and they love it.  But even in an
army of one it's amazing to be able to figure out what I messed up
last week or why I decided to change something at 5:00.  People have
wrote books on it though, so I'll hush.

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 9:41 PM, Bastien Koert  wrote:
> I'm in, sounds like fun and a great way to learn new stuff

This is what I was thinking too.  I'm just not sure what sort of
contributions I could make to such a thing.  It'd be an interesting
experience to try though.

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



Re: [PHP] maybe we could all?

2009-01-19 Thread Eric Butera
On Mon, Jan 19, 2009 at 10:46 PM, Paul M Foster  wrote:
> On Tue, Jan 20, 2009 at 03:29:29AM +, Nathan Rixham wrote:
>
>> Paul M Foster wrote:
>>> On Mon, Jan 19, 2009 at 11:57:25PM +, Nathan Rixham wrote:
>>>
>
> 
>
>>>
>>> You really don't have enough to do, do you?
>>>
>>> Paul
>>>
>>
>> actually, way too much - but I like to learn, contribute, think about
>> what I'm doing, skill share and contribute to the development community.
>>
>> and you? too much to do? :p
>
> Always. I've got projects on the back burner, side burner, next to the
> stove, in the sink, and on top of the fridge. On top of which, I have to
> run my company. And run a Linux User Group. AND I'm married! Whew!
>
> Incidentally, I'm relatively new to the list, but I see a lot of CCs
> along with posts to the list. The CCs are only useful if non-subscribers
> can post to the list. Is that the case?
>
> Paul
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

It's also a side-effect of gmail's reply all laziness.

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



Re: [PHP] curl can't connect to my home server

2009-01-20 Thread Eric Butera
On Tue, Jan 20, 2009 at 1:33 PM, Rene Veerman  wrote:
> Hi,
>
> I've been stuck on this problem i'm having after i re-installed my linux
> (debian) machine last month..
>
> I'm building a CMS with video import capabilities, but since it runs on
> shared hosting i need to make a cURL POST call to a URL on my home machine,
> which does video-conversion.
>
> This curl call has stopped working, curl_error() claiming "couldn't connect
> to host".
>
> As a test, i'm simply calling up a url on my homeserver through curl.. The
> url is http://82.170.249.144/mediaBeez/sn.php
> The curl script is at http://veerman.ws/servagetest.php
>
> Any light you can shed on this is very greatly appreciated.
> I'm kinda stuck at a huge brick wall here..
>

I just tried from the command line and it's timing out.  Check your os
firewall/router firewall?

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



Re: [PHP] Re: curl can't connect to my home server

2009-01-20 Thread Eric Butera
On Tue, Jan 20, 2009 at 1:35 PM, Rene Veerman  wrote:
> OOPS :)
>
> As a second test, i changed the test-url to
>
> http://82.170.249.144:81/mediaBeez/sn.php
>
> On Tue, Jan 20, 2009 at 7:33 PM, Rene Veerman  wrote:
>
>> Hi,
>>
>> I've been stuck on this problem i'm having after i re-installed my linux
>> (debian) machine last month..
>>
>> I'm building a CMS with video import capabilities, but since it runs on
>> shared hosting i need to make a cURL POST call to a URL on my home machine,
>> which does video-conversion.
>>
>> This curl call has stopped working, curl_error() claiming "couldn't connect
>> to host".
>>
>> As a test, i'm simply calling up a url on my homeserver through curl.. The
>> url is http://82.170.249.144/mediaBeez/sn.php
>> The curl script is at http://veerman.ws/servagetest.php
>>
>> Any light you can shed on this is very greatly appreciated.
>> I'm kinda stuck at a huge brick wall here..
>>
>

$ curl -I http://82.170.249.144:81/mediaBeez/sn.php
HTTP/1.1 200 OK
Date: Tue, 20 Jan 2009 19:40:01 GMT
Server: Apache
X-Powered-By: PHP/5.2.0-8+etch13
Set-Cookie: PHPSESSID=b797765b2b77ffe1d51099e11ca680d8; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html; charset=UTF-8

Looks like that works.  But it's setting a session.  Unless you're
using cookie jars maybe that could be part of your problem.

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



Re: [PHP] MySQL class. Thoughts?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 12:45 PM, Edmund Hertle
 wrote:
> 2009/1/21 Jay Moore 
>
>> This is a MySQL class I use and I wanted to get everyone's thoughts on
>> how/if I can improve it.  This is for MySQL only.  I don't need to make it
>> compatible with other databases.  I'm curious what you all think.
>>
>> Thanks,
>> Jay
>
>
> Hey,
> 1. You know the mysqli-Class?
> 2. If yes, than I don't get it in which way this will improve mysql handling
>
>  -eddy
>

Yea if you're only targeting 1 db, then why not use that class?  At
least then there's the php manual to figure out what something does.

mysql_real_escape_string should use $this->link to properly escape
based on charset, not server default.  I'd also call it escape.

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



Re: [PHP] MySQL class. Thoughts?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 5:53 PM, Chris  wrote:
> Eric Butera wrote:
>>
>> On Wed, Jan 21, 2009 at 12:45 PM, Edmund Hertle
>>  wrote:
>>>
>>> 2009/1/21 Jay Moore 
>>>
>>>> This is a MySQL class I use and I wanted to get everyone's thoughts on
>>>> how/if I can improve it.  This is for MySQL only.  I don't need to make
>>>> it
>>>> compatible with other databases.  I'm curious what you all think.
>>>>
>>>> Thanks,
>>>> Jay
>>>
>>> Hey,
>>> 1. You know the mysqli-Class?
>>> 2. If yes, than I don't get it in which way this will improve mysql
>>> handling
>>>
>>>  -eddy
>>>
>>
>> Yea if you're only targeting 1 db, then why not use that class?  At
>> least then there's the php manual to figure out what something does.
>
> Because then to add query logging for the whole app, you just need to put it
> in the class :)
>
> (I've done that before to check what's being run and where from, comes in
> very handy).
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

That's done by tail -f /var/log/mysql/query.log. :D

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



Re: [PHP] MySQL class. Thoughts?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 6:09 PM, Chris  wrote:
>
 Yea if you're only targeting 1 db, then why not use that class?  At
 least then there's the php manual to figure out what something does.
>>>
>>> Because then to add query logging for the whole app, you just need to put
>>> it
>>> in the class :)
>>>
>>> (I've done that before to check what's being run and where from, comes in
>>> very handy).
>>>
>
>>
>> That's done by tail -f /var/log/mysql/query.log. :D
>
> That won't tell you where a query comes from ;) Add a debug_backtrace into
> the class to also pinpoint where the query was called from. Complicated
> queries built on variables (or even just long queries built over multiple
> lines) will be hard to find just by looking at the mysql query log.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

I've been using it for 5 years now and haven't had problems.  Then
again I still write sql by hand too.  I only use it when something is
acting really weird and I'm having a hard time.  So it is a targeted
process where I know what I'm looking for.

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



Re: [PHP] MySQL class. Thoughts?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 6:37 PM, Jochem Maas  wrote:
> Chris schreef:
>>
> Yea if you're only targeting 1 db, then why not use that class?  At
> least then there's the php manual to figure out what something does.
 Because then to add query logging for the whole app, you just need to
 put it
 in the class :)

 (I've done that before to check what's being run and where from,
 comes in
 very handy).

>>
>>>
>>> That's done by tail -f /var/log/mysql/query.log. :D
>>
>> That won't tell you where a query comes from ;) Add a debug_backtrace
>> into the class to also pinpoint where the query was called from.
>> Complicated queries built on variables (or even just long queries built
>> over multiple lines) will be hard to find just by looking at the mysql
>> query log.
>>
>
> besides on shared hosting that log is often turned off even if you can get at 
> it.
>
>

That's why I set up a local dev environment.  If something is wrong,
just grab a db dump & figure it out locally.  That way I can do
whatever I need to really try out what the issue is and the best way
to resolve it.

Just merely saying how I develop.  Whatever gets it done is the real way. :)

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



Re: [PHP] MySQL class. Thoughts?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 7:07 PM, Ashley Sheridan
 wrote:
> On Wed, 2009-01-21 at 18:52 -0500, Eric Butera wrote:
>> On Wed, Jan 21, 2009 at 6:37 PM, Jochem Maas  wrote:
>> > Chris schreef:
>> >>
>> >>>>> Yea if you're only targeting 1 db, then why not use that class?  At
>> >>>>> least then there's the php manual to figure out what something does.
>> >>>> Because then to add query logging for the whole app, you just need to
>> >>>> put it
>> >>>> in the class :)
>> >>>>
>> >>>> (I've done that before to check what's being run and where from,
>> >>>> comes in
>> >>>> very handy).
>> >>>>
>> >>
>> >>>
>> >>> That's done by tail -f /var/log/mysql/query.log. :D
>> >>
>> >> That won't tell you where a query comes from ;) Add a debug_backtrace
>> >> into the class to also pinpoint where the query was called from.
>> >> Complicated queries built on variables (or even just long queries built
>> >> over multiple lines) will be hard to find just by looking at the mysql
>> >> query log.
>> >>
>> >
>> > besides on shared hosting that log is often turned off even if you can get 
>> > at it.
>> >
>> >
>>
>> That's why I set up a local dev environment.  If something is wrong,
>> just grab a db dump & figure it out locally.  That way I can do
>> whatever I need to really try out what the issue is and the best way
>> to resolve it.
>>
>> Just merely saying how I develop.  Whatever gets it done is the real way. :)
>>
> A DB dump won't always tell you where the problem lies. With proper
> logging, you can use the DB dump to work out what went wrong precisely.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

I meant grab a remote db dump, import it locally, reproduce the issue
locally, look at local query log, fix.

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



Re: [PHP] Help me understand unit testing?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 7:01 PM, Murray  wrote:
> Hi All,
>
> I'd like to understand unit testing better (or, in fact, at all). I
> understand the broad idea that testing Is A Very Good Thing, but when I have
> tried to look into it further (for example, have just been looking through
> the PHPUnit site), I always end up thinking 'This looks like more trouble
> than it's worth.' I'm sure that's down to me and not the process of unit
> testing, but I'd like to get some idea of how people on the list actually
> use unit testing in the real world.
>
> I'm assuming that you have your actual application classes and functions
> designed in their own files, and then you build a series of unit testing
> classes / functions in their own sort of space, but do you build these in
> parallel to your application code, or during alpha / beta testing etc?
>
> Any practical or even theoretical advice welcome!
>
> Many thanks,
>
> M is for Murray
>

Well this was a hard topic for me to grasp too.  A lot of times I
still get lazy about it, but I strive to do my best.  Unit testing
makes sure your code works as expected.  So if you're messing around
with stuff, keep re-running your test suite and see if your changes
break any of your tests.  This way you know whether or not your
changes are breaking the very apps that rely on your code.

Unit testing also allows you to quickly assess problems with different
servers, php upgrades, whatever.

Of course these are just little points.  Just give it a try and keep
going at it.  Once I started I noticed that I had been writing my code
all wrong.  Lots of weird dependencies, reliance on hard to recreate
state, stuff like that.  It helped me to start writing leaner methods
that targeted what they were supposed to do a lot better.

There's a lot of info on this subject all across the net & in books.
It isn't just limited to php, but programming in general.

V is for Vendetta?

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



Re: [PHP] Help me understand unit testing?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 7:24 PM, Murray  wrote:
> I think this is my problem -- basically to know how to get some benefit from
> it.
>
> If I have a function in a class that is supposed to return some rows, how
> would I go about performing a useful unit test on it? In theory (and in my
> current practice), I can simply dump the array or object, or step through
> the code with XDebug in Netbeans PHP (love this app!) to see what is taking
> place.
>
> Where would a unit test come into this process in a useful way? Is it
> because I can abstract the call to that function / class without having code
> that puts it to the page? Some other benefit?
>
> M is for Murray
>
>
> On Thu, Jan 22, 2009 at 10:13 AM, Eric Butera  wrote:
>>
>> On Wed, Jan 21, 2009 at 7:01 PM, Murray 
>> wrote:
>> > Hi All,
>> >
>> > I'd like to understand unit testing better (or, in fact, at all). I
>> > understand the broad idea that testing Is A Very Good Thing, but when I
>> > have
>> > tried to look into it further (for example, have just been looking
>> > through
>> > the PHPUnit site), I always end up thinking 'This looks like more
>> > trouble
>> > than it's worth.' I'm sure that's down to me and not the process of unit
>> > testing, but I'd like to get some idea of how people on the list
>> > actually
>> > use unit testing in the real world.
>> >
>> > I'm assuming that you have your actual application classes and functions
>> > designed in their own files, and then you build a series of unit testing
>> > classes / functions in their own sort of space, but do you build these
>> > in
>> > parallel to your application code, or during alpha / beta testing etc?
>> >
>> > Any practical or even theoretical advice welcome!
>> >
>> > Many thanks,
>> >
>> > M is for Murray
>> >
>>
>> Well this was a hard topic for me to grasp too.  A lot of times I
>> still get lazy about it, but I strive to do my best.  Unit testing
>> makes sure your code works as expected.  So if you're messing around
>> with stuff, keep re-running your test suite and see if your changes
>> break any of your tests.  This way you know whether or not your
>> changes are breaking the very apps that rely on your code.
>>
>> Unit testing also allows you to quickly assess problems with different
>> servers, php upgrades, whatever.
>>
>> Of course these are just little points.  Just give it a try and keep
>> going at it.  Once I started I noticed that I had been writing my code
>> all wrong.  Lots of weird dependencies, reliance on hard to recreate
>> state, stuff like that.  It helped me to start writing leaner methods
>> that targeted what they were supposed to do a lot better.
>>
>> There's a lot of info on this subject all across the net & in books.
>> It isn't just limited to php, but programming in general.
>>
>> V is for Vendetta?
>
>

Think of an ecommerce app.  You've got code that calculates price
based on lots of different factors.  Unit testing lets you make sure
that your prices will always add up correctly based on those factors.
Too many times have I messed something up and all of a sudden Michigan
tax isn't acting right.  Unit testing prevents those 4:50pm mistakes.
:D

Start small just testing the logic of your app.  Don't worry so much
about making sure a query has x data.  You can do something called
mock that out later on once you've got a better handle on things.

You might also look at established code and see their unit tests to
maybe get a better idea of how it is really useful.  Really tho

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



Re: [PHP] Help me understand unit testing?

2009-01-21 Thread Eric Butera
On Wed, Jan 21, 2009 at 7:31 PM, Eric Butera  wrote:
> On Wed, Jan 21, 2009 at 7:24 PM, Murray  wrote:
>> I think this is my problem -- basically to know how to get some benefit from
>> it.
>>
>> If I have a function in a class that is supposed to return some rows, how
>> would I go about performing a useful unit test on it? In theory (and in my
>> current practice), I can simply dump the array or object, or step through
>> the code with XDebug in Netbeans PHP (love this app!) to see what is taking
>> place.
>>
>> Where would a unit test come into this process in a useful way? Is it
>> because I can abstract the call to that function / class without having code
>> that puts it to the page? Some other benefit?
>>
>> M is for Murray
>>
>>
>> On Thu, Jan 22, 2009 at 10:13 AM, Eric Butera  wrote:
>>>
>>> On Wed, Jan 21, 2009 at 7:01 PM, Murray 
>>> wrote:
>>> > Hi All,
>>> >
>>> > I'd like to understand unit testing better (or, in fact, at all). I
>>> > understand the broad idea that testing Is A Very Good Thing, but when I
>>> > have
>>> > tried to look into it further (for example, have just been looking
>>> > through
>>> > the PHPUnit site), I always end up thinking 'This looks like more
>>> > trouble
>>> > than it's worth.' I'm sure that's down to me and not the process of unit
>>> > testing, but I'd like to get some idea of how people on the list
>>> > actually
>>> > use unit testing in the real world.
>>> >
>>> > I'm assuming that you have your actual application classes and functions
>>> > designed in their own files, and then you build a series of unit testing
>>> > classes / functions in their own sort of space, but do you build these
>>> > in
>>> > parallel to your application code, or during alpha / beta testing etc?
>>> >
>>> > Any practical or even theoretical advice welcome!
>>> >
>>> > Many thanks,
>>> >
>>> > M is for Murray
>>> >
>>>
>>> Well this was a hard topic for me to grasp too.  A lot of times I
>>> still get lazy about it, but I strive to do my best.  Unit testing
>>> makes sure your code works as expected.  So if you're messing around
>>> with stuff, keep re-running your test suite and see if your changes
>>> break any of your tests.  This way you know whether or not your
>>> changes are breaking the very apps that rely on your code.
>>>
>>> Unit testing also allows you to quickly assess problems with different
>>> servers, php upgrades, whatever.
>>>
>>> Of course these are just little points.  Just give it a try and keep
>>> going at it.  Once I started I noticed that I had been writing my code
>>> all wrong.  Lots of weird dependencies, reliance on hard to recreate
>>> state, stuff like that.  It helped me to start writing leaner methods
>>> that targeted what they were supposed to do a lot better.
>>>
>>> There's a lot of info on this subject all across the net & in books.
>>> It isn't just limited to php, but programming in general.
>>>
>>> V is for Vendetta?
>>
>>
>
> Think of an ecommerce app.  You've got code that calculates price
> based on lots of different factors.  Unit testing lets you make sure
> that your prices will always add up correctly based on those factors.
> Too many times have I messed something up and all of a sudden Michigan
> tax isn't acting right.  Unit testing prevents those 4:50pm mistakes.
> :D
>
> Start small just testing the logic of your app.  Don't worry so much
> about making sure a query has x data.  You can do something called
> mock that out later on once you've got a better handle on things.
>
> You might also look at established code and see their unit tests to
> maybe get a better idea of how it is really useful.  Really tho
>

oops I accidentally sent that before finishing.  But you get the idea
at any rate.

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



  1   2   3   4   5   6   7   8   >