[PHP] Re: zend framework getIdentity

2013-07-19 Thread Dan Joseph
On Wed, Jul 17, 2013 at 5:54 PM, Dan Joseph dmjos...@gmail.com wrote:

 Fatal error: Uncaught exception 'Zend_Session_Exception' with message
 'Zend_Session::start() -
 /product/Messenger-dev/Messenger/library/Zend/Session.php(Line:480): Error
 #2 Class __PHP_Incomplete_Class has no unserializer Array' in
 /product/Messenger-dev/Messenger/library/Zend/Session.php:493


I see I've stumped everyone here, so I wanted to post a reply on what I
found is the root cause of this.

Somewhere in all the code, there's a session_start happening.  Then
elsewhere that our other developer is working, there was another
introduced.  This appears to be the trigger for this error.

Hope this helps someone in the future!

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


[PHP] zend framework getIdentity

2013-07-17 Thread Dan Joseph
Hey Folks,

Getting a weird error...

Fatal error: Uncaught exception 'Zend_Session_Exception' with message
'Zend_Session::start() -
/product/Messenger-dev/Messenger/library/Zend/Session.php(Line:480): Error
#2 Class __PHP_Incomplete_Class has no unserializer Array' in
/product/Messenger-dev/Messenger/library/Zend/Session.php:493
Stack trace:
#0
/product/Messenger-dev/Messenger/library/Zend/Session/Namespace.php(143):
Zend_Session::start(true)
#1
/product/Messenger-dev/Messenger/library/Zend/Auth/Storage/Session.php(87):
Zend_Session_Namespace-__construct('Zend_Auth')
#2 /product/Messenger-dev/Messenger/library/Zend/Auth.php(91):
Zend_Auth_Storage_Session-__construct()
#3 /product/Messenger-dev/Messenger/library/Zend/Auth.php(151):
Zend_Auth-getStorage()
#4
/product/Messenger-dev/Messenger/library/Messenger/Core/Db/Profiler/Log.php(53):
Zend_Auth-getIdentity()
#5
/product/Messenger-dev/Messenger/library/Lm/Application/Resource/Config.php(18):
Messenger_Core_Db_Profiler_Log-__construct()
#6 /product/Messenger-dev/Messenger/library/Zend/Application/Bootstr in
/product/Messenger-dev/Messenger/library/Zend/Session.php on line 493

This seems to be triggered by:

 $this-_identity = Zend_Auth::getInstance()-getIdentity();


Has anyone seen this error before?  Its throwing me for a loop

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-21 Thread Dan Joseph
Hey guys, thanks again for the talk and education.  I've purchased the
book, and started reading thru the links given.  Take care!

-Dan


On Sun, May 19, 2013 at 12:28 PM, Tedd Sperling t...@sperling.com wrote:

 To all:

 Thanks to Stuart, I finally got it.

 The concept of Interface is a bit difficult to explain, but his excellent
 console made the concept clear.

 Many thanks to all for their efforts to educate me.

 Cheers,

 tedd


 _
 t...@sperling.com
 http://sperling.com


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




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


[PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Hey Folks,

I'm looking to refine my PHP 5 OOP skills.  I know the basics, understand
patterns, but have clearly missed a few things along the way.

Do any of you have some real good PHP 5 OOP tutorials/reads bookmarked you
could share?  Something other than php.net/oop5.

Thanks!

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Thanks!  This looks like a good start.  Covers some things I have questions
on.  I like his approach.

Now I just need something advanced to continue on after this.  I'd like to
learn more about extending, interfaces, abstracts, and why/when they should
be used.

Appreciate it!

-Dan


On Thu, May 16, 2013 at 11:01 AM, Francisco C Soares dotjun...@gmail.comwrote:

  On 05/16/2013 11:55 AM, Dan Joseph wrote:

 Hey Folks,

 I'm looking to refine my PHP 5 OOP skills.  I know the basics, understand
 patterns, but have clearly missed a few things along the way.

 Do any of you have some real good PHP 5 OOP tutorials/reads bookmarked you
 could share?  Something other than php.net/oop5.

  Try,
 Tente,

 http://www.killerphp.com/tutorials/object-oriented-php/

 Success!
 Sucesso!

 ___
 Francisco C Soares ( *Junior* )
 403790c89847cdbe5a262146de8fb93139c4

 BLOG dotjunior.blogspot.com




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] A Good OOP Tutorial/Read?

2013-05-16 Thread Dan Joseph
Hey Guys,

Thanks for all this good information so far.  I'll keep you posted on my
edumacation!

-Dan


On Thu, May 16, 2013 at 11:16 PM, Larry Garfield la...@garfieldtech.comwrote:

 On 05/16/2013 06:45 PM, Tedd Sperling wrote:

 Thanks to both Bastien and Sebastian:

 While I understand that an interface is like an abstract Class, in that
 you don't have to flesh-out your methods, but rather where you define
 exactly how Classes who implement that interface will be required to
 flesh-out those methods. But so what? What's the point?

 Without giving me complicated examples, just give me one simple example
 that illustrates the advantage of using an interface over writing a new
 Class where you flesh-out whatever methods you want. After all, an
 interface requires the same thing, does it not?

 As such, I just don't see the advantage interfaces bring.

 Cheers,

 tedd


 Practical example, PSR-3:

 https://github.com/php-fig/**fig-standards/blob/master/**
 accepted/PSR-3-logger-**interface.mdhttps://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

 Say you're writing a stand-alone library, maybe a Twitter-connecting
 library.  You want to be able to log stuff, but don't want to have to deal
 with opening log files yourself.  You also want to allow your library to be
 used by people running Symfony, Code Igniter, Drupal, Zend Framework, or
 PHPBB, all of which have their own logging systems in place that may talk
 to syslog, a database, files on disk, or whatever.  People using those
 frameworks don't want your library spewing log files all over their file
 system.

 Instead, you simply support the PSR-3 logging interface.  You accept an
 object that implements that interface in your constructor, and then write
 to it.  What happens on the other side?  Who gives a damn!

 For your own testing, you can write a simple class that implements that
 interface and dumps log messages to disk.

 When someone uses your library with Symfony, they just pass in a Monolog
 object (the logging system used by Symfony), and your code is now logging
 errors to whatever they have Monolog configured to do.

 When someone uses your library with Drupal, they just pass in the Drupal
 Watchog logger object (which is being rewritten to use PSR-3 as we speak),
 and now your library is logging errors to Drupal's logging system (which
 could be syslog or a DB table, depending on how the user has their site
 configured).

 And you don't give a damn about any of that.  All you care about is that
 you support any object that matches this interface.  What that object
 does with the messages you send it, and where that object came from, you
 don't have to give a crap about.

 Now take that same concept and apply it at a smaller scale, within your
 own project.  Swap out your database-based cache system for a
 memcache-based one.  Your code doesn't change, because it's writing to an
 interface, not to the database.  Swap out your data store with one that is
 used just for testing.  Etc.

 That's what interfaces give you.  Loose coupling, and the ability to
 divide-and-conquer... and even let someone else solve problems for you. :-)

 --Larry Garfield


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




-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] FW:

2013-05-08 Thread Dan Joseph
Yo,

  (And, no, PHP doesn't stand
 for Produced by Horses  Ponies.)


This is completely devastating

-- 
-Dan Joseph

http://www.danjoseph.me
http://www.dansrollingbbq.com
http://www.youtube.com/DansRollingBBQ


Re: [PHP] Need a tool to minimize HTML before storing in memecache

2013-04-17 Thread Joseph Moniz
http://php.net/manual/en/book.tidy.php

- Joseph Moniz
(510) 509-0775 | @josephmoniz https://twitter.com/josephmoniz |
GitHubhttps://github.com/JosephMoniz |
 LinkedIn http://www.linkedin.com/pub/joseph-moniz/13/949/b54/ |
Bloghttp://josephmoniz.github.io/
 | CoderWall https://coderwall.com/josephmoniz

Wake up early, Stay up late, Change the world


On Wed, Apr 17, 2013 at 2:52 PM, Daevid Vincent dae...@daevid.com wrote:

 We do a lot with caching and storing in memecached as well as local copies
 so as to not hit the cache pool over the network and we have found some
 great tools to minimize our javascript and our css, and now we'd like to
 compress our HTML in these cache slabs.



 Anyone know of a good tool or even regex magic that I can call from PHP to
 compress/minimize the giant string web page before I store it in the cache?



 It's not quite as simple as stripping white space b/c obviously there are
 spaces between attributes in tags that need to be preserved, but also in
 the
 words/text on the page. I could strip out newlines I suppose, but then do I
 run into any issues in other ways? In any event, it seems like someone
 would
 have solved this by now before I go re-inventing the wheel.



 d.




Re: [PHP] cyberweaponry

2012-05-31 Thread Joseph Moniz
There was the Never Ever No Sanity worm (
http://news.cnet.com/Net-worm-using-Google-to-spread/2100-7349_3-5499725.html
). One variant of it was written in php the other in perl.


- Joseph Moniz


On Thu, May 31, 2012 at 10:21 AM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:

 This is a little early for Friday's Open Comment day, but my memory is 
 increasingly more short term and by tomorrow I might forget -- so, here goes.

 I watched a interview today where an security expert claimed that the Flame 
 Virus was written in a scripted language named lua (http://www.lua.org/).

 He said that this was unusual because typically such viruses are written in 
 languages like Ruby-on-Rails and such.

 So, my question to the group -- has PHP produced any viruses? If not, could 
 it? If so, can anyone elaborate on the details?

 Cheers,

 tedd


 _
 tedd.sperl...@gmail.com
 http://sperling.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



[PHP] PDF Form Field

2012-05-03 Thread Dan Joseph
Hi,

I've spent hours researching this with no luck.  I have a PDF with a form
field that I want to populate and output the PDF.  Can someone point me in
the right direction?  Can FPDF do this natively, or I need something else?
 My host doesn't have PDFLib installed, so that's not an option.  Thanks.

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] PDF Form Field

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 9:13 PM, David OBrien dgobr...@gmail.com wrote:

 I just found fpdfi using Google. It looks like what you need


Wow, you said the key phrase in your last e-mail, 'text on top'.  I didn't
think of that.  fpdi/fpdf does that like a charm, thanks!

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] function

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott ron.pigg...@actsministries.org
 wrote:

 I need to access a FUNCTION I programmed within a different FUNCTION.  Are
 these able to be passed like a variable?  Or are they able to become like a
 $_SESSION variable in nature?  How am I able to do this?

 I am essentially programming:

 ===
 function name( $flag1, $flag2 ) {

 # some PHP

 echo name_of_a_different_function( $flag1 , $flag2 );

 }
 ===

 The error I am receiving is “Call to undefined function
 name_of_a_different_function”


Are these inside classes or anything?  If they're just functions, they
should work fine together, example of 2 working functions together:

?php

hellotwo();

function helloone()
{
echo hi 1;
}

function hellotwo()
{
helloone();
}

?

This results in hi 1 being echoed to the screen.

-- 
-Dan Joseph

http://www.danjoseph.me


Re: [PHP] Node.PHP

2012-04-03 Thread Joseph Moniz
On Fri, Mar 30, 2012 at 5:56 PM, German Geek geek...@gmail.com wrote:
 Maybe stupid question, but is node.php really necessary? If you can program
 PHP and it performs better than node.js, why would you need to have another
 wrapper around things. Why not just program normal PHP?

This is normal PHP in the same sense that node.js is normal
javascript, python-tornado is normal python and ruby-event-machine is
normal ruby. The only difference as stated by micheal was the async
IO.

On Fri, Mar 30, 2012 at 6:33 PM, Michael Save
savetheinter...@omegasdg.com wrote:
 Also, I kind of doubt you can outperform node.js with standard PHP.

On Sat, Mar 31, 2012 at 9:37 AM, Daniel Brown danbr...@php.net wrote:
 On Fri, Mar 30, 2012 at 21:33, Michael Save
 savetheinter...@omegasdg.com wrote:
 Because normal PHP is not asynchronous.

 Also, I kind of doubt you can outperform node.js with standard PHP.

    Your doubts are indeed well-grounded.  Using node.js (indeed,
 V8-based apps in general) are compiled as native machine code, which
 don't require the added overhead of a parser, such as PHP.

This has been an on the side just for fun project for me mostly and as
such i originally had the same performance assumptions as stated in
this thread. Basically i was writing this to get familar with php
internals and to understand what goes into designing such a system.

You can imagine my surprise when i ran bench marks against the example
server against an equivelant node.js http server and the node.php
implementation was able to respond to twice as many requests per
second (14k req/s) then node.js could (7k req/s). Though i would take
this with a grain of salt as the benchmark is largely unfair seeing
how node.js is much more feature complete and hardend from production
use. Never the less, i was absolutely shocked that this completely
unoptomized and memory leaky node.php implementation i hacked together
in one night was able to run circles around node.js in naive
benchmarks.

So i was absolutely confused to the performance boost with php so i
started poking around asking people in various freenode channels if
they had any hypothesis on why node.php was able to perform against
node.js.

I stumbled across a similar project to create a node.lua
implemantation called luvit ( http://www.luvit.io ) and it also
boasted the same exact performance boost vs node.js, thats is luvit
was able to do 2x the requests as node.js in the same amount of time.

From my exploration on nodes 1/2x performance vs node.php and luvit
(node.lua) it turns out that V8 is fast only when it has to stay in JS
mode. The problem with node like systems is the JS to native code
boundary must be crossed several times to perform IO. So nodejs-core
get's some of it's best performance boosts from reducing the amount of
times JS has to call out to C++. The unfortunate detail is that
node.js like systems get their power from doing lots of IO and every
IO operation has to call out to C/C++ so node.js performance really
drags around this gotcha in V8.

I hold out some hope for native PHP performance tough. If some one
were to invest the time into making a solid JIT based interpreter for
PHP i'm fairly confident based on language characteristics and the
performance characteristics associated with them that a PHP-JIT
implementation would be able to leave V8 in the dust. Mostly due to
explicit lexical scoping in PHP that would offset the Hidden-Class
overhead of V8.

In terms of PHP-JITs Facebook has already done some initial work on
such a VM, they call it, not surprisingly, hip-hop-virtual-machine (
http://www.facebook.com/note.php?note_id=10150415177928920 ) and it
already doing almost no optimizations is closer to performance of
compiled PHP via hiphop then it is to interpreted PHP via the de facto
interpreter.

- Joseph Moniz



  With that
 said, compiling PHP (such as with HopHop) would give at least
 comparable performance results.

    Still, all in all, I would never discourage someone doing a
 'node.php' application.  While its performance may not be quite as
 good speed-wise, that doesn't mean it can't become more robust, more
 generally-applicable, or even just find niche uses.  I've written
 numerous socket servers in PHP for a variety of clients and uses,
 where they made sense (speed of deployment, ease of code-management by
 a number of developers who don't know C, et cetera).  I can easily see
 where this could add value.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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



Re: [PHP] Node.PHP

2012-04-03 Thread Joseph Moniz
*bad link in last post

http://luvit.io/


-Joseph Moniz



On Tue, Apr 3, 2012 at 12:16 PM, Joseph Moniz joseph.mo...@gmail.com wrote:
 On Fri, Mar 30, 2012 at 5:56 PM, German Geek geek...@gmail.com wrote:
 Maybe stupid question, but is node.php really necessary? If you can program
 PHP and it performs better than node.js, why would you need to have another
 wrapper around things. Why not just program normal PHP?

 This is normal PHP in the same sense that node.js is normal
 javascript, python-tornado is normal python and ruby-event-machine is
 normal ruby. The only difference as stated by micheal was the async
 IO.

 On Fri, Mar 30, 2012 at 6:33 PM, Michael Save
 savetheinter...@omegasdg.com wrote:
 Also, I kind of doubt you can outperform node.js with standard PHP.

 On Sat, Mar 31, 2012 at 9:37 AM, Daniel Brown danbr...@php.net wrote:
 On Fri, Mar 30, 2012 at 21:33, Michael Save
 savetheinter...@omegasdg.com wrote:
 Because normal PHP is not asynchronous.

 Also, I kind of doubt you can outperform node.js with standard PHP.

    Your doubts are indeed well-grounded.  Using node.js (indeed,
 V8-based apps in general) are compiled as native machine code, which
 don't require the added overhead of a parser, such as PHP.

 This has been an on the side just for fun project for me mostly and as
 such i originally had the same performance assumptions as stated in
 this thread. Basically i was writing this to get familar with php
 internals and to understand what goes into designing such a system.

 You can imagine my surprise when i ran bench marks against the example
 server against an equivelant node.js http server and the node.php
 implementation was able to respond to twice as many requests per
 second (14k req/s) then node.js could (7k req/s). Though i would take
 this with a grain of salt as the benchmark is largely unfair seeing
 how node.js is much more feature complete and hardend from production
 use. Never the less, i was absolutely shocked that this completely
 unoptomized and memory leaky node.php implementation i hacked together
 in one night was able to run circles around node.js in naive
 benchmarks.

 So i was absolutely confused to the performance boost with php so i
 started poking around asking people in various freenode channels if
 they had any hypothesis on why node.php was able to perform against
 node.js.

 I stumbled across a similar project to create a node.lua
 implemantation called luvit ( http://www.luvit.io ) and it also
 boasted the same exact performance boost vs node.js, thats is luvit
 was able to do 2x the requests as node.js in the same amount of time.

 From my exploration on nodes 1/2x performance vs node.php and luvit
 (node.lua) it turns out that V8 is fast only when it has to stay in JS
 mode. The problem with node like systems is the JS to native code
 boundary must be crossed several times to perform IO. So nodejs-core
 get's some of it's best performance boosts from reducing the amount of
 times JS has to call out to C++. The unfortunate detail is that
 node.js like systems get their power from doing lots of IO and every
 IO operation has to call out to C/C++ so node.js performance really
 drags around this gotcha in V8.

 I hold out some hope for native PHP performance tough. If some one
 were to invest the time into making a solid JIT based interpreter for
 PHP i'm fairly confident based on language characteristics and the
 performance characteristics associated with them that a PHP-JIT
 implementation would be able to leave V8 in the dust. Mostly due to
 explicit lexical scoping in PHP that would offset the Hidden-Class
 overhead of V8.

 In terms of PHP-JITs Facebook has already done some initial work on
 such a VM, they call it, not surprisingly, hip-hop-virtual-machine (
 http://www.facebook.com/note.php?note_id=10150415177928920 ) and it
 already doing almost no optimizations is closer to performance of
 compiled PHP via hiphop then it is to interpreted PHP via the de facto
 interpreter.

 - Joseph Moniz



   With that
 said, compiling PHP (such as with HopHop) would give at least
 comparable performance results.

    Still, all in all, I would never discourage someone doing a
 'node.php' application.  While its performance may not be quite as
 good speed-wise, that doesn't mean it can't become more robust, more
 generally-applicable, or even just find niche uses.  I've written
 numerous socket servers in PHP for a variety of clients and uses,
 where they made sense (speed of deployment, ease of code-management by
 a number of developers who don't know C, et cetera).  I can easily see
 where this could add value.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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



[PHP] Node.PHP

2012-03-21 Thread Joseph Moniz
Hey,

So i had my first Hackathon at work last week and my project was to
prototype making a node.js clone using PHP instead of V8. So i
snatched up libuv and joyent's HTTP parser and set off on a 24 hour
coding spree to get something workable. By the time the sun was coming
out the next morning the following code was working.

?php

$http = new node_http();

$http-listen(8080, function($request, $response) {
$response-end(yay, super awesome response);
});

nodephp_run();

?

The C code that powers it was whipped together really fast and is kind
of hackish as a result. The code has some memory leaks that i haven't
had time to fully track down yet. Some small portions of the code were
borrowed from the phode project.

In a naive benchmark on this simple server VS an equally simple server
in node.js this implementation already out performs node.js in
throughput by being able to serve just under 200% the amount of
requests per second that node.js could. Take that with a grain of salt
though because node.js has much more feature and is much more hardend
from production use. I do believe the PHP binary will have some major
performance gains over V8 as crossing the PHP -- C barrier seems to
be a much lighter operation then crossing the V8 -- C++ barrier.

Any help or feedback will be greatly appreciated. The projects source
code can be found here: https://github.com/JosephMoniz/node.php

- Joseph Moniz

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



Re: [PHP] PDF Printing instead?

2012-01-05 Thread Dan Joseph
On Thu, Jan 5, 2012 at 3:14 PM, Jim Giner jim.gi...@albanyhandball.comwrote:

 ok - somebody has advised that I should not be trying to print to a printer
 from my website php script.

 The suggestion of creating a pdf and sending to the client was made.  How
 do
 I install the pdf functions?  I've never had to install a package before or
 is that something my hoster does?


If you're on shared hosting, it'd be something your hosting company does.
I used fpdf for my last pdf job.  Although, I personally do not see a
problem with having people just print a nicely formatted web page out.

-- 
-Dan Joseph

http://www.danjoseph.me


[PHP] PHP 5.2 and Apache 2.2 are really compatible?

2011-10-19 Thread Joseph Adenuga



Dear All,


I’m using Window XP operating system. I’ve just installed
PHP 5.2.5 and Apache 2.2.8 over a week now. I’ve checked if Apache installation
is okay with ‘localhost’ in my Firefox browser and it displays ‘It Works!’ But, 
my php code ?php  echo h1Hello Web!/h1;
? that I saved as ‘first.php’ in the ‘htdocs’ will not display “Hello Web! in 
my browser. In the ‘Review
Error Log file’ I found:


PHP Warning:  PHP
Startup: Unable to load dynamic library 'C:\\php\\ext\\php_msql.dll' - The
specified module could not be found.\r\n in Unknown on line 0

[Wed Oct 19 16:22:12 2011] [notice] Child 7728: Child
process is running

[Wed Oct 19 16:22:13 2011] [notice] Child 2016: Released the
start mutex

[Wed Oct 19 16:22:13 2011] [notice] Child 7728: Acquired the
start mutex.

[Wed Oct 19 16:22:13 2011] [notice] Child 7728: Starting 64
worker threads.

[Wed Oct 19 16:22:14 2011] [notice] Child 2016: All worker
threads have exited.

[Wed Oct 19 16:22:14 2011] [notice] Child 2016: Child
process is exiting

[Wed Oct 19 16:22:14 2011] [notice] Child 7728: Starting
thread to listen on port 80.


I’ve checked my Apache and PHP configurations again and
again. I’ve checked the information on the internet with more configuration
info. I don’t know what else to do. Please I’m very new to PHP codeand Apache 
environment. I need
your help. I don’t know what I’m doing wrong and what to do. Please please help.
Joseph


[PHP] PHP Version: 5.2.5.

2011-10-17 Thread Joseph Adenuga


Operating System: Window XP

PHP Version: 5.2.5. with Apache 2.2.8

My Firefox browser returns (Output) the same php script code I inserted in 
Notepad:  ?php 

    echo h1Hello
Web!/h1; 

?

 

Please, what am I doing wrong?



Re: [PHP] Cwtc

2011-06-14 Thread Dan Joseph
On Tue, Jun 14, 2011 at 10:58 AM, Daniel Brown danbr...@php.net wrote:

 On Tue, Jun 14, 2011 at 04:00,  scarab...@crcvms.unl.edu wrote:
  Dear user php-general@lists.php.net,
 
  Your account has been used to send a huge amount of junk e-mail messages
 during this week.
  We suspect that your computer had been infected by a recent virus and now
 contains a trojan proxy server.
 
  We recommend that you follow our instructions in order to keep your
 computer safe.
 
  Have a nice day,
  The lists.php.net support team.

Pffft!  Nice try.


You don't think the mailing list software fell for it?

-- 
-Dan Joseph


Re: [PHP] PHP session replication

2011-03-17 Thread Dan Joseph
On Thu, Mar 17, 2011 at 12:06 AM, Alessandro Ferrucci 
alessandroferru...@gmail.com wrote:

 I'm curious, what are the most popular methods to perform session
 replication across http servers in PHP?


I personally just use MySQL and the session_set_save_handler() stuff
attached to a class.  Many of the frameworks, such as Zend, also support
Database Sessions.

-- 
-Dan Joseph


Re: [PHP] Zend Framework - getParam() Question

2011-03-12 Thread Dan Joseph
Howdy,

Mid, Net, thanks for the tips!  I actually didn't have the proper .htaccess
settings that ZF wanted, and I needed to add a router :)

Thank you both!

-Dan

On Sat, Mar 12, 2011 at 12:48 AM, Midhun Girish midhungir...@gmail.comwrote:

 You can also try routing in zend..
 http://codeutopia.net/blog/2007/11/16/routing-and-complex-urls-in-zend-framework/

 Midhun Girish



 On Sat, Mar 12, 2011 at 11:16 AM, NetEmp net.ser...@gmail.com wrote:

 Hi Dan

 One method for this is to use URL Rewriting (which can be implemented on
 Apache using htaccess).

 Through URL Rewriting you can first make the following URL:

 http://www.website.com/article-clean-url

 http://www.website.com/article-clean-urlto internally behave as the
 following:

 http://www.website.com/index/user/ http://www.website.com/index/user/11


 http://www.website.com/index/user/1and then you can use the same
 getParam
 method to grab the value and carry out further processing.

 Hope this helps.

 Cheers

 NetEmp

 On Sat, Mar 12, 2011 at 10:04 AM, Dan Joseph dmjos...@gmail.com wrote:

  Hi Everyone,
 
  Zend Framework getParam question
 
  I'm trying to get a value from the url...
 
  I know how to grab:
 
  http;//www.website.com/index/user/1
 
  that's the index controller, $this-_getParam('user'); (value = 1)..
 
  What I'd like to be able to grab is just off one thing from the url...
  example..  I want to give an article a unique/clean url... so, when I go
  to:
 
  http://www.website.com/article-clean-url
 
  I can somehow grab that 'article-clean-url' as a value and use it for a
  lookup in the database.
 
  I've tried everything and search all over the place.  I can't find the
  answer.  Can someone tell me how this is done?  Thanks...
 
  --
  -Dan Joseph
 





-- 
-Dan Joseph


[PHP] Zend Framework - getParam() Question

2011-03-11 Thread Dan Joseph
Hi Everyone,

Zend Framework getParam question

I'm trying to get a value from the url...

I know how to grab:

http;//www.website.com/index/user/1

that's the index controller, $this-_getParam('user'); (value = 1)..

What I'd like to be able to grab is just off one thing from the url...
example..  I want to give an article a unique/clean url... so, when I go to:

http://www.website.com/article-clean-url

I can somehow grab that 'article-clean-url' as a value and use it for a
lookup in the database.

I've tried everything and search all over the place.  I can't find the
answer.  Can someone tell me how this is done?  Thanks...

-- 
-Dan Joseph


Re: [PHP] New to PHP and struggling with the basics

2010-10-04 Thread Abah Joseph
Your directory configuration should look like this

Directory C:\path_to_www_root
  Order Deny,Allow
  Allow from all

Options Indexes FollowSymLinks Includes ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be All, None, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All
/Directory


On Mon, Oct 4, 2010 at 10:53 AM, kranthi kranthi...@gmail.com wrote:
 apache error logs will be helpful in this case. Their location varies
 depending upon your installation. But in any case they'll be insde
 your server directory (IIRC it is c:/Program Files/Apache Software
 Foundation/Apache by default)

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





-- 
Share with free mind!
Join the world largest open forum for hackers and programmers.
http://www.tuwana.com

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



[PHP] PHP Modular application

2010-09-06 Thread Abah Joseph
I appreciate you all. the php community is a wonderful community.

i`m developing an application that i need to support plugin for
additional features, i have used joomla and prestashop. i love the way
module interface on prestashop and i have been looking into the
classes but i did not understand the theory behind the module
positioning.

All modules must define at least a position, the position may need to
exists inside the template where the module will be displayed.

second, assume i have a registration form with 10 Fields matching 10
Fields in a table and later i want to add like 5 more Fields, did i
need to alter the table and my scripts again? or a plugin should take
care of that, i need some theory to take care of such situation.

Thank you in advance.

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



Re: [PHP] Video lessons

2010-07-23 Thread Dan Joseph
On Thu, Jul 22, 2010 at 10:04 AM, Jordan Jovanov jovanovj...@gmail.comwrote:

 Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS?


I'm not sure exactly what you're meaning there, but check out www.lynda.com

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
http://www.facebook.com/teaserleaguehttp://www.facebook.com/apps/application.php?id=135491833139465


[PHP] Image Replication

2010-07-20 Thread Dan Joseph
Hi,

I'm wondering how you all are doing image replication between servers.  I've
got some things in mind, but I'd like to see how others have done it.

We have a PHP application that accepts an image upload, then we want it to
show up on the other 2 web servers.  We have 3 in a load balanced cluster.
Linux servers.

How did you go about it?

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Dynamic menu

2010-07-19 Thread Dan Joseph
On Sat, Jul 17, 2010 at 5:17 PM, jordan jovanovj...@gmail.com wrote:

 I am new in this group and first whant to say hello to all.
 Need me menu who have different link if user is login or logout, something
 like dynamic menu. Somebody can tall me how can i use and create this 
 menu.http://www.php.net/unsub.php


Well, your basic logic is:

if ( they have a session )
{
   //output the menu
}
else
{
  //output the other menu
}

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Finding a font.

2010-06-09 Thread Dan Joseph
On Wed, Jun 9, 2010 at 11:14 AM, tedd tedd.sperl...@gmail.com wrote:


 I came in late on this thread, so please forgive me if I don't hit the
 mark.

 Whenever I need to find the name of a font, I use this:

 http://new.myfonts.com/WhatTheFont/


Wow  I just tried this out...  I uploaded an image, it looked at it, and
told me what fonts the letters were using.  Thanks Tedd!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] PHP app Server Load

2010-06-08 Thread Dan Joseph
Hi,

This is slightly OT...

We're wrapping up a new PHP/MySQL driven web site built on the Zend
Framework.  We're anticipating a couple hundred thousand members with
several thousand of them coming to the site at once.  I'm trying to figure
out how to determine how many servers we need to support the load.

I've done initial testing on a Xeon 3220 server, but we're looking at an i7
cpu based server now.

Anyone know a good way to estimate load based on actually numbers compared
to benchmark results from intel on a faster server?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] PHP app Server Load

2010-06-08 Thread Dan Joseph
On Tue, Jun 8, 2010 at 12:19 PM, Daniel Brown danbr...@php.net wrote:

 On Tue, Jun 8, 2010 at 12:12, Dan Joseph dmjos...@gmail.com wrote:
 
  Anyone know a good way to estimate load based on actually numbers
 compared
  to benchmark results from intel on a faster server?

 Run a DDoS-style (but not legitimate DDoS attack) load-balance
 simulator against your site and see where the bottlenecks lie.  The
 biggest problems are general filesystem writes (including sessions)
 and database queries.

If you have multiple servers from which you can run test scripts,
 do that (preferrably from various networks).  If not, do what you can
 with what you have.  Make sure your testing system simulates the
 traffic in the manner you expect (clicking links before the page fully
 loads, closing the connection and immediately refreshing it, et
 cetera).

Tools of the trade:

top/htop (for general system process watching)
mtop (for MySQL)
mod-top (for PHP process watching)
apachetop (for Apache)

And invaluable things to remember with regard to MySQL:

The 'log-slow-queries' option
The SQL statement: SHOW PROCESSLIST;

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 We now offer SAME-DAY SETUP on a new line of servers!



Thanks, some of those I wasn't aware of.  I've got them setup now and I'm
going to try and test on the server I have again.

As for estimating how things would run on a better server.  There are
benchmarks that score the CPUs.  Let's say one scored 5500, and one scored
1100, is it safe to say the higher one can handle 5x the load?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] php accelorator

2010-06-02 Thread Dan Joseph
Cool, thanks for the tips, I am going to check them out.


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Another NetBeans Question

2010-06-01 Thread Dan Joseph
On Tue, Jun 1, 2010 at 11:25 AM, tedd t...@sperling.com wrote:

 How do you turn off the automatic insertion of quotes when you're editing?

 For example, when I type div id=content, I end up with div
 id=content. The editor see's me type a quote and then automatically
 inserts another quote.



I can't find where to turn it off either, but I did notice when you type
something like that, when you type in the content in the  , when you type
the last , it overwrites the end quote, so you don't end up with two.
phped works this way too.  Helps me at least.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] php accelorator

2010-06-01 Thread Dan Joseph
Hi,

Are any of you using any of the php accelorators such as Zend, Ioncube, or
any others? Any idea which is the best?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] “五-连-贯”股|权-激|励-法

2010-05-06 Thread Dan Joseph
2010/5/6 Ashley Sheridan a...@ashleysheridan.co.uk

 [/snip]

 If only I could speak Chinese and was gullible I'd love to take them up
 on the offer for whatever it is.



 I wonder if we're missing out on the billion $ prize...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] simplexml choking on apparently valid XML

2010-05-06 Thread Dan Joseph
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote:

 Hey all -

 I'm using simplexml-load-string just to validation a string of XML, and
 libxml-get-errors to return any errors. It's always worked before, but today
 it's choking on this line in the XML:

 client_orderitem_numberBasketball Personalized Notebook -
 Jeffapos;s/client_orderitem_number

 It's returning Premature end of data in tag client_orderitem_number line
 90 but as far as I can tell, Jeffapos;s is properly XML encoded. I can't
 debug this. Any suggestions?

 I have run the XML through a couple of online validators and it does come
 back as valid with no errors found. http://www.php.net/unsub.php


I had this problem  It turned out to be some special characters in the
tags or data that I had to strip out first, then load it thru the simplexml
parser.  I will have to check my code when I get back to the office in the
AM and I'll let you know what it was if you haven't figured it out by then.
But that might get you started in fixing it.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Can't find my error

2010-05-05 Thread Dan Joseph
On Wed, May 5, 2010 at 12:55 PM, David McGlone da...@dmcentral.net wrote:

 26. if(isset($_GET['ProductID']))
 27. $this-mSelectedProduct = (init)$_GET['ProductID'];


You've got (init) instead of (int).  Its always those little characters
causing trouble!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Can't find my error

2010-05-05 Thread Dan Joseph
On Wed, May 5, 2010 at 1:06 PM, David McGlone da...@dmcentral.net wrote:

 On Wednesday 05 May 2010 12:59:07 Dan Joseph wrote:
  On Wed, May 5, 2010 at 12:55 PM, David McGlone da...@dmcentral.net
 wrote:
   26. if(isset($_GET['ProductID']))
   27. $this-mSelectedProduct = (init)$_GET['ProductID'];
 
  You've got (init) instead of (int).  Its always those little characters
  causing trouble!

 Tell me about it. I kept telling myself for the last 4 hours I can find
 it, I
 can find it I don't need to ask the list Huh! I was wrong!





LOL sometimes a second set of eyes is required.  We've all been in your
shoes!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-27 Thread Dan Joseph
On Tue, Apr 27, 2010 at 9:24 AM, Programming Guides 
programming.gui...@gmail.com wrote:

 I've played and still play StarCraft: Brood War a lot. StarCraft 2 is now
 available for pre-order and the beta is active. I'm looking forward to it
 but I'm not looking forward to how much time I'll sink into it :)

 --
 Viktor
 http://programming-guides.com



I am amazed at how long Starcraft has lasted, and how popular it still is.
Is the MMORPG version Starcraft 2?  Or is that yet another one?


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Sun, Apr 25, 2010 at 9:16 AM, tedd t...@sperling.com wrote:

 My gamer tag is special tedd


Hey Tedd, I'm 'jakmo' on Live.  I'll have to give you an add next time I
jump on.

I've been playing Dragon Age and Lost Odyssey.  Both are great.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 7:48 AM, Richard Quadling
rquadl...@googlemail.comwrote:

 On 25 April 2010 14:16, tedd t...@sperling.com wrote:
  What's your game?

 My wife and I play enjoy Baulder's Gate on the PS2 and I like the Lego
 (Star Wars, Batman, etc.) games on the PSP.

 The kids like to play Ice Age and Cars but crash a lot and end up
 shouting at each other.

Ice Age was a fine game!  I played that one a few years ago.  I'd like to
see another Diablo styled game come out in the modern setting.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 12:36 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:



 Diablo 3 is out soon...


   Thanks,
 Ash
 http://www.ashleysheridan.co.uk



oh cool, I did not realize.. have they set a release date yet?  I didn't see
one on gamestop.com...


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] What's your game? (X-PHP)

2010-04-26 Thread Dan Joseph
On Mon, Apr 26, 2010 at 12:52 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 Not yet, but there's trailers on YouTube and it looks good so far. A few
 more classes, different mobs, it looks good!



The screenshots look great as well.  I am going to check YouTube for
trailers.  Maybe after they get Starcraft going they'll get this out.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 1:51 PM, Adam Richardson simples...@gmail.comwrote:

  Contrary to my experiences a few years ago, there is no real loser
 anymore,
 they all are very nice and have their advantages.


Well, I still believe that Linux is the better suitor for a server, but some
companies don't.  So you really just have to adjust to their requirements
and needs.  You're right tho, they all have their advantages.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 2:12 PM, Tommy Pham tommy...@gmail.com wrote:

   As a desktop system, it's my personal choice. Both KDE 4 and Gnome 3
  (released in Sept 2010) offer better flashiness than Windows 7 and
  arguably better than the latest Mac OSX too, and the tools are as stable
  as anything I've ever used before.

 Is there an actual WoW client for Linux or you run in Wine like
 environment?


I used Cedega for WoW years ago, but I think it runs under wine just fine.

I personally am using Windows for my desktop these days.  I have needs for
windows, such as Flash development.  Plus my PhpED license is for the
Windows client, so I feel kind of trapped there :)

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: replying to list (I give up)

2010-04-23 Thread Dan Joseph
On Fri, Apr 23, 2010 at 6:17 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 I run it under Wine. Wine has come a long way since my first encounters
 with it a few years back and run a surprising amount of Windows-based
 software. I don't know how far its support for Flash has come, but I do
 remember running a version of Flash under Wine before. It was a bit
 buggy (some dialogues didn't always work) and crashed more than it might
 have normally on Windows, but it was OK at a push to get work done.
 Nowadays I don't really do anything with Flash, as it's a pita to get it
 optimised for search engines, accessibility just isn't up to scratch,
 and it takes a lot longer to build a whole dynamic site with it.



Yah, I'd never use it for a whole web site build either.  Heck, probably
wouldn't even use it for an image carosel.  We were building games with it,
which was really a no brainer to use flash.  I didn't want to get into
Java.

I'll have to try it under wine sometime.  I didn't even think about that.
But then again, my work machine is windows anyway.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Math Question....

2010-04-22 Thread Dan Joseph
Howdy,

This is a math question, but I'm doing the code in PHP, and have expunged
all resources... hoping someone can guide me here.  For some reason, I can't
figure this out.

I want to take a group of items, and divide them into equal groups based on
a max per group.  Example.

1,252,398 -- divide into equal groups with only 30 items per group max.

Can anyone guide me towards an algorithm or formula name to solve this?  PHP
code or Math stuff is fine.  Either way...

Thanks...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:12 AM, Stephen stephe...@rogers.com wrote:

 1,252,398 DIV 30 = 41,746 groups of 30.

 1,252,398 MOD 30 = 18 items in last group

Well, the only problem with going that route, is the one group is not
equally sized to the others.  18 is ok for a group in this instance, but if
it was a remainder of only 1 or 2, there would be an issue.  Which is where
I come to looking for a the right method to break it equally.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling rquadl...@googlemail.com
 wrote:

  
  It sounds like you are looking for factors.
 
 
 http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
 
  Solution by Find factors of any number
 
  1252398 is NOT a prime number: 1252398 = 2 * 3 * 7 * 29819
  Work Shown
 
  1252398 is divisible by 2: 1252398 = 626199 * 2.
  626199 is divisible by 3: 626199 = 208733 * 3.
  208733 is divisible by 7: 208733 = 29819 * 7.
  29819 is not divisible by anything.
 
  So 29819 by 42 (7*3*2)
 
  would be a route.

 Aha. Missed the 30 bit.

 So, having found the factors, you would need to process them to find
 the largest combination under 30.

 2*3
 2*3*7
 2*7
 3*7

 are the possibilities (ignoring any number over 30).

 Of which 3*7 is the largest.

 So, 1,252,398 divided by 21 = 59,638


 Is that the sort of thing you are looking for?



Yes, that looks exactly what like what I'm looking for.  I'm going to try
and wake up the algebra side of my brain that hasn't been used in years and
see if I can digest all this.

For the 2, 3, and 7, that is based solely on the last number being divisible
by a prime number?

Joao, Jason, thanks for the code.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Math Question....

2010-04-22 Thread Dan Joseph
On Thu, Apr 22, 2010 at 12:16 PM, Richard Quadling rquadl...@googlemail.com
 wrote:

  On 22 April 2010 14:48, Dan Joseph dmjos...@gmail.com wrote:
 This seems to be working ...

 ?php
 function findBestFactors($Value, $GroupSize, array $Factors = null)
{
$Factors = array();
foreach(range(1, ceil(sqrt($Value))) as $Factor)
{
if (0 == ($Value % $Factor))
{
if ($Factor = $GroupSize)
{
$Factors[] = $Factor;
}
if ($Factor != ($OtherFactor = ($Value / $Factor))
  $OtherFactor
 = $GroupSize)
{
$Factors[] = $OtherFactor;
}
}

if ($Factor = $GroupSize)
{
break;
}
}

rsort($Factors);

return reset($Factors);
}

 echo findBestFactors($argv[1], $argv[2], $Factors), PHP_EOL;
 ?


 factors 1252398988 5000

 outputs  ...

 4882

 and 21 for your value 1252398



Wow!  thanks...  I just plopped it into phped and fired off some tests, and
I agree, seems to work fine.  I appreciate your help today.  I am still
looking over the algebra stuff, and am now comparing it to your code.  This
will get me moving forward better in my project.  Thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] replying to list (I give up)

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 9:33 AM, David McGlone da...@dmcentral.net wrote:

 I'm not passing judgment, It just saddens me that I have to send
 multiple messages and this isn't because of anyone, it's because of my
 lack of knowledge on how to reply to lists that are set up in this way.
 But I think the reply to list like ash suggested solves the multiples
 problem.

 And on a positive note, If I wouldn't have brought this discussion up, I
 would have never known. Pretty sure I do now.




Every couple years this discussion comes up.  Cracks me up every time.

When you hit reply all, just take out all the other addresses and leave the
list one in there.  The list was setup like this years ago on purpose, and
they've stated in the past they don't want to change it..

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Re: Re: replying to list (I give up)[SOLVED TO A DEGREE]

2010-04-21 Thread Dan Joseph
My goodness, are you people still going on about all this?  LOL... let it
go... it is what it is.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 6:21 PM, Brandon Rampersad brandon.add...@gmail.com
 wrote:

 What's wrong with asking if PHP supports threading?


Nothing?  PHP itself does not.  You can check out fork though.  I've never
personally used it with PHP, but I did for a Perl project years ago.  I
guess it worked ok.

http://us3.php.net/manual/en/function.pcntl-fork.php

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 8:09 PM, David McGlone da...@dmcentral.net wrote:

 On Wed, 2010-04-21 at 18:21 -0400, Brandon Rampersad wrote:
  What's wrong with asking if PHP supports threading?

 Nothing really, I was just kidding.



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


lol..  I didn't see your email where you said not to ask

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-21 Thread Dan Joseph
On Wed, Apr 21, 2010 at 8:38 PM, David McGlone da...@dmcentral.net wrote:


 Are we gonna have to have a discussion on the use of threading? LOL



We just might.  Personally, I use it to sow holes in the toe of my socks.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Date Math

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 11:40 AM, Floyd Resler fres...@adex-intl.comwrote:

 I need to get the difference in months between two dates.  The dates could
 be as much as 60 months apart.  Is there any easy way to do this either
 through PHP or MySQL?  I know how I can do it through code but thought there
 might be a simple one or two line option.


check out:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Excel Report Formatting

2010-04-20 Thread Dan Joseph
Its good to see we're all playing nice today!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Hello everybody - php newbie from switzerland

2010-04-20 Thread Dan Joseph
On Tue, Apr 20, 2010 at 6:08 PM, Nick Balestra n...@beyounic.com wrote:

 I am NIck, from Locarno (southern switzerland) i am getting into php
 development for my own start-up company, maybe there are other people near
 me that would be nice to know for networking and alike. I will post here all
 my questions if i don't find any answer already on this list.


Hi Nick,

Welcome to the community!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:19 PM, tedd tedd.sperl...@gmail.com wrote:

 So, OP explain what you are trying to do?

 Cheers,

 tedd


Sorta looks to me like he's in a situation where users are fleeing the form,
and wondering why its not filled in when they go back.  The natural reaction
for this would be to call it abnormal, and tell them to learn how to use a
web page, but we all know how the real world is.

I like the original ideas from Peter and Ashley.  Store a session or cookie,
use ajax to periodically update a database table with the information, then
re-populate it if/when they come back.

I kinda like that word Paradigm.  Rolls off the tongue nicely.  I'm going to
use it 3 times today before I leave the office.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:40 PM, Robert Cummings rob...@interjinn.comwrote

 I had a pair-a-dimes one time. Unfortunately I was a nickel short of a
 quarter to put in the slot.

 But the question is... were they outside the box?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 12:48 PM, Kevin Kinsey k...@daleco.biz wrote:

 Nah, the question is, since the slot was intended to accept a quarter,
 why the heck didn't it take two dimes and a nickel ... or just two dimes,
 and throw a nickel in gratis?

 I must be getting old.  We have toilets that flush themselves now.
 WTF happened to grown up being equal to taking responsibility
 for things?


I think you've found the answer to the great question of why people don't
take responsibility anymore...  it all started with the toilet!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Saving form data into session before leaving a page

2010-04-13 Thread Dan Joseph
On Tue, Apr 13, 2010 at 1:46 PM, Robert Cummings rob...@interjinn.comwrote:


 Toilets flush themselves so that we don't need to touch what someone else
 touched... very likely after *cough* wiping up.



They have a cure for having to life a finger and wipe also  but I won't
continue lol

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] another useless message.

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind peter.e.l...@gmail.com wrote:

 That said, there can be little doubt that the response you got went a
 tad too far - some netiquette lessons would be useful, I think.



In defense of the people that react harshly, there has been a lot of people
who just spam the list over the years.  Its a natural reaction.

You may want to put that kind of thing in your signature also.  Rather than
making announcements that bother people, when you participate, your message
will go out.  Although, don't make it 100 lines long...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
Hi Everyone,

I'm trying to figure out if something is even an option with the Zend
Framework.  We use the DB Table stuff.  I don't see it in the manual, so I
figured I'd ask you all...

I have:

$select = $table-select()-where( home_team_id = ?, $home_team_id )
  -where( away_team_id = ?, $away_team_id
);

This translates the where's to home_team_id = 12 AND away_team_id = 15...

What I'd like to have is home_team_id = 12 OR away_team_id = 15.

Is this possible?  Or would I just need to build them all into a single
where() manually?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 3:25 PM, Andrew Ballard aball...@gmail.com wrote:

 Try this:

 ?php
 $select = $table-select()-where( home_team_id = ?, $home_team_id )
 -orWhere( away_team_id = ?,
 $away_team_id );


Perfect...thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Little php code - error

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 10:21 AM, Juan j...@rodriguezmonti.com.ar wrote:

 Hi guys,
 I'm having trouble with the following little php code [0]. The output
 from the server is : 
 * Parse error: syntax error, unexpected '{' in file.php on line 27 *

 Let's assume that file.php is the file that is giving me some troubles.

 The structure is pretty easy to understand, however I'm not able to
 solve this. Could you tell me why I'm not able to run this code.

 I'm running PHP5, Apache2, and Ubuntu 9.10 with sqlite, as you could see.



Its your if's, elseif's, else's.  You have and, change that to .

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Little php code - error

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 10:21 AM, Juan j...@rodriguezmonti.com.ar wrote:

 Hi guys,
 I'm having trouble with the following little php code [0]. The output
 from the server is : 
 * Parse error: syntax error, unexpected '{' in file.php on line 27 *


Sorry, I gave you bad information...

Its the else line.  else doesn't take a condition after it.  it should just
be else {.

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] contant /

2010-04-08 Thread Dan Joseph
On Thu, Apr 8, 2010 at 12:26 PM, Jack jacklistm...@gmail.com wrote:

 I get a couple of errors like this one for undefined variable:

 PHP Notice:  Undefined variable: s_company_name

 And this one for undefined contstant

 PHP Notice:  Use of undefined constant account_type - assumed
 'account_type'


f_put_cookie($auth[user_name],$auth[user_email],$auth[account_type],$auth[co
mpany_name]);

That's your culprit.  You'll need quotes around those.  $auth[username],
user_email, account_type, company_name

Otherwise, it thinks they are constants that haven't been defined:
php.net/define

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] stat(), NFS shares and local files timeout

2010-04-07 Thread Dan Joseph
On Wed, Apr 7, 2010 at 10:27 AM, Igor Feghali igor.fegh...@gmail.comwrote:

 I am running with an issue with remote filesystems (mounted via NFS)
 and PHP's stat() / filemtime().

 Sometimes when the remote filesystem (NFS share) is busy, my PHP
 daemon just hangs forever on a filemtime() call to a file inside this
 FS. I failed to find a proper way of setting a timeout for that kind
 of operation. Everything I can think of is related to remote files
 (URLs) and/or content operations (read/write). Streams for example,
 don't even have any options for local files and
 default_socket_timeout directive is applicable only for sockets.

 I could fork my daemon just to do a stat() call and control the
 running time (timeout) inside the parent process, but I usually stat
 60 files / second, so that would be a lot of forking. I prefer to go
 another way. anyone has a clue ?

What if you simply set the script to time out?  Is it ignoring that too?
set_time_limit( seconds )

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] SimpleXMLElement occasionally fails to parse gb2312 or big5 feeds

2010-04-06 Thread Dan Joseph
On Fri, Apr 2, 2010 at 10:28 AM, Peter Pei peterpei...@hotmail.com wrote:


 I use the following code to get rss and parse it, but the code occasionally
 have issues with gb2312 or big-5 encoded feeds, and fails to parse them.
 However other times may appear just okay. Any thoughts? Maybe
 SimpleXMLElement is simply not meant for other language encodings...

$page = file_get_contents($rss);
try {
$feed = new SimpleXMLElement($page);



I've been learning a bit about SimpleXML today myself.  It seems that it
misses a lot of things when it comes to complex, or abnormal XML.  Abnormal
being what you're describing and whatnot.  I don't really have a solid
answer for you (Just noticed no one  responded), but I think you're running
into what I was...  Its just built to be Simple, not expand its mind.

Hope that helps!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Error Message - Need help troubleshooting

2010-03-02 Thread Joseph Thayne
I do not know if the question has been answered, but how are you opening 
the session?  Are you using session_start() or are you using 
session_register()?


Rick Dwyer wrote:

On Mar 2, 2010, at 8:48 AM, Ashley Sheridan wrote:


How is $item_id created? You've not shown that in your PHP script 
examples.


// parse item id from the url
$refer=$_SERVER['HTTP_REFERER'];
$thispage=$_SERVER['PHP_SELF'];
$item_id=substr($thispage, -9);
$item_id=substr($item_id, 0, 5);

$_SESSION['item_id'] = $item_id;   


The above is where item_id is created and added to a session.

The important thing is that this error never showed up before until I 
added the Javascript link below:


var oss_itemid = ?php echo $item_id; ?;
var loadOSS = window.open(http://www.myurl/myfile.php?iid=; + 
oss_itemid, , 
scrollbars=no,menubar=no,height=600,width=600,resizable=yes,toolbar=no,location=no,status=no); 




When I was testing initially, I had removed the variable above in the 
link with a hard coded value and I never received this error.  Only 
when I made it dynamic did this error appear.


Thanks for any help.

--Rick



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



Re: [PHP] $_POST vs $_REQUEST

2010-02-22 Thread Joseph Thayne



Richard wrote:

It's a wise choice to go with $_POST, unless your form is a GET form,
in which case use $_GET. $_REQUEST has the potential to open your
script(s) up to security issues.

  
I am not sure what the security issues are you are referring to as the 
$_REQUEST superglobal contains both $_GET and $_POST values.  Could you 
expound on that?  Thanks.

Use quoted strings - either single or double quotes. Eg:

$myArray['myKey']
$myArray[myKey]

  
To answer your question though, the quotes will not protect you from SQL 
injection at all.  It simply has to do with processing the values.


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



Re: [PHP] Dumb Question - Casting

2010-02-18 Thread Joseph Thayne
According to the PHP manual using the same expression, Never cast an 
unknown fraction to integer, as this can sometimes lead to unexpected 
results.  My guess is that since it is an expression of floating 
points, that the result is not quite 8 (for whatever reason).  
Therefore, it is rounded towards 0.  Of course, that is only a guess, 
and I have no true documentation on it.


Ashley Sheridan wrote:

On Thu, 2010-02-18 at 09:47 -0600, Chuck wrote:

  

Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.

Can someone explain why the second expression in this code snippet evaluates
to 7 and not 8?

$a = (int) (0.1 +0.7);

echo $a\n;

$x = (int) ((0.1 + 0.7) * 10);

echo $x\n;

$y = (int) (8);

echo $y\n;




It works as expected if you take out the int() parts in each line. I'm
not sure why, but the use of int() seems to be screwing around with the
results. That's why the first line outputs a 0.

Thanks,
Ash
http://www.ashleysheridan.co.uk



  


RE: [PHP] SQL insert () values (),(),(); how to get auto_increments properly?

2010-02-13 Thread Joseph Thayne
In order to make this as sql server independent as possible, the first
thing you need to do is not use extended inserts as that is a MySQL
capability.  If you are insistent on using the extended inserts, then look
at the mysql_info() function.  That will return the number of rows inserted,
etc. on the last query.

-Original Message-
From: Rene Veerman [mailto:rene7...@gmail.com] 
Sent: Saturday, February 13, 2010 12:08 AM
To: php-general
Subject: [PHP] SQL insert () values (),(),(); how to get auto_increments
properly?

Hi.

I'm looking for the most efficient way to insert several records and
retrieve the auto_increment values for the inserted rows, while
avoiding crippling concurrency problems caused by multiple php threads
doing this on the same table at potentially the same time.

I'm using mysql atm, so i thought stored procedures!..
But alas, mysql docs are very basic.

I got the gist of how to setup a stored proc, but how to retrieve a
list of auto_increment ids still eludes me; last_insert_id() only
returns for the last row i believe.
So building an INSERT (...) VALUES (...),(...) at the php end, is
probably not the way to go then.

But the mysql docs don't show how to pass an array to a stored
procedure, so i can't just have the stored proc loop over an array,
insert per row, retrieve last_insert_id() into temp table, and return
the temp table contents for a list of auto_increment ids for inserted
rows.

Any clues are greatly appreciated..
I'm looking for the most sql server independent way to do this.

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


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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Try putting tick marks (`) around the field and table names.  So your 
SQL query would then look like:


INSERT INTO `history` (`v_id`, `hour`, `visits`, `date`) VALUES (45, 0, 
59, '2010 01 27');


This is a good practice to get into.  The problem is that MySQL allows 
you to create tables and fields with the same name as functions.  If the 
tick marks are not there, then it assumes you mean to try using the 
function.  In your case, hour is a function in mysql.  I would assume 
that the reason it works in phpmyadmin is that it filters the query 
somehow to add the tick marks in.


Joseph

james stojan wrote:

I'm at my wits end trying to make this mysql statement insert work in
PHP. I'm not getting any errors from PHP or mysql but the insert fails
(nothing is inserted) error reporting is on and is reporting other
errors. When I echo out the query and manually paste it into PHP
myAdmin the query inserts without a problem. I know that I am
connecting to the database as well part of the data being inserted
comes from the same database and that the mysql user has permission to
do inserts (even tried as root no luck).

$query=INSERT INTO upload_history (v_id,hour,visits,date) VALUES
(.$v_id.,.$hour.,.$visits.,'$date1'.);;

$r2=mysql_query($query) or die(bA fatal MySQL error
occured/b.\nbr /Query:  . $query . br /\nError: ( .
mysql_errno() . )  . mysql_error());

This is an echo of $query and runs in phpmyadmin.

INSERT INTO history (v_id,hour,visits,date) VALUES (45,0,59,'2010 01 27');


Any idea what is going on here?

  


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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne


Actually, the syntax is just fine.  I personally would prefer it the way 
you mention, but there actually is nothing wrong with the syntax.



The ,'$date1'. is not correct syntax, change it to ,'.$date.'


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



Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
That is a good idea to use the curly braces.  I consistently forget 
about them, and fell like an idiot every time I am reminded of them.


As for the backticks, they are required because of MySQL, not because of 
phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is 
that MySQL pretty much requires them when naming a field the same as an 
internal function to my knowledge.  If someone else knows of another way 
to designate to MySQL that a field named HOUR is the name of a field 
rather than the name of the internal function, I would love to know.


James McLean wrote:

On Fri, Feb 12, 2010 at 8:27 AM, Joseph Thayne webad...@thaynefam.org wrote:
  

Actually, the syntax is just fine.  I personally would prefer it the way you
mention, but there actually is nothing wrong with the syntax.



The ,'$date1'. is not correct syntax, change it to ,'.$date.'
  


My personal preference these days is to use Curly braces around
variables in strings such as this, I always find excessive string
concatenation such as is often used when building SQL queries hard to
read, and IIRC there was performance implications to it as well
(though I don't have access to concrete stats right now).

In your case, the variable would be something like this:

$query=INSERT INTO upload_history (v_id,hour,visits,date) VALUES
({$v_id}, {$hour}, {$visits}, '{$date}');

Much more readable and maintainable IMO.

No need for the trailing semicolon in SQL that uses an API like you
are using so save another char there too.
Backticks around column names are not required and IMO again they just
make the code hard to read. Just because phpMyAdmin uses them, doesn't
mean we all need to.

Cheers

  


Re: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
Yeah, I am a lot more descriptive now.  I ran into it quite a bit when I 
was first starting out.


James McLean wrote:

On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org wrote:
  

As for the backticks, they are required because of MySQL, not because of
phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is that
MySQL pretty much requires them when naming a field the same as an internal
function to my knowledge.  If someone else knows of another way to designate
to MySQL that a field named HOUR is the name of a field rather than the name
of the internal function, I would love to know.



Ahh I see :) Wasn't aware of that. Personally i've always been
over-descriptive when designing my tables which is possibly why I've
never run into that limitation :)

Thanks.

  


RE: [PHP] Mysql statement works in phpmyadmin but not in php page

2010-02-11 Thread Joseph Thayne
I was going to write an example as to what should happen instead of what
actually does when id dawned on me why MySQL works the way it does.  One of
the biggest complaints people have with MySQL is in speed.  To demonstrate
what I just realized, take the following statement that will select the hour
from a given time as well as the value from the hour field:

SELECT HOUR('13:42:37') as thehour, hour FROM mytable;

Not a big deal and pretty straight forward.  What about the following?

SELECT HOUR(mydate) as thehour, hour FROM mytable;

Still pretty simple to determine which are the functions and which are the
field names.  However, take the following:

SELECT HOUR(NOW()) as thehour, hour FROM mytable;

As humans, glancing at it, it makes perfect sense to us as to which is
which.  However, try telling a computer how to interpret the above
statement.  You could look for parenthesis.  That would work fine on the
first two statements, but once you get to the third, you have to worry about
recursion and all possible permutations of the data that could come through.
This exponentially increases the complexity and processing time/power
required to run the query.  Granted, that query is a simple one, but plug it
into a query filled with multiple joins, and you have the potential of a
nightmare.  So why focus on adding in functionality that adds so much
complexity and will end up requiring that much extra support when a simple
character (the tick mark) will take care of the work for you and you can
then focus on other things such as data integrity and general processing
speed?

Joseph

-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Thursday, February 11, 2010 9:15 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Mysql statement works in phpmyadmin but not in php page

On Fri, Feb 12, 2010 at 09:44:47AM +1030, James McLean wrote:

 On Fri, Feb 12, 2010 at 9:31 AM, Joseph Thayne webad...@thaynefam.org
wrote:
  As for the backticks, they are required because of MySQL, not because of
  phpMyAdmin.  The issue was not that phpMyAdmin uses backticks, it is
that
  MySQL pretty much requires them when naming a field the same as an
internal
  function to my knowledge.  If someone else knows of another way to
designate
  to MySQL that a field named HOUR is the name of a field rather than the
name
  of the internal function, I would love to know.

Backticks are also required to preserve casing in MySQL, if you name
something in mixed or upper case; MySQL lowercases table and field names
otherwise. It's a silly misfeature of MySQL. 

I can't conceive of why a DBMS would assume something which should be
understood in the context of a field name should instead be interpreted
as a function call. Buy maybe that's just me.

Paul

-- 
Paul M. Foster

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


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



Re: [PHP] PHP generated HTML has submit button which picks up the wrong url.

2010-02-05 Thread Joseph Thayne
This is actually a javascript issue rather than a PHP issue.  What is 
happening is that the action of the form is what is being submitted.  
The action never changes.  What you need to do is have the javascript 
change the action as well as submit the form (which means you will need 
to move it to a function).  It would also help to empty out the form 
action as well.


Example JS function:
function retrieveAllPerm()
{
document.display_data.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries';
document.display_data.submit();
}

Example submit button:
button name='edit_existing_query_form' 
onClick=javascript:retrieveAllPerm(); Revise query/button


Joseph

Mary Anderson wrote:

Hi,
  I am writing code in PHP which generates HTML script.  My app is 
fairly complex.  Twice in the development of the application I have 
run into a problem with submit buttons which pick up the wrong url.  
Instead of call the url for that submit button, it appears to call the 
url for the first submit button on the page.  The problem may be 
intermittent, which seems to suggest that something funny is happening 
with the cache.  Clearing the cache did not help in the last go around.
I am including the generated html code.  Hitting the button 'Retrieve 
all ...' should call up the url get_query_forms.php.  Instead it calls 
up the url query_form_display_data.php, which is the url for the first 
submit button on the page.


  Any clues to clear up this mystery would be greatly appreciated!

Mary Anderson







!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html xmlns=http://www.w3.org/1999/xhtml;
LINK href=./DMEM.css type=text/css rel=stylesheet
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleDisplay Data/title
/head
body form id=display_data name=display_data method=POST  
action=./query_form_display_data.php?perm_batch_file=permpg_query_form_id=518data_table_id=255data_batch_id=query_form_schema=permanent_queriesbatch_input_file_id=create_tmp_data_tables=0 



p 
big72 rows have been returned by this query/big
/pbr
p 

table 

tr 

th 

/th

td 
input type='text' name='max_row_count' size='3' value='0' /input

/td

/tr

/table
brbr
p 
input type='submit'  name='worksheet_join_element_initialize' 
value='Change worksheet : Change max row count' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' 
/input
input type='submit'  name='display_results' value='Display query 
results' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' 
/input
input type='submit'  name='generate_csv_file' value='Generate csv 
file' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' 
/input


p 
input type='submit'  name='edit_existing_query_form' value='Revise 
query' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' 
/input
input type='submit'  name='retrieve_existing_query_forms' 
value='Retrieve all permanent query forms for this table type' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'query_form_schema=permanent_queriesuser_name=data_table_type_id=' 
/input
input type='submit'  name='retrieve_existing_query_forms' 
value='Retrieve all temporary query forms for this table type' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'query_form_schema=temporary_queriesuser_name=data_table_type_id=' 
/input
input type='submit'  name='select_table_type' value='Change data 
table type' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=permuser_name=' 
/input


/p
p 
input type='submit'  name='home' value='Home' 
onClick=form.action='http://unproto.demog.berkeley.edu/memdemo' 
/input


/pinput type='hidden' id='perm_batch_file' name='perm_batch_file' 
value='perm'input type='hidden' id='tmp_data_values_table' 
name='tmp_data_values_table' 
value='display.perm_tmp_data_values_518'input type='hidden' 
id='pg_query_form_id' name='pg_query_form_id' value='518'input 
type='hidden' id='query_form_schema' name='query_form_schema' 
value='permanent_queries'input type='hidden' id='data_table_id' 
name='data_table_id' value='255'input type='hidden' 
id='data_batch_id' name

Re: [PHP] PHP generated HTML has submit button which picks up the wrong url.

2010-02-05 Thread Joseph Thayne
What you maybe ought to consider is using several submit buttons, and 
give each a name and a value. That way, your PHP script can check for a 
specifically named variable sent from the form. That way, you keep many 
people happy, and your site still works perfectly.


The problem with doing it that way is that IE is not happy with multiple 
submit buttons in a single form.  To get around that, you can use image 
input types or buttons.  Also, a return key does not send values the 
same way as a mouse click.  I can't remember which browser does what, 
but the three possible submitted values are (providing the name of the 
button is submit):


submit
submit_x and submit_y
submit_x, submit_y, and submit

Just something to be aware of if you are looking for the value of the 
submit button -- not 100% reliable.  It would be better to use a hidden 
form value or just check to see if submit or submit_x is set.


Joseph

Ashley Sheridan wrote:

On Fri, 2010-02-05 at 14:33 -0600, Joseph Thayne wrote:
This is actually a javascript issue rather than a PHP issue.  What is 
happening is that the action of the form is what is being submitted.  
The action never changes.  What you need to do is have the javascript 
change the action as well as submit the form (which means you will need 
to move it to a function).  It would also help to empty out the form 
action as well.


Example JS function:
function retrieveAllPerm()
{
document.display_data.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries'
 
http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries%27;
document.display_data.submit();
}

Example submit button:
button name='edit_existing_query_form' 
onClick=javascript:retrieveAllPerm(); Revise query/button


Joseph

Mary Anderson wrote:
 Hi,
   I am writing code in PHP which generates HTML script.  My app is 
 fairly complex.  Twice in the development of the application I have 
 run into a problem with submit buttons which pick up the wrong url.  
 Instead of call the url for that submit button, it appears to call the 
 url for the first submit button on the page.  The problem may be 
 intermittent, which seems to suggest that something funny is happening 
 with the cache.  Clearing the cache did not help in the last go around.
 I am including the generated html code.  Hitting the button 'Retrieve 
 all ...' should call up the url get_query_forms.php.  Instead it calls 
 up the url query_form_display_data.php, which is the url for the first 
 submit button on the page.


   Any clues to clear up this mystery would be greatly appreciated!

 Mary Anderson

 





 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

 html xmlns=http://www.w3.org/1999/xhtml;
 LINK href=./DMEM.css type=text/css rel=stylesheet
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleDisplay Data/title
 /head
 body form id=display_data name=display_data method=POST  
 action=./query_form_display_data.php?perm_batch_file=permpg_query_form_id=518data_table_id=255data_batch_id=query_form_schema=permanent_queriesbatch_input_file_id=create_tmp_data_tables=0 



 p 
 big72 rows have been returned by this query/big
 /pbr
 p 

 table 

 tr 

 th 

 /th

 td 
 input type='text' name='max_row_count' size='3' value='0' /input

 /td

 /tr

 /table
 brbr
 p 
 input type='submit'  name='worksheet_join_element_initialize' 
 value='Change worksheet : Change max row count' 
 onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries%27 
 /input
 input type='submit'  name='display_results' value='Display query 
 results' 
 onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries%27 
 /input
 input type='submit'  name='generate_csv_file' value='Generate csv 
 file' 
 onClick=form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file=permpg_query_form_id=518query_form_schema=permanent_queries' http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1perm_batch_file

Re: [PHP] MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Joseph Thayne

It will continue to use the max number which of course will cause an error.

Joseph

Parham Doustdar wrote:

Hello there,
A friend called me today and was wondering what happens if the ID colomn of 
an MYSQL database, set to autoinc reaches the int limit. Will it return and 
begin choosing the ID's that have been deleted, or... what?
Thanks! 




  


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



Re: [PHP] MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Joseph Thayne

That is incorrect.  What will happen is as follows:

1.  The value will be incremented by 1 causing the value to be greater 
than the maximum integer allowed.

2.  MySQL will see this as a problem and truncate it to the closest value.
3.  MySQL will then try and insert the new row with the updated id.
4.  MySQL will find that the id already exists, and will return a 
duplicate ID error.


If you want to verify what occurs, create a table with a tinyint value 
for the id and autoincrement it.


It is correct also, that you cannot use negative numbers for the 
autoincrement field.


Camilo Sperberg wrote:

On Mon, Jan 25, 2010 at 17:15, Parham Doustdar parha...@gmail.com wrote:

  

Hello there,
A friend called me today and was wondering what happens if the ID colomn of
an MYSQL database, set to autoinc reaches the int limit. Will it return and
begin choosing the ID's that have been deleted, or... what?
Thanks!





from what I know, MySQL will convert that number into a negative number,
which would be invalid for an auto-increment field (auto-increment ==
unsigned). That would raise an error ;)

Greetings :)

  


Re: [PHP] Cookies sessions

2010-01-20 Thread Joseph Thayne

Bruno Fajardo wrote:

You don't need to use output buffering at all. You only need this
mechanism if your script needs to output stuff before the
session_start() or setcookie() functions get executed.
Output buffering is also used if you need to output something before 
the headers are sent either by the header() function or simply using 
echo or print().


Joseph

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



Re: [PHP] Open source project management tool - PHP

2009-12-17 Thread Joseph Masoud
On 17 Dec 2009, at 10:24, Angelo Zanetti ang...@elemental.co.za  
wrote:



Hi guys

I would like to know what open source project management tools you  
use for

your projects.

We are looking at installing one that is PHP based and is easy to use.

We have found:

http://www.projectpier.org/

and

http://trac.edgewall.org/


Has anyone used the above and how did you find them? Also are there  
any

others you would recommend or not recommend and why?

Thanks in advance.

Regards
Angelo

http://www.wapit.co.za
http://www.elemental.co.za




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

Trac is not actually PHP based, it is coded in Python.  I used  it for  
roughly 2 months before jumping ship.  There was nothing wrong with  
it.  I simply found a more suitable solution for my projects.


I use Eventum for bug tracking.  It's the system the MySQL development  
team use.  It uses PHP and MySQL as standard.  Took me under 15  
minutes to set it up (after reading the manual). I didn't have any set- 
up problems.


For source control, I recommend you consider implementing a continuous  
integration platform like cruise control for PHP.


For team communications, the non-technical staff were significantly  
happier using Elgg (an open source social networking platform) over  
the Trac wiki and MoinMoin wiki.


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



Re: [PHP] Best ajax library

2009-12-15 Thread Joseph Masoud
On 15 Dec 2009, at 08:50, Ali Asghar Toraby Parizy aliasghar.tor...@gmail.com 
 wrote:



Which one is more active than others? I mean which project extends
faster and better, in future?

On Tue, Dec 15, 2009 at 1:37 AM, Philip Thompson philthath...@gmail.com 
 wrote:

On Dec 14, 2009, at 4:27 AM, Ali Asghar Toraby Parizy wrote:


Hi
I think the best choice is jquery until now.
But, is it reasonable to combine jquery and other library to client
side and server side scripting respectively?
By the way, where i can find good lessons about jquery and php?


I really like this js library.

http://mootools.net/

It's based off of jquery or prototype... I can't remember.

~Philip

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

JQuery and Mootools are two very different approaches of creating a  
JavaScript framework. Both shine in different ways.


I use JQuery when I want to get things done quickly (using the Yii  
framework or on custom projects).  I use mootols when I develop  
Joomla! Extensions and it's amazing.  Which is more suitable boils  
down to what your project needs.


I'm messing around with Ext at the moment and it's really nice too!

The ultimate answer to your question is; it depends. 
  


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



Re: [PHP] MySQL Appeal from Monty

2009-12-14 Thread Joseph Masoud
On 14 Dec 2009, at 22:01, Ashley Sheridan a...@ashleysheridan.co.uk  
wrote:



On Mon, 2009-12-14 at 15:59 -0600, Philip Thompson wrote:


On Dec 14, 2009, at 12:51 AM, Lester Caine wrote:


Lenin wrote:

You might also like this:
Come on Monty - Lukas Smith http://bit.ly/5lmwwD


I've been watching some of this debate with interest, but I'll  
stay with a database that has none of the baggage that MySQL has  
always had, and IS currently replacing Oracle in many large sites :)


--
Lester Caine - G8HFL


Do share your db of interest... (and please don't say MSSQL).

~Philip





MSSQL has nearly brought me to tears and could have easily made me  
bald

through hair pulling!

I have to say, I do like MySQL, it's very flexible and fast, and being
able to choose different storage engines for different tables in the
same DB is brilliant! I really don't think there's anything to overly
worry about from Oracle, as the two DB's have different audiences.

Thanks,
Ash
http://www.ashleysheridan.co.uk


Unfortunately, I do not share your optimism.  I believe that Oracle  
taking over MySQL would be a disaster of epic proportions.


The different audiences theory has been bought up several times but  
I haven't [to date] seen a sound justification for it. Oracle wants  
everyone to use ... Oracle, I can't see how this different audiences  
theory is going to make Oracle promote MySQL, perhaps someone can tell  
me?


I don't think the EU would be able to do anything about it.  The  
powerful companies almost always get what they want.


I don't think Monty wouldn't be doing this unless he felt that  
something [put mildly] bad is coming.


What has happened, has happened.  Trying to figure out who is to blame  
for this mess is pointless. Ideally, It would be nice if Oracle took  
its claws off MySQL and found another project to ruin.


Note: I am *not* trying to spread FUD

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



Re: [PHP] move_uploaded_file

2009-12-11 Thread Joseph Thayne
You should be able to use either an absolute or relative path.  In the 
code below, the path specified is absolute (it starts with /).  If you 
want it to be relative to your current directory, change the line to:


$uploads_dir = 'uploads'; or $uploads_dir = '../uploads';

So basically, it all depends on how you define your path.

Joseph


Roberto wrote:

Am I just drunk or blind or the documentation is simply wrong?

From the official doc
(http://uk2.php.net/manual/en/function.move-uploaded-file.php):

?php
$uploads_dir = '/uploads';
foreach ($_FILES[pictures][error] as $key = $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES[pictures][tmp_name][$key];
$name = $_FILES[pictures][name][$key];
move_uploaded_file($tmp_name, $uploads_dir/$name);
}
}
?

The path for the upload dir should be a relative one, not an absolute one.

Roberto Aloi
http://aloiroberto.wordpress.com
Twitter: @prof3ta

  


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



Re: [PHP] Backup to local drive

2009-12-11 Thread Joseph Thayne
If you are wanting to save the information as a PDF (formatted the same 
as the HTML page), check out tcpdf at www.tcpdf.org.  It is fairly 
simple to implement and can interpret an HTML page causing it to be 
saved as PDF.


Joseph

Ben Miller wrote:

Hello - I have an application I'm building that allows users to store
personal information and files (images, PDFs, etc.) in our database, but I
need a way for them to be able to save the HTML output of that personal data
to a local (for the user) flash drive.  I'm guessing I'm going to need a
clientSide language like javascript for this, but was wondering if maybe
there was a PHP addon or something like that for downloading content to the
user's PC.  Thanks in advance.

 


Ben


  


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



Re: [PHP] move_uploaded_file

2009-12-11 Thread Joseph Thayne
When used in PHP, an absolute path does not go off the web root.  In 
Premise 3 below, an absolute path of /upload will NOT bring up the 
directory /home/prof3ta/projects/moodle/htdocs/upload but rather 
simply /upload  In Windows terms, an absolute path would be 
C:\upload versus C:\home\prof3ta\projects\moodle\htdocs\upload.  The 
only time an absolute path is figured relative to the web root is when 
it is referenced in a browser.  At this point, for all intents and 
purposes, it locates the file based on the web root.  This is a 
fundamental difference between absolute and relative paths.


Absolute:  begins at / in Linux operating systems and C:\ in Windows OS
Relative:  begins wherever the running script is located in the file system.

Joseph

Roberto wrote:

HI,

Premise 1:
echo exec(pwd); - /home/prof3ta/projects/moodle/htdocs/feedback_tool

Premise 2:
I have an upload folder with 777 permissions under:
/home/prof3ta/projects/moodle/htdocs/upload

Premise 3:
The server root is obviously htdocs:
/home/prof3ta/projects/moodle/htdocs

This said, the following doesn't work:

?php
$uploads_dir = /upload;
$tmp_name = $_FILES[file][tmp_name];
$name = $_FILES[file][name];
move_uploaded_file($tmp_name, $uploads_dir/$name);
?

The following does work:

?php
$uploads_dir = ../upload;
$tmp_name = $_FILES[file][tmp_name];
$name = $_FILES[file][name];
move_uploaded_file($tmp_name, $uploads_dir/$name);
?

I consider it as a documentation bug (in the sample code they use an
absolute path).
I indeed believe I *should* be able to use both of them if not
documented otherwise.
I will dig into the C implementation of the move_uploaded_file
function and I'll check, though.

Cheers,

Roberto Aloi
http://aloiroberto.wordpress.com
Twitter: @prof3ta

  


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



Re: [PHP] Backup to local drive

2009-12-11 Thread Joseph Thayne
PHP cannot create a folder structure on your local machine.  I don't 
think Javascript or VBScript can either.  Your best bet is with the zip 
files.  Windows users have it fairly simple actually (as much as I hate 
to admit it) as all they would have to do is right-click and Extract.  
You can always include instructions in either an on-screen format or a 
README file (or both). 

As I have been thinking about it, you are going to need to do a zip file 
so that the user only has to download a single file.


Joseph

Ashley Sheridan wrote:

On Fri, 2009-12-11 at 15:04 -0700, Ben Miller wrote:
  

That’s exactly why I need something that will put all the needed files
directly onto the flash drive – to take that responsibility away from
the user.  Pulling the data from the DB and creating the folder
structure is easy with PHP – just not sure how to copy that folder
structure and related files to the flash drive without the user having
to know much of anything about computers.  Was hoping there is maybe a
PHP extension that I didn’t know about, but sounds like a client side
is going to be my best bet.

 



From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Friday, December 11, 2009 2:39 PM

To: Ben Miller
Cc: 'Roberto'; php-general@lists.php.net
Subject: RE: [PHP] Backup to local drive



 

On Fri, 2009-12-11 at 14:36 -0700, Ben Miller wrote: 



 
Too much reliance on the user knowing how to extract the files to the flash drive – need something that does it all for them so all they have to do is insert the flash drive on their own computer to store the preformatted presentation and then insert into a prospect’s computer and either a) (preferred) run the presentation via an autoplay command or b) open the presentation.html file.
 
 
Ben
 
 
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Friday, December 11, 2009 2:25 PM

To: Ben Miller
Cc: 'Roberto'; php-general@lists.php.net
Subject: RE: [PHP] Backup to local drive
 
 
On Fri, 2009-12-11 at 14:25 -0700, Ben Miller wrote: 
 
Users would be updating data via form input (address, tel, product

catalogues, etc.) as well as uploading files (images, PDFs, etc.), creating
their own presentations and saving those presentations to a flash drive as
HTML files with calls to the images/PDFs so that they can simply plug their
drive into a USB port and present the info on the road, regardless of
connection to the internet.
Ben
-Original Message-
From: Roberto [mailto:prof...@gmail.com] 
Sent: Friday, December 11, 2009 11:58 AM

To: Ben Miller
Cc: php-general@lists.php.net
Subject: Re: [PHP] Backup to local drive
Hi,
you lost me a bit. Let say a user uploads a PDF file to one of your servers.
What do you mean when you say I want the users to be able to save the
HTML output of their data?!?
Roberto Aloi
http://aloiroberto.wordpress.com
Twitter: @prof3ta
On Fri, Dec 11, 2009 at 6:44 PM, Ben Miller biprel...@gmail.com wrote:


Hello - I have an application I'm building that allows users to store
personal information and files (images, PDFs, etc.) in our database, but I
need a way for them to be able to save the HTML output of that personal
  

data


to a local (for the user) flash drive.  I'm guessing I'm going to need a
clientSide language like javascript for this, but was wondering if maybe
there was a PHP addon or something like that for downloading content to
  

the


user's PC.  Thanks in advance.



Ben


  
 
 
 
 
Why not create all the HTML files and images on the server, and zip it up then send that down to the user?
 
 
Thanks,

Ash
http://www.ashleysheridan.co.uk
 
 
 
 




That could end up in a lot of HTML and image files. Also, if you can't
rely on people to unzip a file, can you rely on them to know that they
need to keep the images with the HTML?

Thanks,
Ash
http://www.ashleysheridan.co.uk





 






PHP can't do anything like that, PHP is all on the server. Javascript
doesn't have anything like that either, but JScript and VBScript do I
believe, although that limits you to only Internet Explorer, and only if
the user has allowed the unsafe actions.

Your best bet is to maybe try to use a format that keeps it all in one
file, such as a PDF.

Another solution would be to have the HTML reference the images from
your own hosting, and put the entire presentation in one file.

Thanks,
Ash
http://www.ashleysheridan.co.uk



  


Re: [PHP] Using Curl to replicate a site

2009-12-10 Thread Joseph Thayne
If the site can be a few minutes behind, (say 15-30 minutes), then what 
I recommend is to create a caching script that will update the necessary 
files if the md5 checksum has changed at all (or a specified time period 
has past).  Then store those files locally, and run local copies of the 
files.  Your performance will be much better than if you have to request 
the page from another server every time.  You could run this script 
every 15-30 minutes depending on your needs via a cron job.


Joseph

Ashley Sheridan wrote:

Hi,

I need to replicate a site on another domain, and in this case, an
iframe won't really do, as I need to remove some of the graphics, etc
around the content. The owner of the site I'm needing to copy has asked
for the site to be duplicated, and unfortunately in this case, because
of the CMS he's used (which is owned by the hosting he uses) I need a
way to have the site replicated on an already existing domain as a
microsite, but in a way that it is always up-to-date.

I'm fine using Curl to grab the site, and even alter the content that is
returned, but I was thinking about a caching mechanism. Has anyone any
suggestions on this?

Thanks,
Ash
http://www.ashleysheridan.co.uk



  


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



Re: [PHP] Browsing PHP documentation from Emacs

2009-12-09 Thread Joseph Thayne
Check the following link for help on integrating with Vim:  
http://vim.wikia.com/wiki/PHP_manual_in_Vim_help_format


Kim Emax wrote:

Hello

Roberto wrote on 2009-12-09 17:08:

Hi all,

I've just written a small tool for Emacs that will allow to browse PHP
documentation directly from within Emacs.
I thought you might be interested in it:

http://aloiroberto.wordpress.com/2009/12/09/php-and-emacs-how-to-browse-documentation/ 



It is released with GNU GPLv3 license and it might be integrated with
existing php-mode implementations.
Looking forward to hear feedback from you.


Interesting stuff, is this against the php.net documentation?

And do you believe it would be possible to do the same from Vim?



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



Re: [PHP] Re: What method is best for generating thumbnails in PHP from PDF's?

2009-11-12 Thread Joseph Masoud

 On 12/11/09 17:44, O. Lavell wrote:

Chris Payne wrote:


Hi Everyone,

I have been asked to create thumbnails from the first page of a PDF
document on the fly with PHP, I have looked online but am confused as
there doesn't seem 1 simple solution.

What would you all recommend as an easy way to do this?

Any help would be really appreciated.

I think I would just call an external program to do it, like convert
from Image Magick:

exec(convert -thumbnail 300x300 document001.pdf[0] thumbnail001.png);


If you're going to use ImageMagick, make sure you have the latest 
ghostscript library, otherwise not all thumbnails will render properly.


I don't recommend CentOS for this task.  If this is your server OS, I 
recommend considering this rpm:


http://www.clearfield.com/ghostscript.8.64/ghostscript.html

Good luck.

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



Re: [PHP] How to pronounce PHP code over the phone?

2009-10-16 Thread Joseph Masoud

Robert Cummings wrote:

Bob McConnell wrote:

From: tedd


At 4:51 PM +0100 10/16/09, Ashley Sheridan wrote:

On Fri, 2009-10-16 at 17:46 +0200, Dotan Cohen wrote:


 How would you read this out loud if you were to read it to someone
 over  the phone?

 ($item-getServiceId() ? $item-getServiceId() : $item-getId(;



Wow! Here goes:

Open-bracket,
No, that's not an open bracket -- that's an open parenthesis or 
paren for short.


An open bracket is [

An open curly brace is {



That depends on which edition of English you use. Take a look at the
definition of bracket in Wikipedia. What you call a parenthesis is
called a bracket in England and parts of Canada, as well as elsewhere.
They specify square bracket for the second one. I stumbled on this one
in another mailing list a few years ago.


Bracket... two syllables and ambiguous.

Round Brace... two syllables and not ambiguous.

For terse clarity use the following:

- round brace
- square brace
- curly brace
- angle brace

:)

Cheers,
Rob.
Have you thought about using instant messaging?  How about sending the 
code to him via text message?  Putting it on a pastie or on code pad? 
IRC, sFTP, SSH, you see, in the 21st century, there exists a plethora of 
solutions to circumvent this particular issue.


I would be interested in finding out how the OP ended up having 
absolutely no option but to pass code to another Homo Sapien verbally?  
Unless you managed to cripple your system and disconnect your company 
from the internet, surely, it would have been faster (and easier) using 
the methods above rather than trying to spell it out over the phone.


In any case, I would say:

Call the getServiceId method of the $item object and make that the 
condition of a ternary opertor, if true, call the method again, 
otherwise call the getId method of the $item object


I'm guessing the reason you were on the phone to him/her was because 
your parentheses don't match ... but that's a different story I guess.


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



Re: [PHP] Wrong Date

2009-10-16 Thread Joseph Masoud

Darvin Denmian wrote:

Thanks for your reply

- I'm running Red Hat Linux (5.3)
- The system timezone is set to America/Sao_Paulo

I'm running a stand-alone php script (crontab) , and I don't know how PHP
output this wrong hour.

The output of command php -i  shows:

Default timezone = America/Sao_Paulo

I don't know what to do  :(

Thanks !




On Fri, Oct 16, 2009 at 2:14 PM, Thodoris t...@kinetix.gr wrote:
  

Hello,

My currently timezone is set to : America/Sao_Paulo
My currently date/time is ok: Fri Oct 16 13:04:45 BRT 2009
But when I execute echo date(d/m/Y H:i:s); the output presented
have +1 hour

Bellow [date] of php.ini:

date

date/time support = enabled
Olson Timezone Database Version = 2008.2
Timezone Database = internal
Default timezone = America/Sao_Paulo

Directive = Local Value = Master Value
date.default_latitude = 31.7667 = 31.7667
date.default_longitude = 35.2333 = 35.2333
date.sunrise_zenith = 90.58 = 90.58
date.sunset_zenith = 90.58 = 90.58
date.timezone = no value = no value


Thanks


  

Assuming you have a unix-like OS and the timezone you mention is set to the
system clock I will have to guess that PHP uses different zone from the
system.

Try setting the date.timezone setting in your php.ini and see what happens
(don't forget to restart the web server to make changes take effect) or use
the ini_set().

--
Thodoris





  

1. It is possible that the php.ini files are different.
2. Run phpinfo() to check where the php.ini file your web server uses is 
located.

3. Check that the timezone settings are correct.

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



[PHP] dictionary/spell check...

2009-07-16 Thread Dan Joseph
Hi Everyone,

This is slightly off topic...  We're building an application, and have a
need for an opensource dictionary.  Basically a way to match words against a
dictionary to see if they are valid, and what type of word they are. noun,
adv, etc..

Can anyone point me in the right direction?  Yes.. I did google already...

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] dictionary/spell check...

2009-07-16 Thread Dan Joseph
On Thu, Jul 16, 2009 at 3:51 PM, Robert Cummings rob...@interjinn.comwrote:

 Aspell.

 Can anyone point me in the right direction?  Yes.. I did google already...



Thanks!

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


[PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
Hi Everyone,

I'm trying to get Chrome to output html information as it comes thru.  We
have an iframe running a php script, and when the php script receives
information, it outputs it.  FF, IE, and Safari all work just fine, displays
the info as it comes in.  However, Chrome is not.  It will only display the
information after the php script stops executing.

I am outputting this after every echo:

echo str_pad( , 4096 ) . \n;

flush();
ob_flush();

ob_implicit_flush();

Has anyone else had this issue?  Anyone know how to fix it?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
On Fri, May 1, 2009 at 10:29 AM, Robert Cummings rob...@interjinn.comwrote:


 Have you tried a bigger pad? Try... oh I dunno... 40096. if that works
 then you can chop back until you find the threshold. Seems to be though
 that it might be better done as AJAX.


Hi,

I tried that, didn't work at all even up to 144096 on the pad, but no dice.
Ajax unfortunately isn't an option in this particular case.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
On Fri, May 1, 2009 at 10:40 AM, Robert Cummings rob...@interjinn.comwrote:

 On Fri, 2009-05-01 at 10:34 -0400, Dan Joseph wrote:
 
  Ajax unfortunately isn't an option in this particular case.

 Why? Maybe you're thinking about it wrong.


Maybe, I'm open to suggestions:

Here's the basic way the application works.   main index renders, javascript
runs to create an iframe, and set the src='phpfile.php' that runs in a
continuous loop.  it connects to the server, and then listens for output.

Disconnecting from the server isn't an option at all, or else the
application will not function properly.  It needs to have the constant
stream to the server.

Is there a better solution for this?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


  1   2   3   4   5   6   7   8   9   >