|
Web dev and programming discussions forums
|
|
|
|
||
View original thread with replies |
|||
| Tags: | , , , | ||
AIR + Javascript Debugging: Stepping into Dojo classes?I'm new to this, so I might just be doing it wrong, but I've tried reading tutorials/threads etc. I have debugging my AIR app generally working - at least for my own code. In my app I am importing Dojo 1.4.1 (I downloaded the sources and have them in a lib dir and reference them in my .html file). I'm having trouble with the debugger. It seems that when I try to step from my Javascript code into a piece of Dojo code, even if I have the Dojo source libraries as the only version of Dojo imported, all I get is a blank js window with a declarative like: dbgsource://76.js: 196. And if I happen to know which function I was calling, the 196 usually corresponds to the first line of the method I'm calling on the Dojo object, but this is really cumbersome. Anyone know what I'm doing wrong? Thanks Using models from within modelsHi all! I hate to revive dead threads, but I felt that creating another one would be too much, since this one’s problem is apparently still in question, and it only has two pages, so…. I have come across the same problem as the author. And, from what I’ve read here, CI’s creators think it is useless to call another model’s methods from within a model, and thus have designed it in a way to make it difficult to do so. However, it says in the manual that the architectural goals of CodeIgniter are “flexibility”, “loose coupling” and “singularity”. Well, how can you achieve those, if the components of the system cannot use one another..? What flexibility and reuseability are we talking about then..? I think it is perfectly rational to invoke objects from other objects. I think that “loose coupling” does not mean “insane incapsulation”. One object is not supposed to perform all work in my opinion. And I totally agree that it is definately not OOP to do as CI intends. Moreover, there is nothing deviating from the MVC approach. Magento, one of the best (but, unfortunately, one of the most poorly documented) packages, does this all the time; it is essential to do this in Magento. This is not an attempt to advertise the eCommerce solution… So I’d really like to know how to invoke a model’s method from within another model. I have done as it says in the Manual (used the get_instance method), and it kinda works, but not as expected. You see, the problem is that CI stores the invoked models somehow inside, but from within one model it is impossible to know whether another model, or another model with the same name, has been instanciated before, and this leads to a disaster when addressing these models. Especially this goes crazy when specifying a second parameter while loading, like so:
$this->load->model('Model_name', 'fubar');
This is very frustrating. Please, if someone knows how to do this properly, tell me, as I really need this kind of functionality. Thanks. Models and ORMHello, I found problematic using ORM with pivot tables (of course I've read documentation). So, tablenames: properties models: class Property_Model extends ORM { //filename: models/property.php class Subcategory_Model extends ORM { //filename: models/subcategory.php class Property_Subcategory_Model extends ORM { //filename: models/property_subcategory.php I have no idea why it tries to access 'shop.property_subcategories' table instead of 'shop.properties_subcategories' If you see (or just know) my mistake, please respond. P.S. Sorry for the format of code samples, hope this is legible. Models - useful?Hi! I use CI for some time now but I'm still a bit confused about models. So far I wasn't using models at all, if I had to obtain some data from DB I simply used AR directly in controllers, in more complex situations - I wrote libraries. This worked well and I didn't have any problems (even in big applications/sites), however I feel like I'm approaching MVC the wrong way cause everyone uses models but for me it just brings more complexity to application than it's worth. Or am I missing something? Could you explain me why models are useful? Why create additional methods for simple tasks that aren't used often anyway when I can simply use AR and adjust everything as I want rather than write many sophisticated methods? Thanks, Dynamic models (8)by invictus9 (Posted 20 Jan 2010, 18:07) I presume that you have done some reading on Dynamic Content Types? You need to enable the model once you have uploaded it. As well, the web-client-config-custom.xml has to be installed in the appropriate place, and enabled. If it is in your extensions/ directory, it will be enabled at Alfresco restart time. If it is in your Data Dictionary/Web Client space, then you need to 'reload' the configuration using the web client configuration console. This is described in the custom content type wiki page as well. Read the main topic related to this post Dynamic models (7)by Miguel.martins (Posted 20 Jan 2010, 12:47) I managed to load up everything onto the model folder, and activate the model, I was expecting for it to show on the create document bit, as an option to add "Os alunos", however nothing shows there, how do one properly add a dynamical model into use so that it appears? Read the main topic related to this post Dynamic models (13)by Miguel.martins (Posted 21 Jan 2010, 14:51) 1. Create customModel.xml, define your custom metadata types, which you already done.- yes, alunos xml 2. Create custom-model-context.xml and include following code:=snip= done so. =(done so, used that exact name. Note: customModel is your custom metadata filename. 3. Place these two file at \tomcat\shared\classes\alfresco\extension. And modify web-client-config-custom.xml, which is at same location, you alreday done this.-confirmed Then start the server and create or upload a document; and select your custom type as document type.- when i get to this step, however, nothing shows on the dropdown. Read the main topic related to this post Some error about models.I've got absolutely no idea what this means:
It happens when i'm trying to submit data from form. I think it's about models but i guess i made it right: <?phpAnd category: <?phpMaybe relation is made wrong, i dunno… Dynamic models (15)by Miguel.martins (Posted 22 Jan 2010, 11:46) alunos.xml
alunos-model-content.xml
web-client-config-custom.xml
It all seems to load flawlessly, no "obvious" errors in the xml but whenever I attempt to create a new content, there is no sign of this model on the dropdown menu. Can you load these same on your system? Read the main topic related to this post Try to add more than one Custom Models (4)by webraccoon (Posted 09 Feb 2010, 10:23) Hi, ok, i checked my models and i checked ...-model-context.xml. For every model i defined an ...model-context.xml and it doesn't work. Now i tried to define just one context.xml file with both models in the list and with this configuration it seems to work. hmm, so with this confugaration can i live. thanks for help webraccoon Read the main topic related to this post How to use Models properly?I see Controllers as a place where I can receive HTTP Requests and Views as a means to return XHTML/XML/JSON, etc, but I have yet to get my head around Models. From any MVC best practice guides I've read (and there has been many), it seems people are pushing a lot of their code in to Models.
The majority of web applications will use databases for persisting data beyond sessions, yet all of the example code I've seen from tutorials online is extremely basic in that you end up mapping an object directly to a single table. A lot of my select queries would typically return a ResultSet that comprises of data from multiple tables, and includes things like specific MySQL functions, etc. I know it's not the most portable approach, but I don't have a need to move database vendors. This idea of mapping an object to a single table and just running queries on that appears fantastic, but I can't see how it would be of any use beyond the most basic of database designs and applications. In any one application the sheer number of select queries alone that I could run against a database could span hundreds of unique query types. Would it mean that I would need to create a Model that represents the results from each those queries that I need (which seems like an awful lot of code, just to be able to have an object oriented view of DB interaction). However I think that my understanding of Models and how I can use them to interact with databases using the Zend Framework is way off the mark, and I beg someone to please help me understand how this works. I would consider myself a reasonably proficient programmer and have been using PHP for a few years, but I have still to get my head around MVC and Zend. I am tired of re-inventing the wheel and would love to take advantage of the solid foundations that the Zend Framework provides for my current/future apps. any help appreciated ;) Dynamic models (5)by invictus9 (Posted 18 Jan 2010, 20:56) I have seen this error when there is a conflict in the namespace definition. Essentially, only one file in your system can have "my:" as the namespace identifier. Do you have more than one file with that prefix? The parser is notoriously bad for providing useful feedback. It reminds me of using assembler on very old, very small mini-computers, and debugging them from the front panel switches. One approach that might help is to strip down the entire file to one property and one aspect and trying to get it to be accepted. Once it is, keep adding properties until you trip on the error. Read the main topic related to this post CI models following MVC standard?This is my first post to the CI community. I've been a PHP dev for 10 years and just recently a cakephp dev for 5 weeks and I'm really starting to hate it (which is why I'm posting on the CI side of the force). After reading through a few of the examples, I noticed how CI's model structure is different from cakes. From the top example on… http://codeigniter.com/user_guide/general/models.html It looks like your using a decorator pattern to wrap Blogmodel around the db object, why? In cake there is no decorator pattern, the actual model is the thing you manipulate the db with… class Orgs extends AppModel {But with code CI, a core object does all the object manipulation while a simple wrapper object around it just passes the calls to it… class Blogmodel extends Model { why go through the trouble in wrapping one object around another and call it a model? Technically, Blogmodel isn't the model, $this->db is the model because it (by definition), is an object that represents the underlying data. You could easily extends the db class to something else (otherdb for example) and add the insert_entry method to it. As far a relationships between other models go… Cake does it by sticking an array in a var called $hasMany (see my first example code) So if I wanted to access the projects model from the orgs model, I could just type $orgs->projects->find('all'). In theory, you would think the projects model would retrieve projects that are only associated to that particular org but it doesn't. It just blindly fetches ALL the projects in the projects table. This is the main reason why I'm totally fed up with cakephp. If I can't cleanly do db table relations then I can't use the framework. As for CI I couldn't find any built in examples that shows how one could associate one model to another. The closest thing I found datamapper and rdm and dmz. I can't use datamapper because it uses 5th normal form and all my databases (as well as most others) are in 3rd. from the examples with rdm, it doesn't use a config array or a simple to the point one line command to fetch assoc. dmz seems like my best bet but it looks like I would have to do custom code for each model as far as doing the relations between them. My ultimate goal and the main reason that would make me a CI fan and drop cake is if I can simple traverse related objects in some easy way kind of like this… class contact extends Model {Keep in mind that was a very ruff scetch I whipped up but you get my point. Keep in mind I don't know that much about code igniter yet, I've only been reading the examples from the website for the past hour or so. Dynamic models (2)by Miguel.martins (Posted 18 Jan 2010, 16:22)
The error was literally this one. I have? I thought that you had to define the model and the first type with the same name. I will try to change the name then. changed the type alunos, to osalunos this is the new error.
Read the main topic related to this post Dynamic models (18)by Miguel.martins (Posted 28 Jan 2010, 16:01) I had already detected that one, but it wasnt working out, in the end i started from another already working custom model and started adding the data i needed to it, one by one. Its working out so far. Thank you all. Read the main topic related to this post
Is there any XSLT debugger stepping in subexpressions of a complex XPath expression? (Was: Re: XPath (and other W3C drafts))
Dec 16, 2009 On Wed, Dec 16, 2009 at 8:07 AM, Michael Kay <mi### @saxonica.com> wrote: > released for XPath. To shift to a what I consider a very important, related topic: It has been many years since I have adopted writing complete programs as one XPath...
Can I have 2 different directory for models of 2 connections. if yes then how to load the models? Jan 30, 2010 Can I have 2 different directory for models of 2 connections. if yes then how to load the models? As Currently I load the models using Doctrine_Core::loadModels ('models'); but that loads models for both the connections Thanks in advance ...
Changes in models? Jan 25, 2010 I have a book writing about Symfony 1.0 and tricks written there doesn't work anymore in 1.4. What is equivalent of ModelPeer::doSelect ()? Code: $this->Welcome = PgNewTable::doSelect( new Criteria ); Error: Fatal error: Call to undefined...
Request in Models Feb 9, 2010 Hi, I have provided my Model base class a straight access to $_request object just to simplifying my access to request params from my models. Thought it is not forbidden but is it considered bad design? Is there some aspect I have not thinked...
Building XML from models Mar 9, 2010 I'm putting together and API and I would like to be able to build XML objects of my model objects (similar to how forms work). Has anyone done this before? It seems to me that some custom formatting of the form objects would do this nicely, but I…
600+ models issue Jan 27, 2010 Can cake handle a website with 600+ connected models? Right now the site takes 7-10 seconds as soon as cake initializes any model. I looked through the cake code, and it appears that cake initializes all 600+ models on any model initialization. ...
List of models Feb 4, 2010 I've only just started learning cake recently, so sorry if this question has been asked before as I've got no idea what to search for. Basically what I'm trying to do is find all the models in the system. I'm working on a system which auto...
generating models Dec 8, 2009 Hi I can't generate my models, because in my DB has a field with type ISBN and ISSN. So Doctrine calls a Exception "unknown database attribute type: isbn". How can I generate my models by table? Someone can help me? sorry for my english. Thanks for...
Accessing models Nov 30, 2009 so I figured out that I can access a model to save and retrieve data from components by saying $myvar = new ModelName(); etc. I have another model that keeps giving me this error. Fatal error: Class 'StatisticsUser' not found in ... the problem...
Re: 600+ models issue Jan 28, 2010 No it doesnt really. I just uses the AppModel in its place. On Jan 27, 5:47 pm, Jon Bennett <jmbe### @gmail.com> wrote: > > Im guessing its just a lot of HABTM tables. If so, you don't need > > models for those unless it has...
Stepping down
Sep 24, 2009 Stepping down Mar 10, 2006 Stepping into Year 2010 with 20 Fabulous + 5 Exclusive Wallpapers Dec 31, 2009 A caching pattern for models Apr 6, 2009 A caching pattern for models Apr 6, 2009 Realistic Lego models Jan 11, 2010 21 Raw and Stunningly Realistic 3D Character Models Jan 20, 2010 Using Zend_CodeGenerator_Php to Automate Creation of Models Dec 21, 2009 Using Zend_CodeGenerator_Php to Automate Creation of Models Dec 21, 2009 AXM Paper Space Scale Models Dec 21, 2009 | |||