model

Problem in SharePoint Object model when accessing the sharepoint list items?

just i wrote using (SPSite site = SPContext.Current.Site) { using (SPWeb web = site.OpenWeb()) { //SPList lst = web.Lists["ManagerInfo"]; SPList lst = web.Lists[strlist]; SPQuery getUserNameQuery = new...

Is there a way to customize how the value for a custom Model Field is displayed in a template?

I am storing dates as an integer field in the format YYYYMMDD, where month or day is optional. I have the following function for formatting the number: def flexibledateformat(value): import datetime, re try: value = str(int(value)) except: return None match = re.match(r'(\d{4})(\d\d)(\d\d)$',str(value)) ...

Rails model belongs to model that belongs to model but i want to use another name

Hello. This may be a stupid question but im just starting to learn Rail thats why i am asking thsi question. I have one model called "User" which handles all the users in my community. Now i want to add a guestbook to every user. So i created a model called "user_guestbook" and inserted this into the new model: belongs_to :user and t...

MVVM: Thin ViewModels and Rich Models

I'm continuing to struggle with the MVVM pattern and, in attempting to create a practical design for a small/medium project, have run into a number of challenges. One of these challenges is figuring out how to get the benefits of decoupling with this pattern without creating a lot of repetitive, hard-to-maintain code. My current strate...

Ms Word 12.0 Class Library

Where to get the list of dlls present in microsoft word 12.0 . Can we download microsoft word 12.0 Component seperately and install it in the client system? ...

Rails: How can I define one-to-many relationships using the rails "generate" script?

I'd like to run the rails "generate" script and create a model that belongs two other models. Is there a way that I can do this? ...

Metalanguage like BNF or XML-Schema to validate a tree-instance against a tree-model

Hi! I'm implementing a new machine learning algorithm in Java that extracts a prototype datastructure from a set of structured datasets (tree-structure). As im developing a generic library for that purpose, i kept my design independent from concrete data-representations like XML. My problem now is that I need a way to define a data mod...

Custom Model Validator for MVC

I am trying to write a customer validation with the goal of passing two values from the Event class to perform some validation logic and then add the error to the PURLValue property if it fails. I can't get it to work, am I using the the right approach, below, or is there a way to perform this at the class level and append the error to ...

Dynamic Typed Table/Model in J2EE?

Hi, Usually with Java EE when we create Model, we define the fields and types of fields through XML or annotation before compilation time. Is there a way to change those in runtime? Or better, is it possible to create a new Model based on the user's input during the runtime? Such that the number of columns and types of fields are dynami...

Trying to Nullify Django model fields with method where model and fields are parameters

I'm trying to write a method like the below where a list of fields (a subset of all the fields) is passed in as a parameter and has their column values set to null. I would be happy of I could get a method with just the fields as a parameter like below, but having the model as a parameter would be even better. from my_project.my_app.mo...

Can a django model have embed classes?

Hi, I want to have a django model like this: class Model(models.Model): string = models.CharField() class ContactDetails: phone = models.IntegerField() Is this possible? I've tried googling but it doesn't seem to answer my question This would mean i'd have while accesssing: Model().ContactDetails.phone working like that :) Jo...

General rule - when to use a model (Codeigniter)

Hi guys, I was just curious as to what the rule of thumb was for models. Generally, I use them only for situations where I need to add/edit or update database entries for an object. However, I'm building an app at the moment that has a "config" table which holds various data, such as last updated, which will control when certain featu...

How to describe m2m triple-join table in model (Django)

My question is pretty much the same as this question, except that ALL relationships should be many-to-many. I have the following classes in my models.py (somewhat simplified): class Profile(models.Model): # Extending the built in User model user = models.ForeignKey(User, unique=True) birthday = models.DateField() class...

PHP OOP: Providing Domain Entities with "Identity"

Bit of an abstract problem here. I'm experimenting with the Domain Model pattern, and barring my other tussles with dependencies - I need some advice on generating Identity for use in an Identity Map. In most examples for the Data Mapper pattern I've seen (including the one outlined in this book: http://apress.com/book/view/97815905990...

DTO or Domain Model Object in the View Layer?

I know this is probably an age-old question, but what is the better practice? Using a domain model object throughout all layers of your application, and even binding values directly to them on the JSP (I'm using JSF). Or convert a domain model object into a DTO in the DAO or Service layer and send a lightweight DTO to the presentation ...

CodeIgniter: Can't load database from within a model

Hello, I've written a new model for my CodeIgniter framework. I'm trying to load the database from within the constructor function, but I'm getting the following error: Severity: Notice Message: Undefined property: userdb::$load Filename: models/userdb.php Line Number: 7 Fatal error: Call to a member function database() on a non-ob...

User/Group multiple ownership Model using Entity Framework 4

Hi guys I have to model the following situation. I came up with 2 possible alternatives, but I want to know if there's a better solution. Here's the deal... Simplified Schema User Group ----------- ------------ UserId (PK) GroupId (PK) Name Name ... ... \ / ...

Improve SQL strategy - denormalize in object-children-images case

Hi, I have a Tour object which has many Place objects. For the list of tours, I want to show some info of the tour, the number of places of the tour, and three Place's images. Right now my SQL queries are (i'm using Doctrine with Symfony on MySQL) get Tour get Tour 1 places get Tour 2 places get Tour 3 places ... get Tour n places If...

Best way to handle multiple tables to replace one big table in Rails? (e.g. 'todo_items1', 'todo_items2', etc., instead of just 'todo_items')?

Update: Originally, this post was using Books as the example entity, with Books1, Books2, etc. being the separated table. I think this was a bit confusing, so I've changed the example entity to be "private todo_items created by a particular user." This kind of makes Horace and Ryan's original comments seem a bit ...

Rails - building an absolute url in a model's virtual attribute without url helper

I have a model that has paperclip attachments. The model might be used in multiple rails apps I need to return a full (non-relative) url to the attachment as part of a JSON API being consumed elsewhere. I'd like to abstract the paperclip aspect and have a simple virtual attribute like this: def thumbnail_url self.photo.url(:thu...