Jump to content

keeB

Staff Alumni
  • Posts

    1,075
  • Joined

  • Last visited

Everything posted by keeB

  1. Sounds like you have a rough idea. Your question isn't really focused.
  2. You'd have a rough time with concurrency in a flat text file.
  3. <?php $file = fopen("c.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached while(!feof($file)) { $num = fgets($file); } fclose($file); $file = fopen("c.txt", "w"); fwrite($file, $num+1); fclose($file); ?>
  4. Make an 'Advanced Search' which lists those traits, and have specific criterion built from the users input. Color Dropdown: Blue/Red/Brown Select * FROM Tarantulas where color='Red' and Size > '5cm' -- user input of size X = 'Y' -- user input of X
  5. I have written a mini-blog post which you may find interesting: http://nick.stinemates.org/wordpress/?p=26 I get this question asked a LOT. Really, it comes down to organization and maintainability of previous code. Can you encapsulate outside of OOP? I guess you could, but you'd come up with a system that's a lot like OOP.
  6. Oooh, namespaces. I've never understood the need for late static bindings. It's probably one of those things that at some point I thought 'that would be nice' but I just worked around.
  7. <?php // $input contains user input function add_whitespace($input) { $zeros = 160 - str_len($input); $buf = ""; for ($x=1,$x<$zeros;$x++) { $buf = $buf . " "; } return $input . $buf; } ?>
  8. __set and __get methods are mainly used for open ended data structures, and generally breaks encapsulation (because every class property is now essentially public.) As you can see, the main draw back is the developer using your API can add properties to a class at their leisure.
  9. Very cool. I knew about :e but I didn't know about bufpos and buftabs.
  10. +1 for gentoo. Only for the linux experienced, though. Nubuntu = can't go wrong if you're a windows user.
  11. select * from table where people <> 'jack smith'
  12. It will take some programming. Actually sounds like a fun project, but what you need to do is the following: Get the largest string for each column and ensure you extend the column (using +---+ ) to that size. Optionally, you could set a total length for the entire table (90 chars for standard terminal please ) and /or set a cutoff length to add a newline.
  13. As long as I require db.class.php, it shows me db.class.php's methods in a context menu (ctrl+space by default) when I am using it. Are you speaking specifically about the class overview option?
  14. I started typing a response, but I ended up posting my thoughts on OOP here: http://nick.stinemates.org/wordpress/ This is about as procedural as my code gets (I dont expect it to make sense, its just an example): <?php require_once("src/php/com/cm/qa/ws/factory/RequestFactory.class.php"); require_once("src/php/com/cm/qa/ws/factory/FileNotFoundException.class.php"); require_once("src/php/com/cm/qa/ws/command/CommandDispatcher.class.php"); require_once("src/php/com/cm/qa/ws/validator/Validator.interface.php"); require_once("src/php/com/cm/qa/ws/validator/ExpectedResultsValidator.class.php"); $r = RequestFactory::getInstance()->getFactory("GetMessageLog.xml"); print "<pre>"; while($request = $r->getRequest()) { try { $validator = new ExpectedResultsValidator(); $c = new CommandDispatcher($request->getURL()); $call = $request->getCall(); print "Executing $call \n"; $response = $c->dispatch($request); $expected = $request->getExpectedResults(); $report = $validator->validate($response, $expected); while ($myresults = $report->next()) { if($myresults->getState()) { print $myresults->getSearch() . " - PASS \n"; } else { print $myresults->getSearch() . " - FAIL \n"; } } } catch (FileNotFoundException$e) { } }
  15. This is what most new programmers do. As you mature, you'll start to rely on a good debugger which is like 'printing to screen' but without code bloat
  16. I don't develop specifically in PHP, but I maintain 3 projects written in PHP. I also actively develop in Python and Java. Edit: Also, I live and work near San Francisco, California.
  17. You'll have to clarify that. I've been using vim for years, and not once have I noticed that it's less productive than a normal text editor. I hope you can clarify something... Are you able to browse a large source base with vim? Also, what keeps me away is I like being able to have multiple buffers open at once and to swap between them within my IDE. This allows me to maintain my code much easier, especially if the code is diverse in location.
  18. I guess I would have to disagree there. Where would Java programmers be without Struts? I think I'd only be weary about adopting a framework in to my site if it were incomplete and I had planned on improvements. Since PHP isn't compiled, if there were ever problems it'd be simple to fix. That said, I don't use frameworks as I don't generally write PHP code with a usable UI. That said, I generally write my own to accomplish my very specific needs. The frameworks I tend to write focus on accomplishing tasks and little else.
  19. I pretty much have a .php file for every piece of help I have ever given both here and on the PHP/Python/Gentoo/Ubuntu mailing lists. To say I am neat is... an understatement
  20. LAPP ? Linux Apache PostgreSQL PHP LPC ? Linux PHP CLI ? :X
  21. Pretty sure I hate JavaScript. It gives me the biggest headache in the world. HTML, too, for that matter. Keep me in the back-end where I belong!
×
×
  • 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.