php-general Digest 18 Mar 2010 04:23:18 -0000 Issue 6645

Topics (messages 302930 through 302948):

Re: best way to set up an include path for a multi-level project?
        302930 by: Robert P. J. Day
        302932 by: Teus Benschop

open source bookshop
        302931 by: Ali Reza Sajedi
        302938 by: Tommy Pham
        302941 by: O. Lavell
        302942 by: Ali Reza Sajedi
        302943 by: Tommy Pham
        302944 by: Tommy Pham
        302948 by: Kevin Kinsey

Re: natural language processing (nlp) (was: natural text / human text analysis)
        302933 by: Nathan Rixham
        302936 by: Rene Veerman

Re: $_FILE array being truncated
        302934 by: Ford, Mike

Re: PHP in HTML code
        302935 by: tedd
        302937 by: Rene Veerman
        302940 by: Tommy Pham
        302946 by: tedd

best way to determine mime type of file these days?
        302939 by: Robert P. J. Day

Re: fresh look at storing variables in MySQL [Solution]
        302945 by: tedd

Re: I need a fresh look at storing variables in MySQL
        302947 by: Tommy Pham

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
On Wed, 17 Mar 2010, Bob McConnell wrote:

> I suspect you will have to manage that on a machine by machine
> basis, unless you can convince the entire development team to create
> a common directory structure that encompasses all projects.

  i'm not sure what you mean by the above.  while that single project
(that others might want to take advantage of) will have to have a
uniform and consistent layout for everyone, i don't see that that will
enforce any sort of uniformity on *other* projects that might want to
take advantage of it.  or am i misunderstanding you?

rday
--



========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--- End Message ---
--- Begin Message ---
> let me emphasize that the layout of the entire "proj" directory will
> be consistent across all users and all machines since it will
> represent a single SVN checkout, so that's not an issue.  of course,
> anyone will be free to check it out anywhere they want but once they
> do, its structure will be the same across all checkouts.

The problem of an easy include path also came up in our project. The
solution was to create a Bootstrap class, that sets the include path as
follows:


  private function __construct() {
    // Set the include path, where to look for included files.
    // This is important so as to make pointing to the included files
much easier,
    // and to avoid tortuous path references.
    $this->bibledit_root_folder = dirname (dirname(__FILE__));
    $include_path = get_include_path () . ":" .
$this->bibledit_root_folder;
    set_include_path ($include_path);
    ini_set('include_path', $include_path); 
  } 

The central issue in the above is to use the __FILE__ variable as the
starting point for the include path. Since the bootstrap.php is in a
known location in the directory tree, we can always deduce a known
include path from that.

After that, each php file in each directory was set to include this
bootstrap.php, in various forms, depending on where this php file was
located in the directory tree:

require_once ("../bootstrap/bootstrap.php");

or:

require_once ("../../bootstrap/bootstrap.php");

or

require_once ("bootstrap/bootstrap.php");

That way the include path got set bootstrap.php. It works well.

Teus.


--- End Message ---
--- Begin Message ---
Hello all,

Does anybody know a good open source bookshop/bookstore system written in php+mysql?

Google and sourceforge search didn't yield good results.

Any hint would be very much appreciated.

Ali
--- End Message ---
--- Begin Message ---
On Wed, Mar 17, 2010 at 7:55 AM, Ali Reza Sajedi <arsaj...@khanehjou.com> wrote:
> Hello all,
>
> Does anybody know a good open source bookshop/bookstore system written in
> php+mysql?
>
> Google and sourceforge search didn't yield good results.
>
> Any hint would be very much appreciated.
>
> Ali
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Sounds like you're looking for an e-commerce solution.  Did you search
for 'open source e-commerce' ?

--- End Message ---
--- Begin Message ---
Tommy Pham wrote:
> Ali Reza Sajedi wrote:

>> Hello all,
>>
>> Does anybody know a good open source bookshop/bookstore system written
>> in php+mysql?

> Sounds like you're looking for an e-commerce solution.

You mean a webshop?

> Did you search for 'open source e-commerce' ?

It could be that a bookshop has specific requirements that a generic 
webshop application can't meet.

Sorry, Ali, I can't help you either.

--- End Message ---
--- Begin Message ---
Hello all,

Thanks very much for your kind feedback sofar.

I know of many shop and cms systems written in php.

However, what I am looking for is a system developed specifically for books.

And, as mentioned hier such a system has its own specific requirements that other generic systems do not meet.

Ali

----- Original Message ----- From: "O. Lavell" <olav...@xs4all.nl>
To: <php-gene...@lists.php.net>
Sent: Wednesday, March 17, 2010 8:22 PM
Subject: Re: [PHP] open source bookshop


Tommy Pham wrote:
Ali Reza Sajedi wrote:

Hello all,

Does anybody know a good open source bookshop/bookstore system written
in php+mysql?

Sounds like you're looking for an e-commerce solution.

You mean a webshop?

Did you search for 'open source e-commerce' ?

It could be that a bookshop has specific requirements that a generic
webshop application can't meet.

Sorry, Ali, I can't help you either.

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


--- End Message ---
--- Begin Message ---
On Wed, Mar 17, 2010 at 12:48 PM, Ali Reza Sajedi
<arsaj...@khanehjou.com> wrote:
> Hello all,
>
> Thanks very much for your kind feedback sofar.
>
> I know of many shop and cms systems written in php.
>
> However, what I am looking for is a system developed specifically for books.
>
> And, as mentioned hier such a system has its own specific requirements that
> other generic systems do  not meet.
>
> Ali
>
> ----- Original Message ----- From: "O. Lavell" <olav...@xs4all.nl>
> To: <php-gene...@lists.php.net>
> Sent: Wednesday, March 17, 2010 8:22 PM
> Subject: Re: [PHP] open source bookshop
>
>
>> Tommy Pham wrote:
>>>
>>> Ali Reza Sajedi wrote:
>>
>>>> Hello all,
>>>>
>>>> Does anybody know a good open source bookshop/bookstore system written
>>>> in php+mysql?
>>
>>> Sounds like you're looking for an e-commerce solution.
>>
>> You mean a webshop?
>>
>>> Did you search for 'open source e-commerce' ?
>>
>> It could be that a bookshop has specific requirements that a generic
>> webshop application can't meet.

The only thing that books differ from a general webshop / e-commerce
is ISBN and authors.  In any case, a good e-commerce solution should
have UPC/ISBN since every product is identified by UPC/ISBN regardless
of the industry.  So what I suggest is look for a good open source
e-commerce solution that has most of the features you're looking for
and just implement additional fields in the db for ISBN, authors,
publishers (manufacturers?) and some additional php code.  It beats
writing an e-commerce from scratch and helps you better understand
that solution you're implementing.

>>
>> Sorry, Ali, I can't help you either.
>>
>> --
>> 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
>
>

--- End Message ---
--- Begin Message ---
On Wed, Mar 17, 2010 at 1:06 PM, Tommy Pham <tommy...@gmail.com> wrote:
> On Wed, Mar 17, 2010 at 12:48 PM, Ali Reza Sajedi
> <arsaj...@khanehjou.com> wrote:
>> Hello all,
>>
>> Thanks very much for your kind feedback sofar.
>>
>> I know of many shop and cms systems written in php.
>>
>> However, what I am looking for is a system developed specifically for books.
>>
>> And, as mentioned hier such a system has its own specific requirements that
>> other generic systems do  not meet.
>>
>> Ali
>>
>> ----- Original Message ----- From: "O. Lavell" <olav...@xs4all.nl>
>> To: <php-gene...@lists.php.net>
>> Sent: Wednesday, March 17, 2010 8:22 PM
>> Subject: Re: [PHP] open source bookshop
>>
>>
>>> Tommy Pham wrote:
>>>>
>>>> Ali Reza Sajedi wrote:
>>>
>>>>> Hello all,
>>>>>
>>>>> Does anybody know a good open source bookshop/bookstore system written
>>>>> in php+mysql?
>>>
>>>> Sounds like you're looking for an e-commerce solution.
>>>
>>> You mean a webshop?
>>>
>>>> Did you search for 'open source e-commerce' ?
>>>
>>> It could be that a bookshop has specific requirements that a generic
>>> webshop application can't meet.
>
> The only thing that books differ from a general webshop / e-commerce
> is ISBN and authors.  In any case, a good e-commerce solution should
> have UPC/ISBN since every product is identified by UPC/ISBN regardless
> of the industry.  So what I suggest is look for a good open source
> e-commerce solution that has most of the features you're looking for
> and just implement additional fields in the db for ISBN, authors,
> publishers (manufacturers?) and some additional php code.  It beats
> writing an e-commerce from scratch and helps you better understand
> that solution you're implementing.
>

every product = every 'physical' product (not digital :p)

>>>
>>> Sorry, Ali, I can't help you either.
>>>
>>> --
>>> 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
>>
>>
>

--- End Message ---
--- Begin Message ---
Ali Reza Sajedi wrote:
Hello all,

Does anybody know a good open source bookshop/bookstore system written in php+mysql?

Google and sourceforge search didn't yield good results.

Any hint would be very much appreciated.

SAM'S published a PHP book some years ago that had just
such an app in "demo" form, on CD, included.  A big purple
book.  The app was basically a shopping cart system, but
it was specifically for books.  Might be a good way to
learn something and a good framework for further customization.

Given that it's a few years old, though, you'd want to
definitely do some reading on security best procedures
and changes since PHP 4....

As for the rest of the discussion, a bookshop could
easily be most of the standard cart-type apps.  Since
they have only a few characteristics, it's much easier
than, for example, retail clothing ;-)

HTH,

Kevin Kinsey

--- End Message ---
--- Begin Message ---
Rene Veerman wrote:
> I've browsed wikipedia, sf.net and google for code & papers on what is
> commonly known as NLP.
> ...
> It's an interesting problem though, and probably a profitable one, so
> i'm going to spend some time trying to come up with something better
> from scratch.
> 
> On Sun, Mar 14, 2010 at 12:04 AM, Rene Veerman <rene7...@gmail.com> wrote:
>>
>> I'm building a newsscraper -> portal.
>> So in the first place, I'm looking for any free/paid useful existing
>> data-mining / text-analysis code that can be run easily from php.
>> TBH i dont even know my feature-requirements really, i'm interested to
>> know what's available.
>>
>> In the second place, i'm looking for free and published-for-a-cost
>> data-mining / text-analysis papers/books that explain how to produce
>> useful results.
>>

wouldn't be diving right in to full on nlp for this ;) it's pretty easy
to do term/semantic extraction nowadays.

have you seen opencalais, alchemy, zemanta, yahoo term extraction or the
like?

honestly I've been doing this for years and would recommend hooking up
to the opencalais and zemanta api's - should you muddle your way towards
linked data in any way from there give me a shout and I'll give you some
pointers. There are already clients for PHP, as well as the normal cms
things like drupal, wordpress etc :)

regards!

ps: if you really want to get in to this kind of thing then
http://gate.ac.uk/ is a good starting (and ending) point

--- End Message ---
--- Begin Message ---
Thanks for the links..

But i think i'll keep at it on my own. I may be interested to set up a
competitor to the companies of which you gave links.
I've built a nice datamodel today, which i think will return even
better results than zemanta.

But what do you mean by "linked data", Nathan?

On Wed, Mar 17, 2010 at 4:10 PM, Nathan Rixham <nrix...@gmail.com> wrote:
> wouldn't be diving right in to full on nlp for this ;) it's pretty easy
> to do term/semantic extraction nowadays.
>
> have you seen opencalais, alchemy, zemanta, yahoo term extraction or the
> like?
>
> honestly I've been doing this for years and would recommend hooking up
> to the opencalais and zemanta api's - should you muddle your way towards
> linked data in any way from there give me a shout and I'll give you some
> pointers. There are already clients for PHP, as well as the normal cms
> things like drupal, wordpress etc :)
>
> regards!
>
> ps: if you really want to get in to this kind of thing then
> http://gate.ac.uk/ is a good starting (and ending) point
>

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Kim Madsen [mailto:php....@emax.dk]
> Sent: 16 March 2010 18:54

> when the field is changed (onChange()) or out of focus (is there
> such a
> function? onUnFocus()? :-)). 

onBlur()

(Keeping the A as short as the Q is OT!)

Cheers!

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





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

--- End Message ---
--- Begin Message ---
At 8:55 PM -0400 3/16/10, Adam Richardson wrote:
That said, I'm not taking exception with those who don't use the short tag, only with those who say I shouldn't.

Exception or not, it's still your choice and using short tags can cause problems.

My view, why create problems when there is a solution? Forcing the issue is a bit like "I'm going to do it my way regardless!" I've traveled that path too many times in my life. Sometimes it's easier to take the path most traveled.

Cheers,

ted
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
hmm.. seems easier to me to push a filetree of .php's with <?= through
the str_replace(), than it is to get all the <?= writers to comply
with your wishes, which may not apply to their situation ;-)

On Wed, Mar 17, 2010 at 5:14 PM, tedd <tedd.sperl...@gmail.com> wrote:
> At 8:55 PM -0400 3/16/10, Adam Richardson wrote:
>>
>> That said, I'm not taking exception with those who don't use the short
>> tag, only with those who say I shouldn't.
>
> Exception or not, it's still your choice and using short tags can cause
> problems.
>
> My view, why create problems when there is a solution? Forcing the issue is
> a bit like "I'm going to do it my way regardless!" I've traveled that path
> too many times in my life. Sometimes it's easier to take the path most
> traveled.
>
> Cheers,
>
> ted
> --
> -------
> 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
>
>

--- End Message ---
--- Begin Message ---
On Wed, Mar 17, 2010 at 11:01 AM, Rene Veerman <rene7...@gmail.com> wrote:
> hmm.. seems easier to me to push a filetree of .php's with <?= through
> the str_replace(), than it is to get all the <?= writers to comply
> with your wishes, which may not apply to their situation ;-)
>
> On Wed, Mar 17, 2010 at 5:14 PM, tedd <tedd.sperl...@gmail.com> wrote:
>> At 8:55 PM -0400 3/16/10, Adam Richardson wrote:
>>>
>>> That said, I'm not taking exception with those who don't use the short
>>> tag, only with those who say I shouldn't.
>>
>> Exception or not, it's still your choice and using short tags can cause
>> problems.
>>
>> My view, why create problems when there is a solution? Forcing the issue is
>> a bit like "I'm going to do it my way regardless!" I've traveled that path
>> too many times in my life. Sometimes it's easier to take the path most
>> traveled.
>>
>> Cheers,
>>
>> ted
>> --
>> -------
>> 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
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

http://www.php.net/manual/en/language.basic-syntax.phpmode.php

"There are four different pairs of opening and closing tags which can
be used in PHP. Two of those, <?php ?> and <script language="php">
</script>, are always available. The other two are short tags and ASP
style tags, and can be turned on and off from the php.ini
configuration file. As such, while some people find short tags and ASP
style tags convenient, they are less portable, and generally not
recommended. "

--- End Message ---
--- Begin Message ---
At 11:59 AM -0700 3/17/10, Tommy Pham wrote:
http://www.php.net/manual/en/language.basic-syntax.phpmode.php

"There are four different pairs of opening and closing tags which can
be used in PHP. Two of those, <?php ?> and <script language="php">
</script>, are always available. The other two are short tags and ASP
style tags, and can be turned on and off from the php.ini
configuration file. As such, while some people find short tags and ASP
style tags convenient, they are less portable, and generally not
recommended. "

+1

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
  i realize it sounds trivial but the online info is annoyingly
recursive.  there's mime_content_type(), but it's officially
deprecated.  there's getimagesize() but, as i read it, it's only good
for images and i'm going to want to categorize audio and video files.
finally, numerous people refer to the PECL FileInfo extension but, in
the same breath, admit that a lot of folks have problems with it so
you might want to drop back to the (deprecated) mime_content_type()
routine.

  thoughts?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--- End Message ---
--- Begin Message ---
At 1:10 PM -0500 3/13/10, tedd wrote:
I just completed writing a survey that has approximately 180 questions in it and I need a fresh look at how to store the results so I can use them later.

I decided to store all questions/answers pairs in MySQL as individual records.

Now I could have serialized each series of questions/answers into one long string (or XML) and have one record per responder, but that would have required me later to de-serialize the results to do the analysis.

The specifics of the analysis are not known at this time other than it will be a collection of comparisons between "this" and "that". Having each question/answer coupled as individual records lends itself well using MySQL to do the analysis whereas using a serialized string or XML would not.

To connect each series of questions/answers to the responder I used two keys. One key was generated from time() recording the second that user submitted the survey and the other key was a simple rand() generated number. That way if two responders entered their survey results at the exact same second (a race condition), then their entries would not be likely to also have the same random number. Even if in the unlikely event that two records had the same keys, it wouldn't affect the analysis much.

As far as the statement made by Phpster that the OP (namely me) not yet having good db design skills and being a "noob", I have to chuckle. I've been doing database stuff for over 20+ years. In this post I was just wanting to bounce ideas around and see if there was something new. But as it turns out, nothing was presented that wasn't considered in my original post, other than the possibility of a race problem.

As for your offer:

OP: if you need a mysql datamodel for reports, i'm willing to give it
a free shot. i'm sure others here would too, or improve upon mine.
It's probably not more than 3 tables i think.
Let us know eh..

I appreciate the offer, but the solution was one simple table consisting of question, answer, and two keys (as previously described). Each participant of the survey would generate up to 180 question/answer records -- that's not a problem.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Sat, Mar 13, 2010 at 11:10 AM, tedd <tedd.sperl...@gmail.com> wrote:
> Hi gang:
>
> I just completed writing a survey that has approximately 180 questions in it
> and I need a fresh look at how to store the results so I can use them later.
>
> The survey requires the responder to identify themselves via an
> authorization script. After which, the responder is permitted to take the
> survey. Everything works as the client wants so there are no problems there.
>
> My question is how to store the results?
>
> I have the answers stored in a session variable, like:
>
> $_SESSION['answer']['e1']
> $_SESSION['answer']['e2']
> $_SESSION['answer']['e2a']
> $_SESSION['answer']['e2ai']
> $_SESSION['answer']['p1']
> $_SESSION['answer']['p1a']
> $_SESSION['answer']['p1ai']
>
> and so on. As I said, there are around 180 questions/answers.
>
> Most of the answers are integers (less than 100), some are text, and some
> will be null.
>
> Each "vote" will have a unique number (i.e., time) assigned to it as well as
> a common survey id.
>
> My first thought was to simply record the "vote" as a single record with the
> answers as a long string (maybe MEDIUMTEXT), such as:
>
> 1, 1268501271, e1, 1, e2, 16, e2a, Four score and ..., e2a1, ,
>
> Then I thought I might make the data xml, such as:
>
> <survey_id>1</survey_id><vote_id>1268501271</vote_id><e1>1</e1><e2>16</e2><e2a>Four
> score and ...</e2a><e2ai></e2ai>
>
> That way I can strip text entries for <> and have absolute control over
> question separation.
>
> Then I thought I could make each question/answer combination have it's own
> record while using the vote_id to tie the "vote" together. That way I can
> use MySQL to do the heavy lifting during the analysis. While each "vote"
> creates 180 records, I like this way best.
>
> Then I thought, what would you guys do? So, what would you guys do?
>
> Keep in mind that this survey must evaluated in terms of answers, such as
> "Of the ones who answered e1 as 1 how did they answer e2?"
>
> If there is something wrong with my preference, please let me know.
>
> Thanks,
>
> tedd
>
> --
> -------

Tedd,

Sorry to be jumping in late, trying to migrate from yahoo mail to
gmail since I'm experiencing more problems with yahoo mail then I'd
like.  Any way, I'd go with db storage for storing of the results
since it will give better and more flexible analysis and reporting
later.  Below is how I'd do the db structure:

tbl_survey_questions:
questionId = int / uid << your call
languageId = int / uid / char << your call if you intend to I18n it ;)
question = varchar << length is your requirement
PK > questionId + languageId

tbl_participants:
userId = int / uid
userName = varchar
PK > userId

tbl_answers:
userId = int / uid
questionId = int / uid
languageId = int / uid
answer = varchar / mediumtext / or another type of text field
PK > userId + questionId + languageId

The reason why I'd structure it like this is:

Let's say you have question 1 with 5 (a-e) multiple choices, you
aggregrate your query (GROUP BY) to db for question 1 and see how many
responses are for a to e (each).  If your survey is I18n and your DB
reflects it, you can even analyze how/why certain cultural background
would choose each of those answer. (don't flame me... I know the
environment comes in to growing up too :p and that's way beyond the
scope of this list )

For question 2 with could be user entry (non multiple choice
selection), again, you see what their opinions are for that question.
You get the idea as how the rest may go.

I used to do lots of reporting with the real tool, Crystal Report ;)

Regards,
Tommy

--- End Message ---

Reply via email to