Re: [PHP] the best 1 book for php

2011-04-07 Thread Yousif Masoud
On Thu, 2011-04-07 at 00:15 -0400, Kirk Bailey wrote:
 If I only had 1 book on php, what would it be?
 
 -- 
 end
 
 Very Truly yours,
   - Kirk Bailey,
 Largo Florida
 
 kniht
+-+
| BOX |
+-+
 think
 
 

The best answer I can think to your question is: It depends.

That said, can I suggest PHP in Action by Reiersol, Baker and Shiflett

I believe it covers a good variety of topics.

http://books.google.com/books?id=8TnUOQAACAAJdq=PHP+in
+actionhl=ensrc=bmrrei=6cmdTY7eD8Gk8QOyufm2BAsa=Xoi=book_resultct=resultresnum=1ved=0CCgQ6AEwAA



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



Re: [PHP] 1984 (Big Brother)

2010-09-15 Thread Yousif Masoud

On 12/09/10 17:32, tedd wrote:

Hi gang:

I have a client who wants his employees' access to their online 
business database restricted to only times when he is logged on. 
(Don't ask why)


In other words, when the boss is not logged on, then his employees 
cannot access the business database in any fashion whatsoever 
including checking to see if the boss is logged on, or not. No access 
whatsoever!


Normally, I would just set up a field in the database and have that 
set to yes or no as to if the employees could access the database, 
or not. But in this case, the boss does not want even that type of 
access to the database permitted. Repeat -- No access whatsoever!


I was thinking of the boss' script writing to a file that accomplished 
the yes or no thing, but if the boss did not log off properly then 
the file would remain in the yes state allowing employees undesired 
access. That would not be acceptable.


So, what methods would you suggest?

Cheers,

tedd


Hi Tedd,
One aspect of software design to keep in mind is change.  Today the 
customer wants everyone to have access when they are logged in.  They 
may want that rule relaxed a little.  Perhaps, employees can login when 
members of a certain group are logged in.


I recommend using some form of external device that instructs the system 
to enable/disable access to the database. Depending on the sensitivity 
of the data, the solution can utilize a card reader (once the boss takes 
the card out of the reader, database access is terminated for the 
company) and either a fingerprint or retinal scanner [for extra 
security].  If it is really sensitive data, then a retinal scanner and 
some form of code generator that generates one-time eight digit (at 
least) code to enable access to the database.  The algorithm that 
generates the codes would be a deeply guarded secret (that would mostly 
be their problem -- you will need to ensure that once you sign off the 
project, there is no way it can be retrieved from you).


No need to shut down the database server, just instruct the firewall to 
block the MySQL port and/or Web server port.  Might be a good idea to 
choose a different port than 3306 for MySQL.


What would happen if, for some reason the boss couldn't make it in or 
is on Holiday?


Good luck,
Yousif

PS. It might be a good idea to introduce them to the concept of RBAC and 
see what they think.




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



Re: [PHP] Still searching for a bugtracking system

2010-03-30 Thread Yousif Masoud
On Tue, Mar 30, 2010 at 2:13 PM, Andre Polykanine an...@oire.org wrote:

 Hello everyone,
 The best of all suggested bugtrackers is JotBug, on my opinion. But it
 works only with SQLite databases, and I have no access to such one
 (only MySql).
 Any solutions?

[...]

I use Eventum.  So far, so good.

http://dev.mysql.com/downloads/other/eventum/

Works fine with Maria DB too.


Re: [PHP] Server-side postscript-to-PDF on-the-fly conversion

2010-03-27 Thread Yousif Masoud
On Sat, Mar 27, 2010 at 4:41 AM, Rob Gould gould...@me.com wrote:

 Is there a free solution out there that will enable me to take a
 PHP-generated postscript output file, and dynamically, on-the-fly convert it
 to a PDF document and send to the user as a download when the user clients
 on a link?

 [...]

 3)  I've got a PHP file that takes that input and generates a custom
 Postscript file from it, which I presently serve back to the user.  On a
 Mac, Safari and Firefox automatically take the .ps output and render it in
 Preview.

 [...]


I think you're looking for a PHP library that can take the output from the
function that produces the PS file and generates a PDF file which you then
send back to the user.  I haven't come across such a utility.

I recommend generating a PDF file directly using PDFLib or FPDF (
http://www.fpdf.org/) if possible.

An alternative strategy (if you cannot create a PDF directly) could be:

1. Validate input and Generate PS file then go to 2 otherwise raise input
exception and exit
2. Write (1) to a temporary location then go to 3 otherwise raise file
generation exception and exit
3, Use a utility like ps2pdf (or ghostscript) to convert file to pdf then go
to 4 otherwise raise file conversion exception and exit
4. Serve (3) then go to 5 otherwise raise file transfer exception and exit
5. Delete files and exit normally

Tutorial on ps2pdf: http://www.linux.com/archive/feed/35022


Re: [PHP] Adding Time

2010-03-27 Thread Yousif Masoud
On Sat, Mar 27, 2010 at 8:41 PM, Gary gwp...@ptd.net wrote:

 [...]
?php


  $pay_date=($_SESSION['pay_date']);


  $loan_length=($_SESSION['loan_length']);

 $orgDate=($_SESSION['pay_date']);
 $mth=($_SESSION['loan_length']);
 function add_date($orgDate,$mth){
  $cd = strtotime($orgDate);
  $end_date = date('Y-m-d',
 mktime(0,0,0,date('m',$cd)+$mth,date('d',$cd),date('Y',$cd)));
  return $end_date;
 }
 echo $orgDate .br /;
 echo $end_date .br /;
 echo $pay_date .br /;
 echo $loan_length;
 ?


You access form element values via the $_POST superglobal, why are you using
$_SESSION?

http://php.net/manual/en/reserved.variables.post.php


Re: [PHP] Adding Time

2010-03-27 Thread Yousif Masoud
On Sat, Mar 27, 2010 at 8:41 PM, Gary gwp...@ptd.net wrote:

 [...]
?php


  $pay_date=($_SESSION['pay_date']);


  $loan_length=($_SESSION['loan_length']);

 $orgDate=($_SESSION['pay_date']);
 $mth=($_SESSION['loan_length']);
 function add_date($orgDate,$mth){
  $cd = strtotime($orgDate);
  $end_date = date('Y-m-d',
 mktime(0,0,0,date('m',$cd)+$mth,date('d',$cd),date('Y',$cd)));
  return $end_date;
 }
 echo $orgDate .br /;
 echo $end_date .br /;
 echo $pay_date .br /;
 echo $loan_length;
 ?


Can you echo $pay_date and show us how the input date is formatted? eg.
2010-03-27

Can you also show us the output of the last four echo statements?

This works for me:

function addMonthsToDate($start,$month)
{
return strtotime($start + $month months);
}

$test = addMonthsToDate(2010-03-26,3);

echo date('Y-m-d',$test); // gives 2010-06-26


Re: [PHP] Adding Time

2010-03-27 Thread Yousif Masoud
On Sat, Mar 27, 2010 at 10:26 PM, Gary gwp...@ptd.net wrote:

 [...]

 strtotime('$pay_date'));

 [...]


If you want the value of $pay_date to be the argument of strtotime, you need
to enclose it in double quotes (do the same for all other occurrences).

Try:

strtotime($pay_date);

[...]

When a string http://www.php.net/manual/en/language.types.string.php is
specified in double quotes or with heredoc,
variableshttp://www.php.net/manual/en/language.variables.phpare
parsed within it.

[...]

from: http://php.net/manual/en/language.types.string.php
Beginning of Variable Parsing Section


Re: [PHP] Adding Time

2010-03-27 Thread Yousif Masoud
On Sat, Mar 27, 2010 at 10:26 PM, Gary gwp...@ptd.net wrote:

 [...]


$end_date=date('m-d-Y',strtotime('$mth')) + date('m-d-Y',
 strtotime('$pay_date'));

 [...]


Try changing above to:

$end_date = date('m-d-Y',strtotime($pay_date + $mth months));

I think your mail client took it out of the add_date function.


Re: [PHP] MySQL: Return Number of Matched Rows

2010-03-25 Thread Yousif Masoud
On Thu, Mar 25, 2010 at 9:19 PM, James Colannino ja...@colannino.orgwrote:

 Yeah, the extra select is what I was hoping to avoid :-P  The MySQL
 client will return both the number of rows matched and the number of
 rows affected by the query; I was hoping perhaps the PHP API offered a
 way for me to do the same.  Ah well...  Thanks!


You can access data about the latest query via mysql_info()

http://php.net/manual/en/function.mysql-info.php

You can parse the string for the values you need.

There may be a more elegant solution.


Re: [PHP] how to do cloud computing with php

2010-03-24 Thread Yousif Masoud
On Wed, Mar 24, 2010 at 11:55 AM, Rene Veerman rene7...@gmail.com wrote:

 Hi..

 As a way to take a few steps back from the kinda heated when will php
 grow up and support threading thread, i'm requesting you people list
 how you scale from 1 server to many servers; what's called cloud
 computing.


Interesting definition of cloud computing.

There is a book called Building Scalable Web Sites by Cal Henderson.

http://books.google.co.uk/books?id=wIWU94zKEtYCdq=Building+Scalable+Web+Sitesprintsec=frontcoversource=bnhl=enei=zg2qS7m1G9WO_AbL7_x1sa=Xoi=book_resultct=resultresnum=4ved=0CBcQ6AEwAw#v=onepageq=f=false

I recommend you take a look at Chapter 9: Scaling Web Applications,
particularly the following sections:

The Scaling Myth (particularly the subsection What is Scalability?)

Scaling PHP
I quote As PHP has gained more acceptance as a serious language, there's
still been a significant camp of people claiming that it can't scale.
 Clearly, this isn't the case. page 212.

It would be very helpful if you tell us what you've read, tried or
considered?


Re: [PHP] Recommended Books on Object Oriented Programming

2010-03-24 Thread Yousif Masoud
On Wed, Mar 24, 2010 at 12:13 PM, Ben Stones stones...@googlemail.comwrote:

 Hi,

 I want to properly learn object oriented programming as I've been coding in
 procedural style since I started with PHP a few years ago, and want to give
 OOP a shot. The web isn't really a good resource to learn OOP in PHP to be
 honest, as a lot is outdated for PHP4's style of OOP. I've looked into OOP
 quite a bit and understand the concept of it, and want to take it further.
 Any recommendations appreciated :).


I think the Head First Object Oriented Analysis and Design book is a good
place to start.

http://books.google.co.uk/books?id=-QpmamSKl_ECdq=Head+First+Object+Oriented+Analaysis+and+Designprintsec=frontcoversource=bnhl=enei=9hKqS6LUKNP__AbXl8CAAQsa=Xoi=book_resultct=resultresnum=4ved=0CBoQ6AEwAw#v=onepageq=f=false

For PHP, a book I really liked was:

http://books.google.co.uk/books?id=LWkGyWErOq0Cprintsec=frontcoverdq=Web+applications+PHP+And+MySQLhl=enei=KROqS9jWAtCM_Ab5isC1AQsa=Xoi=book_resultct=resultresnum=1ved=0CDoQ6AEwAA#v=onepageq=f=false

A very clear route to developing OO PHP applications.  There is a sample
winestore application in the last section of the book.

You will still need to use the Web as these books become out of date as soon
as they're published.  I recommend to focus more on the thought process
rather than the actual code in the books.

To really grasp OO in PHP, I recommend checking out a popular open source
PHP Application and go through the code.  A CMS or a framework should
suffice.


Re: [PHP] Recommended Books on Object Oriented Programming

2010-03-24 Thread Yousif Masoud
On Wed, Mar 24, 2010 at 1:33 PM, Yousif Masoud yousif.mas...@gmail.comwrote:

 For PHP, a book I really liked was:


 http://books.google.co.uk/books?id=LWkGyWErOq0Cprintsec=frontcoverdq=Web+applications+PHP+And+MySQLhl=enei=KROqS9jWAtCM_Ab5isC1AQsa=Xoi=book_resultct=resultresnum=1ved=0CDoQ6AEwAA#v=onepageq=f=false



Apologies, I gave the wrong link to the PHP book, it should be:

http://books.google.co.uk/books?id=ttlrWxAUX0gCprintsec=frontcoverdq=Web+Database+Applications+with+PHP+and+MySQLhl=enei=ExaqS4fAD5T__Aavgam5AQsa=Xoi=book_resultct=resultresnum=1ved=0CDwQ6AEwAA#v=onepageq=f=false


Re: [PHP] Will PHP ever grow up and have threading?

2010-03-24 Thread Yousif Masoud

 P.S. I HATE bottom posting. WTF do I have to scroll all the way down past
 hundreds of useless lines just to read a me too or some other comment. If
 it's at the top, I can simply just keep moving from header to header in
 Outlook (or your email GUI of choice). DELETE as I go. Easy. Simple.
 Efficient.


http://www.netmeister.org/news/learn2quote.html


Re: [PHP] MySQL Appeal from Monty

2009-12-16 Thread Yousif Masoud
On Wed, Dec 16, 2009 at 3:14 PM, Philip Thompson philthath...@gmail.comwrote:

 On Dec 15, 2009, at 6:03 AM, Ashley Sheridan wrote:

  On Tue, 2009-12-15 at 02:53 +, Joseph Masoud wrote:
 
  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
 
  I've always been led to believe that you go with MySQL if you want speed,
 Oracle if you want data integrity. I know they both handle each one
 admirably, but Oracle is known more for guarding the data against mishaps
 and MySQL is known more for performance. I just think it may be a little
 early to be condemning Oracle yet, we should wait a little to at least see
 what stance they have on the whole thing. And before you ask, no I have no
 connection to Oracle, I'm an avid MySQL fan!
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 

 Let's not forget one of the biggest decisions on why people choose MySQL
 over Oracle/MSSQL it's way cheap. So cheap they're nearly giving it
 away. Oh wait! They ARE giving it away. You start to piss people off
 whenever you take away their working, free option. Also by being open
 source, you have plenty of people that have the opportunity to work with it.
 The biggest reason I haven't messed with Oracle (except in college for my db
 class) is that it's expensive. Don't underestimate how cheap people are.
 There's your different audience.

 ~Philip

Your rant has been repeated so many times that it is becoming like a
corporate mantra.  Some of the biggest software companies in the world use
open source software (which is free as in free beer).  Are companies that
use Linux or FreeBSD as their server software cheap?  For the remainder of
my argument, I will assume that your assertions only apply to database
servers (I'm not sure why you've chosen to single them out).

It is disheartening that developers who decide to use open source software
are castigated as cheap.  Well in my case, I like to know what's under the
bonnet.  That's just me, not a generalization and I emphasize that I am not
speaking on behalf of anyone.

The tenets of a successful argument include a viable theory substantiated by
reliable and independently verifiable facts (none of which exist in your
rant).  I will, nevertheless, try to make sense of your logic [in my own
mind[.

I think you are making 2 assertions and then clumsily using them to prove
your claim.

Assertion 1:  It is inconvenient when a successful, widely adopted and very
convenient open source solution is taken away from the community (I am aware
that there are no explicit plans to kill the project, but this is my
perception based on how Oracle treated InnoDB).

True. This is not only inconvenient, it is rude, immoral and very selfish.
Now, you tell me who's being cheap?  Developers who implement MySQL (for
whatever reason) or Oracle by viciously going after businesses that are
happily using MySQL?

Assertion 2: People who implement Open Source Software are tawdry.
This is absurd.  Period.  Cost is one of the more important factors when
choosing a software solution to implement,