ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition)

November 23, 2009 11:54pm

Subscribe [46]
  • #391 / Feb 24, 2010 7:58pm

    OverZealous

    1030 posts

    Oh, one more cool trick (for all IDEs):

    Add the attached file somewhere into your project - anywhere will work, as long as the IDE can index it.

    Modify it to include every library you use, and you will get code completion from within Controllers!

    Make sure to choose the correct prefix (MY_ or CI_) based on whether you customize these libraries or not.

  • #392 / Feb 24, 2010 8:08pm

    NachoF

    171 posts

    I wish I could test netbeans but the download rate is at 5KB/s… Im not sure whats wrong with their website cause i seem to be browsing just fine/.... anyone knows an alternate download site?

  • #393 / Feb 24, 2010 9:13pm

    NachoF

    171 posts

    Ok, I finally was able to download it… Phil, can you help me a little bit on setting it up?... Im not sure if its possible but I would like to be able to do.. File->New->CI Project.. and have all the CI files already there… what do you think? also.. how do I turn the project I was working in notepad++ into a netbeans project?.. do you store your netbeans projects in the same folder of the http server>? (in my case htdocs)

  • #394 / Feb 24, 2010 9:31pm

    OverZealous

    1030 posts

    @NachoF
    I’m not really sure I can help you set it up.  I started with a New Project from existing sources.  NB allowed me to put the nbproject folder into a different location.  There isn’t too much more to set up.

    NetBeans might have project templates, but I’ve never used them.  It’s really as simple as copying in the CI files, at any rate, and NB will immediately see the imported files.

    I work out of a local directory, because I use Subversion to make changes safe, and I never work directly on production files.  After a bit of work, I was able to set up my local Apache (included with OS X) and local PHP (also included with OS X, but I had to build and add several features) and point a virtual server to the working directory.  This setup is awesome, because I can simply save my file, refresh and I can see it.  If you use NB’s remote setup, you can do the same thing via FTP or SFTP (by auto-uploading on save).

    My project is big enough, however, that I made a custom PHP build file.  I won’t go into detail, but it lets me run a lint check on all PHP and JS files (catching typos early), compress all images, JS, and CSS files, and then hand it off to Unison to sync across either my Dev, Test, or Production servers as necessary.

  • #395 / Feb 24, 2010 9:41pm

    Oblique

    32 posts

    @NachoF
    You should go File->New Project->PHP Application with existing sources
    and choose dir with your app. After that all your app files should be accessible in projects window and files window.

    For more details check out netbeans help and netbeans tutorials on netbeans.org, and maybe even there are some threads about on this forum, use search. This is not the place you should ask about it )

    offtop: Poor russians…

  • #396 / Feb 24, 2010 9:49pm

    NachoF

    171 posts

    Maybe not specific to netbeans but to datamapper it definitely is….

    Phil, sorry to bother again…do you have autocomplete for the get_by_someattribute methods? and related objects??
    $user->group… you have autocomplete for that??

  • #397 / Feb 24, 2010 10:11pm

    OverZealous

    1030 posts

    @NachoF
    No.  Autocomplete really isn’t magic.  Basically, look at the top of the DataMapper library to see what I included.  I have to hard-code everything that is suggested, and there is no way to suggest fields or methods for subclasses of DataMapper.

    I included hints where applicable, such as adding a method get_by_FIELD, but you still need to replace FIELD with your actual field.

    If you want more specific suggestions, you’ll have to add them for every class.

    Beyond that, like Oblique said, this isn’t the right forum for discussing NetBeans specifically, or even IDEs.

    I think I’m going to package up and release an RC2 for 1.7.0 tonight.  I found and fixed a couple more little bugs, and I’ll get to renaming the get_large_query method, and updating the documentation for that method.  I’m still deciding on the name, but I’m checking to see if I can integrate the streaming results into the existing Iterator method, so the iterator doesn’t have to be returned explicitly.

  • #398 / Feb 25, 2010 12:37am

    OverZealous

    1030 posts

    Announcing 1.7.0 Release Candidate 2

    I decided to go with get_iterated, since it is the most accurate description.

    However, the get_iterated method works a lot differently than it did before.  The old version required capturing the result of the method call, and iterating over that object specifically.  However, I was able to integrate the Iterable directly into the main class, as well as provide seamless access to exists() and result_count() on the same object.  Usage now looks like this:

    $countries = new Country();
    // get all countries
    $countries->get_iterated();
    
    if(!$countries->exists())
    {
        echo('No countries found');
    }
    else
    {
        echo($countries->result_count() . ' countries were found.');
        foreach($countries as $country)
        {
            // process like normal
        }
    }

    I think this is pretty slick!  It means switching to the new method is as simple as adding _iterated to your existing code.  (The new method now returns $this for method chaining.)

    This update includes several bugfixes, the renaming of get_large_query to get_iterated, and there are also two new methods, get_paged_iterated and count_distinct. The manual has also been updated.

    Also, the example application now is using get_paged_iterated, so you can see how it works in practice.

    Edit: Links are good 😊

    Download the Latest Version Here

      View the change log and the upgrade process
      Having issues? Please look through the Troubleshooting Guide & FAQs
      View the Complete Manual
      Search the Manual
      (Due to the server’s caching configuration, you may need to forcibly refresh your browser to see the changes in the manual.)

  • #399 / Feb 25, 2010 1:00am

    NachoF

    171 posts

    Awesome.. I decided to use it in my app cause Im not (yet) using any of the advanced methods and nothing got broken (and Im using htmlform and still works)... just like to point out though.. not sure if its a bug but in netbeans Im getting “phpdoc not found” for get_by_id() method. Its also not showing that it expects an int $id parameter… not sure if its something with my config but many other methods are working just fine with autocomplete.

  • #400 / Feb 25, 2010 1:04am

    OverZealous

    1030 posts

    @NachoF
    Sadly, that’s is a bug in NetBeans 6.8.  I’m almost certain it’s already been fixed in the next revision.

    (It is also possible that I have the format incorrect, but I matched the PHPDoc format exactly and it works in the PHPDoc parser.  I won’t know for sure until I can test NB 6.9, but I avoid pre-releases because they sometimes are a hassle.)

  • #401 / Feb 25, 2010 5:19pm

    TheJim

    35 posts

    @Overzealous

    Directly integrating the iterator for get_iterated into the class is really a slick way of doing it.  I hadn’t considered that, but I definitely like it.

  • #402 / Feb 26, 2010 7:18am

    Benedikt

    85 posts

    I saw the new “get_iterated()” feature and want to change my code accordingly.

    Is there a date when 1.7 will be stable?

    Thanks for this.

  • #403 / Feb 26, 2010 1:04pm

    OverZealous

    1030 posts

    @Benedikt
    Not hard set (see the changelog, it’s February Soonish, 2010 😊), but the best way to help get DMZ 1.7.0 out and stable is to download it and test it on a non-production server.

    It’s impossible for me to single handedly tests all cases for all environments.  The majority of changes in this version are behind-the-scenes, and I can’t be sure that some of them won’t affect existing code, but I’d sure like to get as close as possible, especially since this is a performance and bugfix focused upgrade, and everyone should use it!

    So, if you get a chance, try it out.  The only file you have to change for this version is the core DataMapper library.  So, you can test it by grabbing the lite version, renaming your current datamapper.php to datamapper.php.bak, and copying in the new file.  Test your App.  If you get any errors, or odd results, report them, and swap back.

    If I don’t hear from anyone through the weekend, I’ll probably go live on Sunday or Monday, ‘cause I really wanted to have this out there already.

  • #404 / Feb 26, 2010 1:35pm

    Benedikt

    85 posts

    Ok, I will report any bugs I can find but as most of the projects are under construction, could be hard to find. But I guess you didnt change the core functionality too much 😊

    The new features look great.

  • #405 / Feb 26, 2010 2:45pm

    OverZealous

    1030 posts

    I’m already thinking ahead to DMZ 2.0, which will probably be the next big release after 1.7 goes live…

    Since performance has been on my mind, I’ve been thinking about the number one fixable memory hog since DMZ 1.6: the $db (CI_DB) object(s).

    A little history
    In 1.6 I redesigned DMZ to allow the $db object to be created as needed.  This enabled multiple queries to be built and run simultaneously, as well as enabling the subqueries feature.  Any time a query is run on an object, that object (by default) gets it’s own copy of $db.  (This also made it easier to support connecting to multiple DBs at once.)


    However, this can have some serious side effects if you are running a lot of different queries on one page.  Some of it can be alleviated using a better architecture (e.g., implementing PGPool for PostgreSQL databases, and then disabling pconnect in CodeIgniter).  But the sad thing is that it is completely unnecessary: the only reason for this setup is the way ActiveRecord is integrated into the database driver(s).  It’s the AR functions that need duplicates, not the database connections.

    I think I’ve wrapped my mind around how to make this work, however, with minimal effort and code changes.  I can basically copy-and-paste the ActiveRecord code into a new class (while making improvements and deleting deprecated methods), and then use that on the DMZ object in place of CI_DB.  The actual DB methods will then pass off to a shared (or shareable) copy of the real DB.

    I’d then recommend that you disable CodeIgniter’s ActiveRecord altogether.

    If I’m careful enough, I don’t even think it will break existing code, even code that works with $object->db directly.  🐛  (I can safely hand off any methods to the real CI_DB using __call!)


    One of the benefits of this is that I can fix some of the more annoying AR bugs, such as preventing _protect_identifiers from being called on subqueries and functions.


    Another design choice is: do I inline this new, very large class in the already ridiculous datamapper.php file, or do I break it out into its own file?  If I break it out, should I break out the other classes in use?  And then, where do I store them?  APPPATH/datamapper, APPPATH/libraries?  I’ll think about that as I get nearer.


    I would like to get rid of a few things, though, unless they are in use a lot.  Mostly, I don’t see the purpose in the ActiveRecord cache methods.  Even now you can get better results via get_clone, and I think they are confusing, because they really have nothing to do with caching.  However, if they are useful, I’ll leave them.


    Anyway, just thought I’d mention this.

    (There’s really no point to this message, but sometimes I find just writing ideas like this out help me to think them over.)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases