Jump to content

SparK_BR

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by SparK_BR

  1. if you use cygwin or something and do a "ls -lia" you will see that things that can be run are marked with x, things that are readonly aren't marked with w and so on I think ntfs uses the chmod policy but windows explorer hides it from the user except if you try to share the folder, then you will see the permition settings oh btw, to set a folder and/or file permition use chmod
  2. version control is language independent here we use SVN but we want to use GIT in the future (stay away from CVS)
  3. He means you must create a page like "hobbies.php" but in the main page you simply don't link to it so the bot will get to your index but if the index has no link to the other page, the bot won't see it
  4. if you exclude all session_start() calls and leave only the ones that get called directly, like the main screen, the things that get called through ajax or something. then you wouldn't need session_start() for the rest I mean, included/required files don't need session_start() other than that just check if session_id() returns an empty string
  5. you can give a name to the submit button and then check isset($_POST['name']); to see what action to take, your target script would be a delegator, just delivering the message to the right script so you can either redraw the screen with more itens or add the itens to the database (phpMyAdmin does that)
  6. SparK_BR

    An Odity

    Good, at least PHP tells you something is wrong
  7. on mine I have a small script that instantiates the controller, sets the parameters from POST then run the intended action and returns the results already digested by the view. but of course, in the controller I can call another one and make it run something for me, only thing is that I can discard the result or play with the result object. as in like, if you call 'erase' in a group controller, it calls the item controller and erases the itens of that group before commiting suicide.
  8. shouldn't your substr be using 10 as third parameter instead of -10? actually, you should use substr($page_content,$strPos-10,strlen($q)+10); or something if you want to cut 10 before and 10 after the keyword and not counting with it
  9. something like that is either with the php team (or someone with time) with a list of commands and versions to check the script or somebody with all versions installed and capturing warnings and errors with every execution (and of course a vm or sandbox like thing to prevent a script to change stuff on the server)
  10. if by "defying" you mean "defining" ok =D a nice concept you should take a look at is dependency injection. either by constructors, by setters, or by configuration objects/injection containers. it's simple and will keep your code decoupled
  11. there's no such competitions where I live... and usually people who are smarter than the teachers score 50%
  12. SparK_BR

    An Odity

    is that because you used $this and called foo as static context and it found the closest instance context to get "$this" value? really interesting
  13. then you need something more hardcore like Aspects and proxies so you can attach pseudo-events to any method without changing the class, from an external source problem is, it's difficult and uses undocumented workarounds to be implemented (I'm working on something so I can handle transversal interests in my system like logging, but nothing ready yet)
  14. chrome's anonymus window firefox's private navigation and similars may help you with that (cookies get eaten after you close the browser)
  15. can I post code? last time I posted code it got removed... Event abstract abstract class Event{ private $target; private $lockTarget = false; public function setTargetOnce($obj){ if($lockTarget) return; $this->target = $obj; $this->lockTarget = true; } abstract public function getName(); public function getTarget(){ return $this->target; } } Handler abstract (your dispatcher inherit from this) abstract class EventHandler{ private $listeners = array(); public function addEventListener($eventName,$listener,$method=""){ if(!isset($this->listeners[$eventName])) $this->listeners[$eventName] = array(); $this->listeners[$eventName][] = array($listener,$method); } public function removeEventListener($eventName,$listener){ for($i = 0; $i < count($this->listeners[$eventName]); $i++){ $subject = $this->listeners[$eventName][$i]; if($subject[0] !== $listener) continue; array_splice($this->listeners[$eventName],$i,1); } } protected function dispatchEvent($event){ $event->setTargetOnce($this); foreach($this->listeners[$event->getName()] as $listener){ $called = $listener[0]; if($listener[1] != "") $called = array($listener[0],$listener[1]); call_user_func($called,$event); } } } now to test it you will need these: BasicEvent class BasicEvent extends Event{ private $name = "basic"; private $type; public function BasicEvent($type){ $this->type = $type; } public function getName(){ return $this->name; } public function getType(){ return $this->type; } } and this is something that will use that event: The dispatcher class BasicDispatcher extends EventHandler{ private $holder = false; public function __set($key,$value){ $this->dispatchEvent(new BasicEvent("set")); $this->holder->{$key} = $value; } public function __get($key){ $this->dispatchEvent(new BasicEvent("get")); return $this->holder->{$key}; } } now for the main code: PS the Dynamic class and others are part of my project, you can use any class here $ouvinte = new Dynamic(); $ouvinte->onBasic = function($self,$evento){ JavaScript::alert($evento->getName()." ".$evento->getType()." sendo tratado pelo ouvinte."); }; $disparador = new BasicDispatcher(); $disparador->addEventListener("basic", $ouvinte, "onBasic"); $disparador->addEventListener("basic", "tratarLocal"); $disparador->basicIo = "verificando integridade da mensagem pós-evento."; $mensagem = $disparador->basicIo; JavaScript::alert($mensagem); //local function function tratarLocal($evento){ JavaScript::alert($evento->getName()." ".$evento->getType()." sendo tratado localmente."); } once you set or get the basicIo property the event is dispatched and both listening methods are called
  16. hmm... it's a single table "computers" I guess, then you store the name and specs and type (server, client, terminal, etc...) not sure what use that would have but I guess that's it
  17. ok, let me tell you something to your IT manager: unless you put a fixed IP on the network computers AND you port forward a service on the router to the computer There's no way, an outsider will ever see there's a computer after the modem! ever! just, close your modem ports, enable the config panel only for local network (default) put a good password on it and plug everyone on the modem now if you don't trust the people inside the company... then you have an HR issue.
  18. why don't you use events? create a class that stores the name of the method/ callback/ closure and use the event type/name they are listening to be the key (so you have an array of arrays) then to populate that class using methods like addEventListener, removeEventListener and dispatchEvent. uppon the call of dispatchEvent, you will look for the right type of event and iterate the callback list calling them. so when something happens somewhere in your system and the method is being listen for, it will run your listening functions. (I have a sample here, but then it's part of my framework, pm me if you want a copy)
  19. a name aside from breaking the classes' encapsulation? usually names come from what you are trying to achieve what do you use this pattern for?
  20. you buy an offboard network cards, and connect those to the modem on the internet enabled computers OR you can set up a proxy server (using windows server) sitting betwen the network and the modem and have it block/unblock network users (then you would have to setup domain based login, etc...)
  21. well... your system, as you use pieces of it to achieve a greater objective, may use a framework for the most common tasks. For control panels a template framework is a good idea, for more extensibility of a language a framework may add complex types such as classes for managing connections instead of loose resources and may add event handling too. Generally features that PHP alone would require you to write something similar over and over (or write some dirty code), for each project. So in the end you will be writting your own framework, wanting or not, which may be what you call "your own patters" within the system.
  22. Programmer's Notepad is nice, it's kind of a mix of Notepad++ with TextPad I use Aptana for projects and Programmer's Notepad for individual random files thrown at me by my workmates.
  23. I would tell you to google it or go to php.net, but I think that would be kinda rude. ok, first make sure your form has the method atribute set to post: <form method="post" then on the target atribute place your script url target="callMe.php" so when the client submits the form, it will send the values of the inputs by name within the $_POST array then validate the data, check if the email smells like an email and etc. then use the mail() function! you can look here for reference and samples. another alternative is control the form with jQuery and use the .post() function, so you can check the result and show error messages to the user, but that's GUI and AJAX, the PHP will still be the same.
  24. once it's out, let's learn it as fast as we can so they may hire us XD
  25. I also fear my personal projects, specially when someone is asking me to finish it repeatedly and I don't have time. Something I fear is when the client asks for a "flying anti-gravity coffee-maker fire-throwing car" type project.
×
×
  • 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.