Jump to content

drkstr

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

About drkstr

  • Birthday 09/20/1983

Contact Methods

  • Website URL
    http://www.openbaseinteractive.com/

Profile Information

  • Gender
    Male
  • Location
    Seattle, WA - USA

drkstr's Achievements

Member

Member (2/5)

0

Reputation

  1. I figured that much, but why would a PEAR package not be able to find PEAR.php? I shouldn't have to modify the source to a PEAR package so it makes me think there is something else wrong. I just don't know what. Any ideas? Thanks! ~Aaron **Edit** Just so I'm clear, the error is coming from the pear package, not my script. Here is my script in it's entireity: <?php // include class file require_once("XML/Serializer.php"); // create object $serializer = new XML_Serializer(); // create array to be serialized $xml = array ( "book" => array ( "title" => "Oliver Twist", "author" => "Charles Dickens")); // perform serialization $result = $serializer->serialize($xml); // check result code and display XML if success if($result === true) { echo $serializer->getSerializedData(); } ?> XML/Serializer.php is the PEAR package.
  2. Hello, I'm getting an error when I run a pear package and I'm not sure where to start looking. It seems like it might be some kind of configuration problem but I'm not sure. When I run the php file that includes the pear package, I get the following error: I opened the source file to the pear package and all it has on line 30 is "require_once(PEAR.php)". Any ideas what's wrong? Thanks! ~Aaron
  3. It was indeed a local configuration overriding the global settings. Resolved. Thanks for the help! ~Aaron
  4. Thanks for the quick reply! I updated the php.ini to use the quotes and restarted the server, but no help. When I copy the file to the site directory (which runs phpinfo() I noticed the open_basedir is set to: I also noticed the error indicates the '/var/www/vhosts/domain.com/httpdocs:/tmp' setting. I'm not quite sure what the difference is between the local value and master value, but do you think the 'main' setting is being overridden by a local one? Thanks again! ~Aaron
  5. Hello, I have a set of core files that I want to link to from various site directories and I was wondering if I could get a little help understanding the open_basedir restriction. I have /var/www/vhosts/base/php/phpinfo.php5 and a symlink to the absolute path at /var/www/vhosts/domain.com/httpdocs/php/phpinfo.php5 When I go to http://domain.com/php/phpinfo.php5 I get the following error: I tried setting this line in the php.ini open_basedir = /var/www/vhosts But I still get the same error. Could anyone give me a little insight to understand the problem? Thanks in advance! ~Aaron
  6. First of all, sorry if I seem curt, but it's late and my coding momentum ground to a halt as soon as I needed to do something in javascript (which I'm pretty sure is the devil's creation). Anyways, I have a fairly large form which consists of a long list of identical elements. For example, let's say my form has 10 lines, and each line contains the same 5 uniquely named form elements. So when submitted, the server side script will basically get a matrix of form elements (an array of the first element, an array of the second element, etc.). When any particular element on any particular line is changed, clicked, whatever, I need to be able to modify other elements on the same line. Furthermore, I don't think I can loop through the entire list to find the element being worked on because some of the lines could contain the same value for that element.  I have spent the past few hours digging though my javascript book (which is the biggest programming book I have by the way), and have come to the conclusion that javascript is completely useless for any real coding. Can anyone recommend some strategies for working on dynamically created form elements with such a "static" language? Any advice you can give me will probably add a year to this poor programmers life span. Thanks in advance! ...aaron PS: I can post code if you would like, but I am more interested in general strategies then a specific solution.
  7. heh, yeah, that would be quite a chore. And it is a lot better then my "array of function references" idea too. I'll have to remember these, could come in handy some day. ...drkstr
  8. Was this not the conclusion we came to earlier; We can call the methods, but don't have access to the properties, and in order to simulate it, you will need to declare an instance in your custom object and wrap the method calls to pull from the instantiated object? I would like to know if this is no longer the case, because I can use the method in my current project. I have a bunch of objects that have to pull data from an instantiated object. regards, ...drkstr **edit** Although I see your point, it is a pretty handy way to copy all the methods to your own class. I'm not sure what the original posters intentions were, but from my understanding, I think the problem was being able to extend the object, not use it in another object. I am interested to see if there is a way to modify the data, or if you are limitted to modyfying it with the provided methods.
  9. I had a hard time trying to find a way to get the terminal size (rows and cols) in a command line php script I'm writing. I was about to  give up and call a perl script to get the info, but I was wondering if there was a more efficient way. I need to be able to do this without recompiling php with ncurses support. Any ideas? thanks! ...drkstr
  10. Yup, that worked perfectly. updated code: [code]define( 'MONTHS', 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' ); class Date {   protected $myDay  = 0;   protected $myMonth = 0;   protected $myYear  = 0;   protected $myHour  = 0;   protected $myMin  = 0;   protected $mySec  = 0;   protected $myTimeStamp=0;    #Unix time stamp used for comparason;   public function __construct( $_arDateVars=array() ) {     $nMonth=0;     if(! is_null($_arDateVars)) {       $this->myDay    = (int) $_arDateVars[0];       $this->myMonth  = (int) (strpos(MONTHS, $_arDateVars[1])+4)/4;  #get month number       $this->myYear  = (int) $_arDateVars[2];       $this->myHour  = (int) $_arDateVars[3];       $this->myMin    = (int) $_arDateVars[4];       $this->mySec    = (int) $_arDateVars[5];       $this->myTimeStamp = mktime( $this->myHour, $this->myMin, $this->mySec,                                     $this->myMonth, $this->myDay, $this->myYear );     }   }   #returns True if the passed in date is greater then $this date.   public function greater( $_newDate ) {     return ($_newDate->myTimeStamp > $this->myTimeStamp);   } }[/code] Thanks for the help! ...drkstr
  11. Is there a good PHP manual page that will explain conditional expressions in detail? I'm getting strange results when comparing two objects. Here's the object (I included some debug output): [code]#global var used for month checking define( 'MONTHS', 'undef Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' ); class Date {     public $myDay  = 0;     public $myMonth = 'undef';     public $myYear  = 0;     public $myHour  = 0;     public $myMin  = 0;     public $mySec  = 0;     #pass Null to constructor for an "empty" object     public function __construct( $_arDateVars=array() ) {       if(! is_null($_arDateVars)) {         $this->myDay    = (int) $_arDateVars[0];         $this->myMonth  = (string) $_arDateVars[1];         $this->myYear  = (int) $_arDateVars[2];         $this->myHour  = (int) $_arDateVars[3];         $this->myMin    = (int) $_arDateVars[4];         $this->mySec    = (int) $_arDateVars[5];       }     }     #returns True if the passed in date is greater then $this date.     #otherwise returns False     public function greater( $_newDate ) {       print "checking if\n"; var_dump($_newDate);       print "is greater then \n"; var_dump($this);       switch (True) {         case ( $_newDate.myYear > $this->myYear ):           print "Year: ". gettype($_newDate->myYear)." ".$_newDate->myYear." > ".                           gettype($this->myYear)." ".$this->myYear."\n";           return True;         case strpos(MONTHS, $_newDate->myMonth) > strpos(MONTHS, $this->myMonth):           print "Months: ". gettype($_newDate->myMonth)." ".$_newDate->myMonth." > ".                           gettype($this->myMonth)." ".$this->myMonth."\n";           return True;         case ( $_newDate.myDay > $this->myDay ) :           print "Days: ". gettype($_newDate->myDay)." ".$_newDate->myDay." > ".                           gettype($this->myDay)." ".$this->myDay."\n";           return True;         case ( $_newDate.myHour > $this->myHour):           print "Hours: ". gettype($_newDate->myHour)." ".$_newDate->myHour." > ".                           gettype($this->myHour)." ".$this->myHour."\n";           return True;         case ( $_newDate.myMin > $this->myMin):           print "Mins: ". gettype($_newDate->myMin)." ".$_newDate->myMin." > ".                           gettype($this->myMin)." ".$this->myMin."\n";           return True;         case ( $_newDate.mySec > $this->mySec):           print "Sec: ". gettype($_newDate->mySec)." ".$_newDate->mySec." > ".                           gettype($this->mySec)." ".$this->mySec."\n";           return True;       }     return False;   } }[/code] And here is the output of a sample set: checking if object(Date)#2 (6) {   ["myDay"]=>   int(31)   ["myMonth"]=>   string(3) "Aug"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(9)   ["myMin"]=>   int(13)   ["mySec"]=>   int(21) } is greater then object(Date)#4 (6) {   ["myDay"]=>   int(0)   ["myMonth"]=>   string(5) "undef"   ["myYear"]=>   int(0)   ["myHour"]=>   int(0)   ["myMin"]=>   int(0)   ["mySec"]=>   int(0) } [color=red]Months: string Aug > string undef[/color] checking if object(Date)#4 (6) {   ["myDay"]=>   int(31)   ["myMonth"]=>   string(3) "Aug"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(9)   ["myMin"]=>   int(25)   ["mySec"]=>   int(13) } is greater then object(Date)#2 (6) {   ["myDay"]=>   int(31)   ["myMonth"]=>   string(3) "Aug"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(9)   ["myMin"]=>   int(13)   ["mySec"]=>   int(21) } checking if object(Date)#5 (6) {   ["myDay"]=>   int(1)   ["myMonth"]=>   string(3) "Sep"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(8)   ["myMin"]=>   int(14)   ["mySec"]=>   int(31) } is greater then object(Date)#2 (6) {   ["myDay"]=>   int(31)   ["myMonth"]=>   string(3) "Aug"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(9)   ["myMin"]=>   int(13)   ["mySec"]=>   int(21) } [color=red]Months: string Sep > string Aug[/color] checking if object(Date)#2 (6) {   ["myDay"]=>   int(7)   ["myMonth"]=>   string(3) "Sep"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(21)   ["myMin"]=>   int(31)   ["mySec"]=>   int(2) } is greater then object(Date)#5 (6) {   ["myDay"]=>   int(1)   ["myMonth"]=>   string(3) "Sep"   ["myYear"]=>   int(2006)   ["myHour"]=>   int(8)   ["myMin"]=>   int(14)   ["mySec"]=>   int(31) } As you can see, it's only returning True for the cases when the month is greater.  What am I doing wrong? Thanks for the help! ...drkstr
  12. It actually does involve a bit of log analizing, which perl is great for. I wanted to give php a shot with this project though, just to se  how it held up. The thing I really liked about PHP was how easy it was to take it to the next level. I started out doing a simple log mining to building an andvanced method for generating data reports based on whatever criteria you want, date ranges, IP ranges, service protocols, or a combenation thereof. I'm not saying this isn't possible in perl, but I think in a very object oriented kind of way and it was easire for me build complex data objects in this mindset, then the more linear perl approach. I am however, going to stick to perl for the simpeler tasks since I like it's low level syntax more. And it's regex kicks! [code]CPAN/modules, <>, map, grep, custom sorts, lists, slices, contexts, references (out the wazoo)?[/code]Not to long, I've only been using Linux for about a year now. Never I am a big fan of all the other trickery you mention though. Building objects as multidemensional arrays was fun (that is, if you like pain ..which I do). I guess I should look into some more of the advanced features you mentioned, such as 'map' (not really sure what that is). Thanks for the replies! This has been a fun learning process for me! ...drkstr
  13. Thanks for the link. After a litle bit of reading up on the pros/cons, I don't think I'm ready to give up on perl quite yet. I am going to give it a shot for this project however. I wanted to analyze my log files and store info in a database, and I think I can put my new found PHP knowledge to use with this. After some more reading, I found what I needed to get started. $argc is the number of arguments, and $argv is an array that contains command line arguments. Thanks for the pointer to the right direction! ...drkstr **edit** Just wanted to clear something up. I meant no disrespect when I said PHP was a better language. perl was actually my first language, so it will always hold a place in my heart. I'm a big OOP person however so I was excited when I started learning PHP. For the same reason, I'm thinking of picking up python at some point.
  14. I do a lot of perl scripting for my Linux desktop and server, and was wondering how PHP held up as a replacement. Does is support command line parameters? If so, how are the accessed in the PHP script? Also, does it support a shebang ( #!/usr/bin/php at the top of the file ), or do I have to tell it to run the script manually with 'php script name'? I would like to start doing my scripting in PHP since it's a much better language. Any input would be appreciated. Thanks! ...drkstr
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.