Jump to content

dpacmittal

Members
  • Posts

    220
  • Joined

  • Last visited

    Never

About dpacmittal

  • Birthday 07/24/1990

Contact Methods

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

Profile Information

  • Gender
    Male

dpacmittal's Achievements

Member

Member (2/5)

0

Reputation

  1. How about the second part of the question about the MX entries?
  2. I'm wanting to change hosting provide but I dont know how to change it without any downtime. Any help is appreciated. Also, since I'll change hosts, I need to point my domain names to the new nameservers. So, do I have to edit the MX entries to point to Google Apps again or would it be retained? Just FYI, I'm switching from Linode to Web Faction.
  3. I've modifying lots of wordpress plugins for a client. But since I've modified them he can no longer update them. Is there anyway to modify a plugin and still make them update. I know some updates might break the changes, but thats okay. I just want the plugins to be updatable and changes I've made applied to them dynamically or something.
  4. I made a CNAME static.mysite.com and pointed it to www.mysite.com. This is basically to create a cookieless domain. Now I don't want anything other than javascript, css and pictures to be served from static.mysite.com. I almost wasted one hour figuring out what htaccess would suffice this. I've got the logic but I am not able to implement it. Basically, if the HOST header has static in it, then allow only above-specified filetypes and give a 403 on the other pages. If the HOST header doesn't contain 'static' in it, then its normal domain and should allow access to everything. I hope I am clear. Can you guys help me with this?
  5. Gave a quick look and I have just one suggestion: Consider making a db class just for CRUD operations and another class which would handle the queries related to login. This way db class becomes reusable.
  6. I guess this would be quite enough.
  7. Yeah, I hope so. I'd rather sacrifice performance. Thanks for all the replies. I'll mark this solved.
  8. Thanks for the code. I too had thought of doing this way but I wanted to have better performance. In this way, you notify all the attached observers which then process through a series of conditions. This creates unnecessary overhead. Is there any way we can notify only the objects which are related to a particular state?
  9. Add set_time_limit(0); ini_set('memory_limit', '64M'); at the top of the file. Also initialize $message as pointed by bulrush.
  10. I think he means a web-app which can update on a single click or maybe auto-update using cron. @OP: You can create a php file on central server which simply echoes (or displays xml) latest version of software available. You can then use curl to download the archive on to client server, use zip libraries to extract the files and redirect the client-browser to upgrade.php or something.
  11. I don't know whether I'll get better answer posting this in 'Php coding' or 'Application design', so I'll just post it in 'PHP coding' since it has more traffic. Okay, so I've read about observer pattern, seen examples. Seen how to use SPL for the purpose. However, all the examples were basic and only dealt with a single hook. However, I'd like to have multiple hooks within a class and I am confused about whats the best way to achieve that. I've written a code last night which does this but I'm afraid its very noobish. I'd be grateful to anyone who could point me in the right direction. Code I wrote last night: <?php class Login implements SplSubject { private $storage; var $currhook; function __construct() { $this->storage = array(); } function attach( SplObserver $observer ) { if(!isset($this->storage[$observer->hookName])) $this->storage[$observer->hookName] = new SplObjectStorage(); $this->storage[$observer->hookName]->attach($observer); } function detach( SplObserver $observer) { $this->storage[$observer->hookName]->detach($observer); } function notify() { foreach ( $this->storage[$this->currhook] as $obs ) { $obs->update( $this ); } } function log_in(){ $this->currhook = 'beforelogin'; $this->notify(); echo "LOGGED IN"; $this->currhook = 'afterlogin'; $this->notify(); } } class LoginObserver implements SplObserver { var $hookName; function update(SplSubject $login){ $this->doupdate($login); } } class afterLogin extends LoginObserver { function __construct(Login $login){ $this->hookName = 'beforelogin'; $login->attach($this); } function doupdate($login){ echo "beforelogin<br/>"; } } class beforeLogin extends LoginObserver { function __construct(Login $login){ $this->hookName = 'afterlogin'; $login->attach($this); } function doupdate($login){ echo "<br/>After login"; } } $login = new Login(); new beforeLogin($login); new afterLogin($login); $login->log_in(); ?> Pardon the naming inconsistencies.
  12. This is what you need: http://php.net/manual/en/function.eval.php Store the equation in database as: $ORIGINAL_PRICE - ($ORIGINAL_PRICE * 0.50) After that, you can do: $value = eval($row['equation']);
  13. Thanks a lot. I was just over-complicating stuff. It was straighforward. Thanks, again.
  14. UPDATE: I tried this new regex. It seems to be working fine except that it is accepting phone numbers with lesser digits. Here is it: if(preg_match('!^\d(\d|(?<=\d)(\s|\-)?){5,10}\d$!',$number))
×
×
  • 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.