Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. 1. Download composer.phar from http://getcomposer.org and drop it inside your project directory 2. Create a composer.json file: { "require": { "imagine/imagine": "0.6.*@dev" } }3. Run $ /path/to/php composer.phar install in the terminal4. Use the imagine library: <?php require_once 'vendor/autoload.php' $imagine = new Imagine\Gd\Imagine(); $image = $imagine->open('/path/to/image'); $image // scale image to 50% ->thumbnail($image->getSize()->scale(0.5)) // display as jpeg at 75% ->show('jpeg', array('quality' => 75));Documentation can be found at http://imagine.readthedocs.org/en/latest/index.htmlAPI is available at http://imagine.readthedocs.org/en/latest/_static/API/
  2. Yes. Simply state your new topic title here, I'll change it for you.
  3. Use google maps. And simply place Maker's on the map. It's also possible to get the directions between two Maker's.
  4. Indeed. You talk about poor OOP practices and you mention procedural code. That's like writing an article about Italy and then go on describing the country-side in Australia. How call_user_func and if/switch fit into the poor OOP practices is also lost on me.
  5. There is no typical term. You can make this up. Some use pro account, others use premium account. If you have multiple levels in your premium accounts, you can use gold, silver, copper as differentiators.
  6. A dependency is when one thing requires another to work. For example: class A implements FrameworkSpecificInterface class A extends FrameworkClassB class A { public function setFoo(FrameworkSpecificInterface $i) } class A { const B = FrameworkFoo::B; }These are hard depencies on an interface, a class, a constant, and a soft depency on the framework it's from (if these were framework things). These are hard depencies since your code won't run if it can't find the class/interface/constant. Dependency injection/IoC does not remove these dependencies, they merely help you to bind these dependencies dynamically. It also allows you to decouple any using code from having to know how to construct the object. That said, IoC is not a new concept, in fact there are many patterns you may already know that provide IoC: a Factory, a Facade, a Builder. These all share the same thing they hide the construction of an object from the code that uses it, though less dynamically then a dependency injection container. http://en.wikipedia.org/wiki/Inversion_of_control
  7. Portfolio. Is sufficient to have your foot in the door. Most employers will also use a technical test to ascertain quality offered. For example we use multiple empirical technical tests which basically acts as a grading system. Candidates that passed are contacted for a conversation.
  8. http://forums.phpfreaks.com/topic/281633-generate-a-registration-id-and-display-it-after-successful-registration/?do=findComment&comment=1447128
  9. Our first hindu in the Guru rank.
  10. Your MVC implementation is wrong. class Controller { private $view; private $model; } class Model { } class View { private $model; }Your controller connects your Model and View. Not your View.
  11. I think it's great to see two people decide to repeat what I said.
  12. table (.., version) table_versions (.., version)In table version is default 1 when you update the row you copy it to the *_versions table. You update the table, and increment the version on the 'table' table. You might wanna lock the row/table before doing this to avoid multiple people overriding each others changes.
  13. If you use Doctrine you can create your database schema in code. Schema updates can then be performed through code.
  14. Double post http://forums.phpfreaks.com/topic/281490-systemportal-to-manage-logins-authenticate-other-systems-basic-functions/?do=findComment&comment=1446430
  15. Encrypting your source code is slow. An hacker is still able to retrieve the decrypted code or able to generate a license key or re-use an existing key multiple times. Encrypting your source code also has other issues, like how will you provide support when they need it, unless you have some extreme logging in your code this will be hard to do, and you can't install an decrypted version on their system. Developing new features has the same problem. It's ok if everything runs smooth, but if something fails, you lose a customer. So in essence encrypting your software makes you lose business instead of gaining. Therefor it is up to you as a businessmen to think of a way that will provide you repeat business and happy customers without having to resort to techniques that are threats to your business. Like for example provide a lightweight version of your product for free. Customers wishing additional features, can buy these from your website, you can even allow 3rd party developers participate, and let them sell these through your website, taking a percentage on each sale. Aggressive methods will make your customers run away from you instead of towards you. If you are developing this for a customer, and my arguments don't stick. Then you are gonna have to clearly define what the software will do when an invalid/expired license key is entered. If you lock down your system like the above mentioned script does, none of your customers is gonna like this (and probably either sue you or leave), that they can't access THEIR data and their website is offline because the license key expired at 2am... (they are gonna raise their middle finger to the screen while they press [del] in their ftp client). So at the very basic level you'll need a working lightweight version of your software, that allows exporting data, and some basic admin stuff (fix typos etc.. while they wai for the new license key), and ability to enter/purchase a new license key. Just imagine your OS would lockdown when you dont have a valid license key, and they encrypted your hard-drives, so without the license key you cant get your photos, your music, .., I think you would be really pissed off and you would most likely run linux from that point onwards, if not already Treating your customers like friends is better then to treat them like enemies, because they'll treat you the same way!
  16. Your website is flagged by my antivirus as harmful. http://browsingprotection.f-secure.com/swp/result?url=http%3A%2F%2Fuqload.com%2F
  17. The result you return is passed to the success function. success: function(data) { var el = document.getElementById('subcategory_id'); $(el).empty(); // remove all HTML inside <select/> $.each(data, function(i, option) { // add each <option/> from data $('<option value="' + option.id + '">' + option.name + '</option>').appendTo(el); }); }
  18. Dupe: http://forums.phpfreaks.com/topic/281199-php-assigne/
  19. It's easier to install phpunit and zendframework through composer. Download composer.phar and put it inside your project directory. Then using the commandline type: $ composer.phar require phpunit/phpunit zendframework/zendframework
  20. No. It was the answer to your second question. A front controller is the single point of entry to boot your application, in Java this is your main method. In C++ this is main(). In PHP this is index.php (or whatever you set as default). Since files can easily be served by Apache you don't need a front controller as Apache does all your front controller needs. However where your system consists of functions or objects it's not so easy to route a request to an object which is why you use a front controller to do this for you. Thus translating /foo/bar to (new Foo)->bar() or to foo_bar().
  21. If all your controllers are named: index.php, start.php, .. then you don't need a front controller as Apache already does all what your front controller would do. The reason there is a front controller in some systems is because something has to translate /foo/bar to (new Foo)->bar(); or foo_bar(); when your controllers however are files, then your front controller is obsolete. Using includes you would center the logic required to redirect the user to the correct page, like when he is not logged in.
  22. You understood me wrong in your controller you can use this however you want, but not inside your update_save function. You can pass these like so: update_save($_POST['foo'], $_POST['bar']);If you need a redirect you just add it: update_save(..); header('Location: ..'); exit;
  23. Yes. It separates the 3 responsibilities. Though a controller should not execute queries as only your model should be capable to do this. Also your update_save function should receive it's data from the controller and not use $_POST or $_GET internally since only your controller knows about $_POST and $_GET. The controller should be a firewall of some sort, between the client and your controller HTTP exists, but the model should be agnostic of HTTP. HTTP CALLS { client }<---->{ controller}---->{ model } The advantage here is that you can change HTTP to for example CLI or SOAP or whatever without having to change the underlying model. Since $_POST, $_GET, $_COOKIE, $_SESSION are part of HTTP it's therefor that your model should be agnostic of these variables. A model should not issue redirects since redirect's are the responsibility of the controller.
×
×
  • 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.